system HF staff commited on
Commit
0e5372b
1 Parent(s): c43b7b8

Update files from the datasets library (from 1.17.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.17.0

Files changed (3) hide show
  1. README.md +8 -1
  2. dataset_infos.json +1 -1
  3. fashion_mnist.py +18 -16
README.md CHANGED
@@ -69,9 +69,16 @@ Fashion-MNIST is a dataset of Zalando's article images—consisting of a trainin
69
 
70
  A data point comprises an image and its label.
71
 
 
 
 
 
 
 
 
72
  ### Data Fields
73
 
74
- - `image`: a 2d array of integers representing the 28x28 image.
75
  - `label`: an integer between 0 and 9 representing the classes with the following mapping:
76
  | Label | Description |
77
  | --- | --- |
69
 
70
  A data point comprises an image and its label.
71
 
72
+ ```
73
+ {
74
+ 'image': <PIL.PngImagePlugin.PngImageFile image mode=L size=28x28 at 0x27601169DD8>,
75
+ 'label': 9
76
+ }
77
+ ```
78
+
79
  ### Data Fields
80
 
81
+ - `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]`.
82
  - `label`: an integer between 0 and 9 representing the classes with the following mapping:
83
  | Label | Description |
84
  | --- | --- |
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"fashion_mnist": {"description": "Fashion-MNIST is a dataset of Zalando's article images\u2014consisting of a training set of \n60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, \nassociated with a label from 10 classes. We intend Fashion-MNIST to serve as a direct drop-in \nreplacement for the original MNIST dataset for benchmarking machine learning algorithms. \nIt shares the same image size and structure of training and testing splits.\n", "citation": "@article{DBLP:journals/corr/abs-1708-07747,\n author = {Han Xiao and\n Kashif Rasul and\n Roland Vollgraf},\n title = {Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning\n Algorithms},\n journal = {CoRR},\n volume = {abs/1708.07747},\n year = {2017},\n url = {http://arxiv.org/abs/1708.07747},\n archivePrefix = {arXiv},\n eprint = {1708.07747},\n timestamp = {Mon, 13 Aug 2018 16:47:27 +0200},\n biburl = {https://dblp.org/rec/bib/journals/corr/abs-1708-07747},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n", "homepage": "https://github.com/zalandoresearch/fashion-mnist", "license": "", "features": {"image": {"shape": [28, 28], "dtype": "uint8", "id": null, "_type": "Array2D"}, "label": {"num_classes": 10, "names": ["T - shirt / top", "Trouser", "Pullover", "Dress", "Coat", "Sandal", "Shirt", "Sneaker", "Bag", "Ankle boot"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "image", "output": "label"}, "builder_name": "fashion_mnist", "config_name": "fashion_mnist", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 54480048, "num_examples": 60000, "dataset_name": "fashion_mnist"}, "test": {"name": "test", "num_bytes": 9080008, "num_examples": 10000, "dataset_name": "fashion_mnist"}}, "download_checksums": {"https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/train-images-idx3-ubyte.gz": {"num_bytes": 26421880, "checksum": "3aede38d61863908ad78613f6a32ed271626dd12800ba2636569512369268a84"}, "https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/train-labels-idx1-ubyte.gz": {"num_bytes": 29515, "checksum": "a04f17134ac03560a47e3764e11b92fc97de4d1bfaf8ba1a3aa29af54cc90845"}, "https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/t10k-images-idx3-ubyte.gz": {"num_bytes": 4422102, "checksum": "346e55b948d973a97e58d2351dde16a484bd415d4595297633bb08f03db6a073"}, "https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/t10k-labels-idx1-ubyte.gz": {"num_bytes": 5148, "checksum": "67da17c76eaffca5446c3361aaab5c3cd6d1c2608764d35dfb1850b086bf8dd5"}}, "download_size": 30878645, "post_processing_size": null, "dataset_size": 63560056, "size_in_bytes": 94438701}}
1
+ {"fashion_mnist": {"description": "Fashion-MNIST is a dataset of Zalando's article images\u2014consisting of a training set of\n60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image,\nassociated with a label from 10 classes. We intend Fashion-MNIST to serve as a direct drop-in\nreplacement for the original MNIST dataset for benchmarking machine learning algorithms.\nIt shares the same image size and structure of training and testing splits.\n", "citation": "@article{DBLP:journals/corr/abs-1708-07747,\n author = {Han Xiao and\n Kashif Rasul and\n Roland Vollgraf},\n title = {Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning\n Algorithms},\n journal = {CoRR},\n volume = {abs/1708.07747},\n year = {2017},\n url = {http://arxiv.org/abs/1708.07747},\n archivePrefix = {arXiv},\n eprint = {1708.07747},\n timestamp = {Mon, 13 Aug 2018 16:47:27 +0200},\n biburl = {https://dblp.org/rec/bib/journals/corr/abs-1708-07747},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n", "homepage": "https://github.com/zalandoresearch/fashion-mnist", "license": "", "features": {"image": {"id": null, "_type": "Image"}, "label": {"num_classes": 10, "names": ["T - shirt / top", "Trouser", "Pullover", "Dress", "Coat", "Sandal", "Shirt", "Sneaker", "Bag", "Ankle boot"], "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": ["Ankle boot", "Bag", "Coat", "Dress", "Pullover", "Sandal", "Shirt", "Sneaker", "T - shirt / top", "Trouser"]}], "builder_name": "fashion_mnist", "config_name": "fashion_mnist", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 31296655, "num_examples": 60000, "dataset_name": "fashion_mnist"}, "test": {"name": "test", "num_bytes": 5233818, "num_examples": 10000, "dataset_name": "fashion_mnist"}}, "download_checksums": {"https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/train-images-idx3-ubyte.gz": {"num_bytes": 26421880, "checksum": "3aede38d61863908ad78613f6a32ed271626dd12800ba2636569512369268a84"}, "https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/train-labels-idx1-ubyte.gz": {"num_bytes": 29515, "checksum": "a04f17134ac03560a47e3764e11b92fc97de4d1bfaf8ba1a3aa29af54cc90845"}, "https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/t10k-images-idx3-ubyte.gz": {"num_bytes": 4422102, "checksum": "346e55b948d973a97e58d2351dde16a484bd415d4595297633bb08f03db6a073"}, "https://github.com/zalandoresearch/fashion-mnist/raw/master/data/fashion/t10k-labels-idx1-ubyte.gz": {"num_bytes": 5148, "checksum": "67da17c76eaffca5446c3361aaab5c3cd6d1c2608764d35dfb1850b086bf8dd5"}}, "download_size": 30878645, "post_processing_size": null, "dataset_size": 36530473, "size_in_bytes": 67409118}}
fashion_mnist.py CHANGED
@@ -22,6 +22,7 @@ import struct
22
  import numpy as np
