Type Tensor doesn't define __round__ method
doneisdone36 opened this issue · 6 comments
Search before asking
- I have searched the Yolov7_StrongSORT_OSNet issues and discussions and found no similar questions.
Yolov7_StrongSORT_OSNet Component
No response
Bug
Hello, I found an error when run your code, the error log is:
File " Yolov7_StrongSORT_OSNet/yolov7/utils/track.py", line 149, in run
for frame_idx, (path, im, im0s, vid_cap) in enumerate(dataset):
File Yolov7_StrongSORT_OSNet/yolov7/utils/datasets.py", line 189, in next
img = letterbox(img0, self.img_size, stride=self.stride)[0]
File "Yolov7_StrongSORT_OSNet/yolov7/utils/datasets.py", line 1009, in letterbox
top, bottom = int(round(dh - 0.1)), int(round(dh + 0.1))
TypeError: type Tensor doesn't define round method
I change top, bottom = int(torch.round(dh - 0.1)), int(torch.round(dh + 0.1)), it can run
but "Yolov7_StrongSORT_OSNet/track.py" line 207 in run
s += f"{n} {names[int(c)]}{'s' * (n > 1)}
IndexError: list index out of range
do you know how to solve this happen? Thanks for update!!!
Environment
- YOLO v7 : yolov7 @ 60978d6 torch 1.10.1, CUDA = 0
- Strong_SORT : resnet50_fc512_msmt17
- OS : MAC (ventura) Intel Core i9( 4.8GHz Turbo Boost, 16MB )
- Python : 3.9.15
Minimal Reproducible Example
No response
It happens to me as well while the yolov7 repo was on master i.e. bce62c4. But in the case I checkout to 60978d6 it works just fine. So give it the try...
Thanks!! I solved this problem
dh -> float(dh)
dw -> float(dw)
Thanks!! I solved this problem dh -> float(dh) dw -> float(dw)
Have you created PR?
I haven't done it yet
This should be fixed in master now. Could somebody try it out and report back here?
Thanks for the update. Hope I can verify it in the following days. In that case, I would report back here.