first commit

This commit is contained in:
hatcher committed 2026-07-17 18:55:31 +08:00
1 parent ae53e9eac5
commit 91cbd01126
514 files changed
+55625 -2203

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
'''
author : Hatcher W
Email: hcwang@semi.ac.cn
use: 用于根据VOC的images中train和test的图像文件分成annotation 的xml文件,将Annotation分开放到Anno_train,Anno_val中,
input:images/train ,test 图像文件路径
output:COCO/Anno_train and COCO/Anno_val
'''
import os,shutil
from tqdm import tqdm
rootPath = "/data4/Hatcher/smallobject/voc_class/CDB_vehicle/images/train"
rootPathxml = "/data4/Hatcher/smallobject/voc_class/CDB_vehicle/Annotations"
rootresultpath = "/data4/Hatcher/smallobject/voc_class/CDB_vehicle/COCO/Anno_train"
if not os.path.exists(rootresultpath):
os.makedirs(rootresultpath)
for image in tqdm(os.listdir(rootPath)):
shutil.copy(os.path.join(rootPathxml,image.replace(".jpg",".xml").replace(".png",".xml")),os.path.join(rootresultpath,image.replace(".jpg",".xml").replace(".png",".xml")))
#exit()
rootPath = "/data4/Hatcher/smallobject/voc_class/CDB_vehicle/images/test"
rootPathxml = "/data4/Hatcher/smallobject/voc_class/CDB_vehicle/Annotations"
rootresultpath = "/data4/Hatcher/smallobject/voc_class/CDB_vehicle/COCO/Anno_test"
if not os.path.exists(rootresultpath):
os.makedirs(rootresultpath)
for image in tqdm(os.listdir(rootPath)):
shutil.copy(os.path.join(rootPathxml,image.replace(".jpg",".xml").replace(".png",".xml")),os.path.join(rootresultpath,image.replace(".jpg",".xml").replace(".png",".xml")))