Ask Your Question

Revision history [back]

read nets with caffe python layer in OpenCV

There is a caffe model which has a python layer, and I can read it in python with caffe.Net(...) command (caffe already compiled with WITH_PYTHON_LAYER=1). However, due to existing python layer, I can't read it using cv2.dnn.readNet in OpenCV4. Because of some attributes available inside OpenCV net data type, I need to have network in that format.

is there anyway for this? if not directly readable in OpenCV, is there any easy way to first read it by caffe read net method, and then cast it to cv2.dnn.readNet type?

this works: net = caffe.Net(model_arch_path, model_weight_path, caffe.TEST),

But this does not:

read nets with caffe python layer in OpenCV

There is a caffe model (here) which has a "caffe python layer, and layer". I can read it normally in python with using caffe.Net(...) command (caffe already compiled with WITH_PYTHON_LAYER=1). However, due to existing "caffe python layer, layer", I can't read it using cv2.dnn.readNet in OpenCV4. Because of some attributes available inside OpenCV net data type, I need to have network in that format.mean:

net = caffe.Net(model_arch_path, model_weight_path, caffe.TEST) #caffe method

works fine, but below one does not (It generates errors about that existing "cafe python layer":

net = cv2.dnn.readNet(model_arch_path, model_weight_path, caffe.TEST) #OpenCV4 method

This is there anyway for this? a general question, not specific to this network. How should I read caffe models which include "python-layer" by OpenCV? if not directly readable in OpenCV, is there any easy way to first read it by caffe read net method, and then cast it to cv2.dnn.readNet type?

this works: net = caffe.Net(model_arch_path, model_weight_path, caffe.TEST),

But this does not:

read nets with caffe python layer in OpenCV

There is a caffe model (here) which has a "caffe python layer". I can read it normally in python using caffe.Net(...) command (caffe already compiled with WITH_PYTHON_LAYER=1). However, due to existing "caffe python layer", I can't read it using cv2.dnn.readNet in OpenCV4. I mean:

net = caffe.Net(model_arch_path, model_weight_path, caffe.TEST) #caffe method

works fine, but below one does not (It generates errors about that existing "cafe python layer":

net = cv2.dnn.readNet(model_arch_path, model_weight_path, caffe.TEST) #OpenCV4 method

This is a general question, not specific to this network. How should I read caffe models which include "python-layer" by OpenCV? if not directly readable in OpenCV, is there any easy way to first read it by caffe read net method, and then cast it to cv2.dnn.readNet type?

I've already easily read and work original Yolov3-darknet with OpenCV. But due to some reasons I want to use it's caffe conversion. The reason is I want to use Yolov3 on some AI accelerator USB sticks (like intel NCS2, Orange pi AI stick,...). They work well with caffe models, but does not support or does not work without issue with original darknet model.

read nets with caffe python layer in OpenCV

There is a caffe model (here) which has a "caffe python layer". I can read it normally in python using caffe.Net(...) command (caffe already compiled with WITH_PYTHON_LAYER=1). However, due to existing "caffe python layer", I can't read it using cv2.dnn.readNet in OpenCV4. I mean:

net = caffe.Net(model_arch_path, model_weight_path, caffe.TEST) #caffe method

works fine, but below one does not (It generates errors about that existing "cafe python layer":

net = cv2.dnn.readNet(model_arch_path, model_weight_path, caffe.TEST) #OpenCV4 method

This is a general question, not specific to this network. How should I read caffe models which include "python-layer" by OpenCV? if not directly readable in OpenCV, is there any easy way to first read it by caffe read net method, and then cast it to cv2.dnn.readNet type?

I've already easily read and work original Yolov3-darknet with OpenCV. But due to some reasons I want to use it's caffe conversion. The reason is I want to use Yolov3 on some AI accelerator USB sticks (like intel NCS2, Orange pi AI stick,...). They work well with caffe models, but does not support or does not work without issue with original darknet model.

click to hide/show revision 5
retagged

updated 2019-03-12 06:20:52 -0500

berak gravatar image

read nets with caffe python layer in OpenCV

There is a caffe model (here) which has a "caffe python layer". I can read it normally in python using caffe.Net(...) command (caffe already compiled with WITH_PYTHON_LAYER=1). However, due to existing "caffe python layer", I can't read it using cv2.dnn.readNet in OpenCV4. I mean:

net = caffe.Net(model_arch_path, model_weight_path, caffe.TEST) #caffe method

works fine, but below one does not (It generates errors about that existing "cafe python layer":

net = cv2.dnn.readNet(model_arch_path, model_weight_path, caffe.TEST) #OpenCV4 method

This is a general question, not specific to this network. How should I read caffe models which include "python-layer" by OpenCV? if not directly readable in OpenCV, is there any easy way to first read it by caffe read net method, and then cast it to cv2.dnn.readNet type?

I've already easily read and work original Yolov3-darknet with OpenCV. But due to some reasons I want to use it's caffe conversion. The reason is I want to use Yolov3 on some AI accelerator USB sticks (like intel NCS2, Orange pi AI stick,...). They work well with caffe models, but does not support or does not work without issue with original darknet model.