Getting error while running a classification code in keras

这一生的挚爱 提交于 2020-01-03 06:37:13

问题


When I run the code from the following link:

https://gist.github.com/fchollet/f35fbc80e066a49d65f1688a7e99f069#file-classifier_from_little_data_script_2-py

I get the following error:

Using TensorFlow backend. Found 2000 images belonging to 2 classes. /home/nd/anaconda3/lib/python3.6/site-packages/PIL/TiffImagePlugin.py:692: UserWarning: Possibly corrupt EXIF data. Expecting to read 80000 bytes but only got 0. Skipping tag 64640 "Skipping tag %s" % (size, len(data), tag))

I am Using Ubuntu.

Tried Solution : change 'w' to 'wb' in line 70 and 81.

Thnx in advance


回答1:


This is because some of the images have corrupted exif info. You can just remove the exif info of all your images to remove this warning.

The python package piexif can help you. you can use the following code to remove the exif info of an image:

import piexif
# suppose im_path is a valid image path
piexif.remove(im_path)

You can find more discussion here.




回答2:


The error seems to imply that you try to use TIFF images (rather than JPEGs) and that the PIL library can´t import these without an error (Possibly corrupt EXIF data).

I suggest you try some test JPEGs to make sure your images can be imported correctly.



来源:https://stackoverflow.com/questions/45452783/getting-error-while-running-a-classification-code-in-keras

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!