i followed the steps in the yolov5m tutorial retraining model. I also adjusted numclass (nc) = 7 in data.yaml and yolov5m.yaml (I use same dataset in tutorial video). I also use the same command, but there still some error :
1.
UserWarning: This overload of nonzero is deprecated:
nonzero()
Consider using one of the following signatures instead:
nonzero(*, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1607370172916/work/torch/csrc/utils/python_arg_parser.cpp:882.)
i, j = (x[:, 5:] > conf_thres).nonzero().t()
=> fixed : i, j = (x[:, 5:] > conf_thres).nonzero().t()
→ i, j = (x[:, 5:] > conf_thres).nonzero(as_tuple=True)
note : after this error , there will appear some same error about ‘nonzero’, still fix like above.
File “train.py”, line 340, in train
results, maps, times = test.test(opt.data,
File “/workspace/yolov5/test.py”, line 164, in test
correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn
File “/opt/conda/lib/python3.8/site-packages/torch/tensor.py”, line 27, in wrapped
return f(*args, **kwargs)
RuntimeError: The size of tensor a (0) must match the size of tensor b (10) at non-singleton dimension 0
=> fixed : correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn
→ correct[pi[j]] = (ious[j].unsqueeze(-1) > iouv).all()
3.
File “train.py”, line 340, in train
results, maps, times = test.test(opt.data,
File “/workspace/yolov5/test.py”, line 162, in test
if d not in detected:
File “/opt/conda/lib/python3.8/site-packages/torch/tensor.py”, line 27, in wrapped
return f(*args, **kwargs)
RuntimeError: The size of tensor a (0) must match the size of tensor b (12) at non-singleton dimension 0
I can’t fix this. Pls help me…