PINTO0309 / OpenVINO-YoloV3

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

Instructions on conversion from a custom YOLOv3 network #28

Open hai-h-nguyen opened 5 years ago

hai-h-nguyen commented 5 years ago

I have a trained YOLO network with 5 classes. Steps that I took.

  1. Convert from my YOLO weight file (trained using Darknet C++ model) to IR:

Conversion to pb: python3 convert_weights_pb.py --class_names obj.names --data_format NHWC --weights_file k-yolo-obj_last.weights

My yolo_v3.json file:

  {
    "id": "TFYOLOV3",
    "match_kind": "general",
    "custom_attributes": {
      "classes": 5,
      "coords": 4,
      "num": 9,
      "mask": [0, 1, 2],
      "jitter":0.3,
      "ignore_thresh":0.5,
      "truth_thresh":1,
      "random":1,
      "anchors":[10,13,16,30,33,23,30,61,62,45,59,119,116,90,156,198,373,326],
      "entry_points": ["detector/yolo-v3/Reshape", "detector/yolo-v3/Reshape_4", "detector/yolo-v3/Reshape_8"]
    }
  }
]

Conversion from pb file to IR: python3 /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo_tf.py --input_model ~/tensorflow-yolo-v3/frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config yolo_v3.json --batch 1 --data_type FP16

The conversions were succesful.

  1. Test the IR model: In your script openvino_yolov3_test.py, I changed the class number to 5, and labels into my label names. However, the result when running on NCS2 is very bad compared to the the original weight testing with Darknet commands.

Do I need to make corrections of the test file (m_input_size, camera_width, camera_height) or in any other steps to make it work?

Thanks!

PINTO0309 commented 5 years ago

However, the result when running on NCS2 is very bad compared to the the original weight testing with Darknet commands.

I know that there are multiple issues.

  1. NCAPI + NCS2 bug
  2. Accuracy degradation by FP16 (only a little)
  3. Calculation bug of frame display position of my test program

https://github.com/PINTO0309/OpenVINO-YoloV3#issue

Especially 1. is serious. I can not solve the problem 1.

hai-h-nguyen commented 5 years ago

I performed the same routine on the new version of OpenVINO (2019) (with my custom network), the performance is greatly improved.

PINTO0309 commented 5 years ago

Thank you for providing the information. It will be a great help to other engineers.