CV DNN Caffe model with two inputs of different size

asked 2017-08-31 03:36:51 -0500

RRR gravatar image

updated 2017-08-31 03:41:13 -0500

Hi, I am trying to run a pre trained Caffe model using cv::dnn, using C++.

The model has two inputs, of different sizes, and that seems to cause a problem (a model with a single input works fine)

I do succeed in running that network using Python's caffe, and I hoped I could run it from C++ using OpenCV DNN.

When I dive into the dnn code, it seems that when it loads the network it is aware of only the first input. It crashes when it tries to apply the blob shape of the first input instead of the blob shape of the second input.

Any advice about how to run a dnn network, imported Caffe, such that the network has two inputs of different sizes?

Will be grateful for a code sample.


edit retag flag offensive close merge delete


@dkurt might interest you

StevenPuttemans gravatar imageStevenPuttemans ( 2017-08-31 03:47:55 -0500 )edit

@StevenPuttemans, thanks! @RRR, I see several ways of using model with more than one input of different sizes: 1) You want to get predictions for different resolutions simultaneously, In example, we may use ENet network for semantic segmentation of any size images. This way you'd better initialize several networks for different input sizes. 2) You network has several "heads" with different input blobs. Which one of them is actual or neither of them?

dkurt gravatar imagedkurt ( 2017-08-31 08:17:18 -0500 )edit