|
import os |
|
import shutil |
|
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) |
|
|
|
|
|
zip_filename = video_dataset + '.zip' |
|
zip_filepath = os.path.join(split_root, zip_filename) |
|
|
|
with zipfile.ZipFile(zip_filepath, 'r') as zipf: |
|
zipf.extractall(split_root) |
|
|
|
os.remove(zip_filepath) |
|
|
|
|
|
zip_and_unzip_videos(dataset_root) |