You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

copy_img.py 859 B

2 years ago
123456789101112131415161718
  1. import os
  2. import shutil
  3. path = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/smd12_2112_coco/train/images/"
  4. path_labels = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/smd12_2112_coco/train/labels/"
  5. dist = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/unlabel_11_12/images/"
  6. dist_labels = "/home/shanwei-luo/teamdata/anomaly_detection_active_learning/data0422/unlabel_11_12/labels/"
  7. files = os.listdir(path)
  8. count_img = 0
  9. count_label = 0
  10. for file in files:
  11. if file.endswith("jpg"):
  12. shutil.copy(path+file, dist+file)
  13. count_img += 1
  14. if os.path.exists(path_labels+file.replace(".jpg",".txt")):
  15. shutil.copy(path_labels+file.replace(".jpg",".txt"), dist_labels+file.replace(".jpg",".txt"))
  16. count_label += 1
  17. print(count_img, count_label)

No Description

Contributors (1)