在keras中运行分类代码时出错 [英] Getting error while running a classification code in keras

查看:558
本文介绍了在keras中运行分类代码时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从以下链接运行代码时:

When I run the code from the following link:

https://gist.github.com/fchollet/f35fbc80e066a7a066d7f -classifier_from_little_data_script_2-py

我收到以下错误:

使用TensorFlow后端.找到属于2类的2000张图像. /home/nd/anaconda3/lib/python3.6/site-packages/PIL/TiffImagePlugin.py:692: 用户警告:可能损坏了EXIF数据.预计读取80000字节 但只有0.正在跳过标签64640正在跳过标签%s"%(大小, len(data),tag))

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))

我正在使用Ubuntu.

I am Using Ubuntu.

尝试的解决方案:在第70和81行中将"w"更改为"wb".

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

事先感谢

推荐答案

这是因为某些图像损坏了exif信息.您只需删除所有图像的exif信息即可删除此警告.

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.

python软件包 piexif 可以为您提供帮助.您可以使用以下代码删除图像的exif信息:

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)

您可以在此处.

这篇关于在keras中运行分类代码时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