Hello,
I am using the code of this example:
https://devtalk.nvidia.com/default/topic/1037104/jetson-tx2/how-to-run-caffe-on-gpu-tx2-/
The program works fine for one image, however, it does not work when I use my webcam. With the webcam, only objects in the first frame are detected. Next frames are ignored. It looks like the blob input is not being upgraded. Can anyone help me?
On the other hand, someone in the same post suggests “Ideally, you should use GPU data to avoid CPU <-> GPU memory copy”. Where I can find more info about that? Where should I use that instruction?
Best,
Eduardo.
Hi,
If you want to use above sample, please update the image each time when getting a cvmat from the camera.
For caffe-based user, it’s more recommended to use TensorRT to get a better performance.
Here is our sample for your reference: [url]https://github.com/dusty-nv/jetson-inference[/url]
Thanks
Hi, thanks for your answer.
I am updating the image (cvmat) every frame. However, I get bounding boxes only for the first frame. It is like the first frame is still in memory, and the next images are ignored. Is it possible that the new cvmat image is not being copied to the GPU memory? Do I need to reset/clean the GPU memory?
Thanks
Hi,
You also need to copy the output back each frame.
You won’t need to reset the GPU memory. memcpy will update all the data to the new frame.
Thanks.
Hi,
Yes, I am copying input and output, there is no problem there. I have noticed that when I specify Caffe::set_mode(Caffe::CPU), the code works fine, and the faces are detected in every frame. However, when I specify Caffe::set_mode(Caffe::GPU), only the faces in the first frame are detected.
Thanks.
I solved the problem. I just needed to change (char*) caffeInput->cpu_data() to (char*) caffeInput->mutable_cpu_data() (Lines 54 and 63].
Thanks!