Pankajric22 commited on
Commit
04fc74b
·
verified ·
1 Parent(s): 3293e73

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +159 -0
  2. dataset_infos.json +191 -0
  3. imagenette.py +159 -0
README.md ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ language:
7
+ - en
8
+ license:
9
+ - apache-2.0
10
+ multilinguality: []
11
+ size_categories:
12
+ - 1K<n<10K
13
+ source_datasets:
14
+ - extended
15
+ task_categories:
16
+ - image-classification
17
+ task_ids: []
18
+ paperswithcode_id: imagenette
19
+ pretty_name: Imagenette
20
+ ---
21
+
22
+ # Dataset Card for Imagenette
23
+
24
+ ## Table of Contents
25
+ - [Table of Contents](#table-of-contents)
26
+ - [Dataset Description](#dataset-description)
27
+ - [Dataset Summary](#dataset-summary)
28
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
29
+ - [Languages](#languages)
30
+ - [Dataset Structure](#dataset-structure)
31
+ - [Data Instances](#data-instances)
32
+ - [Data Fields](#data-fields)
33
+ - [Data Splits](#data-splits)
34
+ - [Dataset Creation](#dataset-creation)
35
+ - [Curation Rationale](#curation-rationale)
36
+ - [Source Data](#source-data)
37
+ - [Annotations](#annotations)
38
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
39
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
40
+ - [Social Impact of Dataset](#social-impact-of-dataset)
41
+ - [Discussion of Biases](#discussion-of-biases)
42
+ - [Other Known Limitations](#other-known-limitations)
43
+ - [Additional Information](#additional-information)
44
+ - [Dataset Curators](#dataset-curators)
45
+ - [Licensing Information](#licensing-information)
46
+ - [Citation Information](#citation-information)
47
+ - [Contributions](#contributions)
48
+
49
+ ## Dataset Description
50
+
51
+ - **Homepage:** https://github.com/fastai/imagenette
52
+ - **Repository:** https://github.com/fastai/imagenette
53
+ - **Leaderboard:** https://paperswithcode.com/sota/image-classification-on-imagenette
54
+
55
+ ### Dataset Summary
56
+
57
+ A smaller subset of 10 easily classified classes from [Imagenet](https://huggingface.co/datasets/imagenet-1k#dataset-summary), and a little more French.
58
+ This dataset was created by [Jeremy Howard](https://twitter.com/jeremyphoward), and this repository is only there to share his work on this platform. The repository owner takes no credit of any kind in the creation, curation or packaging of the dataset.
59
+
60
+ ### Supported Tasks and Leaderboards
61
+
62
+ - `image-classification`: The dataset can be used to train a model for Image Classification.
63
+
64
+ ### Languages
65
+
66
+ The class labels in the dataset are in English.
67
+
68
+ ## Dataset Structure
69
+
70
+ ### Data Instances
71
+
72
+ A data point comprises an image URL and its classification label.
73
+
74
+ ```
75
+ {
76
+ 'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=320x320 at 0x19FA12186D8>,
77
+ 'label': 'tench',
78
+ }
79
+ ```
80
+
81
+ ### Data Fields
82
+
83
+ - `image`: A `PIL.Image.Image` object containing the image.
84
+ - `label`: the expected class label of the image.
85
+
86
+ ### Data Splits
87
+
88
+ | |train|validation|
89
+ |----------|----:|---------:|
90
+ |imagenette| 9469| 3925|
91
+
92
+
93
+ ## Dataset Creation
94
+
95
+ ### Curation Rationale
96
+
97
+ cf. https://huggingface.co/datasets/imagenet-1k#curation-rationale
98
+
99
+ ### Source Data
100
+
101
+ #### Initial Data Collection and Normalization
102
+
103
+ Imagenette is a subset of [ImageNet](https://huggingface.co/datasets/imagenet-1k). Information about data collection of the source data can be found [here](https://huggingface.co/datasets/imagenet-1k#initial-data-collection-and-normalization).
104
+
105
+ ### Annotations
106
+
107
+ #### Annotation process
108
+
109
+ cf. https://huggingface.co/datasets/imagenet-1k#annotation-process
110
+
111
+ #### Who are the annotators?
112
+
113
+ cf. https://huggingface.co/datasets/imagenet-1k#who-are-the-annotators
114
+
115
+ ### Personal and Sensitive Information
116
+
117
+ cf. https://huggingface.co/datasets/imagenet-1k#personal-and-sensitive-information
118
+
119
+ ## Considerations for Using the Data
120
+
121
+ ### Social Impact of Dataset
122
+
123
+ cf. https://huggingface.co/datasets/imagenet-1k#social-impact-of-dataset
124
+
125
+ ### Discussion of Biases
126
+
127
+ cf. https://huggingface.co/datasets/imagenet-1k#discussion-of-biases
128
+
129
+ ### Other Known Limitations
130
+
131
+ cf. https://huggingface.co/datasets/imagenet-1k#other-known-limitations
132
+
133
+ ## Additional Information
134
+
135
+ ### Dataset Curators
136
+
137
+ cf. https://huggingface.co/datasets/imagenet-1k#dataset-curators
138
+ and Jeremy Howard
139
+
140
+ ### Licensing Information
141
+
142
+ [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
143
+
144
+ ### Citation Information
145
+
146
+ ```
147
+ @software{Howard_Imagenette_2019,
148
+ title={Imagenette: A smaller subset of 10 easily classified classes from Imagenet},
149
+ author={Jeremy Howard},
150
+ year={2019},
151
+ month={March},
152
+ publisher = {GitHub},
153
+ url = {https://github.com/fastai/imagenette}
154
+ }
155
+ ```
156
+
157
+ ### Contributions
158
+
159
+ This dataset was created by [Jeremy Howard](https://twitter.com/jeremyphoward) and published on [Github](https://github.com/fastai/imagenette). It was then only integrated into HuggingFace Datasets by [@frgfm](https://huggingface.co/frgfm).
dataset_infos.json ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "full_size": {
3
+ "description": "Imagenette is a subset of 10 easily classified classes from Imagenet\n(tench, English springer, cassette player, chain saw, church, French\nhorn, garbage truck, gas pump, golf ball, parachute).",
4
+ "citation": "@software{Howard_Imagenette_2019,\ntitle={Imagenette: A smaller subset of 10 easily classified classes from Imagenet},\nauthor={Jeremy Howard},\nyear={2019},\nmonth={March},\npublisher = {GitHub},\nurl = {https://github.com/fastai/imagenette}\n}\n",
5
+ "homepage": "https://github.com/fastai/imagenette",
6
+ "license": "Apache License 2.0",
7
+ "features": {
8
+ "image": {
9
+ "decode": true,
10
+ "id": null,
11
+ "_type": "Image"
12
+ },
13
+ "label": {
14
+ "num_classes": 10,
15
+ "names": ["tench", "English springer", "cassette player", "chain saw", "church", "French horn", "garbage truck", "gas pump", "golf ball", "parachute"],
16
+ "id": null,
17
+ "_type": "ClassLabel"
18
+ }
19
+ },
20
+ "post_processed": null,
21
+ "supervised_keys": null,
22
+ "task_templates": null,
23
+ "builder_name": "imagenette",
24
+ "config_name": "full_size",
25
+ "version": {
26
+ "version_str": "1.0.0",
27
+ "description": null,
28
+ "major": 1,
29
+ "minor": 0,
30
+ "patch": 0
31
+ },
32
+ "splits": {
33
+ "train": {
34
+ "name": "train",
35
+ "num_bytes": 1124364288,
36
+ "num_examples": 9469,
37
+ "dataset_name": "imagenette"
38
+ },
39
+ "validation": {
40
+ "name": "validation",
41
+ "num_bytes": 472133632,
42
+ "num_examples": 3925,
43
+ "dataset_name": "imagenette"
44
+ }
45
+ },
46
+ "download_checksums": {
47
+ "https://s3.amazonaws.com/fast-ai-imageclas/imagenette2.tgz": {
48
+ "num_bytes": 1557161267,
49
+ "checksum": "6cbfac238434d89fe99e651496f0812ebc7a10fa62bd42d6874042bf01de4efd"
50
+ },
51
+ "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata/imagenette2/train.txt": {
52
+ "num_bytes": 461815,
53
+ "checksum": "d126624c5ba676e3fdc3613bf0d6327f7f348000b479a063a0d0512e006c8a8c"
54
+ },
55
+ "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata/imagenette2/val.txt": {
56
+ "num_bytes": 183482,
57
+ "checksum": "f60a82dee593b3f06e92b6682c62c3c5663700f6ec4a10b9821be1b0393b2411"
58
+ }
59
+ },
60
+ "download_size": 1557806564,
61
+ "post_processing_size": null,
62
+ "dataset_size": 1597734912,
63
+ "size_in_bytes": 1597734912
64
+ },
65
+ "320px": {
66
+ "description": "Imagenette is a subset of 10 easily classified classes from Imagenet\n(tench, English springer, cassette player, chain saw, church, French\nhorn, garbage truck, gas pump, golf ball, parachute).",
67
+ "citation": "@software{Howard_Imagenette_2019,\ntitle={Imagenette: A smaller subset of 10 easily classified classes from Imagenet},\nauthor={Jeremy Howard},\nyear={2019},\nmonth={March},\npublisher = {GitHub},\nurl = {https://github.com/fastai/imagenette}\n}\n",
68
+ "homepage": "https://github.com/fastai/imagenette",
69
+ "license": "Apache License 2.0",
70
+ "features": {
71
+ "image": {
72
+ "decode": true,
73
+ "id": null,
74
+ "_type": "Image"
75
+ },
76
+ "label": {
77
+ "num_classes": 10,
78
+ "names": ["tench", "English springer", "cassette player", "chain saw", "church", "French horn", "garbage truck", "gas pump", "golf ball", "parachute"],
79
+ "id": null,
80
+ "_type": "ClassLabel"
81
+ }
82
+ },
83
+ "post_processed": null,
84
+ "supervised_keys": null,
85
+ "task_templates": null,
86
+ "builder_name": "imagenette",
87
+ "config_name": "320px",
88
+ "version": {
89
+ "version_str": "1.0.0",
90
+ "description": null,
91
+ "major": 1,
92
+ "minor": 0,
93
+ "patch": 0
94
+ },
95
+ "splits": {
96
+ "train": {
97
+ "name": "train",
98
+ "num_bytes": 265355264,
99
+ "num_examples": 9469,
100
+ "dataset_name": "imagenette"
101
+ },
102
+ "validation": {
103
+ "name": "validation",
104
+ "num_bytes": 110903296,
105
+ "num_examples": 3925,
106
+ "dataset_name": "imagenette"
107
+ }
108
+ },
109
+ "download_checksums": {
110
+ "https://s3.amazonaws.com/fast-ai-imageclas/imagenette2-320.tgz": {
111
+ "num_bytes": 341663724,
112
+ "checksum": "569b4497c98db6dd29f335d1f109cf315fe127053cedf69010d047f0188e158c"
113
+ },
114
+ "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata/imagenette2-320/train.txt": {
115
+ "num_bytes": 499691,
116
+ "checksum": "d424983637a53416a00724192ccd1fb368e98ad323dec7d4228cda8d3bf7f8df"
117
+ },
118
+ "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata/imagenette2-320/val.txt": {
119
+ "num_bytes": 199182,
120
+ "checksum": "0573e89b8aed5a9eb990f07cface4e97c6220f9de46e31a884a37e4af3e6d83a"
121
+ }
122
+ },
123
+ "download_size": 342362597,
124
+ "post_processing_size": null,
125
+ "dataset_size": 377495552,
126
+ "size_in_bytes": 377495552
127
+ },
128
+ "160px": {
129
+ "description": "Imagenette is a subset of 10 easily classified classes from Imagenet\n(tench, English springer, cassette player, chain saw, church, French\nhorn, garbage truck, gas pump, golf ball, parachute).",
130
+ "citation": "@software{Howard_Imagenette_2019,\ntitle={Imagenette: A smaller subset of 10 easily classified classes from Imagenet},\nauthor={Jeremy Howard},\nyear={2019},\nmonth={March},\npublisher = {GitHub},\nurl = {https://github.com/fastai/imagenette}\n}\n",
131
+ "homepage": "https://github.com/fastai/imagenette",
132
+ "license": "Apache License 2.0",
133
+ "features": {
134
+ "image": {
135
+ "decode": true,
136
+ "id": null,
137
+ "_type": "Image"
138
+ },
139
+ "label": {
140
+ "num_classes": 10,
141
+ "names": ["tench", "English springer", "cassette player", "chain saw", "church", "French horn", "garbage truck", "gas pump", "golf ball", "parachute"],
142
+ "id": null,
143
+ "_type": "ClassLabel"
144
+ }
145
+ },
146
+ "post_processed": null,
147
+ "supervised_keys": null,
148
+ "task_templates": null,
149
+ "builder_name": "imagenette",
150
+ "config_name": "160px",
151
+ "version": {
152
+ "version_str": "1.0.0",
153
+ "description": null,
154
+ "major": 1,
155
+ "minor": 0,
156
+ "patch": 0
157
+ },
158
+ "splits": {
159
+ "train": {
160
+ "name": "train",
161
+ "num_bytes": 94937088,
162
+ "num_examples": 9469,
163
+ "dataset_name": "imagenette"
164
+ },
165
+ "validation": {
166
+ "name": "validation",
167
+ "num_bytes": 39583744,
168
+ "num_examples": 3925,
169
+ "dataset_name": "imagenette"
170
+ }
171
+ },
172
+ "download_checksums": {
173
+ "https://s3.amazonaws.com/fast-ai-imageclas/imagenette2-160.tgz": {
174
+ "num_bytes": 99003388,
175
+ "checksum": "64d0c4859f35a461889e0147755a999a48b49bf38a7e0f9bd27003f10db02fe5"
176
+ },
177
+ "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata/imagenette2-160/train.txt": {
178
+ "num_bytes": 499691,
179
+ "checksum": "971de5a44d69360ebb362bc104887995be67e4cdefdec3d2c51762073b549967"
180
+ },
181
+ "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata/imagenette2-160/val.txt": {
182
+ "num_bytes": 199182,
183
+ "checksum": "fb0f7c7d9eb125e0fb69d30fc3a2da29d836b080c0a3f61f9e59a09f65ce0221"
184
+ }
185
+ },
186
+ "download_size": 99702261,
187
+ "post_processing_size": null,
188
+ "dataset_size": 135766016,
189
+ "size_in_bytes": 135766016
190
+ }
191
+ }
imagenette.py ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2022, François-Guillaume Fernandez.
2
+
3
+ # This program is licensed under the Apache License 2.0.
4
+ # See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
5
+
6
+ """Imagenette dataset."""
7
+
8
+ import os
9
+ import json
10
+
11
+ import datasets
12
+
13
+
14
+ _HOMEPAGE = "https://github.com/fastai/imagenette"
15
+
16
+ _LICENSE = "Apache License 2.0"
17
+
18
+ _CITATION = """\
19
+ @software{Howard_Imagenette_2019,
20
+ title={Imagenette: A smaller subset of 10 easily classified classes from Imagenet},
21
+ author={Jeremy Howard},
22
+ year={2019},
23
+ month={March},
24
+ publisher = {GitHub},
25
+ url = {https://github.com/fastai/imagenette}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ Imagenette is a subset of 10 easily classified classes from Imagenet
31
+ (tench, English springer, cassette player, chain saw, church, French
32
+ horn, garbage truck, gas pump, golf ball, parachute).
33
+ """
34
+
35
+ _LABEL_MAP = [
36
+ 'n01440764',
37
+ 'n02102040',
38
+ 'n02979186',
39
+ 'n03000684',
40
+ 'n03028079',
41
+ 'n03394916',
42
+ 'n03417042',
43
+ 'n03425413',
44
+ 'n03445777',
45
+ 'n03888257',
46
+ ]
47
+
48
+ _REPO = "https://huggingface.co/datasets/frgfm/imagenette/resolve/main/metadata"
49
+
50
+
51
+ class ImagenetteConfig(datasets.BuilderConfig):
52
+ """BuilderConfig for Imagette."""
53
+
54
+ def __init__(self, data_url, metadata_urls, **kwargs):
55
+ """BuilderConfig for Imagette.
56
+ Args:
57
+ data_url: `string`, url to download the zip file from.
58
+ matadata_urls: dictionary with keys 'train' and 'validation' containing the archive metadata URLs
59
+ **kwargs: keyword arguments forwarded to super.
60
+ """
61
+ super(ImagenetteConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
62
+ self.data_url = data_url
63
+ self.metadata_urls = metadata_urls
64
+
65
+
66
+ class Imagenette(datasets.GeneratorBasedBuilder):
67
+ """Imagenette dataset."""
68
+
69
+ BUILDER_CONFIGS = [
70
+ ImagenetteConfig(
71
+ name="full_size",
72
+ description="All images are in their original size.",
73
+ data_url="https://s3.amazonaws.com/fast-ai-imageclas/imagenette2.tgz",
74
+ metadata_urls={
75
+ "train": f"{_REPO}/imagenette2/train.txt",
76
+ "validation": f"{_REPO}/imagenette2/val.txt",
77
+ },
78
+ ),
79
+ ImagenetteConfig(
80
+ name="320px",
81
+ description="All images were resized on their shortest side to 320 pixels.",
82
+ data_url="https://s3.amazonaws.com/fast-ai-imageclas/imagenette2-320.tgz",
83
+ metadata_urls={
84
+ "train": f"{_REPO}/imagenette2-320/train.txt",
85
+ "validation": f"{_REPO}/imagenette2-320/val.txt",
86
+ },
87
+ ),
88
+ ImagenetteConfig(
89
+ name="160px",
90
+ description="All images were resized on their shortest side to 160 pixels.",
91
+ data_url="https://s3.amazonaws.com/fast-ai-imageclas/imagenette2-160.tgz",
92
+ metadata_urls={
93
+ "train": f"{_REPO}/imagenette2-160/train.txt",
94
+ "validation": f"{_REPO}/imagenette2-160/val.txt",
95
+ },
96
+ ),
97
+ ]
98
+
99
+ def _info(self):
100
+ return datasets.DatasetInfo(
101
+ description=_DESCRIPTION + self.config.description,
102
+ features=datasets.Features(
103
+ {
104
+ "image": datasets.Image(),
105
+ "label": datasets.ClassLabel(
106
+ names=[
107
+ "tench",
108
+ "English springer",
109
+ "cassette player",
110
+ "chain saw",
111
+ "church",
112
+ "French horn",
113
+ "garbage truck",
114
+ "gas pump",
115
+ "golf ball",
116
+ "parachute",
117
+ ]
118
+ ),
119
+ }
120
+ ),
121
+ supervised_keys=None,
122
+ homepage=_HOMEPAGE,
123
+ license=_LICENSE,
124
+ citation=_CITATION,
125
+ )
126
+
127
+ def _split_generators(self, dl_manager):
128
+ archive_path = dl_manager.download(self.config.data_url)
129
+ metadata_paths = dl_manager.download(self.config.metadata_urls)
130
+ archive_iter = dl_manager.iter_archive(archive_path)
131
+ return [
132
+ datasets.SplitGenerator(
133
+ name=datasets.Split.TRAIN,
134
+ gen_kwargs={
135
+ "images": archive_iter,
136
+ "metadata_path": metadata_paths["train"],
137
+ },
138
+ ),
139
+ datasets.SplitGenerator(
140
+ name=datasets.Split.VALIDATION,
141
+ gen_kwargs={
142
+ "images": archive_iter,
143
+ "metadata_path": metadata_paths["validation"],
144
+ },
145
+ ),
146
+ ]
147
+
148
+ def _generate_examples(self, images, metadata_path):
149
+ with open(metadata_path, encoding="utf-8") as f:
150
+ files_to_keep = set(f.read().split("\n"))
151
+ idx = 0
152
+ for file_path, file_obj in images:
153
+ if file_path in files_to_keep:
154
+ label = _LABEL_MAP.index(file_path.split("/")[-2])
155
+ yield idx, {
156
+ "image": {"path": file_path, "bytes": file_obj.read()},
157
+ "label": label,
158
+ }
159
+ idx += 1