YOLOv5、YOLOv6、YOLOv7、YOLOv8——训练过程警告

问题一

运行程序,遇到出现以下警告:

…pytorchlibsite-packages orchfunctional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:actions-runner_workpytorchpytorchuilderwindowspytorchatensrcATen ativeTensorShape.cpp:2895.)

不啦不啦一长串,就是functional.py的问题,虽然警告不影响程序,但是看着难受!!!

解决方法:

点击报错处,跳转到代码functional.py,找到错误处478行,加上indexing=ij即可,如下图所示:

PS:这个函数,有点魔鬼,有时候换个torch版本,又没问题了。如果之前按照上面改了,那就把indexing=ij再给删掉就行,看你报错了,会提示的。

问题二

运行程序,报错以下错误:

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte

然后参考资料,说是编码格式utf-8的问题,可是已经设置过是utf-8了,还是报错。

解决方法: 读取文件的问题,一般都是。 按照给的报错,找到错误那段,有时候比较难找,实在找不到,就找报错程序里,看哪部分有以下代码:

with open(file) as f:

就是它,没跑了,把它改成:

with open(file, ‘r’, encoding=‘utf-8’) as f:

即可解决,over。

问题三

YOLOv6训练时,报以下错误:

AttributeError: module ‘distutils’ has no attribute ‘version’.

解决方法 一般都是因为setuptools版本太高,先 pip uninstall setuptools 卸载,再 pip install setuptools==59.5.0 (60以上包括60版本都不行,还是直接安装这个版本吧)

经验分享 程序员 微信小程序 职场和发展