-
Notifications
You must be signed in to change notification settings - Fork 634
Fix deploy_to_roboflow seg model export #578
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #578 +/- ##
======================================
Coverage 22% 22%
======================================
Files 46 46
Lines 6181 6181
======================================
Hits 1342 1342
Misses 4839 4839 🚀 New features to boost your workflow:
|
|
@Matvezy could we add a test, pls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Fixes ONNX export for segmentation models when using deploy_to_roboflow / deploy by ensuring the correct model instance is put into evaluation mode prior to inference during export.
Changes:
- Switches the
.eval()call inexport()fromself.modelto the locally-copiedmodelused for inference/export.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dynamic_axes = None | ||
| self.model.eval() | ||
|
|
||
| model.eval() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
This circumvents the problem in one scenario but the same bug also appears when just exporting to onxx. The problem occurs one line before the print statement: masks = outputs['pred_masks']
Depending on which needs to be printed out, the line should be updated to: masks = outputs['pred_masks']['query_features'] # or ['spatial_features']Then the export works successfully. |
What does this PR do?
For seg models models when calling deploy_to_roboflow and deploy, this error occurs:
Type of Change
Fixing this by calling .eval() on the right model object.
Testing
Test details:
N/A
Checklist
Additional Context