Datasets:
File size: 1,062 Bytes
ece013f 291ae19 ece013f 291ae19 ece013f | 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 | import json
import shutil
import os
import argparse
def main(args):
with open(args.json) as f:
clips = json.load(f)
if isinstance(clips, dict):
clips = [clips]
for clip in clips:
clip_id = clip["clip_id"]
split = clip["split"]
folder = clip["source_video_folder"]
out_dir = os.path.join(args.dst, split, clip_id)
os.makedirs(out_dir, exist_ok=True)
for frame in clip["frames"]:
src = os.path.join(args.src, folder, frame["source_frame"])
dst = os.path.join(out_dir, frame["new_frame"])
shutil.copy2(src, dst)
print(f"Copied {src} -> {dst}")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Map old clip/frame names to new ones and copy files.")
parser.add_argument("--json", default="./OLiVES_VOS_metadata.json", help="Path to the clips JSON file")
parser.add_argument("--src", default="./OLiVES/input", help="Path to the low-light videos directory")
args = parser.parse_args()
main(args) |