duongcongnha / Vehicle-tracking

Vehicle tracking yolov5 + deepsort
187 stars 51 forks source link

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

Open MyraBaba opened 2 years ago

MyraBaba commented 2 years ago

@duongcongnha
I have below error :

Python 3.8.5 (default, Jul 28 2020, 12:59:40)

python app_track.py Loading weights from ../../models/ckpt.t7... Done! Loading weights from ../../models/ckpt.t7... Done! YOLOv5 🚀 2bfaa90 torch 1.12.0+cu102 CUDA:0 (GeForce RTX 2080 Ti, 11018MiB)

YOLOv5 🚀 2bfaa90 torch 1.12.0+cu102 CUDA:0 (GeForce RTX 2080 Ti, 11018MiB)

Fusing layers... Model Summary: 213 layers, 7225885 parameters, 0 gradients Traceback (most recent call last): File "app_track.py", line 26, in tracker.detect() File "/home/alp2080/Projects/Vehicle-tracking/application/main/infrastructure/handlers/track.py", line 139, in detect model(torch.zeros(1, 3, imgsz).to(device).type_as(next(model.model.parameters()))) # warmup File "/home/alp2080/Projects/Vehicle-tracking/venv_VehicleTrack/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "/home/alp2080/Projects/Vehicle-tracking/application/main/infrastructure/yolov5/models/common.py", line 381, in forward y = self.model(im) if self.jit else self.model(im, augment=augment, visualize=visualize) File "/home/alp2080/Projects/Vehicle-tracking/venv_VehicleTrack/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "/home/alp2080/Projects/Vehicle-tracking/application/main/infrastructure/yolov5/models/yolo.py", line 126, in forward return self._forward_once(x, profile, visualize) # single-scale inference, train File "/home/alp2080/Projects/Vehicle-tracking/application/main/infrastructure/yolov5/models/yolo.py", line 149, in _forward_once x = m(x) # run File "/home/alp2080/Projects/Vehicle-tracking/venv_VehicleTrack/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "/home/alp2080/Projects/Vehicle-tracking/venv_VehicleTrack/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 154, in forward recompute_scale_factor=self.recompute_scale_factor) File "/home/alp2080/Projects/Vehicle-tracking/venv_VehicleTrack/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

WuckerSama commented 2 years ago

I found the solution for now which was downgrading the pytorch to 1.9.0 version. It worked for me so if anyone else struggling with that i hope it helps you as well.