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

Problems applying self-trained ResNet50 in NCS2

alexalex35
Novice
689 Views

When I use the ResNet50 trained by Matlab to classify images using OpenVino samples (hello_classification.py), there is a problem with the consistency of the results.


The following is my process of converting onnx to IR file:
python mo.py --input_model D:\mydata\Desktop\openvino\seg_traindata\resnet_50.onnx --input_shape [1,3,224,224] --mean_values=[104.0,117.0,123.0] --data_type FP16 --reverse_input_channels --output_dir D:\mydata\Desktop\openvino\seg_traindata\


My model is successfully converted but running NCS2 on Raspberry Pi4 will get the same class id for different types of images
Can someone help me?

0 Kudos
6 Replies
Peh_Intel
Moderator
662 Views

Hi Alex,


Thanks for reaching out to us.


Please have a try to run the OpenVINO™ sample (hello_classification.py) on CPU plugin and share the results with us.


For your information, Inference Engine samples load input images in the BGR channels order. Does your ONNX model trained on images loaded with RGB order? Besides, you can also try to run the hello_classification.py directly with ONNX model if the model is trained on images loaded with BGR order.


If possible, please share your ONNX model and the prediction classes with us for better understanding and further investigation.



Regards,

Peh


0 Kudos
alexalex35
Novice
657 Views

Hi Peh_Intel,

 

Thanks for your response.

 

I bought NCS2 a while ago and wanted to implement the network architecture I trained in Matlab on Rasberry Pi4.


The function is mainly to identify small defects on the wafer, there are 10 categories that are normal and other 9 kinds of defects.


I converted the neural network file of Matlab to onnx file and then transferred it to IR file for NCS2 to use. It has been successful on squeezenet and googlenet, but when I use resnet, the same result will be run as shown in the following figure, so I would like to ask Are there any successful cases of converting resnet to IR file?

Pro.png
In addition, I would like to ask whether the accuracy of the image judgment will also drop after using NCS2, because my test results will be quite different from the accuracy of using Matlab on the computer.

0 Kudos
Peh_Intel
Moderator
644 Views

Hi Alex,


Thanks for sharing.


We do have a resnet-50-pytorch in Open Model Zoo. You can also refer to its model.yml file for the Model Optimizer arguments.


Regarding the accuracy, it is expected to have the relative accuracy difference between any of the target platforms and the reference metrics should be within 1%. You can try running IR on your computer with CPU plugin to figure out whether the obtained inaccuracy results are caused by the IR model itself or due to NCS2.



Regards,

Peh


0 Kudos
alexalex35
Novice
624 Views

Hi Peh_Intel,

Thanks for your response.

I am new to OpenvVINO, does IR on your computer with CPU plugin on your computer mean to use Openvino on the computer to run the IR file I have converted?

In addition, I would like to ask if my neural network in Matlab is FP32 because only FP16 can be used on NCS2, so will there be a difference in the use of the network?

0 Kudos
Peh_Intel
Moderator
613 Views

Hi Alex,


Yes, try run the demo (-d CPU) on your computer with the IR file.


If the original model is in FP32 and --data_type=FP16 is specified, all model weights and biases are quantized to FP16.



Regards,

Peh


0 Kudos
Munesh_Intel
Moderator
584 Views

Hi Alex,

This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.

 

Regards,

Peh

 

0 Kudos
Reply