WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.36k stars 4.21k forks source link

The onnx model exported by the u7 branch det/export.py seem not work with opencv #726

Open JimXu1989 opened 2 years ago

JimXu1989 commented 2 years ago

Hi, I try the same way by export the yolov7.pt to onnx, by: python export.py --weights yolov7.pt --include onnx. It reports can not find class RepConv, so I copied it from u5 branch. The exported onnx model take by opencv, but the output of the model is an all NAN array.

dnsefe commented 2 years ago

If you compare the yolov7.yaml file in the u7 branch with the corresponding file in the main branch, you will notice that RepConv is not used in u7. The weight file you're providing is most likely from the main branch. I am not quite sure, but that might be the culprit.

You could train on the COCO dataset from scratch in the u7 branch and use your trained model to convert to ONNX or maybe @WongKinYiu already has it pretrained and could eventually provide it?

ghmchen commented 1 year ago

I can export onnx from the u7 branch. The exported onnx file is also working well in predict.py. But this onnx file can not be readed coreectly by opencvDNN. Here is error message: image