一、报错:AttributeError: ‘Hardswish‘ object has no attribute ‘inplace‘
解决方法:定位到错误的那一行,把其中的self.inplace删掉即可。例:
![](https://img-blog.csdnimg.cn/img_convert/af801419f35c1a7ad601ddeaff3366dd.png)
改成:
![](https://img-blog.csdnimg.cn/img_convert/f2ae47399f2624d011d4331dec7385e0.png)
二、报错问题— assert img0 is not None, ‘Image Not Found ‘ + pathAssertionError: Image Not Found
解决方法:
将utils/datasets.py文件中的
p = str(Path(path).absolute()) # os-agnostic absolute path
改为
p = str(Path(path)),重新运行代码即可
![](https://img-blog.csdnimg.cn/img_convert/d43ff8b3c31b4b6fddcc5fbd076d9e06.png)
三、报错:RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place
解决方法:
在model/yolo.py文件
![](https://img-blog.csdnimg.cn/img_convert/4b59f2471e7e5ca81a811b32f98a85e6.png)
添加with torch.no_grad():如下
![](https://img-blog.csdnimg.cn/img_convert/3f544348fee3f9e4ec056f690ba8a1f3.png)