zl程序教程

您现在的位置是:首页 >  后端

当前栏目

vehicle_counting_tensorflow源码分析——加载label map

Map源码 分析 加载 Tensorflow Label Counting
2023-09-11 14:17:00 时间
label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
"""
PATH_TO_LABELS是文件路径。其中文件格式为
item {
  name: "/m/01g317"
  id: 1
  display_name: "person"
}...
label_map也是一样的格式

"""
categories = label_map_util.convert_label_map_to_categories(label_map,
        max_num_classes=NUM_CLASSES, use_display_name=True)
"""
categories的值为:[{'id': 1, 'name': 'person'},..., {'id': 90, 'name': 'toothbrush'}]
max_num_classes为标签总数
"""
category_index = label_map_util.create_category_index(categories)
"""
category_index的值为{1: {'id': 1, 'name': 'person'}, ..., 90: {'id': 90, 'name': 'toothbrush'}}
"""