PINTO0309 / OpenVINO-YoloV3

YoloV3/tiny-YoloV3+RaspberryPi3/Ubuntu LaptopPC+NCS/NCS2+USB Camera+Python+OpenVINO
https://qiita.com/PINTO
Apache License 2.0
537 stars 165 forks source link

IR model results different from PB model #24

Open cloudboy08 opened 5 years ago

cloudboy08 commented 5 years ago

[Required] Your device (RaspberryPi3, LaptopPC, or other device name): Laptop PC

[Required] Your device's CPU architecture (armv7l, x86_64, or other architecture name):

[Required] Your OS (Raspbian, Ubuntu1604, or other os name): Ubuntu1604

[Required] Details of the work you did before the problem occurred:

  1. convert weight file into PB file python3 convert_weights_pb.py --class_names coco.names --weights_file yolov3.weights --data_format NHWC --output_graph pbmodels/frozen_yolo.pb

  2. verify pb file python3 demo.py --class_names coco.names --data_format NHWC --frozen_model pbmodels/frozen_yolo.pb --input_img dog.jpg --output_img dog_pb.jpg

  3. convert pb file to IR file python3 /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo_tf.py --input_model pbmodels/frozen_yolo.pb --output_dir lrmodels/YoloV3/FP16/ --data_type FP16 --batch 1 --tensorflow_use_custom_operations_config yolo_v3_changed.json

  4. detect using IR files python3 openvino_yolov3_test_img_cam.py -d MYRIAD -m lrmodels/YoloV3/FP16/frozen_yolo.xml -i dog.jpg

[Required] Error message:

the dog_pb.jpg is normal. Confidence of the bicycle is 0.994%
However, the output of IR model is not good. The confidence of the detected biccyle is only 65.9%
[Required] Overview of problems and questions:

Anything wrong with the IR conversion? Below is the detection using pb file:

dog_pb

Below is the detection using IR file: output

demo.py, openvino_yolov3_test_img_cam.py is attached as: scripts.zip

model files are too big to attach. Please see link: https://drive.google.com/file/d/1tN0LlUpazH0FJGoSIeiQ0HUBb_UPZnny/view?usp=sharing

Appreciate your inputs. thanks.

PINTO0309 commented 5 years ago

There is no problem with the model structure, but I know that my program has a bug. It is a bug that the frame display position is shifted. #23 In addition, accuracy will be reduced if converted with FP16. Since conversion to 32bit-> 16bit, degradation of precision occurs.