File size: 772 Bytes
cd1cf68 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import shutil
from pathlib import Path
from tqdm.auto import tqdm
# filtering file from https://github.com/google-research/google-research/tree/master/seq2act/data_generation
with open("./filter_24598.txt", "r") as f:
filtered_files = f.read().replace(".json", "").split("\n")[:-1]
print("num_filtered:", len(filtered_files))
# make filtered directories
Path("captions_filtered").mkdir(exist_ok=True)
Path("hierarchies_filtered").mkdir(exist_ok=True)
Path("images_filtered").mkdir(exist_ok=True)
# copy filtered files into filtered directories
for file in tqdm(filtered_files):
shutil.copy(f"captions/{file}.txt", "captions_filtered")
shutil.copy(f"hierarchies/{file}.json", "hierarchies_filtered")
shutil.copy(f"images/{file}.jpg", "images_filtered") |