OSError: cannot identify image file 三种解决方法

OSError: cannot identify image file 三种解决方法

img = Image.open(img_path)

在进行分类数据集制作,将图片数据集转换为tfrecords格式时,遇到如标题所示的错误语句提示,主要有三种方法可解决。

  • import Image 改成 from PIL import Image
  • 修改PIL版本,改成最新版也不一定合适,试一试 pip install Pillow==3.2.0
  • 可以利用try…except…语句,使运行时跳过那张图片
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/crist_meng/article/details/123048870