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

AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor' #24

Open
ghost opened this issue Jun 23, 2022 · 3 comments
Open

Comments

@ghost
Copy link

ghost commented Jun 23, 2022

Namespace(agnostic_nms=False, api_key=None, augment=False, cfg='/content/zero-shot-object-tracking/models/yolov5s.yaml', classes=None, confidence=0.4, detection_engine='yolov5', device='', exist_ok=False, img_size=640, info=False, max_cosine_distance=0.4, name='exp', names='coco.names', nms_max_overlap=1.0, nn_budget=None, overlap=0.3, project='runs/detect', save_conf=False, save_txt=False, source='/content/zero-shot-object-tracking/example/video/fish.mp4', thickness=3, update=False, url=None, view_img=False, weights='yolov5s.pt')
Fusing layers...
Using torch 1.11.0+cu113 CUDA:0 (Tesla T4, 15109.75MB)

Traceback (most recent call last):
File "clip_object_tracker.py", line 360, in
detect()
File "clip_object_tracker.py", line 141, in detect
_ = yolov5_engine.infer(img.half() if half else img) if device.type != 'cpu' else None # run once
File "/content/zero-shot-object-tracking/utils/yolov5.py", line 16, in infer
pred = self.model(img, augment=self.augment)[0]
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/content/zero-shot-object-tracking/models/yolo.py", line 123, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "/content/zero-shot-object-tracking/models/yolo.py", line 139, in forward_once
x = m(x) # run
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/upsampling.py", line 154, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1186, in getattr
type(self).name, name))
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

@learninguser
Copy link

learninguser commented Jun 24, 2022

Hi @hammadyounas2008,

This error has occurred because of the latest version of Pytorch that you're using.

But this repo is created and supports yolov5 with the following commit hash: 886f1c03d839575afecb059accf74296fad395b6

The following version of pytorch and its dependancies will solve the issue:
!pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

@noctilucas1
Copy link

Nice @learninguser!

It works for me. Thank you!

@AmartyaCSB
Copy link

@learninguser @noctilucas1
I am having a similar issue. Did you encounter this?
Can't get attribute 'DetectionModel' on <module 'models.yolo' from '/content/zero-shot-object-tracking/models/yolo.py'>

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

No branches or pull requests

3 participants