TAO-Amodal / unzip_video.py
WesleyHsieh0806
unzip videos
9f01bbb
raw
history blame
No virus
883 Bytes
import os
import shutil # For zip creation and extraction
import zipfile
dataset_root = "/path/to/TAO-Amodal/frames"
def zip_and_unzip_videos(dataset_root):
for split in os.listdir(dataset_root):
split_root = os.path.join(dataset_root, split)
for video_dataset in os.listdir(split_root):
video_dataset_root = os.path.join(split_root, video_dataset)
# *** Unzipping ***
# *** Zipping ***
zip_filename = video_dataset + '.zip'
zip_filepath = os.path.join(split_root, zip_filename) # Zip in the split folder
with zipfile.ZipFile(zip_filepath, 'r') as zipf:
zipf.extractall(split_root) # Extract to the split folder
os.remove(zip_filepath)
# Call the function to perform zipping and unzipping
zip_and_unzip_videos(dataset_root)