1.代码来自:https://github.com/eriklindernoren/PyTorch-YOLOv3;
2.主要原因是yolov3输出三个分支,voc类别只有20类,因为只改动了一个分支,所以出现最后三个分支的输出张量因为维度不对,而导致无法拼接;
3.解决方法:在yolov3.cfg中更改配置,共有三处:
第一处:yolov3训练voc数据集报错RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1.
第二处:yolov3训练voc数据集报错RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1.
第三处:yolov3训练voc数据集报错RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1.

以上三处改动地方都一样,convolutional中filters=75(原来filters=255),因为VOC类别为20类,则(20+5)*3=75,coco数据集为80类,则(80+5)*3=255;
接着,在yolo中把类别classes=20(原来classes=80);

修改完就可以解决这类报错问题,欢迎指正!

相关文章:

  • 2021-08-09
  • 2022-12-23
  • 2021-04-03
  • 2021-06-22
  • 2021-10-25
  • 2021-11-10
  • 2021-12-28
  • 2021-07-25
猜你喜欢
  • 2021-08-12
  • 2022-12-23
  • 2021-08-10
  • 2021-10-26
  • 2022-12-23
  • 2021-07-29
相关资源
相似解决方案