TensorFlow讀取圖片時發生錯誤,報錯信息:‘utf-8’ codec can’t decode byte 0x89 in position 0: invalid start byte
在用TensorFlow讀取圖片文件時發生以上報錯,讀取方式
image=tf.gfile.FastGFile('D:\AITFPy\Picture\duck.png','r').read()
- 原因及解決方法:utf-8編碼格式原因。把上述代碼的‘r’修改爲‘rb’即可。即.
image=tf.gfile.FastGFile('D:\AITFPy\Picture\duck.png','rb').read()