def _download(self): if not os.path.exists(os.path.join(self.data_path, "CUB_200_2011")): tgz_path = os.path.join(self.data_path, "CUB_200_2011.tgz") if not os.path.exists(tgz_path): print("Downloading tgz archive...", end=' ') download_file_from_google_drive( "1hbzc_P1FuxMkcabkgn9ZKinBwW683j45", tgz_path) print('Done!') print('Extracting archive...', end=' ') try: untar(tgz_path) except tarfile.ReadError: print() try: os.remove(tgz_path) except: pass raise IOError( "The file wasn't downloaded properly, probably because it " "has hit the limit of download from Google Drive. " "Try downloading the .tgz archive manually at " "http://www.vision.caltech.edu/visipedia-data/CUB-200/images.tgz" ) print('Done!')
def _download(self): if not os.path.exists(os.path.join(self.data_path, "images")): archive_images_path = os.path.join(self.data_path, "images.tar.gz") if not os.path.exists(archive_images_path): print("Downloading images archive...", end=' ') image_url = os.path.join(self.base_url, "images.tar.gz") download(image_url, self.data_path) print('Done!') print('Extracting images archive...', end=' ') untar(archive_images_path) print('Done!') if not os.path.exists(os.path.join(self.data_path, "annotations")): archive_annotations_path = os.path.join(self.data_path, "annotations.tar.gz") if not os.path.exists(archive_annotations_path): print("Downloading annotations archive...", end=' ') annotations_url = os.path.join(self.base_url, "annotations.tar.gz") download(annotations_url, self.data_path) print('Done!') print('Extracting annotations archive...', end=' ') untar(archive_annotations_path) print('Done!')
def _download(self): # Downloading images if not os.path.exists(os.path.join(self.data_path, "VOCdevkit")): path = os.path.join(self.data_path, "VOCtrainval_11-May-2012.tar") if not os.path.exists(path): print("Downloading Pascal VOC segmentation maps...") download.download(self.data_url, self.data_path) print("Uncompressing images...") download.untar(path) # Downloading segmentation maps if not os.path.exists(os.path.join(self.data_path, "SegmentationClassAug")): path = os.path.join(self.data_path, "SegmentationClassAug.zip") if not os.path.exists(path): print("Downloading Pascal VOC segmentation maps...") download.download(self.segmentation_url, self.data_path) print("Uncompressing segmentation maps...") download.unzip(path) # Downloading train/val/test indexes if not os.path.exists(os.path.join(self.data_path, "list")): path = os.path.join(self.data_path, "list.zip") if not os.path.exists(path): print("Downloading Pascal VOC train/val/test indexes...") download.download(self.split_url, self.data_path) print("Uncompressing train/val/test indexes...") download.unzip(path)
def _download(self): archive_path = os.path.join(self.data_path, "dtd-r1.0.1.tar.gz") if not os.path.exists(archive_path): print("Downloading DTD dataset...") download.download(self.url, self.data_path) if not os.path.exists(os.path.join(self.data_path, "dtd")): print("Uncompressing images...") download.untar(archive_path)
def _download(self): archive_path = os.path.join(self.data_path, "fer2013.tar.gz") if not os.path.exists(archive_path): raise Exception( "You need to download this dataset yourself at " "https://www.kaggle.com/c/challenges-in-representation-learning-facial-expression-recognition-challenge/data?select=fer2013.tar.gz" ) if not os.path.exists(os.path.join(self.data_path, "fer2013")): print("Extracting archive...", end=" ") untar(archive_path) print("Done!")
def _download(self): if not os.path.exists(os.path.join(self.data_path, "VLCS")): tar_path = os.path.join(self.data_path, "VLCS.tar.gz") if not os.path.exists(tar_path): print("Downloading zip images archive...", end=' ') download_file_from_google_drive(self.images_gdrive_id, tar_path) print('Done!') print('Extracting archive...', end=' ') untar(tar_path) print('Done!')
def _download(self): if not os.path.exists(os.path.join(self.data_path, "SUN397")): archive_path = os.path.join(self.data_path, "SUN397.tar.gz") if not os.path.exists(archive_path): print("Downloading images archive...", end=' ') download(self.images_url, self.data_path) print('Done!') print('Extracting archive...', end=' ') untar(archive_path) print('Done!')
def _download(self): if not os.path.exists( os.path.join(self.data_path, "fgvc-aircraft-2013b")): archive_path = os.path.join(self.data_path, "fgvc-aircraft-2013b.tar.gz") if not os.path.exists(archive_path): print(f"Downloading archive ...", end=" ") download(self.url, self.data_path) print('Done!') print(f"Extracting archive...", end=" ") untar(archive_path) print("Done!")
def _download(self): data_folder = os.path.join(self.data_path, self.folder) annotation_folder = os.path.join(self.data_path, "Annotations") if not os.path.exists(data_folder): if not os.path.exists(data_folder + ".tar.gz"): print("Downloading data archive...", end=" ") download_file_from_google_drive(self.data_id, data_folder + ".tar.gz") print("Done!") print("Extracting data archive...", end=" ") untar(data_folder + ".tar.gz") print("Done!")
def _download(self): if not os.path.exists( os.path.join(self.data_path, "VOCdevkit", "VOC2007")): archive_path = os.path.join(self.data_path, "VOCtrainval_06-Nov-2007.tar") if not os.path.exists(archive_path): print(f"Downloading archive ...", end=" ") download.download(self.url, self.data_path) print('Done!') print(f"Extracting archive...", end=" ") download.untar(archive_path) print("Done!")
def _download(self): folders = ["devkit", "cars_train", "cars_test"] archives = ["car_devkit.tgz", "cars_train.tgz", "cars_test.tgz"] urls = [self.devkit_url, self.train_url, self.test_url] for f, a, u in zip(folders, archives, urls): if not os.path.exists(os.path.join(self.data_path, f)): archive_path = os.path.join(self.data_path, a) if not os.path.exists(archive_path): print(f"Downloading archive {a} ...", end=" ") download(u, self.data_path) print('Done!') print(f"Extracting archive... {a}->{f}", end=" ") untar(archive_path) print("Done!") if not os.path.exists( os.path.join(self.data_path, "cars_test_annos_withlabels.mat")): download(self.test_labels_url, self.data_path)
def _download(self): if not os.path.exists(os.path.join(self.data_path, "jpg")): archive_images_path = os.path.join(self.data_path, "102flowers.tgz") if not os.path.exists(archive_images_path): print("Downloading images archive...", end=' ') image_url = os.path.join(self.base_url, "102flowers.tgz") download(image_url, self.data_path) print('Done!') print('Extracting archive...', end=' ') untar(archive_images_path) print('Done!') # Downloading label file if not os.path.exists(os.path.join(self.data_path, "imagelabels.mat")): label_url = os.path.join(self.base_url, "imagelabels.mat") download(label_url, self.data_path) # Downloading split file if not os.path.exists(os.path.join(self.data_path, "setid.mat")): split_url = os.path.join(self.base_url, "setid.mat") download(split_url, self.data_path)
def _download(self): global _DOWNLOAD_FOLDER _DOWNLOAD_FOLDER = os.path.join(self.data_path, "images") os.makedirs(_DOWNLOAD_FOLDER, exist_ok=True) if not os.path.exists(os.path.join(self.data_path, "birdsnap")): archive_path = os.path.join(self.data_path, "birdsnap.tgz") if not os.path.exists(archive_path): print("Downloading archive of metadata...", end=' ') download(self.meta_url, self.data_path) print('Done!') print('Extracting archive...', end=' ') untar(archive_path) print('Done!') with open(os.path.join(self.data_path, "birdsnap", "images.txt")) as f: data = f.readlines()[1:] good_images = 0 print(f"Downloading or checking {len(data)} images...") pb = ProgressBar() with ThreadPool(10) as pool: for processed_data in pool.imap_unordered(_download_images, data): pb.update(None, 1, len(data)) if processed_data is None: continue good_images += 1 pb.end(len(data)) if good_images != len(data): warnings.warn( f"{len(data)-good_images} couldn't be downloaded among {len(data)}." )
def _download(self): if not os.path.exists( os.path.join(self.data_path, "eccv_18_all_images_sm")): tar_path = os.path.join(self.data_path, "eccv_18_all_images_sm.tar.gz") if not os.path.exists(tar_path): print("Downloading images archive...", end=" ") download(self.images_url, self.data_path) print("Done!") print('Extracting archive...', end=' ') untar(tar_path) print('Done!') if not os.path.exists( os.path.join(self.data_path, "caltech_images_20210113.json")): zip_path = os.path.join(self.data_path, "caltech_camera_traps.json.zip") if not os.path.exists(zip_path): print("Downloading json archive...", end=" ") download(self.json_url, self.data_path) print("Done!") print('Extracting archive...', end=' ') unzip(zip_path) print('Done!')