KeyError: 'face'

来源:6-21 TensorFlow-ssd 模型训练-实操(1)

N1ghtV0yager

2021-01-08

有face还是报错
/home/chlts/models/research/object_detection/utils/dataset_util.py:79: FutureWarning: The behavior of this method will change in future versions. Use specific ‘len(elem)’ or ‘elem is not None’ test instead.
if not xml:
Traceback (most recent call last):
File “object_detection/dataset_tools/create_face_tf_record.py”, line 185, in
tf.app.run()
File “/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py”, line 125, in run
_sys.exit(main(argv))
File “object_detection/dataset_tools/create_face_tf_record.py”, line 178, in main
FLAGS.ignore_difficult_instances)
File “object_detection/dataset_tools/create_face_tf_record.py”, line 120, in dict_to_tf_example
classes.append(label_map_dict[obj[‘name’]])
KeyError: ‘face’

master/research/object_detection/data/face_label_map.pbtxt :

item {
  name: 'face'
  id: 1
  display_name: 'face'
}
写回答

4回答

慕田峪7505890

2021-12-03

你们应该是没改这里

flags.DEFINE_string('label_map_path', '../data/face_label_map.pbtxt',                    'Path to label map proto')

而是用了保留了原文件中的通用物体检测的文件

1
0

会写代码的好厨师

2021-12-14

master/research/object_detection/data/face_label_map.pbtxt
注意这个文件,需要和数据打包时候定义的类别保持对齐

0
0

幕布斯0585347

2021-05-01

我也遇到这个问题,请问解决了吗


0
0

会写代码的好厨师

2021-01-23

'face' --》 用了中文字符?

0
0

Python3+TensorFlow打造人脸识别智能小程序

理论与实战项目双管齐下,让AI技术真正落地应用,适合毕设展示。

1090 学习 · 538 问题

查看课程