Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shifted bounding boxes after inference #14

Open
9friday opened this issue Nov 28, 2023 · 1 comment
Open

Shifted bounding boxes after inference #14

9friday opened this issue Nov 28, 2023 · 1 comment

Comments

@9friday
Copy link

9friday commented Nov 28, 2023

Hi,
I am trying to run inference using a custom trained YOLOv7 model in both the .pt and .onnx formats.

The bounding boxes and confidence values from the weight files of both the formats aren't the same. It appears that the bounding boxes are shifted.
Both the pytorch inference code and the onnx inference code is written using Python.

I am attaching pictures from both pytorch and onnx inference on one of the images below.
Pytorch inference :
objectInWild_AerialVid12-fNo12401
Onnx inference :
objectInWild_AerialVid12-fNo12401

To recreate the issue :
Pytorch inference :
I used the detect.py file from the yolov7 repository.
Convert the model from pytorch to onnx:
I used the export.py file from the yolov7 repository with the following command line arguments :
python3 export.py --weights /custom model_path/yolov7_custom_best.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.50 --conf-thres 0.2 --img-size 960 540 --max-wh 960.
The commit id : 84932d70fb9e2932d0a70e4a1f02a1d6dd1dd6ca

ONNX Inference :
I used the WALDO repository.
The commit id : a99ad40
The playground/run_local_network_on_images_onnxruntime.py file was only modified to log inference times.

I am unable to identify what could be causing this issue and would appreciate any insight regarding why this issue could occur and how to rectify it. Thanks in advance!

@stephansturges
Copy link
Owner

yes you're right there is an offset that is not corrected well there.. I will fix it in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants