SuperYOLO icon indicating copy to clipboard operation
SuperYOLO copied to clipboard

Resolve YoloV5 Version Error

Open bpleahey opened this issue 1 year ago • 1 comments

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'

bpleahey avatar Jun 28 '23 15:06 bpleahey

Other fixes exist here:

https://github.com/ultralytics/yolov5/issues/6948

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

bpleahey avatar Jun 28 '23 15:06 bpleahey