|  | 
| 2 | 2 | import os.path | 
| 3 | 3 | from pathlib import Path | 
| 4 | 4 | from typing import Any, Callable, Optional, Union | 
| 5 |  | - | 
|  | 5 | +import shutil | 
| 6 | 6 | from PIL import Image | 
| 7 | 7 | 
 | 
| 8 |  | -from .utils import download_and_extract_archive, verify_str_arg | 
|  | 8 | +from .utils import download_and_extract_archive, verify_str_arg,extract_archive | 
| 9 | 9 | from .vision import VisionDataset | 
| 10 | 10 | 
 | 
| 11 | 11 | 
 | 
| @@ -133,17 +133,18 @@ def download(self) -> None: | 
| 133 | 133 |             return | 
| 134 | 134 | 
 | 
| 135 | 135 |         download_and_extract_archive( | 
| 136 |  | -            "https://drive.google.com/file/d/137RyRjvTBkBiIfeYBNZBtViDHQ6_Ewsp", | 
| 137 |  | -            self.root, | 
| 138 |  | -            filename="101_ObjectCategories.tar.gz", | 
| 139 |  | -            md5="b224c7392d521a49829488ab0f1120d9", | 
| 140 |  | -        ) | 
| 141 |  | -        download_and_extract_archive( | 
| 142 |  | -            "https://drive.google.com/file/d/175kQy3UsZ0wUEHZjqkUDdNVssr7bgh_m", | 
| 143 |  | -            self.root, | 
| 144 |  | -            filename="Annotations.tar", | 
| 145 |  | -            md5="6f83eeb1f24d99cab4eb377263132c91", | 
|  | 136 | +            "https://data.caltech.edu/records/mzrjq-6wc02/files/caltech-101.zip", | 
|  | 137 | +            download_root=self.root, | 
|  | 138 | +            filename="caltech-101.zip", | 
|  | 139 | +            md5="3138e1922a9193bfa496528edbbc45d0", | 
| 146 | 140 |         ) | 
|  | 141 | +        extracted_dir = os.path.join(self.root, "caltech-101") | 
|  | 142 | +        extract_archive(os.path.join(extracted_dir, "101_ObjectCategories.tar.gz"), self.root) | 
|  | 143 | +        extract_archive(os.path.join(extracted_dir, "Annotations.tar.gz"), self.root) # Note: Annotations is now also .tar.gz in the new archive | 
|  | 144 | +        shutil.rmtree(extracted_dir) | 
|  | 145 | +        os.remove(os.path.join(self.root, "caltech-101.zip")) | 
|  | 146 | +        | 
|  | 147 | + | 
| 147 | 148 | 
 | 
| 148 | 149 |     def extra_repr(self) -> str: | 
| 149 | 150 |         return "Target type: {target_type}".format(**self.__dict__) | 
| @@ -233,7 +234,7 @@ def download(self) -> None: | 
| 233 | 234 |             return | 
| 234 | 235 | 
 | 
| 235 | 236 |         download_and_extract_archive( | 
| 236 |  | -            "https://drive.google.com/file/d/1r6o0pSROcV1_VwT4oSjA2FBUSCWGuxLK", | 
|  | 237 | +            "https://data.caltech.edu/records/nyy15-4j048/files/256_ObjectCategories.tar", | 
| 237 | 238 |             self.root, | 
| 238 | 239 |             filename="256_ObjectCategories.tar", | 
| 239 | 240 |             md5="67b4f42ca05d46448c6bb8ecd2220f6d", | 
|  | 
0 commit comments