23
 
24
  import datasets
 
25
 
26
 
27
  _CITATION = """\
@@ -62,6 +63,19 @@ _URLS = {
62
  "test_labels": "t10k-labels-idx1-ubyte.gz",
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  class FashionMnist(datasets.GeneratorBasedBuilder):
67
  """FashionMNIST Data Set"""
@@ -79,26 +93,14 @@ class FashionMnist(datasets.GeneratorBasedBuilder):
79
  description=_DESCRIPTION,
80
  features=datasets.Features(
81
  {
82
- "image": datasets.Array2D(shape=(28, 28), dtype="uint8"),
83
- "label": datasets.features.ClassLabel(
84
- names=[
85
- "T - shirt / top",
86
- "Trouser",
87
- "Pullover",
88
- "Dress",
89
- "Coat",
90
- "Sandal",
91
- "Shirt",
92
- "Sneaker",
93
- "Bag",
94
- "Ankle boot",
95
- ]
96
- ),
97
  }
98
  ),
99
  supervised_keys=("image", "label"),
100
- homepage="https://github.com/zalandoresearch/fashion-mnist",
101
  citation=_CITATION,
 
102
  )
103
 
104
  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 = """\
63
  "test_labels": "t10k-labels-idx1-ubyte.gz",
64
  }
65
 
66
+ _NAMES = [
67
+ "T - shirt / top",
68
+ "Trouser",
69
+ "Pullover",
70
+ "Dress",
71
+ "Coat",
72
+ "Sandal",
73
+ "Shirt",
74
+ "Sneaker",
75
+ "Bag",
76
+ "Ankle boot",
77
+ ]
78
+
79
 
80
  class FashionMnist(datasets.GeneratorBasedBuilder):
81
  """FashionMNIST Data Set"""
93
  description=_DESCRIPTION,
94
  features=datasets.Features(
95
  {
96
+ "image": datasets.Image(),
97
+ "label": datasets.features.ClassLabel(names=_NAMES),
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
  ),
100
  supervised_keys=("image", "label"),
101
+ homepage=_HOMEPAGE,
102
  citation=_CITATION,
103
+ task_templates=[ImageClassification(image_column="image", label_column="label", labels=_NAMES)],
104
  )
105
 
106
  def _split_generators(self, dl_manager):