|
1 | 1 | import os |
2 | 2 | import os.path |
| 3 | +import shutil |
3 | 4 | from pathlib import Path |
4 | 5 | from typing import Any, Callable, Optional, Union |
5 | 6 |
|
6 | 7 | from PIL import Image |
7 | 8 |
|
8 | | -from .utils import download_and_extract_archive, verify_str_arg |
| 9 | +from .utils import download_and_extract_archive, extract_archive, verify_str_arg |
9 | 10 | from .vision import VisionDataset |
10 | 11 |
|
11 | 12 |
|
@@ -133,17 +134,17 @@ def download(self) -> None: |
133 | 134 | return |
134 | 135 |
|
135 | 136 | 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", |
| 137 | + "https://data.caltech.edu/records/mzrjq-6wc02/files/caltech-101.zip", |
| 138 | + download_root=self.root, |
| 139 | + filename="caltech-101.zip", |
| 140 | + md5="3138e1922a9193bfa496528edbbc45d0", |
146 | 141 | ) |
| 142 | + gzip_folder = os.path.join(self.root, "caltech-101") |
| 143 | + for gzip_file in os.listdir(gzip_folder): |
| 144 | + if gzip_file.endswith(".gz"): |
| 145 | + extract_archive(os.path.join(gzip_folder, gzip_file), self.root) |
| 146 | + shutil.rmtree(gzip_folder) |
| 147 | + os.remove(os.path.join(self.root, "caltech-101.zip")) |
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