YOLOV5报错和解决办法合集
一、报错:AttributeError: ‘Hardswish‘ object has no attribute ‘inplace‘
解决方法:定位到错误的那一行,把其中的self.inplace删掉即可。例:

改成:

二、报错问题— 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)),重新运行代码即可

三、报错:RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place
解决方法:
在model/yolo.py文件

添加with torch.no_grad():如下
