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…语句,使运行时跳过那张图片