Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
10K<n<100K
License:
Update files from the datasets library (from 1.17.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.17.0
- README.md +10 -3
- dataset_infos.json +1 -1
- mnist.py +9 -1
README.md
CHANGED
|
@@ -69,12 +69,19 @@ English
|
|
| 69 |
|
| 70 |
### Data Instances
|
| 71 |
|
| 72 |
-
A data point comprises an image and its label
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
### Data Fields
|
| 75 |
|
| 76 |
-
- image: a
|
| 77 |
-
- label
|
| 78 |
|
| 79 |
### Data Splits
|
| 80 |
|
|
|
|
| 69 |
|
| 70 |
### Data Instances
|
| 71 |
|
| 72 |
+
A data point comprises an image and its label:
|
| 73 |
+
|
| 74 |
+
```
|
| 75 |
+
{
|
| 76 |
+
'image': <PIL.PngImagePlugin.PngImageFile image mode=L size=28x28 at 0x276021F6DD8>,
|
| 77 |
+
'label': 5
|
| 78 |
+
}
|
| 79 |
+
```
|
| 80 |
|
| 81 |
### Data Fields
|
| 82 |
|
| 83 |
+
- `image`: A `PIL.Image.Image` object containing the 28x28 image. Note that when accessing the image column: `dataset[0]["image"]` the image file is automatically decoded. Decoding of a large number of image files might take a significant amount of time. Thus it is important to first query the sample index before the `"image"` column, *i.e.* `dataset[0]["image"]` should **always** be preferred over `dataset["image"][0]`
|
| 84 |
+
- `label`: an integer between 0 and 9 representing the digit.
|
| 85 |
|
| 86 |
### Data Splits
|
| 87 |
|
dataset_infos.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"mnist": {"description": "The MNIST dataset consists of 70,000 28x28 black-and-white images in 10 classes (one for each digits), with 7,000\nimages per class. There are 60,000 training images and 10,000 test images.\n", "citation": "@article{lecun2010mnist,\n title={MNIST handwritten digit database},\n author={LeCun, Yann and Cortes, Corinna and Burges, CJ},\n journal={ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist},\n volume={2},\n year={2010}\n}\n", "homepage": "http://yann.lecun.com/exdb/mnist/", "license": "", "features": {"image": {"
|
|
|
|
| 1 |
+
{"mnist": {"description": "The MNIST dataset consists of 70,000 28x28 black-and-white images in 10 classes (one for each digits), with 7,000\nimages per class. There are 60,000 training images and 10,000 test images.\n", "citation": "@article{lecun2010mnist,\n title={MNIST handwritten digit database},\n author={LeCun, Yann and Cortes, Corinna and Burges, CJ},\n journal={ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist},\n volume={2},\n year={2010}\n}\n", "homepage": "http://yann.lecun.com/exdb/mnist/", "license": "", "features": {"image": {"id": null, "_type": "Image"}, "label": {"num_classes": 10, "names": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "image", "output": "label"}, "task_templates": [{"task": "image-classification", "image_column": "image", "label_column": "label", "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]}], "builder_name": "mnist", "config_name": "mnist", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 17470848, "num_examples": 60000, "dataset_name": "mnist"}, "test": {"name": "test", "num_bytes": 2916440, "num_examples": 10000, "dataset_name": "mnist"}}, "download_checksums": {"https://storage.googleapis.com/cvdf-datasets/mnist/train-images-idx3-ubyte.gz": {"num_bytes": 9912422, "checksum": "440fcabf73cc546fa21475e81ea370265605f56be210a4024d2ca8f203523609"}, "https://storage.googleapis.com/cvdf-datasets/mnist/train-labels-idx1-ubyte.gz": {"num_bytes": 28881, "checksum": "3552534a0a558bbed6aed32b30c495cca23d567ec52cac8be1a0730e8010255c"}, "https://storage.googleapis.com/cvdf-datasets/mnist/t10k-images-idx3-ubyte.gz": {"num_bytes": 1648877, "checksum": "8d422c7b0a1c1c79245a5bcf07fe86e33eeafee792b84584aec276f5a2dbc4e6"}, "https://storage.googleapis.com/cvdf-datasets/mnist/t10k-labels-idx1-ubyte.gz": {"num_bytes": 4542, "checksum": "f7ae60f92e00ec6debd23a6088c31dbd2371eca3ffa0defaefb259924204aec6"}}, "download_size": 11594722, "post_processing_size": null, "dataset_size": 20387288, "size_in_bytes": 31982010}}
|
mnist.py
CHANGED
|
@@ -22,6 +22,7 @@ import struct
|
|
| 22 |
import numpy as np
|
| 23 |
|
| 24 |
import datasets
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
_CITATION = """\
|
|
@@ -64,13 +65,20 @@ class MNIST(datasets.GeneratorBasedBuilder):
|
|
| 64 |
description=_DESCRIPTION,
|
| 65 |
features=datasets.Features(
|
| 66 |
{
|
| 67 |
-
"image": datasets.
|
| 68 |
"label": datasets.features.ClassLabel(names=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]),
|
| 69 |
}
|
| 70 |
),
|
| 71 |
supervised_keys=("image", "label"),
|
| 72 |
homepage="http://yann.lecun.com/exdb/mnist/",
|
| 73 |
citation=_CITATION,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
)
|
| 75 |
|
| 76 |
def _split_generators(self, dl_manager):
|
|
|
|
| 22 |
import numpy as np
|
| 23 |
|
| 24 |
import datasets
|
| 25 |
+
from datasets.tasks import ImageClassification
|
| 26 |
|
| 27 |
|
| 28 |
_CITATION = """\
|
|
|
|
| 65 |
description=_DESCRIPTION,
|
| 66 |
features=datasets.Features(
|
| 67 |
{
|
| 68 |
+
"image": datasets.Image(),
|
| 69 |
"label": datasets.features.ClassLabel(names=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]),
|
| 70 |
}
|
| 71 |
),
|
| 72 |
supervised_keys=("image", "label"),
|
| 73 |
homepage="http://yann.lecun.com/exdb/mnist/",
|
| 74 |
citation=_CITATION,
|
| 75 |
+
task_templates=[
|
| 76 |
+
ImageClassification(
|
| 77 |
+
image_column="image",
|
| 78 |
+
label_column="label",
|
| 79 |
+
labels=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
| 80 |
+
)
|
| 81 |
+
],
|
| 82 |
)
|
| 83 |
|
| 84 |
def _split_generators(self, dl_manager):
|