运行yolov5 train.py报错:AssertionError: Image Not Found ../data/images/xxx.png

运行环境

    一开始在笔记本上用显卡跑训练是可以正常运行的,后来随着数据量越来越大,笔记本显卡显存不够用了,改用学校的浪潮服务器来跑,但出现了报错。

报错详情

    当时报错时忘记截图了,这里就大概描述一下报错发生的位置和内容。报错发生在终端输出接下来这句之后。

Optimizer groups: 62 .bias, 62 conv.weight, 59 other
train: Scanning 'data/train.cache' images and labels... 2590 found, 0 missing, 335 empty, 0 corrupted: 100%|##########| 2590/2590 [00:00<?, ?it/s]

    在走完上面这个进度条之后就会出现如标题所示的报错。我这个项目在本地是可以跑通的,只是如果不减小batch-size会之后因为显存不足报错,可见图片训练集的位置没有问题,不会引起报错。

解决方案

    在国内搜索引擎上似乎没有找到相关解决方案,在谷歌后在yolov5 github的issues里找到了可能的解决方案,链接在本文底部。其中有一位评论

I've opened PR #2042 to fix this issue. This runs an additional check on the actual image format using PIL img.format. For this check to actually run you'd need to delete your existing *.cache files in your dataset directories, which will trigger a new caching.

Verified update works correctly. I added a GIF to COCO128 and renamed it with a .jpg extension. The new check caught the file, removed it from the training images, and then trains correctly.

    考虑到报错的位置本应该是要加载'data/val.cache'的,可能是这位提到的cache的问题,我试着将之前在本机训练生成的.cache文件删除,重新在服务器运行train.py,顺利运行,开始训练。



    如图,删除train.cache和val.cache后再重新在服务器上运行即可。

参考

https://github.com/ultralytics/yolov5/issues/195

最新文章

  1. C#自定义控件属性显示在属性面板中操作
  2. 游戏 gui button
  3. BZOJ2738: 矩阵乘法
  4. jxl 导入excel以及日期格式处理
  5. IOS 第三方开源库记录
  6. position containing block原点
  7. Cocos3.0测试版发布(中文)
  8. flume 以 kafka 为channel 的配置
  9. 【IE6的疯狂之四】IE6文字溢出BUG
  10. Unity相对于Cocos2d-x的比较
  11. 全面理解 javascript 的 argements caller callee call apply 之caller
  12. [模板]快速傅里叶变换(FFT)
  13. nginx反向代理proxy_pass的问题
  14. mysql报错:/usr/sbin/mysqld:unknown variable &#39;default-character-set=utf8&#39;
  15. 分享一个DataTable转List强类型的类库
  16. java_Proxy动态代理_AOP
  17. Eclipse 中安装Browse Deployment Location插件
  18. ural 2020 Traffic Jam in Flower Town(模拟)
  19. Redis学习记录(三)
  20. Ubuntu 12.04源

热门文章

  1. 查看linux系统是多少位,使用 getconf LONG_BIT
  2. BRAM 和 DRAM 区别
  3. 绿色版 notepad++ 添加鼠标右键菜单
  4. SSM整合(ForestBlog为例)
  5. readlink 函数用法 -(转自 JK198310的专栏)
  6. Java反射机制详情(2)
  7. 删除win10系统下文件默认打开方式的关联-win10配置
  8. 五:.net core(.NET 6)使用Autofac实现依赖注入
  9. 回顾Servlet
  10. leetcode中Java关于Json处理的依赖