当我运行时会报一些错误,首先采用下面两个链接的方式解决,亲测有效,这里进行一个汇总。
当遇到:AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ... 问题时
看此链接:
作者是:
当遇到:YOLOV5 | AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘ 问题时
作者是:
最后如果遇到 RuntimeError: The size of tensor a (60) must match the size of tensor b (56) at non-singleton dimension 3 这个问题应该是训练版本不一致的原因,因为有的人在官网可能找不到对应的版本,所以我将yolov5s.pt放在我的百度网盘上,链接如下:https://pan.baidu.com/s/1dpD7vldIdfBBdNkDq99BfQ?pwd=8mf0
提取码:8mf0
将此文件下载后放在:
运行后的结果在:
若需要在本地自己训练则需要下载coco128.zip,然后解压。https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
若运行时自动下载失败则推荐使用迅雷下载,然后将解压后的文件放在yolov5文件夹的上一级(此处我是根据系统提示放置的,你们的可能会不同)
此时点开train.py文件,可能在运行时会报 RuntimeError: result type Float can‘t be cast to the desired output type long int 的错。
看此链接:
作者是: