学习记录
报错:Traceback (most recent call last):
File "train.py", line 256, in <module>
run()
File "train.py", line 234, in run
metrics_output = _evaluate(
File "/root/PyTorch-YOLOv3-master/test.py", line 116, in _evaluate
outputs = model(imgs)
File "/root/miniconda3/envs/bishe/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/PyTorch-YOLOv3-master/models.py", line 197, in forward
return yolo_outputs if self.training else torch.cat(yolo_outputs, 1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 85 but got size 6 for tensor number 2 in the list.
其实就是.cfg文件没改好
当需要识别的种类为1类时 .cfg文件[YOLO]要修改class=1,且紧挨着[YOLO]的上面那个[CONCOLUTION]卷积层要修改为18,三个[YOLO]都要改,我没改全。