|
- import os
- import shutil
-
- path = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/smd12_2112_coco/train/images/"
- path_labels = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/smd12_2112_coco/train/labels/"
- dist = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/unlabel_11_12/images/"
- dist_labels = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/unlabel_11_12/labels/"
- files = os.listdir(path)
- count_img = 0
- count_label = 0
- for file in files:
- if file.endswith("jpg"):
- shutil.copy(path+file, dist+file)
- count_img += 1
- if os.path.exists(path_labels+file.replace(".jpg",".txt")):
- shutil.copy(path_labels+file.replace(".jpg",".txt"), dist_labels+file.replace(".jpg",".txt"))
- count_label += 1
- print(count_img, count_label)
|