机器学习之猫狗大战,解决image RGB values must be in the 0..1 range.

 猫狗大战是比较经典的机器学习案例,前几天体验了一番,来记录一下

1.图片准备

首先是准备训练的图片

链接:https://pan.baidu.com/s/1ht1HIuw 密码:aw9s

 

 

 

2.开始训练

需要的时间可能比较长

 

 

 

注:可能出现image RGB values must be in the 0..1 range.的错误

可以尝试修改下面的代码,将img[j,:,:,:]数组的值调到0到1之间,

0.1 * old_img + 0.5 对图片显示影响较小,不过可能会偏移;

0.2 * abs(old_img)对图片位置影响较小,不过可能显示会失真。

可参考:https://stackoverflow.com/questions/47318871/valueerror-floating-point-image-rgb-values-must-be-in-the-0-1-range-while-usi

 

 

3.测试训练

再找几张猫狗图片进行测试

test.py

 

 

参考:

TensorFlow——训练自己的数据(一)数据处理:http://blog.csdn.net/xinyu3307/article/details/74643019
TensorFlow——训练自己的数据(二)模型设计:http://blog.csdn.net/xinyu3307/article/details/74943033
TensorFlow——训练自己的数据(三)模型训练:http://blog.csdn.net/xinyu3307/article/details/74979842
TensorFlow——训练自己的数据(四)模型测试:http://blog.csdn.net/xinyu3307/article/details/75008458

用自己的图片数据做tensorflow深度学习:http://blog.csdn.net/baidu_23263735/article/details/74177831
github地址:https://github.com/kevin28520/My-TensorFlow-tutorials/tree/master/01%20cats%20vs%20dogs

posted @ 2018-02-27 08:46  程序生(Codey)  阅读(3542)  评论(0编辑  收藏  举报