Open VYRION-Ai opened 2 years ago
I found this post by programmerah which solved this attribute error.
But now i get another error when I use custom weights:
Namespace(agnostic_nms=False, api_key=None, augment=False, cfg='yolov4.cfg', 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='./data/video/cars.mp4', thickness=3, update=False, url=None, view_img=False, weights=['trial_best.pt'])
Fusing layers...
Using torch 1.10.0+cu111 CUDA:0 (Tesla K80, 11441.1875MB)
/usr/local/lib/python3.7/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Traceback (most recent call last):
File "clip_object_tracker.py", line 360, in <module>
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 1102, 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 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/content/zero-shot-object-tracking/models/yolo.py", line 58, in forward
y[..., 2:4] = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i] # wh
RuntimeError: The size of tensor a (80) must match the size of tensor b (84) at non-singleton dimension 3
Hi,
Addressing issues #21 and #15.
So I think updating some of the file content with the latest yolov5 repo will solve the problem.
Please see my branch for a fix.
I have tested it in the following notebook, where I commented out the
!git clone https://github.com/roboflow-ai/zero-shot-object-tracking
and replaced it with my version of the repo instead:
!git clone -b fix-custom-weights https://github.com/ikitcheng/zero-shot-object-tracking.git
.
To run zeroshot object tracking with custom weights:
!python clip_object_tracker.py --source ./data/video/cars.mp4 --detection-engine yolov5 --weights custom_weights.pt
Please let me know if it works.
Thanks
Hi @ikitcheng
I couldn't see the results being saved at all. Even though the runs are complete, it's a blank folder under exp. Could you tell me what might be going wrong?
i got this error when i run your colab