File size: 883 Bytes
0dc8bfb
 
 
 
 
9f01bbb
0dc8bfb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)