Applying net for batch of images with C++?

51 views
Skip to first unread message

Ilya Zhenin

unread,
May 23, 2016, 4:48:57 AM5/23/16
to Caffe Users
Can you give an example of C++ code that loads caffemodel and performs forward run on batch om images on GPU?

Felix Abecassis

unread,
May 23, 2016, 4:29:39 PM5/23/16
to Caffe Users
This code performs forward run in C++ for batch size 1:
https://github.com/BVLC/caffe/tree/master/examples/cpp_classification
Be aware that it's an example, it might not be fit for all networks.

It's not too difficult to handle larger batch sizes, but it makes the code more obfuscated so I didn't do it in the cpp_classification code. You basically need to add std::vector's everywhere.
I have a quick patch here:
https://github.com/flx42/caffe/commit/be0bff1a84c9e16fb8e8514dc559f2de5ab1a416
Reply all
Reply to author
Forward
0 new messages