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

ONNX runtime support #922

Merged
merged 23 commits into from
Jan 10, 2024
Merged

ONNX runtime support #922

merged 23 commits into from
Jan 10, 2024

Conversation

karl-joan
Copy link
Contributor

@karl-joan karl-joan commented Jul 28, 2023

Made changes to pull request #904 since the author didn't respond.

Changes:

  • Separated functions for image preprocessing and post-processing.
  • You can supply options to onnxruntime.
  • Fixed bugs in image post-processing, where iou_threshold was missing and bounding boxes were sent to non_max_supression in wrong format.
  • Fixed bug where sessions options weren't passed to onnxruntime.
  • Added some test.
  • Renamed onnx.py to onnx_model.py to avoid confusion with onnx library.

The code was designed with the intention of being used for YOLOv8 ONNX model. Perhaps some changes should be made to make it more suitable for other architectures.

@karl-joan karl-joan marked this pull request as ready for review July 28, 2023 11:38
@julled
Copy link

julled commented Aug 1, 2023

Thanks for continuing this work! I thinks its very important and i am looking forward to test this if you think its ready.

@karl-joan
Copy link
Contributor Author

@julled You can go ahead and test it

@LongLe18
Copy link

LongLe18 commented Aug 4, 2023

@karl-joan I tested your contribution. It's appear error like image below. And image which I used to test (https://ultralytics.com/images/bus.jpg)
image

@karl-joan
Copy link
Contributor Author

@LongLe18 The test is meant to be run with image specified in the test file. If you change the image, then it won't work since the image you provided does not contain any cars.

If you just want to try the model, then use one of the built in functions such as get_sliced_prediction or get_prediction.

@LongLe18
Copy link

LongLe18 commented Aug 7, 2023

@karl-joan ok tks sir. I understood, you have not handled except yet. I will try again

@fcakyon
Copy link
Collaborator

fcakyon commented Nov 5, 2023

Thanks a lot for this amazing contribution @karl-joan !

If you could add a demo notebook as other model implementations, we would gladly merge the PR 👍

Copy link
Collaborator

@fcakyon fcakyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code styling errors need to be fixed, a demo notebook need to be added

requirements.txt Outdated Show resolved Hide resolved
sahi/auto_model.py Outdated Show resolved Hide resolved
sahi/models/__init__.py Outdated Show resolved Hide resolved
sahi/models/onnx_model.py Outdated Show resolved Hide resolved
tests/test_onnxmodel.py Outdated Show resolved Hide resolved
tests/test_onnxmodel.py Outdated Show resolved Hide resolved
@fcakyon
Copy link
Collaborator

fcakyon commented Nov 6, 2023

@karl-joan can you please fix the styling? https://github.com/obss/sahi#contributing

@karl-joan
Copy link
Contributor Author

@fcakyon Yes, I'll try to get that and the notebook tomorrow done.

@karl-joan
Copy link
Contributor Author

@fcakyon Let me know if you need anything else.

karl-joan and others added 14 commits November 25, 2023 22:48
Co-authored-by: fatih <34196005+fcakyon@users.noreply.github.com>
Co-authored-by: fatih <34196005+fcakyon@users.noreply.github.com>
Co-authored-by: fatih <34196005+fcakyon@users.noreply.github.com>
Co-authored-by: fatih <34196005+fcakyon@users.noreply.github.com>
Co-authored-by: fatih <34196005+fcakyon@users.noreply.github.com>
Co-authored-by: fatih <34196005+fcakyon@users.noreply.github.com>
@devrimcavusoglu
Copy link
Member

@karl-joan @fcakyon what is the status here ? I can take the lead, but I assume code formatting/linting has been addressed. As far as I reviewed the files, there are no additional requirements.

@karl-joan
Copy link
Contributor Author

@devrimcavusoglu It's currently waiting behind @fcakyon

Copy link
Member

@devrimcavusoglu devrimcavusoglu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution @karl-joan

@devrimcavusoglu devrimcavusoglu merged commit d91e1e6 into obss:main Jan 10, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants