打包时:KeyError: 'face'
来源:6-21 TensorFlow-ssd 模型训练-实操(1)

李嘉图是个Shaby诶
2020-02-10
麻烦老师帮忙看下
D:\0-STUDY\models\research>python object_detection\dataset_tools\create_face_tf_record.py \
--data_dir=D:/0-STUDY \
--year=widerface \
--output_path=D:\0-STUDY\datasets\widerface\TF_data\train.record \
--set=train
这里路径绝对路劲和相对路径都用了,斜杆和正斜杆也用过了不是路径问题
输出:
2020-02-10 12:15:56.228347: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
WARNING:tensorflow:From object_detection\dataset_tools\create_face_tf_record.py:184: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.
WARNING:tensorflow:From object_detection\dataset_tools\create_face_tf_record.py:158: The name tf.python_io.TFRecordWriter is deprecated. Please use tf.io.TFRecordWriter instead.
W0210 12:15:58.775146 18236 module_wrapper.py:139] From object_detection\dataset_tools\create_face_tf_record.py:158: The name tf.python_io.TFRecordWriter is deprecated. Please use tf.io.TFRecordWriter instead.
WARNING:tensorflow:From D:\0-STUDY\models\research\object_detection\utils\label_map_util.py:138: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.
W0210 12:15:58.776178 18236 module_wrapper.py:139] From D:\0-STUDY\models\research\object_detection\utils\label_map_util.py:138: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.
I0210 12:15:58.779169 18236 create_face_tf_record.py:163] Reading from PASCAL widerface dataset.
I0210 12:15:58.820035 18236 create_face_tf_record.py:170] On image 0 of 12880
D:\0-STUDY\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 184, in <module>
tf.app.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\ProgramData\Anaconda3\lib\site-packages\absl\app.py", line 299, in run
_run_main(main, args)
File "C:\ProgramData\Anaconda3\lib\site-packages\absl\app.py", line 250, in _run_main
sys.exit(main(argv))
File "object_detection\dataset_tools\create_face_tf_record.py", line 177, in main
tf_example = dict_to_tf_example(data, FLAGS.data_dir, label_map_dict,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'
目录结构:
-> $ tree -L 2
.
├── datasets
│ └── widerface
├── models
│ ├── AUTHORS
│ ├── CODEOWNERS
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE.md
│ ├── LICENSE
│ ├── README.md
│ ├── WORKSPACE
│ ├── models.zip
│ ├── official
│ ├── research
│ ├── samples
│ ├── tutorials
│ └── widerface
└── widerface
├── Annotations
├── ImageSets
├── JPEGImages
├── WIDER_test
├── WIDER_train
├── WIDER_val
└── wider_face_split
写回答
3回答
-
会写代码的好厨师
2020-03-22
看这个问题时Key error。可以看一下类别定义的文件,是不是类别中没有face这个类别。
https://github.com/tensorflow/models/blob/master/research/object_detection/data/face_label_map.pbtxt
00 -
慕哥3369061
2020-03-21
我也遇到这种问题了,请问你解决了吗?求教
00 -
李嘉图是个Shaby诶
提问者
2020-02-13
emmm
在Linux环境下问题解决我吐了。。。。
00
相似问题