- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am unable to convert caffe model to ir with the following command:
python3 mo_caffe.py --input_model <PATH_TO_DIRECTORY>/model.caffemodel --input_proto <PATH_TO_DIRECTORY>/model.prototxt --mean_values [104,117,123] --scale 255 --model result --output_dir ~/Documents --data_type FP16 --reverse_input_channel --log_level=DEBUG
It is giving me following error:
[ ERROR ] Shape is not defined for output 0 of "detection_out".
[ ERROR ] Cannot infer shapes or values for node "detection_out".
[ ERROR ] Not all output shapes were inferred or fully defined for node "detection_out".
For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #40.
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function multi_box_detection_infer at 0x7fa839ae0598>.
[ ERROR ] Or because the node inputs have incorrect values/shapes.
[ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ ERROR ] Run Model Optimizer with --log_level=DEBUG for more information.
[ ERROR ] Stopped shape/value propagation at "detection_out" node.
in my code i am loading the network as follows:
net = caffe.Net('<PATH_TO_DIRECTORY>/model.prototxt', '<PATH_TO_DIRECTORY>/model.caffemodel', caffe.TEST)
net.blobs['data'].reshape(1, 3, process_frame.shape[0], process_frame.shape[1])
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2, 0, 1))
transformer.set_mean('data', np.array([104, 117, 123])) # mean pixel
transformer.set_raw_scale('data', 255) # the reference model operates on images in [0,255] range instead of [0,1]
transformer.set_channel_swap('data', (2, 1, 0)) # the reference model has channels in BGR order instead of RGB
transformed_image = transformer.preprocess('data', process_frame)
net.blobs['data'].data[...] = transformed_image
t1 = time.time()
detections = net.forward()['detection_out']
print "Time to process a frame: ",time.time()-t1
I am attaching the model files here. Kindly let me know whats the issue. Thank you!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Saad:
MO_FAQ question #40 says:
40. What does the message "Not all output shapes were inferred or fully defined for node" mean?
Most likely, the shape is not defined (partially or fully) for the specified node. You can use --input_shape with positive integers to override model input shapes.
I don't see --input_shape as a parameter in your mo command. Please supply it with 4 numbers separated by comma in brackets, i.e. [1,216,216,3] or something like that and this should fix your problem.
About –input_shape:
--input_shape INPUT_SHAPE
Input shape(s) that should be fed to an input node(s)
of the model. Shape is defined as a comma-separated
list of integer numbers enclosed in parentheses or
square brackets, for example [1,3,227,227] or
(1,227,227,3), where the order of dimensions depends
on the framework input layout of the model. For
example, [N,C,H,W] is used for Caffe* models and
[N,H,W,C] for TensorFlow* models. Model Optimizer
performs necessary transformations to convert the
shape to the layout required by Inference Engine
(N,C,H,W). The shape should not contain undefined
dimensions (? or -1) and should fit the dimensions
defined in the input operation of the graph. If there
are multiple inputs in the model, --input_shape should
contain definition of shape for each input separated
by a comma, for example: [1,3,227,227],[2,4] for a
model with two inputs with 4D and 2D shapes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Shubha:
I had a same probleme above when convert a R-FCN caffe model using model optimizer, I specifized everything i could and the error message is same as Saad "Shape is not defined for output 0 of "detection_out"."
Here is my error messages:
D:\programme_file\OpenVino\openvino_2019.1.133\deployment_tools\model_optimizer>python mo.py --framework caffe --input_model D:\myRFCN_model\my_RFCN_model.caffemodel --input_proto D:\myRFCN_model\my_RFCN_model.prototxt --input data,im_info --input_shape (1,3,300,300),(1,3) --scale 1.0 --mean_values (102.9801,115.9465,122.7717)
Model Optimizer arguments:
Common parameters:
- Path to the Input Model: D:\myRFCN_model\my_RFCN_model.caffemodel
- Path for generated IR: D:\programme_file\OpenVino\openvino_2019.1.133\deployment_tools\model_optimizer\.
- IR output name: my_RFCN_model
- Log level: ERROR
- Batch: Not specified, inherited from the model
- Input layers: data,im_info
- Output layers: Not specified, inherited from the model
- Input shapes: (1,3,300,300),(1,3)
- Mean values: (102.9801,115.9465,122.7717)
- Scale values: Not specified
- Scale factor: 1.0
- Precision of IR: FP32
- Enable fusing: True
- Enable grouped convolutions fusing: True
- Move mean values to preprocess section: False
- Reverse input channels: False
Caffe specific parameters:
- Enable resnet optimization: True
- Path to the Input prototxt: D:\myRFCN_model\my_RFCN_model.prototxt
- Path to CustomLayersMapping.xml: extensions\front\caffe\CustomLayersMapping.xml
- Path to a mean file: Not specified
- Offsets for a mean file: Not specified
Model Optimizer version: 2019.1.0-341-gc9b66a2
[ ERROR ] Shape is not defined for output 0 of "detection_out".
[ ERROR ] Cannot infer shapes or values for node "detection_out".
[ ERROR ] Not all output shapes were inferred or fully defined for node "detection_out".
For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #40.
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function multi_box_detection_infer at 0x000001E27D451840>.
[ ERROR ] Or because the node inputs have incorrect values/shapes.
[ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ ERROR ] Run Model Optimizer with --log_level=DEBUG for more information.
[ ERROR ] Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "detection_out" node.
For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #38.
Any ideas? thanks for your time!!
HL
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page