Getting error while running a classification code

2019-06-14 15:26发布

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

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-06-14 16:01

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.

查看更多
3楼-- · 2019-06-14 16:17

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.

查看更多
登录 后发表回答