TNTWEN / OpenVINO-YOLOV4

This is implementation of YOLOv4,YOLOv4-relu,YOLOv4-tiny,YOLOv4-tiny-3l,Scaled-YOLOv4 and INT8 Quantization in OpenVINO2021.3
MIT License
238 stars 66 forks source link

Question about file yolo_v4_tiny.json ? #35

Closed hoangkhoiLE closed 3 years ago

hoangkhoiLE commented 3 years ago

Hello,

I very appreciate your excellent work. Now I want to train the yolo_v4 on my custom dataset but I don't know how to get the json file for the step convert to openvino like you did. Can you show me the way to get file "yolo_v4_tiny.json" by your file "yolo-tiny.weights" ? Thank you in advance.

Best regards

TNTWEN commented 3 years ago

For custom model,you need to modify following files:

(1) When running convert_weights_pb.py use your .names file,the default is coco.names

(2) Modify "classes" in yolov4.json https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/cc0245aaf258a9c8578d2f5ed32e595aedd41266/yolo_v4_tiny.json#L6

Optional: (3)anchors:https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/cc0245aaf258a9c8578d2f5ed32e595aedd41266/yolo_v4_tiny.json#L7 It is the same with https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/cc0245aaf258a9c8578d2f5ed32e595aedd41266/cfg/yolov4-tiny.cfg#L219

If you cluster your own dataset, you need to modify it. Otherwise, there is no need to modify anchors

There is no need to modify the following lines:

https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/cc0245aaf258a9c8578d2f5ed32e595aedd41266/yolo_v4_tiny.json#L10-L11 This tells OpenVINO the location of yolo layer

"entry_points": ["detector/yolo-v4-tiny/Reshape", "detector/yolo-v4-tiny/Reshape_4"] is defined by TF model's namespace.

"masks": [[3, 4, 5] corresponds to "detector/yolo-v4-tiny/Reshape"corresponds to https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/cc0245aaf258a9c8578d2f5ed32e595aedd41266/cfg/yolov4-tiny.cfg#L218

"masks": [1, 2, 3]]corresponds to"detector/yolo-v4-tiny/Reshape_4" corresponds to https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/cc0245aaf258a9c8578d2f5ed32e595aedd41266/cfg/yolov4-tiny.cfg#L267

Other lines are parameters required by mo.py or inference demo.There is no need to modify.

hoangkhoiLE commented 3 years ago

Thank you for your kind response