import tensorflow as tf
image = tf.gfile.FastGFile("./01.png",'r').read()
程序报错为:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x89 in position 0: invalid start byte
只需将‘r’改为’rb’即可
本文介绍了如何修复Python中使用TensorFlow读取文件时遇到的UnicodeDecodeError,只需将文件打开模式'r'修改为'rb'。
import tensorflow as tf
image = tf.gfile.FastGFile("./01.png",'r').read()
程序报错为:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x89 in position 0: invalid start byte
只需将‘r’改为’rb’即可
您可能感兴趣的与本文相关的镜像
TensorFlow-v2.15
TensorFlow 是由Google Brain 团队开发的开源机器学习框架,广泛应用于深度学习研究和生产环境。 它提供了一个灵活的平台,用于构建和训练各种机器学习模型
5931
4365
9128

被折叠的 条评论
为什么被折叠?