roboflow / zero-shot-object-tracking

Object tracking implemented with the Roboflow Inference API, DeepSort, and OpenAI CLIP.
https://blog.roboflow.com/zero-shot-object-tracking/
GNU General Public License v3.0
357 stars 62 forks source link

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

Open ghost opened 2 years ago

ghost commented 2 years ago

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_objecttracker.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 commented 2 years ago

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 commented 2 years ago

Nice @learninguser!

It works for me. Thank you!

AmartyaCSB commented 1 year ago

@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'>