由于出现问题我是边改边调试的所以现在就大概记录一下。
问题1:
YOLOv5 IndexError: index 2 is out of bounds for dimension 1 with size 2
使用自己标记的数据集,在网上找了许多解决方式都不行,可以试试这一个
找到问题图片并删除,这是我的一个解决办法
运行detect.py又出现问题
detect.py参数设置
--source ./inference/images/ --weights yolov5s.pt --conf 0.4
1:AttributeError: ‘Hardswish‘ object has no attribute ‘inplace‘
定位到错的位置
修改代码
return F.hardswish(input)
2:报错:AttributeError: ‘Upsample’ object has no attribute ‘recompute_scale_factor’
原代码
修改为
修改代码
return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)