Open 9friday opened 11 months ago
yes you're right there is an offset that is not corrected well there.. I will fix it in the next release
Hi guys, I tried to do the same thing here, and I used the same commit id of yolov7 to export the yolov7-tiny.onnx. However, the run_local_network_on_images_onnxruntime.py output with this:
Warning: Model resolution not found in the model path. Defaulting to 960px.
Traceback (most recent call last):
File "/home/xliu/gitrepo/WALDO/playground/run_local_network_on_images_onnxruntime.py", line 245, in <module>
main()
File "/home/xliu/gitrepo/WALDO/playground/run_local_network_on_images_onnxruntime.py", line 234, in main
final_image, outputs = process_large_image(image, model, resize_image=args.resize)
File "/home/xliu/gitrepo/WALDO/playground/run_local_network_on_images_onnxruntime.py", line 164, in process_large_image
outputs = session.run(outname, inp)[0]
File "/home/xliu/.local/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 217, in run
return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: images for the following indices
index: 3 Got: 960 Expected: 544
Please fix either the inputs or the model.
Here is the output of test_onnx_gpu.py:
2024-10-24 17:15:28.627995902 [W:onnxruntime:, session_state.cc:1169 VerifyEachNodeIsAssignedToAnEp] Some nodes were not assigned to the preferred execution providers which may or may not have an negative impact on performance. e.g. ORT explicitly assigns shape related ops to CPU to improve perf.
2024-10-24 17:15:28.628012092 [W:onnxruntime:, session_state.cc:1171 VerifyEachNodeIsAssignedToAnEp] Rerunning with verbose output on a non-minimal build will show node assignments.
------------------------------------------------
Loaded model OK : yolov7-tiny.onnx
I am beginner in this field so I really appreciate you can give me some suggestions, thanks a lot!
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 : Onnx inference :
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 : a99ad40be13395d3d7cf67bf3704e122862658ca 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!