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

Upgrade onnxsim to v0.4.1 #8632

Merged
merged 6 commits into from
Jul 19, 2022
Merged

Conversation

daquexian
Copy link
Contributor

@daquexian daquexian commented Jul 19, 2022

I'm the author of onnx-simplifier. Recently I published onnxsim v0.4.1. In the latest version, dynamic input shapes are natively supported. Extra flags like dynamic_input_shapes and input_shapes are not needed anymore.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhanced ONNX export functionality and requirements adjustment for the YOLOv5 model.

📊 Key Changes

  • Updated the ONNX simplification process in export.py, removing the need to specify dynamic input shapes directly.
  • Modified conditional requirement to install either onnxruntime-gpu or onnxruntime based on CUDA availability for ONNX model simplification.
  • Changed assertion in export.py to clarify that the optimization process requires the CPU device.
  • Bumped minimum version requirement for onnx-simplifier in requirements.txt to >=0.4.1.

🎯 Purpose & Impact

  • 🚀 Simplifies the ONNX export process, potentially leading to fewer user errors and smoother integration for those using ONNX models.
  • 🌐 Allows for automatic selection of the appropriate ONNX runtime depending on the user's environment, potentially improving performance.
  • 🛠️ Clarifies the need to use a CPU for model optimization to prevent user confusion and ensure compatibility.
  • 📈 Ensures users have the necessary software versions for seamless functionality and compatibility with the improved export process.

These changes aim to streamline the process for users exporting YOLOv5 models to ONNX format, which may improve user experience and broaden the deployment possibilities of YOLOv5 in different environments and platforms.

Signed-off-by: daquexian <daquexian566@gmail.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

👋 Hello @daquexian, thank you for submitting a YOLOv5 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • ✅ Verify your PR is up-to-date with upstream/master. If your PR is behind upstream/master an automatic GitHub Actions merge may be attempted by writing /rebase in a new comment, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
# git checkout feature  # <--- replace 'feature' with local branch name
git merge upstream/master
git push -u origin -f
  • ✅ Verify all Continuous Integration (CI) checks are passing.
  • ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee

@glenn-jocher
Copy link
Member

glenn-jocher commented Jul 19, 2022

@daquexian I get a failure in Colab when testing this PR. Something seems off about the onnxruntime installation:

Screen Shot 2022-07-19 at 6 32 25 PM

@glenn-jocher
Copy link
Member

@daquexian I added onnxruntime install prior to the new onnxsim 0.4.1 install and this appears to resolve the issue. Not sure what the problem was.
Screen Shot 2022-07-19 at 6 51 05 PM

@glenn-jocher glenn-jocher changed the title upgrade onnxsim to v0.4.1 Upgrade onnxsim to v0.4.1 Jul 19, 2022
@glenn-jocher glenn-jocher merged commit 92e47b8 into ultralytics:master Jul 19, 2022
@glenn-jocher
Copy link
Member

@daquexian PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

@daquexian
Copy link
Contributor Author

@glenn-jocher Thanks for your work!

@daquexian daquexian deleted the upgrade_onnxsim branch July 20, 2022 02:58
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* upgrade onnxsim to v0.4.1

Signed-off-by: daquexian <daquexian566@gmail.com>

* Update export.py

* Update export.py

* Update export.py

* Update export.py

* Update export.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member

@daquexian you're welcome! It's a team effort and we're grateful for all the support from the YOLO community and the Ultralytics team. If you have any more questions or suggestions, feel free to reach out anytime.

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

Successfully merging this pull request may close these issues.

2 participants