TAO-Amodal / unzip_video.py
chengyenhsieh's picture
Update unzip_video.py
ca35dd8 verified
raw
history blame
No virus
865 Bytes
import os
import shutil # For zip creation and extraction
import zipfile
dataset_root = "./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)