Datasets:
Delete loading script
Browse files
sun397.py
DELETED
@@ -1,438 +0,0 @@
|
|
1 |
-
import datasets
|
2 |
-
from datasets.data_files import DataFilesDict
|
3 |
-
from datasets.packaged_modules.imagefolder.imagefolder import ImageFolder, ImageFolderConfig
|
4 |
-
|
5 |
-
logger = datasets.logging.get_logger(__name__)
|
6 |
-
|
7 |
-
|
8 |
-
class SUN397(ImageFolder):
|
9 |
-
R"""
|
10 |
-
SUN397 dataset for image classification.
|
11 |
-
"""
|
12 |
-
|
13 |
-
BUILDER_CONFIG_CLASS = ImageFolderConfig
|
14 |
-
BUILDER_CONFIGS = [
|
15 |
-
ImageFolderConfig(
|
16 |
-
name="default",
|
17 |
-
features=("images", "labels"),
|
18 |
-
data_files=DataFilesDict({split: f"data/{split}.zip" for split in ["train", "test"]}),
|
19 |
-
)
|
20 |
-
]
|
21 |
-
|
22 |
-
classnames = [
|
23 |
-
"abbey",
|
24 |
-
"airplane cabin",
|
25 |
-
"airport terminal",
|
26 |
-
"alley",
|
27 |
-
"amphitheater",
|
28 |
-
"amusement arcade",
|
29 |
-
"amusement park",
|
30 |
-
"anechoic chamber",
|
31 |
-
"apartment building outdoor",
|
32 |
-
"apse indoor",
|
33 |
-
"aquarium",
|
34 |
-
"aqueduct",
|
35 |
-
"arch",
|
36 |
-
"archive",
|
37 |
-
"arrival gate outdoor",
|
38 |
-
"art gallery",
|
39 |
-
"art school",
|
40 |
-
"art studio",
|
41 |
-
"assembly line",
|
42 |
-
"athletic field outdoor",
|
43 |
-
"atrium public",
|
44 |
-
"attic",
|
45 |
-
"auditorium",
|
46 |
-
"auto factory",
|
47 |
-
"badlands",
|
48 |
-
"badminton court indoor",
|
49 |
-
"baggage claim",
|
50 |
-
"bakery shop",
|
51 |
-
"balcony exterior",
|
52 |
-
"balcony interior",
|
53 |
-
"ball pit",
|
54 |
-
"ballroom",
|
55 |
-
"bamboo forest",
|
56 |
-
"banquet hall",
|
57 |
-
"bar",
|
58 |
-
"barn",
|
59 |
-
"barndoor",
|
60 |
-
"baseball field",
|
61 |
-
"basement",
|
62 |
-
"basilica",
|
63 |
-
"basketball court outdoor",
|
64 |
-
"bathroom",
|
65 |
-
"batters box",
|
66 |
-
"bayou",
|
67 |
-
"bazaar indoor",
|
68 |
-
"bazaar outdoor",
|
69 |
-
"beach",
|
70 |
-
"beauty salon",
|
71 |
-
"bedroom",
|
72 |
-
"berth",
|
73 |
-
"biology laboratory",
|
74 |
-
"bistro indoor",
|
75 |
-
"boardwalk",
|
76 |
-
"boat deck",
|
77 |
-
"boathouse",
|
78 |
-
"bookstore",
|
79 |
-
"booth indoor",
|
80 |
-
"botanical garden",
|
81 |
-
"bow window indoor",
|
82 |
-
"bow window outdoor",
|
83 |
-
"bowling alley",
|
84 |
-
"boxing ring",
|
85 |
-
"brewery indoor",
|
86 |
-
"bridge",
|
87 |
-
"building facade",
|
88 |
-
"bullring",
|
89 |
-
"burial chamber",
|
90 |
-
"bus interior",
|
91 |
-
"butchers shop",
|
92 |
-
"butte",
|
93 |
-
"cabin outdoor",
|
94 |
-
"cafeteria",
|
95 |
-
"campsite",
|
96 |
-
"campus",
|
97 |
-
"canal natural",
|
98 |
-
"canal urban",
|
99 |
-
"candy store",
|
100 |
-
"canyon",
|
101 |
-
"car interior backseat",
|
102 |
-
"car interior frontseat",
|
103 |
-
"carrousel",
|
104 |
-
"casino indoor",
|
105 |
-
"castle",
|
106 |
-
"catacomb",
|
107 |
-
"cathedral indoor",
|
108 |
-
"cathedral outdoor",
|
109 |
-
"cavern indoor",
|
110 |
-
"cemetery",
|
111 |
-
"chalet",
|
112 |
-
"cheese factory",
|
113 |
-
"chemistry lab",
|
114 |
-
"chicken coop indoor",
|
115 |
-
"chicken coop outdoor",
|
116 |
-
"childs room",
|
117 |
-
"church indoor",
|
118 |
-
"church outdoor",
|
119 |
-
"classroom",
|
120 |
-
"clean room",
|
121 |
-
"cliff",
|
122 |
-
"cloister indoor",
|
123 |
-
"closet",
|
124 |
-
"clothing store",
|
125 |
-
"coast",
|
126 |
-
"cockpit",
|
127 |
-
"coffee shop",
|
128 |
-
"computer room",
|
129 |
-
"conference center",
|
130 |
-
"conference room",
|
131 |
-
"construction site",
|
132 |
-
"control room",
|
133 |
-
"control tower outdoor",
|
134 |
-
"corn field",
|
135 |
-
"corral",
|
136 |
-
"corridor",
|
137 |
-
"cottage garden",
|
138 |
-
"courthouse",
|
139 |
-
"courtroom",
|
140 |
-
"courtyard",
|
141 |
-
"covered bridge exterior",
|
142 |
-
"creek",
|
143 |
-
"crevasse",
|
144 |
-
"crosswalk",
|
145 |
-
"cubicle office",
|
146 |
-
"dam",
|
147 |
-
"delicatessen",
|
148 |
-
"dentists office",
|
149 |
-
"desert sand",
|
150 |
-
"desert vegetation",
|
151 |
-
"diner indoor",
|
152 |
-
"diner outdoor",
|
153 |
-
"dinette home",
|
154 |
-
"dinette vehicle",
|
155 |
-
"dining car",
|
156 |
-
"dining room",
|
157 |
-
"discotheque",
|
158 |
-
"dock",
|
159 |
-
"doorway outdoor",
|
160 |
-
"dorm room",
|
161 |
-
"driveway",
|
162 |
-
"driving range outdoor",
|
163 |
-
"drugstore",
|
164 |
-
"electrical substation",
|
165 |
-
"elevator door",
|
166 |
-
"elevator interior",
|
167 |
-
"elevator shaft",
|
168 |
-
"engine room",
|
169 |
-
"escalator indoor",
|
170 |
-
"excavation",
|
171 |
-
"factory indoor",
|
172 |
-
"fairway",
|
173 |
-
"fastfood restaurant",
|
174 |
-
"field cultivated",
|
175 |
-
"field wild",
|
176 |
-
"fire escape",
|
177 |
-
"fire station",
|
178 |
-
"firing range indoor",
|
179 |
-
"fishpond",
|
180 |
-
"florist shop indoor",
|
181 |
-
"food court",
|
182 |
-
"forest broadleaf",
|
183 |
-
"forest needleleaf",
|
184 |
-
"forest path",
|
185 |
-
"forest road",
|
186 |
-
"formal garden",
|
187 |
-
"fountain",
|
188 |
-
"galley",
|
189 |
-
"game room",
|
190 |
-
"garage indoor",
|
191 |
-
"garbage dump",
|
192 |
-
"gas station",
|
193 |
-
"gazebo exterior",
|
194 |
-
"general store indoor",
|
195 |
-
"general store outdoor",
|
196 |
-
"gift shop",
|
197 |
-
"golf course",
|
198 |
-
"greenhouse indoor",
|
199 |
-
"greenhouse outdoor",
|
200 |
-
"gymnasium indoor",
|
201 |
-
"hangar indoor",
|
202 |
-
"hangar outdoor",
|
203 |
-
"harbor",
|
204 |
-
"hayfield",
|
205 |
-
"heliport",
|
206 |
-
"herb garden",
|
207 |
-
"highway",
|
208 |
-
"hill",
|
209 |
-
"home office",
|
210 |
-
"hospital",
|
211 |
-
"hospital room",
|
212 |
-
"hot spring",
|
213 |
-
"hot tub outdoor",
|
214 |
-
"hotel outdoor",
|
215 |
-
"hotel room",
|
216 |
-
"house",
|
217 |
-
"hunting lodge outdoor",
|
218 |
-
"ice cream parlor",
|
219 |
-
"ice floe",
|
220 |
-
"ice shelf",
|
221 |
-
"ice skating rink indoor",
|
222 |
-
"ice skating rink outdoor",
|
223 |
-
"iceberg",
|
224 |
-
"igloo",
|
225 |
-
"industrial area",
|
226 |
-
"inn outdoor",
|
227 |
-
"islet",
|
228 |
-
"jacuzzi indoor",
|
229 |
-
"jail cell",
|
230 |
-
"jail indoor",
|
231 |
-
"jewelry shop",
|
232 |
-
"kasbah",
|
233 |
-
"kennel indoor",
|
234 |
-
"kennel outdoor",
|
235 |
-
"kindergarden classroom",
|
236 |
-
"kitchen",
|
237 |
-
"kitchenette",
|
238 |
-
"labyrinth outdoor",
|
239 |
-
"lake natural",
|
240 |
-
"landfill",
|
241 |
-
"landing deck",
|
242 |
-
"laundromat",
|
243 |
-
"lecture room",
|
244 |
-
"library indoor",
|
245 |
-
"library outdoor",
|
246 |
-
"lido deck outdoor",
|
247 |
-
"lift bridge",
|
248 |
-
"lighthouse",
|
249 |
-
"limousine interior",
|
250 |
-
"living room",
|
251 |
-
"lobby",
|
252 |
-
"lock chamber",
|
253 |
-
"locker room",
|
254 |
-
"mansion",
|
255 |
-
"manufactured home",
|
256 |
-
"market indoor",
|
257 |
-
"market outdoor",
|
258 |
-
"marsh",
|
259 |
-
"martial arts gym",
|
260 |
-
"mausoleum",
|
261 |
-
"medina",
|
262 |
-
"moat water",
|
263 |
-
"monastery outdoor",
|
264 |
-
"mosque indoor",
|
265 |
-
"mosque outdoor",
|
266 |
-
"motel",
|
267 |
-
"mountain",
|
268 |
-
"mountain snowy",
|
269 |
-
"movie theater indoor",
|
270 |
-
"museum indoor",
|
271 |
-
"music store",
|
272 |
-
"music studio",
|
273 |
-
"nuclear power plant outdoor",
|
274 |
-
"nursery",
|
275 |
-
"oast house",
|
276 |
-
"observatory outdoor",
|
277 |
-
"ocean",
|
278 |
-
"office",
|
279 |
-
"office building",
|
280 |
-
"oil refinery outdoor",
|
281 |
-
"oilrig",
|
282 |
-
"operating room",
|
283 |
-
"orchard",
|
284 |
-
"outhouse outdoor",
|
285 |
-
"pagoda",
|
286 |
-
"palace",
|
287 |
-
"pantry",
|
288 |
-
"park",
|
289 |
-
"parking garage indoor",
|
290 |
-
"parking garage outdoor",
|
291 |
-
"parking lot",
|
292 |
-
"parlor",
|
293 |
-
"pasture",
|
294 |
-
"patio",
|
295 |
-
"pavilion",
|
296 |
-
"pharmacy",
|
297 |
-
"phone booth",
|
298 |
-
"physics laboratory",
|
299 |
-
"picnic area",
|
300 |
-
"pilothouse indoor",
|
301 |
-
"planetarium outdoor",
|
302 |
-
"playground",
|
303 |
-
"playroom",
|
304 |
-
"plaza",
|
305 |
-
"podium indoor",
|
306 |
-
"podium outdoor",
|
307 |
-
"pond",
|
308 |
-
"poolroom establishment",
|
309 |
-
"poolroom home",
|
310 |
-
"power plant outdoor",
|
311 |
-
"promenade deck",
|
312 |
-
"pub indoor",
|
313 |
-
"pulpit",
|
314 |
-
"putting green",
|
315 |
-
"racecourse",
|
316 |
-
"raceway",
|
317 |
-
"raft",
|
318 |
-
"railroad track",
|
319 |
-
"rainforest",
|
320 |
-
"reception",
|
321 |
-
"recreation room",
|
322 |
-
"residential neighborhood",
|
323 |
-
"restaurant",
|
324 |
-
"restaurant kitchen",
|
325 |
-
"restaurant patio",
|
326 |
-
"rice paddy",
|
327 |
-
"riding arena",
|
328 |
-
"river",
|
329 |
-
"rock arch",
|
330 |
-
"rope bridge",
|
331 |
-
"ruin",
|
332 |
-
"runway",
|
333 |
-
"sandbar",
|
334 |
-
"sandbox",
|
335 |
-
"sauna",
|
336 |
-
"schoolhouse",
|
337 |
-
"sea cliff",
|
338 |
-
"server room",
|
339 |
-
"shed",
|
340 |
-
"shoe shop",
|
341 |
-
"shopfront",
|
342 |
-
"shopping mall indoor",
|
343 |
-
"shower",
|
344 |
-
"skatepark",
|
345 |
-
"ski lodge",
|
346 |
-
"ski resort",
|
347 |
-
"ski slope",
|
348 |
-
"sky",
|
349 |
-
"skyscraper",
|
350 |
-
"slum",
|
351 |
-
"snowfield",
|
352 |
-
"squash court",
|
353 |
-
"stable",
|
354 |
-
"stadium baseball",
|
355 |
-
"stadium football",
|
356 |
-
"stage indoor",
|
357 |
-
"staircase",
|
358 |
-
"street",
|
359 |
-
"subway interior",
|
360 |
-
"subway station platform",
|
361 |
-
"supermarket",
|
362 |
-
"sushi bar",
|
363 |
-
"swamp",
|
364 |
-
"swimming pool indoor",
|
365 |
-
"swimming pool outdoor",
|
366 |
-
"synagogue indoor",
|
367 |
-
"synagogue outdoor",
|
368 |
-
"television studio",
|
369 |
-
"temple east asia",
|
370 |
-
"temple south asia",
|
371 |
-
"tennis court indoor",
|
372 |
-
"tennis court outdoor",
|
373 |
-
"tent outdoor",
|
374 |
-
"theater indoor procenium",
|
375 |
-
"theater indoor seats",
|
376 |
-
"thriftshop",
|
377 |
-
"throne room",
|
378 |
-
"ticket booth",
|
379 |
-
"toll plaza",
|
380 |
-
"topiary garden",
|
381 |
-
"tower",
|
382 |
-
"toyshop",
|
383 |
-
"track outdoor",
|
384 |
-
"train railway",
|
385 |
-
"train station platform",
|
386 |
-
"tree farm",
|
387 |
-
"tree house",
|
388 |
-
"trench",
|
389 |
-
"underwater coral reef",
|
390 |
-
"utility room",
|
391 |
-
"valley",
|
392 |
-
"van interior",
|
393 |
-
"vegetable garden",
|
394 |
-
"veranda",
|
395 |
-
"veterinarians office",
|
396 |
-
"viaduct",
|
397 |
-
"videostore",
|
398 |
-
"village",
|
399 |
-
"vineyard",
|
400 |
-
"volcano",
|
401 |
-
"volleyball court indoor",
|
402 |
-
"volleyball court outdoor",
|
403 |
-
"waiting room",
|
404 |
-
"warehouse indoor",
|
405 |
-
"water tower",
|
406 |
-
"waterfall block",
|
407 |
-
"waterfall fan",
|
408 |
-
"waterfall plunge",
|
409 |
-
"watering hole",
|
410 |
-
"wave",
|
411 |
-
"wet bar",
|
412 |
-
"wheat field",
|
413 |
-
"wind farm",
|
414 |
-
"windmill",
|
415 |
-
"wine cellar barrel storage",
|
416 |
-
"wine cellar bottle storage",
|
417 |
-
"wrestling ring indoor",
|
418 |
-
"yard",
|
419 |
-
"youth hostel",
|
420 |
-
]
|
421 |
-
|
422 |
-
clip_templates = [
|
423 |
-
lambda c: f"a photo of a {c}.",
|
424 |
-
lambda c: f"a photo of the {c}.",
|
425 |
-
]
|
426 |
-
|
427 |
-
def _info(self):
|
428 |
-
return datasets.DatasetInfo(
|
429 |
-
description="SUN397 dataset for image classification.",
|
430 |
-
features=datasets.Features(
|
431 |
-
{
|
432 |
-
"image": datasets.Image(),
|
433 |
-
"label": datasets.ClassLabel(names=self.classnames),
|
434 |
-
}
|
435 |
-
),
|
436 |
-
supervised_keys=("image", "label"),
|
437 |
-
task_templates=[datasets.ImageClassification(image_column="image", label_column="label")],
|
438 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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