-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Fix TensorRT --dynamic excess outputs bug #8869
Conversation
Potential fix for #8790
@democat3457 confirm fix for #8866. Can you please review this PR and see if this approach makes sense? |
I have a better solution, should I make a PR? Add this line: ...
self.context.set_binding_shape(self.model.get_binding_index('images'), img.shape)
self.bindings['images'] = self.bindings['images']._replace(shape=img.shape)
+ self.bindings['output'].data.resize_(tuple(self.context.get_binding_shape(self.model.get_binding_index('output'))))
... |
@democat3457 got it! I'll add your line and remove my fix. |
@democat3457 stupid question, is the previous line not modifying inplace? Does it need a reasignment like you have here? self.bindings['images'] = self.bindings['images']._replace(shape=im.shape) i.e. could this just be: self.bindings['images']._replace(shape=im.shape) |
@democat3457 how does this look? |
It does not modify in place, the underscore just stops it from getting mixed up with a possible field of the namedtuple. (Also, I looked - there doesn't exist an in-place replacement, sadly) |
Looks good to me! |
@democat3457 PR is merged. Thank you for your contributions to YOLOv5 π and Vision AI β |
* Fix TensorRT --dynamic excess outputs bug Potential fix for ultralytics#8790 * Cleanup * Update common.py * Update common.py * New fix
Potential fix for #8790
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Improved TensorRT dynamic input handling in YOLOv5 π
π Key Changes
dynamic_input
variable todynamic
to simplify naming.π― Purpose & Impact