python - UnicodeDecodeError:“utf-8”编解码器无法解码位置 71 中的字节 0xcd:无效的继续字节
问题描述
错误:
Traceback (most recent call last):
File "C:\Users\Lenovo\Emergency-Vehicle-Detection-using-Image-Processing\objectdetection1.py", line 59, in <module>
serialized_graph = fid.read()
File "C:\Python39\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 117, in read
self._preread_check()
File "C:\Python39\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 79, in _preread_check
self._read_buf = _pywrap_file_io.BufferedInputStream(
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 71: invalid continuation byte
# Load the Tensorflow model into memory.
代码:
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.compat.v1.GraphDef()
with tf.compat.v1.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name ='')
解决方案
推荐阅读
- c# - AddJwtBearer + AddAzureADBearer 不一起工作
- powershell - 将一行cmd转换为powershell
- javascript - 使用谷歌图表旋转时将 3d 饼图转换为 2d 饼图
- javascript - jQuery缩放功能不适用于悬停图像
- sql - 带有左外连接的 Postgresql COUNT() 值不正确
- node.js - 我尝试在猫鼬中使用 Populate 但它没有用
- javascript - Vue JS中复选框的适当两种方式绑定
- python - 即使已安装,导入 matplotlib 也会出错
- powershell - 用于检查多语言 URL 重定向的 PowerShell
- caching - 唯一 ID 的缓存解决方案