Example #1
0
 def download(self, file_id, destination):
     archive_path = os.path.join(destination, 'tiered_imagenet.tar')
     print('Downloading tiered ImageNet. (12Gb) Please be patient.')
     download_file_from_google_drive(file_id, archive_path)
     archive_file = tarfile.open(archive_path)
     archive_file.extractall(destination)
     os.remove(archive_path)
Example #2
0
 def download(self, file_id, destination):
     archive_path = os.path.join(destination, 'fc100.zip')
     print('Downloading FC100. (160Mb) Please be patient.')
     download_file_from_google_drive(file_id, archive_path)
     archive_file = zipfile.ZipFile(archive_path)
     archive_file.extractall(destination)
     os.remove(archive_path)
Example #3
0
def download_pkl(google_drive_id, data_root, mode):
    filename = 'mini-imagenet-cache-' + mode
    file_path = os.path.join(data_root, filename)

    if not os.path.exists(file_path + '.pkl'):
        print('Downloading:', file_path + '.pkl')
        download_file_from_google_drive(google_drive_id, file_path + '.pkl')
    else:
        print("Data was already downloaded")
Example #4
0
 def _download(self):
     # Download the zip, unzip it, and clean up
     print('Downloading CIFARFS to ', self.root)
     if not os.path.exists(self.root):
         os.mkdir(self.root)
     zip_file = os.path.join(self.root, 'cifarfs.zip')
     download_file_from_google_drive('1pTsCCMDj45kzFYgrnO67BWVbKs48Q3NI',
                                     zip_file)
     with zipfile.ZipFile(zip_file, 'r') as zfile:
         zfile.extractall(self.raw_path)
     os.remove(zip_file)
Example #5
0
 def download(self):
     # Download and extract the data
     data_path = os.path.join(self.root, DATA_DIR)
     os.makedirs(data_path, exist_ok=True)
     tar_path = os.path.join(data_path, DATA_FILENAME)
     print('Downloading CUBirds200 dataset. (1.1Gb)')
     download_file_from_google_drive(ARCHIVE_ID, tar_path)
     tar_file = tarfile.open(tar_path)
     tar_file.extractall(data_path)
     tar_file.close()
     os.remove(tar_path)
Example #6
0
 def download(self):
     archive_path = os.path.join(self.root, 'fc100.zip')
     print('Downloading FC100. (160Mb)')
     try:  # Download from Google Drive first
         download_file_from_google_drive(GOOGLE_DRIVE_FILE_ID, archive_path)
         archive_file = zipfile.ZipFile(archive_path)
         archive_file.extractall(self.root)
         os.remove(archive_path)
     except zipfile.BadZipFile:
         download_file(DROPBOX_LINK, archive_path)
         archive_file = zipfile.ZipFile(archive_path)
         archive_file.extractall(self.root)
         os.remove(archive_path)