Spaces:
Running
on
Zero
Running
on
Zero
File size: 834 Bytes
59b2a81 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
'''
Sometimes, Bridge dataset will contain strange downloads, we need to clean them
'''
import os, shutil
# TODO: 后面把这个直接merge 到prepare_bridge_dataset中
if __name__ == "__main__":
dataset_path = "/nfs/turbo/jjparkcv-turbo-large/boyangwa/Bridge"
for sub_folder in sorted(os.listdir(dataset_path)):
sub_folder_path = os.path.join(dataset_path, sub_folder)
img_lists = os.listdir(sub_folder_path)
if len(img_lists) < 14:
print("The folder is too short, we will remove them all")
shutil.rmtree(sub_folder_path)
continue
for img_name in img_lists:
img_path = os.path.join(sub_folder_path, img_name)
if not img_name.startswith("im_"):
print("We remove ", img_path)
os.remove(img_path) |