gpt4 book ai didi

python - 将 xml 文件转换为 tfrecord 文件时出错

转载 作者:行者123 更新时间:2023-12-03 23:26:36 26 4
gpt4 key购买 nike

我正在 Macbook 上学习 TensorFlow 2 对象检测 API 教程
这是我在运行将 xmls 转换为 TFrecords 的给定脚本时得到的结果

Traceback (most recent call last):
File "generate_tfrecord.py", line 62, in <module>
label_map_dict = label_map_util.get_label_map_dict(label_map)
File "/usr/local/lib/python3.8/site-packages/object_detection/utils/label_map_util.py", line 164, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "/usr/local/lib/python3.8/site-packages/object_detection/utils/label_map_util.py", line 133, in load_labelmap
label_map_string = fid.read()
File "/usr/local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 116, in read
self._preread_check()
File "/usr/local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 78, in _preread_check
self._read_buf = _pywrap_file_io.BufferedInputStream(
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. tensorflow.python._pywrap_file_io.BufferedInputStream(arg0: str, arg1: int)

Invoked with: item {
name: "cat"
id: 1
}
, 524288
我的标签 map 文件包含以下内容
item {
id: 1
name: 'cat'
}

最佳答案

看来问题可以通过更换来解决

label_map = label_map_util.load_labelmap(args.labels_path)
label_map_dict = label_map_util.get_label_map_dict(label_map)
作为
label_map_dict = label_map_util.get_label_map_dict(args.labels_path)

关于python - 将 xml 文件转换为 tfrecord 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63763809/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com