fix vehicle attr doc (#2096)

This commit is contained in:
littletomatodonkey 2022-06-23 15:40:00 +08:00 committed by GitHub
parent 1fe19cb701
commit 46ec76eb06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,7 +178,7 @@ from xml.dom.minidom import parse
vehicleids = []
def convert_annotation(input_fp, output_fp):
def convert_annotation(input_fp, output_fp, subdir):
in_file = open(input_fp)
list_file = open(output_fp, 'w')
tree = parse(in_file)
@ -201,12 +201,12 @@ def convert_annotation(input_fp, output_fp):
typeid = int (item.getAttribute("typeID"))
label[typeid+9] = '1'
label = ','.join(label)
list_file.write(os.path.join('image_train', name) + "\t" + label + "\n")
list_file.write(os.path.join(subdir, name) + "\t" + label + "\n")
list_file.close()
convert_annotation('train_label.xml', 'train_list.txt') #imagename vehiclenum colorid typeid
convert_annotation('test_label.xml', 'test_list.txt')
convert_annotation('train_label.xml', 'train_list.txt', 'image_train') #imagename vehiclenum colorid typeid
convert_annotation('test_label.xml', 'test_list.txt', 'image_test')
```
执行上述命令后,`VeRi`目录中具有以下数据: