Example #1
0
def download_dataset(root: str):
    """
    Download the Standford Cars dataset archives and expand them in the folder provided as parameter
    """
    download_and_extract_archive(url=TRAIN_IMAGE_URL, download_root=root)
    download_and_extract_archive(url=TRAIN_ANNOT_URL, download_root=root)
    download_and_extract_archive(url=TEST_IMAGE_URL, download_root=root)
    download_url(url=TEST_ANNOT_URL, root=root)
def download_oxford_flowers(root: str):
    """
    Download the Oxford Pets dataset archives and expand them
    in the folder provided as parameter
    """
    url_folder = "https://www.robots.ox.ac.uk/~vgg/data/flowers/102/"
    download_and_extract_archive(url_folder + "102flowers.tgz", download_root=root)
    for url_file in ["imagelabels.mat", "setid.mat"]:
        download_url(url_folder + url_file, root)
Example #3
0
def download_oxford_dataset(root: str):
    """
    Download the Oxford dataset archive and expand it in the folder provided as parameter
    """
    images_url = "https://www.robots.ox.ac.uk/~vgg/data/oxbuildings/oxbuild_images.tgz"
    download_and_extract_archive(images_url, root)

    metadata_url = (
        "http://cmp.felk.cvut.cz/revisitop/data/datasets/roxford5k/gnd_roxford5k.pkl"
    )
    download_url(metadata_url, root)
Example #4
0
 def _download_missing_files(self, download: bool):
     for file, url in self._FILES.values():
         if not os.path.exists(os.path.join(self.input_path, file)):
             if download:
                 filename = os.path.basename(url)
                 download_url(url=url, root=self.input_path, filename=filename)
                 from_path = os.path.join(self.input_path, filename)
                 to_path = from_path.replace(".gz", "")
                 with gzip.open(from_path, "rb") as rfh, open(to_path, "wb") as wfh:
                     wfh.write(rfh.read())
             else:
                 raise ValueError(f"Missing file {file} in {self.input_path}")