Spaces:
Build error
Build error
File size: 936 Bytes
ccdf9bb |
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 |
import os
import json
import tqdm
from shutil import copyfile
MAIN_PATH = "/Users/matyasbohacek/Documents/Academics/Projects/WLASL/start_kit"
BATCH = "train"
if not os.path.exists(MAIN_PATH + "/" + BATCH + "_preprocessed/"):
os.mkdir(MAIN_PATH + "/" + BATCH + "_preprocessed/")
with open(MAIN_PATH + "/specs.json") as f:
data = json.load(f)
for item_index, item in tqdm.tqdm(enumerate(data)):
for video in item["instances"]:
if video["split"] != BATCH:
continue
if not os.path.exists(MAIN_PATH + "/" + BATCH + "_preprocessed/" + str(item_index) + "/"):
os.mkdir(MAIN_PATH + "/" + BATCH + "_preprocessed/" + str(item_index) + "/")
original_path = MAIN_PATH + "/videos/" + str(video["video_id"]) + ".mp4"
new_path = MAIN_PATH + "/" + BATCH + "_preprocessed/" + str(item_index) + "/" + str(video["video_id"]) + ".mp4"
copyfile(original_path, new_path)
|