代码本身在windows下正常运行,移动到linux环境下突然提示
/yolov3-9.0/utils/datasets.py", line 592, in load_image
assert img is not None, 'Image Not Found ' + path
AssertionError: Image Not Found data\kaist\images\train\
问题根源就是在linux下目录中'\'并不能被识别,只能被当做普通字符
解决办法:
在utils/datasets.py 587行将
path = self.img_files[index]
改为
path = self.img_files[index].replace('\\','/')
即可正常读取目录下图片
Linux环境下的图片读取问题:路径替换解决
本文介绍了在从Windows迁移到Linux环境时,由于路径分隔符的不同导致的图片加载错误。作者发现代码中使用了不被Linux识别的反斜杠,并提供了相应解决方案:用正斜杠替换所有反斜杠。通过这一改动,代码在Linux下可以正常读取图片。
1万+





