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

Resolve YoloV5 Version Error #37

Closed
wants to merge 1 commit into from
Closed

Conversation

bpleahey
Copy link

It seems like the line here would make a call to an uncaught exception in the current version of YoloV5 (this was fixed in a recent patch). The exception read: AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'. This solution fixed it, by manually ensuring the blank dict in the stack trace below was not passed.

The stack trace is as follows:

Traceback (most recent call last):
File "/content/SuperYOLO/test.py", line 139, in test
out, train_out = model(img,ir,input_mode=input_mode) #zjq inference and training outputs
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/content/SuperYOLO/models/SRyolo.py", line 196, in forward
y,features = self.forward_once(steam,'yolo', profile) #zjq
File "/content/SuperYOLO/models/SRyolo.py", line 232, in forward_once
x = m(x) # run
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/upsampling.py", line 154, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1185, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/content/SuperYOLO/test.py", line 376, in
test(opt.data,
File "/content/SuperYOLO/test.py", line 141, in test
out, train_out,_ = model(img,ir,input_mode=input_mode) #zjq inference and training outputs
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/content/SuperYOLO/models/SRyolo.py", line 196, in forward
y,features = self.forward_once(steam,'yolo', profile) #zjq
File "/content/SuperYOLO/models/SRyolo.py", line 232, in forward_once
x = m(x) # run
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/upsampling.py", line 154, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1185, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

It seems like the line here would make a call to an uncaught exception in the current version of YoloV5 (this was fixed in a recent patch). The exception read: AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'. This solution fixed it, by manually ensuring the blank dict in the stack trace below was not passed.
@bpleahey
Copy link
Author

Other fixes exist here:

ultralytics/yolov5#6948

I just wanted to make sure you were aware some users may be facing this problem.

@icey-zhang icey-zhang closed this Jun 8, 2024
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