import shutil
import os
#input file path
input_file_path = 'E:/AI/安全帽检测/helmet_work_clothes/helmet'
#output file path
output_file_path = 'E:/AI/安全帽检测/helmet_work_clothes/all/'
file_list = os.listdir(input_file_path)
#annotations 文件夹的生成
for files in file_list:
annotations_path = os.path.join(input_file_path,files)
# print(annotations_path)
annotations_path = os.path.join(annotations_path, 'Annotations')
annotations_list_ann = os.listdir(annotations_path)
# print(annotations_list_ann)
for file in annotations_list_ann:
filename1 = os.path.splitext(file)[1] # 读取文件后缀名
filename0 = os.path.splitext(file)[0] # 读取文件名
# print(filename1)
m = filename1 == '.xml'
# print(m)
if m:
full_path = os.path.join(annotations_path, file)
ann_output_path = os.path.join(output_file_path, 'Annotations
目标检测中关于多组标注数据的合并,包括Annotations、JPEGImages、ImageSets三个文件夹
最新推荐文章于 2025-04-03 16:30:43 发布