label_name_to_value = {
'_background_': 0} #把这一段注释掉
for shape in sorted(data['shapes'], key=lambda x: x['label']):
label_name = shape['label']
if label_name in label_name_to_value:
label_value = label_name_to_value[label_name]
else:
label_value = len(label_name_to_value)
label_name_to_value[label_name] = label_value
修改如下:
label_name_to_value = {
'unlabeled': 0,
'road': 1,
'sidewalk': 2}
全部程序如图所示 (D:\Anaconda3\envs\labelme\Lib\site-packages\labelme\cli):
import argparse
import base64
i