- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I have retrained ssd_mobilenet_v2_coco model using tensorflow detection API (only train with one class).
Then I use Openvino 2019 R2 to convert this model to IR, as below command:
python mo.py --input_model frozen_inference_graph.pb --tensorflow_use_custom_operations_config extensions\front\tf\ssd_v2_support.json --tensorflow_object_detection_api_pipeline_config .\pipeline.config --reverse_input_channels --input image_tensor --log_level DEBUG
This lead me to an error:
I0731 15:49:48.692595 8868 infer.py:32] input[0]: shape = [], value = 300.0
I0731 15:49:48.692595 8868 infer.py:32] input[1]: shape = [], value = -1.0
I0731 15:49:48.692595 8868 infer.py:144] Outputs:
I0731 15:49:48.692595 8868 infer.py:32] output[0]: shape = [], value = 0.0033333334
I0731 15:49:48.692595 8868 infer.py:129] --------------------
I0731 15:49:48.692595 8868 infer.py:130] Partial infer for Postprocessor/Cast_1
I0731 15:49:48.692595 8868 infer.py:131] Op: Cast
E0731 15:49:48.692595 8868 infer.py:180] Cannot infer shapes or values for node "Postprocessor/Cast_1".
E0731 15:49:48.692595 8868 infer.py:181] 0
E0731 15:49:48.692595 8868 infer.py:182]
E0731 15:49:48.692595 8868 infer.py:183] It can happen due to bug in custom shape infer function <function Cast.infer at 0x0000014C5B89B488>.
E0731 15:49:48.692595 8868 infer.py:184] Or because the node inputs have incorrect values/shapes.
E0731 15:49:48.692595 8868 infer.py:185] Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
I0731 15:49:48.692595 8868 infer.py:196] Node "Postprocessor/Cast_1" attributes: {'pb': name: "Postprocessor/Cast_1"
I have search many related topics, and tried many commands, but it always leads to error relate to shape.
What shoud I do?
Thanks for any help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear pham, hai
Please refer to a similar post which I recently replied to:
https://software.intel.com/en-us/forums/computer-vision/topic/815126
You need to use ssd_support_api_v1.14.json
ssd_support_api_v1.14.json is definitely there (Windows 10) n C:\Program Files (x86)\IntelSWTools\openvino_2019.2.242\deployment_tools\model_optimizer\extensions\front\tf but you must install OpenVIno 2019R2 to get it.
Hope it helps,
Thanks,
Shubha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shubha,
Thank you for your reply,
I have tried to use ssd_support_api_v1.14.json but got same error.
I also tried to add --input_shape=1,300,300,3 when freeze the model (using export_inference_graph.py) and when convert, the error is:
I0801 09:41:38.673687 1232 infer.py:130] Partial infer for Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select
I0801 09:41:38.673687 1232 infer.py:131] Op: Select
E0801 09:41:38.673687 1232 infer.py:180] Cannot infer shapes or values for node "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select".
E0801 09:41:38.673687 1232 infer.py:181]
E0801 09:41:38.673687 1232 infer.py:182]
E0801 09:41:38.673687 1232 infer.py:183] It can happen due to bug in custom shape infer function <function Select.infer at 0x000001F3241550D0>.
E0801 09:41:38.673687 1232 infer.py:184] Or because the node inputs have incorrect values/shapes.
E0801 09:41:38.673687 1232 infer.py:185] Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
I0801 09:41:38.673687 1232 infer.py:196] Node "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select" attributes: {'pb': name: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select"
op: "Select"
input: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Less"
input: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Gather/GatherV2_1"
input: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/mul"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
I seem that some nodes in model have no shape. I tried to convert pre-trained model ssd_mobilenet_v2_coco (in model zoo) and successful.
Any suggestion about this?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear pham, hai,
what version of Tensorflow are you using ? Can you update to at least 1.14 ? Please use Tensorflow freeze graph to freeze your model. Some nodes being shapeless is definitely a strange and abnormal phenomenon. Please retry, but this time do not use --input_shape. Did you select an ssd from The MO Supported Tensorflow List ? And if so which one did you choose to custom-train ? I am assuming SSD MobileNet V2 COCO ?
If that one, notice that the pipeline.config has :
image_resizer { fixed_shape_resizer { height: 300 width: 300 } }
Please peruse this document :
Read the part which says this:
If the --input_shape [1, H, W, 3] command line parameter is specified, the Model Optimizer sets the input layer height to H and width to W and convert the model. However, the conversion may fail because of the following reasons:
Thanks,
Shubha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shubha,
I have found the root cause.
I train and freeze the model on Colab, which is using python 3.6, and download the freezed model to my computer, which is using python3.7.
Then I convert model using Openvino and it false.
I have retried with python 3.6 and successful.
Thank you for you helping!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear pham, hai,
I'm thrilled to hear of your success ! And most of all, I'm so glad that you shared your learnings with the OpenVino community. We are all in this together !
Shubha

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page