yolov7 icon indicating copy to clipboard operation
yolov7 copied to clipboard

Why does the exported end2end yolov7.onnx only get a mAP of 0.46721 on COCO dataset? while yolov7.pt's mAP is 0.512

Open pustar opened this issue 1 year ago • 4 comments

I follow the tutorial to generate an end2end yolov7.onnx : https://github.com/WongKinYiu/yolov7/blob/main/tools/YOLOv7onnx.ipynb

however, the exported end2end yolov7.onnx only get a mAP of 0.46721 on COCO dataset, while yolov7.pt is 0.512 , why?

pustar avatar Aug 04 '22 05:08 pustar

Use --conf-thres 0.001 during export https://github.com/WongKinYiu/yolov7/blob/main/test.py#L25

python export.py --weights yolov7-tiny.pt --grid --end2end --simplify \
        --topk-all 100 --iou-thres 0.65 --conf-thres 0.001 --img-size 640 640 --max-wh 640

AlexeyAB avatar Aug 04 '22 05:08 AlexeyAB

Use --conf-thres 0.001 during export https://github.com/WongKinYiu/yolov7/blob/main/test.py#L25

python export.py --weights yolov7-tiny.pt --grid --end2end --simplify \
        --topk-all 100 --iou-thres 0.65 --conf-thres 0.001 --img-size 640 640 --max-wh 640

many thanks for your quick reply. I have set conf-thres to 0.001, and I also change topk-all to 500 in another try, but still get 0.467 mAP

is the preprocess method that matters? should do the same preprocess as test.py does? statistic aspect ratio, shapes, sort shapes, ...

can an yolov7.onnx of fixed 640x640 input shape get the mAP of 0.512?

only yolov7.onnx with dynamic width and height , and do the same preprocess as train or test(evaluate) course, can reach the mAP of 0.512?

pustar avatar Aug 04 '22 06:08 pustar

my case.

--end2end cmd is not cood.

try python export.py --weights yolov7-tiny.pt --grid --include-nms //default thr=0.25

HeungJunKim avatar Aug 04 '22 06:08 HeungJunKim

my case.

--end2end cmd is not cood.

try python export.py --weights yolov7-tiny.pt --grid --include-nms //default thr=0.25

Thank you very much! Can yolov7.onnx or yolov7-tiny.onnx reach the same mAP as yolov7.pt or yolov7-tiny.pt by this way? I will take a try

pustar avatar Aug 04 '22 07:08 pustar