-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-检验数据集是否完整.py
40 lines (34 loc) · 1.66 KB
/
1-检验数据集是否完整.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#encoding=UTF-8
import os
# img_path='G:\B-数据集\焊缝+X-Ray数据集\GC10-DET_VOCdevkit\VOCdevkit\VOC2007\JPEGImages'
# label_path='G:\B-数据集\焊缝+X-Ray数据集\GC10-DET_VOCdevkit\VOCdevkit\VOC2007\Annotations'
# img_path=r"F:\Graduation_Design_Dataset\collect_RGBD\RGB-D_People_Dataset\rgbd_people_voc\sum\depth"
# label_path=r"F:\Graduation_Design_Dataset\collect_RGBD\RGB-D_People_Dataset\rgbd_people_voc\sum\annotation"
# img_path=r"G:\Internet_Dataset\recordData\RGBD_intelnet_b\rgb"
# label_path=r"G:\Internet_Dataset\recordData\RGBD_intelnet_b\annotation"
img_path=r"F:\doing\Motor_detection_dataset\third_dataset\labeled\zhuohang_311\images"
label_path=r"F:\doing\Motor_detection_dataset\third_dataset\labeled\zhuohang_311\labels"
img_list=os.listdir(img_path)
label_list=os.listdir(label_path)
for filename in img_list:
# print(filename.rstrip('png')+'xml')
filename_xml=label_path+'/'+filename.rstrip('jpg')+'xml'
# print(filename_xml)
if not os.path.exists(filename_xml):
print('no xml:',filename)
os.remove(img_path+'/'+filename)
# for filename in img_list:
# filename_xml=label_path+'/'+filename.strip('jpg')+'txt'
# if not os.path.exists(filename_xml):
# print('no txt:',filename)
# os.remove(img_path+'/'+filename)
# for label in label_list:
# filename_jpg=img_path+'/'+label.strip('xml')+'jpg'
# if not os.path.exists(filename_jpg):
# print('no jpg:',label)
# os.remove(label_path+'/'+label)
for label in label_list:
filename_jpg=img_path+'/'+label.rstrip('xml')+'jpg'
if not os.path.exists(filename_jpg):
print('no jpg:',label)
os.remove(label_path+'/'+label)