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

failed to run self-trained Yolov3-Tiny on raspberryPI 4B

JasmyChen
Beginner
833 Views

Hello,

I have just tried LinuxOpenVINO™Toolkit 2020.4 to train the self-trained Yolov3-Tiny, and successfully converted its weight model to obtain the IR file.

I also installed OpenVINO™Toolkit 2020.4 on Raspberry PI 4B.When using the IR file obtained above, When you run the.py file that reads the image, the error is reported as follows:

屏幕截图 2020-10-07 170839.jpg

The corresponding .py file corresponds to the following:屏幕截图 2020-10-07 171132.jpg

When I read the video file with the following .py file , I get the following error:

屏幕截图 2020-10-07 171156.jpg

 

 

 

 

The corresponding .py file corresponds to the following:

屏幕截图 2020-10-07 171102.jpg屏幕截图 2020-10-07 171132.jpg

 

 

 

 

 

 

 

 

 

 

I hope to get your Suggestions on the solution or direction of this problem.Thank you very much.

 

Previous questions are linked below:

link

 

 

 

 

 

 

0 Kudos
6 Replies
Sebastian_M_Intel
Moderator
817 Views

Hello JasmyChen, 

 

Thank you for posting on the Intel® communities.   

 

So you can get better assistance, I will move this thread to the correct subforum: 

 

Intel Community > Software Development SDKs and Libraries > Intel® Distribution of OpenVINO™ Toolkit.  

 

Regards, 

 

Sebastian M  

Intel Customer Support Technician  


0 Kudos
IntelSupport
Moderator
787 Views

Hi Chen,


Thanks for reaching out to us. If possible, could you share the model optimizer command (including the parameters) that you used to convert your model into IR file.


As an additional information, please refer to the links below which contain information related to the issue you are facing.

https://github.com/mystic123/tensorflow-yolo-v3/issues/15

https://github.com/mystic123/tensorflow-yolo-v3/issues/64


Regards,

Adli


0 Kudos
JasmyChen
Beginner
774 Views

Here is my environment

PCubuntu16.4 python3.6 tensorflow1.12.0 openvino2020.4

raspberryPi4Bpython3.6 tensorflow1.12.0 openvino2020.4

 

Here is my command:

  1. Model self-training

1.1 Download Darknet and weights from: https://pjreddie.com/darknet/yolo/

1.2 Training command:

$sudo ./darknet detector train cfg/voc.data cfg/yolov3-tiny.cfg yolov3-tiny.conv.15

1.3 The configuration file yolov3-tiny. cfg and Lables name file voc.names are shown in the attachment.

1.4 The weight file obtained is shown in the attachment named yolov3-tiny_10000.weights.

 

 

  1. Converting YOLO* Models to the Intermediate Representation (IR)

Training command:

2.1  Clone the repository:

$git clone https://github.com/mystic123/tensorflow-yolo-v3.git

$cd tensorflow-yolo-v3

2.2 run a converter using the files mentioned above:

2.2.1

$python ./tensorflow-yolo-v3/convert_weights_pb.py --class_names voc.names --data_format NHWC --weights_file yolov3-tiny_10000.weights --tiny

2.2.2 Convert YOLOv3 TensorFlow Model to the IR

I changed the  “classes” to 1 in the file of <OPENVINO_INSTALL_DIR>/deployment_tools/model_optimizer/extensions/front/tf /  yolo_v3_tiny.json  to correspond to the number of detected tags in the vac.names file. .And yolo_v3_tiny.json  is shown in the attachment.

To generate the IR of the YOLOv3-tiny TensorFlow model, run:

$cd /opt/intel/openvino/deployment_tools/model_optimizer

$sudo python mo_tf.py --input_model /home/chen/CProject/openvino/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config /opt/intel/openvino/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3_tiny.json --batch 1 --data_type FP16 --output_dir /home/chen/CProject/openvino/YOLOv3tinyOpenVINO/output

 

Then I got the file including frozen_darknet_yolov3_model.bin, frozen_darknet_yolov3_model.xml, frozen_darknet_yolov3_model.mapping.

 

 

  1. Copy the IR file above to raspberrypi 4B and run, I got a mistake at the beginning of this post.

 

 

0 Kudos
IntelSupport
Moderator
748 Views

Hi Chen,


Thank you for your cooperation. We are currently investigating this issue, and will get back to you soon.


Regards,

Adli.


0 Kudos
IntelSupport
Moderator
703 Views

Hi Chen,

Sorry for the delay. I have replicated the issue. I have executed your script with your self-trained yolov3-tiny model using OpenVINO 2020.4 version and OpenVINO 2021.1 version and I’m also seeing the same error in both versions.

 

I then replaced your self-trained yolov3-tiny model with face-detection-adas-0001 model, and the program is able to load and execute properly.

 

So, the issue lies with your model. The error ‘ValueError: cannot reshape array of size 3042 into shape (7)' is happening probably due to the defined input shape is not compatible with the model shape. Aside from that, I suggest you check your voc.names file. Make sure no black space left behind after you write down the class name.

 

I am giving a few links here which will be helpful for you to solve your issue.

https://github.com/mystic123/tensorflow-yolo-v3/issues/62

https://github.com/mystic123/tensorflow-yolo-v3/issues/64

https://github.com/mystic123/tensorflow-yolo-v3/issues/15

 

Regards,

Adli

 

0 Kudos
IntelSupport
Moderator
674 Views

Hi Chen,


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,

Adli


0 Kudos
Reply