Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

SSD 300

川李000
Beginner
553 Views

how to convert the .pb model to IR?

l use

python3 mo_tf.py --data_type FP16 --input_shape [1,300,300,3] --input_model /path/to/my/pbmodel

it's wrong.

[ ERROR ] Shape [ 1 3 -1 256] is not fully defined for output 0 of "conv8_2/convolution". Use --input_shape with positive integers to override model input shapes. [ ERROR ] Cannot infer shapes or values for node "conv8_2/convolution". [ ERROR ] Not all output shapes were inferred or fully defined for node "conv8_2/convolution". 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 Convolution.infer at 0x7fe94897d378>. [ 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 "conv8_2/convolution" node. For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #38.

how to correct convert? need other parameter? and parameter's content?

 

And what should l change the code if l use your code to detect

0 Kudos
3 Replies
JesusE_Intel
Moderator
553 Views

Hello,

I was able to download and convert the ssd300 caffe model available in the OpenVINO toolkit downloader.py. However, I have not tried to convert a Tensorflow version of this model. Could you provide a link to the model you are using?

Please give the following a try and let me know if you have any issues.

Download the ssd300 caffe model:

cd ~/intel/openvino/deployment_tools/tools/model_downloader/
python3 downloader.py --name ssd300
cd ~/intel/openvino/deployment_tools/tools/model_downloader/object_detection/common/ssd/300/caffe/

 

Copy the python sample code for object detection:

cp ~/intel/openvino/deployment_tools/inference_engine/samples/python_samples/object_detection_demo_ssd/object_detection_demo_ssd_async.py  .

Convert caffe model to IR:

export mo_caffe=~/intel/openvino/deployment_tools/model_optimizer/mo_caffe.py 
python3 $mo_caffe --input_model ssd300.caffemodel --input_proto ssd300.prototxt

Run the python sample with the IR model, web camera on CPU:

python3 object_detection_demo_ssd_async.py -m ssd300.xml -i cam -l ~/intel/openvino/deployment_tools/inference_engine/lib/intel64/libcpu_extension_avx2.so

Regards,

Jesus

0 Kudos
川李000
Beginner
553 Views

Jesus

     I am not using the caffe SSD model, I am using the keras SSD model (https://github.com/pierluigiferrari/ssd_keras) and then converting to the tensorflow model. The attachment is a model file.

     (tensorflow-gpu) C:\Program Files (x86)\IntelSWTools\openvino_2019.1.133\deployment_tools\model_optimizer>python mo_tf.py --data_type FP32 --input_model model.pb --input_shape [1,300,300,3]
Model Optimizer arguments:
Common parameters:
        - Path to the Input Model:      C:\Program Files (x86)\IntelSWTools\openvino_2019.1.133\deployment_tools\model_optimizer\model.pb
        - Path for generated IR:        C:\Program Files (x86)\IntelSWTools\openvino_2019.1.133\deployment_tools\model_optimizer\.
        - IR output name:       model
        - Log level:    ERROR
        - Batch:        Not specified, inherited from the model
        - Input layers:         Not specified, inherited from the model
        - Output layers:        Not specified, inherited from the model
        - Input shapes:         [1,300,300,3]
        - Mean values:  Not specified
        - Scale values:         Not specified
        - Scale factor:         Not specified
        - Precision of IR:      FP32
        - Enable fusing:        True
        - Enable grouped convolutions fusing:   True
        - Move mean values to preprocess section:       False
        - Reverse input channels:       False
TensorFlow specific parameters:
        - Input model in text protobuf format:  False
        - Path to model dump for TensorBoard:   None
        - List of shared libraries with TensorFlow custom layers implementation:        None
        - Update the configuration file with input/output node names:   None
        - Use configuration file used to generate the model with Object Detection API:  None
        - Operations to offload:        None
        - Patterns to offload:  None
        - Use the config file:  None
Model Optimizer version:        2019.1.0-341-gc9b66a2
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.ConvertGroupedStridedSlice.ConvertGroupedStridedSlice'>): Number of elements in input [1 1] and output [1, 300, 300] of reshape node input_channel_swap/strided_slice/Reshape_shrink mismatch

 

       thanks your help,Best Regards!

       lichuan

0 Kudos
JesusE_Intel
Moderator
553 Views

Hi 李, 川,

I have not tried to convert a keras model myself, however, take a look at the documentation for converting a tensorflow model. You will need to specify the following parameters. 

--tensorflow_use_custom_operations_config 
--tensorflow_object_detection_api_pipeline_config

In the following thread, a user converted a SSD mobilenet to IR. It should be similar with your keras model. 

https://software.intel.com/en-us/forums/computer-vision/topic/805387

Regards,

Jesus

0 Kudos
Reply