1.出现警告问题
/home/flyingbird/.conda/envs/pytorch-0.4/lib/python3.6/site-packages/PIL/TiffImagePlugin.py:786: UserWarning: Possibly corrupt EXIF data. Expecting to read 131072 bytes but only got 13120. Skipping tag 60219
" Skipping tag %s" % (size, len(data), tag)
-
原因
可能是图片读取时,对应的EXIF异常,检查确认图片格式,或者删除图片 -
解决方法:
import warnings
warnings.filterwarnings('ignore')
2.出现中断问题
IOError: image file is truncated (5 bytes not processed)
-
原因
可能是PIL根据文本读取训练图片时,图片已经损坏或者格式问题导致; -
解决方法:
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
本文详细介绍了在使用Python的PIL库处理图片时,遇到的警告与中断问题及其解决方案。包括忽略EXIF数据异常警告和处理截断图片错误的方法。
1953

被折叠的 条评论
为什么被折叠?



