Use Caffe model with GPU in Python program

Hi,

I want to use a trained Caffe model to detect objects in videos in my Python program. Can I use GPU on Jetson TX2 to do it? It will be greatly appreciated if any code snippets/samples can be provided.

Thanks.

Hi,

It’s NOT recommended to do training on Jetson.
TX2 is an embedded platform and isn’t suitable for back-propagation.

If there is not option on your side, you can switch to use GPU with this configuration.
https://github.com/BVLC/caffe/blob/master/examples/cpp_classification/classification.cpp#L55

Caffe::set_mode(Caffe::GPU);

Thanks.

Hi AastaLLL,

Thank you for the prompt response.

I didn’t mean to train a Caffe model on TX2. I want to use an already trained Caffe model on TX2. And I want to use the model to do video processing on GPU. My program is written in Python, and it uses CPU to do video processing currently. I want to change the program to use GPU. Can you provide any code snippets/samples in Python?

Thanks.

Hi,

Suppose you can follow this script:
https://github.com/BVLC/caffe/blob/master/python/classify.py

And set it to GPU mode:

caffe.set_mode_gpu()

Thanks.

Thanks.

caffe.set_mode_gpu()