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.
6403 Discussions

Customized YOLO V2 Inference IR error: Size of dims(2) and format(NCHW) are inconsistent.

CBell1
New Contributor II
1,690 Views

Hello,

I customized a YOLO v2 Model and it's work using Python code for inference.

Now, I want to use the same model with OpenVino and NCS v1.

I converted with success the Model to IR FP16 files.

When I run the IR FP16 .xml with OpenVino ./object_detection_demo_yolov3_async and NCS v1 I have the following error:

OpenVino 2019 R3.1

cosma@UP1:~/inference_engine_demos_build/intel64/Release$ ./object_detection_demo_yolov3_async -i "cam" -m ~/TF_Models/IR_FP16/yolo_Test_1.xml -d MYRIAD
InferenceEngine:
    API version ............ 2.1
    Build .................. custom_releases/2019/R3_ac8584cb714a697a12f1f30b7a3b78a5b9ac5e05
    Description ....... API
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ INFO ] Loading Inference Engine
[ INFO ] Device info:
    MYRIAD
    myriadPlugin version ......... 2.1
    Build ........... 32974
[ INFO ] Loading network files
[ INFO ] Batch size is forced to  1.
[ INFO ] Checking that the inputs are as the demo expects
[ INFO ] Checking that the outputs are as the demo expects
[ ERROR ] Size of dims(2) and format(NCHW) are inconsistent.

 

I tried also -d CPU and I have the same error.

Please, do you have a suggestion?

Thank you

 

0 Kudos
1 Solution
CBell1
New Contributor II
1,690 Views

Hi Sahira, Hi Jesus,

I have the pleasure to inform you that I solved the problem and I perfectly converted YOLO v3 customized model using transfer learning and a custom dataset.

I converted .weights to .pb using tensorflow-yolo-v3 tool and then converted the .pb to IR files using model_optimizer.

Finally, I used OpenVino with NCS for the inference.

FYI, I trained data testing the TF 12, 14 & 15 versions and all work fine.

Best Regards

 

View solution in original post

0 Kudos
8 Replies
Sahira_Intel
Moderator
1,690 Views

Hi,

Can you please attach your model so I can try to reproduce this issue? 

If you would like to send your model over a private message, let me know and I can start a thread.

Best,

Sahira 

0 Kudos
Sahira_Intel
Moderator
1,690 Views

Hi,

I have sent you a private message.

Thank you,

Sahira 

0 Kudos
CBell1
New Contributor II
1,691 Views

Hi Sahira,

Thanks for your replay

Where is the private link?

Anyway, for the moment, attached the .pb file.

Please, let me know your opinion

Thank you

 

0 Kudos
Sahira_Intel
Moderator
1,691 Views

Hi,

The model you are using is actually for YoloV2, but the sample is YoloV3. Check this one out from the NCAPPZOO: https://github.com/movidius/ncappzoo/tree/master/networks/tiny_yolo_v2 

You will need to make some modifications to the sample to match your model: num_classes and anchor_boxes.

Please let me know if this works.

Sincerely,

Sahira 

 

0 Kudos
CBell1
New Contributor II
1,691 Views

Hi Sahira,

I already applied these steps to customize Yolo v2 with my dataset following the following instructions:

https://github.com/thtrieu/darkflow

The Inference results run properly using Python application with OpenCV.

Now, I want to use OpenVino and I applied the following instruction to convert the customized YOLO Model to IR:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html

And it works, I have created the IR files.

Unfortunately, I found only the "object_detection_demo_yolov3_async" application to run the customized YOLO with OpenVino.

Please, let me know if you have other tools to run YOLO with OpenVino.

Or, is only supported YOLO v3 ?

Thank you

Cosma

 

0 Kudos
JesusE_Intel
Moderator
1,692 Views

Hi Cosma,

Sounds like you have trained your YOLOv2 model and successfully converted to IR format! The sample code you are trying to use is only for the YOLOv3 architecture. As Sahira suggested, we have another sample application that can be used with YOLOv2 models. However, the sample application is written to work with the original YOLOv2. Since you have a custom trained model, you will need to update the variables for number of classes and anchors_boxes. Otherwise, the inference results will be inaccurate.

See the following python sample code for YOLOv2 on OpenVINO:

https://github.com/movidius/ncappzoo/blob/master/networks/tiny_yolo_v2/tiny_yolo_v2.py

Regards,

Jesus

0 Kudos
CBell1
New Contributor II
1,692 Views

Hi Sahira, Hi Jesus,

ok!

I'll work in this direction.

Many thanks for your suggestions!

 

 

0 Kudos
CBell1
New Contributor II
1,691 Views

Hi Sahira, Hi Jesus,

I have the pleasure to inform you that I solved the problem and I perfectly converted YOLO v3 customized model using transfer learning and a custom dataset.

I converted .weights to .pb using tensorflow-yolo-v3 tool and then converted the .pb to IR files using model_optimizer.

Finally, I used OpenVino with NCS for the inference.

FYI, I trained data testing the TF 12, 14 & 15 versions and all work fine.

Best Regards

 

0 Kudos
Reply