From 87101c9b51d5cc254bfb59f62e025599df97de24 Mon Sep 17 00:00:00 2001 From: Piotr Czarnik Date: Fri, 31 May 2024 16:07:37 +0200 Subject: [PATCH] Add citations, alias FMNIST for FashionMNIST --- mnists/__init__.py | 2 + mnists/_emnist.py | 105 +++++++++++++++++++++++++++++++++++++++++++++ mnists/_mnist.py | 56 +++++++++++++++++++++++- 3 files changed, 161 insertions(+), 2 deletions(-) diff --git a/mnists/__init__.py b/mnists/__init__.py index 98b4510..51cf387 100644 --- a/mnists/__init__.py +++ b/mnists/__init__.py @@ -44,4 +44,6 @@ from ._emnist import EMNIST from ._mnist import KMNIST, MNIST, FashionMNIST +FMNIST = FashionMNIST + __version__ = "0.3.0" diff --git a/mnists/_emnist.py b/mnists/_emnist.py index aa48eab..aa8ed12 100644 --- a/mnists/_emnist.py +++ b/mnists/_emnist.py @@ -27,6 +27,16 @@ class EMNIST(MNIST): >>> letters.train_images().dtype dtype('uint8') + Citation + -------- + @article{cohen2017emnist, + title={EMNIST: an extension of MNIST to handwritten letters}, + author={Gregory Cohen and Saeed Afshar and Jonathan Tapson and André van Schaik}, + year={2017}, + eprint={1702.05373}, + archivePrefix={arXiv}, + primaryClass={cs.CV} + } """ mirrors = [ @@ -194,6 +204,25 @@ class Balanced(_Split): Directory where all files exist or will be downloaded. zip_filepath : str Zip file from which dataset will be extracted. + + Usage + ----- + >>> from mnists import EMNIST + >>> emnist = EMNIST() + >>> balanced = emnist.Balanced() + >>> balanced.train_images().dtype + dtype('uint8') + + Citation + -------- + @article{cohen2017emnist, + title={EMNIST: an extension of MNIST to handwritten letters}, + author={Gregory Cohen and Saeed Afshar and Jonathan Tapson and André van Schaik}, + year={2017}, + eprint={1702.05373}, + archivePrefix={arXiv}, + primaryClass={cs.CV} + } """ resources = { @@ -227,6 +256,25 @@ class ByClass(_Split): Directory where all files exist or will be downloaded. zip_filepath : str Zip file from which dataset will be extracted. + + Usage + ----- + >>> from mnists import EMNIST + >>> emnist = EMNIST() + >>> byclass = emnist.ByClass() + >>> byclass.train_images().dtype + dtype('uint8') + + Citation + -------- + @article{cohen2017emnist, + title={EMNIST: an extension of MNIST to handwritten letters}, + author={Gregory Cohen and Saeed Afshar and Jonathan Tapson and André van Schaik}, + year={2017}, + eprint={1702.05373}, + archivePrefix={arXiv}, + primaryClass={cs.CV} + } """ resources = { @@ -260,6 +308,25 @@ class ByMerge(_Split): Directory where all files exist or will be downloaded. zip_filepath : str Zip file from which dataset will be extracted. + + Usage + ----- + >>> from mnists import EMNIST + >>> emnist = EMNIST() + >>> bymerge = emnist.ByMerge() + >>> bymerge.train_images().dtype + dtype('uint8') + + Citation + -------- + @article{cohen2017emnist, + title={EMNIST: an extension of MNIST to handwritten letters}, + author={Gregory Cohen and Saeed Afshar and Jonathan Tapson and André van Schaik}, + year={2017}, + eprint={1702.05373}, + archivePrefix={arXiv}, + primaryClass={cs.CV} + } """ resources = { @@ -293,6 +360,25 @@ class Digits(_Split): Directory where all files exist or will be downloaded. zip_filepath : str Zip file from which dataset will be extracted. + + Usage + ----- + >>> from mnists import EMNIST + >>> emnist = EMNIST() + >>> digits = emnist.Digits() + >>> digits.train_images().dtype + dtype('uint8') + + Citation + -------- + @article{cohen2017emnist, + title={EMNIST: an extension of MNIST to handwritten letters}, + author={Gregory Cohen and Saeed Afshar and Jonathan Tapson and André van Schaik}, + year={2017}, + eprint={1702.05373}, + archivePrefix={arXiv}, + primaryClass={cs.CV} + } """ resources = { @@ -326,6 +412,25 @@ class Letters(_Split): Directory where all files exist or will be downloaded. zip_filepath : str Zip file from which dataset will be extracted. + + Usage + ----- + >>> from mnists import EMNIST + >>> emnist = EMNIST() + >>> letters = emnist.Letters() + >>> letters.train_images().dtype + dtype('uint8') + + Citation + -------- + @article{cohen2017emnist, + title={EMNIST: an extension of MNIST to handwritten letters}, + author={Gregory Cohen and Saeed Afshar and Jonathan Tapson and André van Schaik}, + year={2017}, + eprint={1702.05373}, + archivePrefix={arXiv}, + primaryClass={cs.CV} + } """ resources = { diff --git a/mnists/_mnist.py b/mnists/_mnist.py index af2454f..bc2b291 100644 --- a/mnists/_mnist.py +++ b/mnists/_mnist.py @@ -25,8 +25,8 @@ class MNIST: resources : dict[str, tuple[str, str]] Dictionary of data files with filename and md5 hash. - Example usage - ------------- + Usage + ----- >>> from mnists import MNIST >>> mnist = MNIST() >>> type(mnist.train_images()) @@ -46,6 +46,18 @@ class MNIST: >>> mnist.test_labels().shape (10000,) + Citation + -------- + @article{lecun-98, + author={Lecun, Y. and Bottou, L. and Bengio, Y. and Haffner, P.}, + journal={Proceedings of the IEEE}, + title={Gradient-based learning applied to document recognition}, + year={1998}, + volume={86}, + number={11}, + pages={2278-2324}, + doi={10.1109/5.726791} + } """ classes = [ @@ -189,6 +201,26 @@ class FashionMNIST(MNIST): List of urls where dataset is hosted. resources : dict[str, tuple[str, str]] Dictionary of data files with filename and md5 hash. + + Usage + ----- + >>> from mnists import FashionMNIST + >>> fmnist = FashionMNIST() + >>> fmnist.train_images().dtype + dtype('uint8') + + Citation + -------- + @online{xiao2017/online, + author = {Han Xiao and Kashif Rasul and Roland Vollgraf}, + title = {Fashion-MNIST: a Novel Image Dataset for Benchmarking + Machine Learning Algorithms}, + date = {2017-08-28}, + year = {2017}, + eprintclass = {cs.LG}, + eprinttype = {arXiv}, + eprint = {cs.LG/1708.07747}, + } """ classes = [ @@ -243,6 +275,26 @@ class KMNIST(MNIST): List of urls where dataset is hosted. resources : dict[str, tuple[str, str]] Dictionary of data files with filename and md5 hash. + + Usage + ----- + >>> from mnists import KMNIST + >>> kmnist = KMNIST() + >>> kmnist.train_images().dtype + dtype('uint8') + + Citation + -------- + @online{clanuwat2018deep, + author = {Tarin Clanuwat and Mikel Bober-Irizar and Asanobu Kitamoto + and Alex Lamb and Kazuaki Yamamoto and David Ha}, + title = {Deep Learning for Classical Japanese Literature}, + date = {2018-12-03}, + year = {2018}, + eprintclass = {cs.CV}, + eprinttype = {arXiv}, + eprint = {cs.CV/1812.01718}, + } """ classes = [