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.

Convert YOLOV3 Models to IR

Lee__Terry
Beginner
633 Views

I try to flow the instruction ( https://software.intel.com/en-us/articles/OpenVINO-Using-TensorFlow#convert-object-detection-api-models) to covert yolov3 model to IR and run into some issues on building YOLOv3 TensorFlow Model.

Do I need to use Ubuntu 16.04 or it can run on windows 10 ?

Could you provide a working IR model for yolov3 or a working  yolo_v3.pb file?

Thanks in advance.

0 Kudos
7 Replies
nikos1
Valued Contributor I
633 Views

Hi Terry,

I froze and run YOLO3 model optimizer on Linux (Ubuntu 16.04) and run inference on both Windows and Linux.

Safer to start freezing on Linux. Cannot comment on Windows as did not try.

Better to generate pb and IR yourself.

Cheers,

Nikos  

0 Kudos
Lee__Terry
Beginner
633 Views

Hi Nikos,

Thanks for the quick respond. Since I 'm not familiar with Linux, it's time consuming for me to generate the yolov3 pd file. Is there anyway to get the ready yolov3.pd file?  Can someone share that file?

Thanks,

Terry

0 Kudos
Meller__Daniel
Beginner
633 Views

raising this question again.

i've tried following https://software.intel.com/en-us/articles/OpenVINO-Using-TensorFlow#convert-object-detection-api-models unfortuently with no luck.

i froze the models and just when running:

python3 mo.py --input_model frozen_darknet_yolov3_model.pb

i get:

Common parameters:
    - Path to the Input Model:     /home/mellerdaniel/Documents/yolo/tensorflow-yolo-v3/frozen_darknet_yolov3_model.pb
    - Path for generated IR:     /home/mellerdaniel/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/.
    - IR output name:     frozen_darknet_yolov3_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:     Not specified, inherited from the model
    - 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
    - Offload unsupported operations:     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:     1.4.292.6ef7232d
[ ERROR ]  Shape [ -1 416 416   3] is not fully defined for output 0 of "inputs". Use --input_shape with positive integers to override model input shapes.
[ ERROR ]  Cannot infer shapes or values for node "inputs".
[ ERROR ]  Not all output shapes were inferred or fully defined for node "inputs".
 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 tf_placeholder_ext.<locals>.<lambda> at 0x7f6fbdbd0e18>.
[ 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 "inputs" node.
 For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #38.

 

would be great getting some help regarding this.

 

Daniel.

0 Kudos
nikos1
Valued Contributor I
633 Views

Hello Daniel,

try something like 

python3 mo_tf.py --input_model yolov3_model.pb 

--tensorflow_use_custom_operations_config 
~/intel/computer_vision_sdk/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3.json  

--input_shape=[1,416,416,3] --data_type=FP32

 

Cheers,

Nikos

0 Kudos
Meller__Daniel
Beginner
633 Views

hi nikos,

tried it and i get:

mellerdaniel@mellerdaniel-GS43VR-7RE:~/Documents/newYolo/tensorflow-yolo-v3$ python3 ~/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo_tf.py --input_model frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config ~/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3.json --input_shape=[1,416,416,3] --data_type=FP32
Model Optimizer arguments:
Common parameters:
    - Path to the Input Model:     /home/mellerdaniel/Documents/newYolo/tensorflow-yolo-v3/frozen_darknet_yolov3_model.pb
    - Path for generated IR:     /home/mellerdaniel/Documents/newYolo/tensorflow-yolo-v3/.
    - IR output name:     frozen_darknet_yolov3_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,416,416,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
    - Offload unsupported operations:     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:     /home/mellerdaniel/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3.json
Model Optimizer version:     1.4.292.6ef7232d
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
[ WARNING ]  
Detected not satisfied dependencies:
    numpy: installed: 1.11.0, required: 1.12.0

Please install required versions of components or use install_prerequisites script
/home/mellerdaniel/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/install_prerequisites/install_prerequisites_tf.sh
Note that install_prerequisites scripts may install additional components.
[ ERROR ]  Cannot infer shapes or values for node "detector/yolo-v3/Conv_14/BiasAdd/YoloRegion".
[ ERROR ]  'coords'
[ ERROR ]  
[ ERROR ]  It can happen due to bug in custom shape infer function <function RegionYoloOp.regionyolo_infer at 0x7f290119b488>.
[ 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 "detector/yolo-v3/Conv_14/BiasAdd/YoloRegion" node.
 For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #38.

 

0 Kudos
nikos1
Valued Contributor I
633 Views

I think the error is 

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
[ WARNING ]  
Detected not satisfied dependencies:
    numpy: installed: 1.11.0, required: 1.12.0

Something looks wrong with numpy - can you try

pip install numpy --upgrade

 

0 Kudos
Wen__JiaPing
Beginner
633 Views

I also have this problem. Have you solved it?

0 Kudos
Reply