ππ Additional datasets for tensorflow.keras
Powered by MachineCurve at www.machinecurve.com π
Hi there, and welcome to the extra-keras-datasets
module! This extension to the original tensorflow.keras.datasets
module offers easy access to additional datasets, in ways almost equal to how you're currently importing them.
The extra-keras-datasets
module is not affiliated, associated, authorized, endorsed by, or in any way officially connected with TensorFlow, Keras, or any of its subsidiaries or its affiliates. The official TensorFlow and Keras websites can be found at https://www.tensorflow.org/ and https://keras.io/.
The names TensorFlow, Keras, as well as related names, marks, emblems and images are registered trademarks of their respective owners.
Make sure to install TensorFlow!
This package makes use of the TensorFlow 2.x package and specifically tensorflow.keras
. Therefore, make sure to install TensorFlow - you can do so in the following way:
pip install tensorflow
Installing is really easy, and can be done with PIP: pip install extra-keras-datasets
. The package depends on numpy
, scipy
, pandas
and scikit-learn
, which will be automatically installed.
Extended MNIST (EMNIST) contains digits as well as uppercase and lowercase handwritten letters. EMNIST-Balanced
contains 131.600 characters across 47 balanced classes.
from extra_keras_datasets import emnist
(input_train, target_train), (input_test, target_test) = emnist.load_data(type='balanced')
Extended MNIST (EMNIST) contains digits as well as uppercase and lowercase handwritten letters. EMNIST-ByClass
contains 814.255 characters across 62 unbalanced classes.
from extra_keras_datasets import emnist
(input_train, target_train), (input_test, target_test) = emnist.load_data(type='byclass')
Extended MNIST (EMNIST) contains digits as well as uppercase and lowercase handwritten letters. EMNIST-ByMerge
contains 814.255 characters across 47 unbalanced classes.
from extra_keras_datasets import emnist
(input_train, target_train), (input_test, target_test) = emnist.load_data(type='bymerge')
Extended MNIST (EMNIST) contains digits as well as uppercase and lowercase handwritten letters. EMNIST-Digits
contains 280.000 characters across 10 balanced classes (digits only).
from extra_keras_datasets import emnist
(input_train, target_train), (input_test, target_test) = emnist.load_data(type='digits')
Extended MNIST (EMNIST) contains digits as well as uppercase and lowercase handwritten letters. EMNIST-Letters
contains 145.600 characters across 26 balanced classes (letters only).
from extra_keras_datasets import emnist
(input_train, target_train), (input_test, target_test) = emnist.load_data(type='letters')
Extended MNIST (EMNIST) contains digits as well as uppercase and lowercase handwritten letters. EMNIST-MNIST
contains 70.000 characters across 10 balanced classes (equal to keras.datasets.mnist
).
from extra_keras_datasets import emnist
(input_train, target_train), (input_test, target_test) = emnist.load_data(type='mnist')
Kuzushiji-MNIST is a drop-in replacement for the MNIST dataset: it contains 70.000 28x28 grayscale images of Japanese Kuzushiji characters.
from extra_keras_datasets import kmnist
(input_train, target_train), (input_test, target_test) = kmnist.load_data(type='kmnist')
Kuzushiji-49 extends Kuzushiji-MNIST and contains 270.912 images across 49 classes.
from extra_keras_datasets import kmnist
(input_train, target_train), (input_test, target_test) = kmnist.load_data(type='k49')
The Street View House Numbers dataset (SVHN) contains 32x32 cropped images of house numbers obtained from Google Street View. There are 73.257 digits for training and 26.032 digits for testing. Noncommercial use is allowed only: see the SVHN website for more information.
from extra_keras_datasets import svhn
(input_train, target_train), (input_test, target_test) = svhn.load_data(type='normal')
SVHN-Extra extends SVHN-Normal with 531.131 less difficult samples and contains a total of 604.388 digits for training and 26.032 digits for testing. Noncommercial use is allowed only: see the SVHN website for more information.
from extra_keras_datasets import svhn
(input_train, target_train), (input_test, target_test) = svhn.load_data(type='extra')
The STL-10 dataset is an image recognition dataset for developing unsupervised feature learning, deep learning, self-taught learning algorithms. It contains 5.000 training images and 8.000 testing images, and represents 10 classes in total (airplane, bird, car, cat, deer, dog, horse, monkey, ship, truck).
from extra_keras_datasets import stl10
(input_train, target_train), (input_test, target_test) = stl10.load_data()
This is perhaps the best known database to be found in the pattern recognition literature. Fisher's paper is a classic in the field and is referenced frequently to this day. (See Duda & Hart, for example.) The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant. One class is linearly separable from the other 2; the latter are NOT linearly separable from each other.
Predicted attribute: class of iris plant.
from extra_keras_datasets import iris
(input_train, target_train), (input_test, target_test) = iris.load_data(test_split=0.2)
This dataset presents wine qualities related to red and white vinho verde wine samples, from the north of Portugal. According to the creators, "[the] goal is to model wine quality based on physicochemical tests". Various chemical properties of the wine are available as well (inputs
) as well as the quality score (targets
) for the wine.
- Input structure: (fixed acidity, volatile acidity, citric acid, residual sugar, chlorides, free sulfur dioxide, total sulfur dioxide, density, pH, sulphates, alcohol, wine type)
- Target structure: quality score between 0 and 10
from extra_keras_datasets import wine_quality
(input_train, target_train), (input_test, target_test) = wine_quality.load_data(which_data='both', test_split=0.2, shuffle=True)
This dataset presents thousands of 16x16 grayscale images of handwritten digits, generated from real USPS based mail.
- Input structure: 16x16 image
- Target structure: digit ranging from 0.0 - 9.0 describing the input
from extra_keras_datasets import usps
(input_train, target_train), (input_test, target_test) = usps.load_data()
- EMNIST dataset:
- Cohen, G., Afshar, S., Tapson, J., & van Schaik, A. (2017). EMNIST: an extension of MNIST to handwritten letters. Retrieved from http://arxiv.org/abs/1702.05373
- tlindbloom on StackOverflow: loading EMNIST-letters dataset in emnist.py.
- KMNIST dataset:
- Clanuwat, T., Bober-Irizar, M., Kitamoto, A., Lamb, A., Yamamoto, K., & Ha, D. (2018). Deep learning for classical Japanese literature. arXiv preprint arXiv:1812.01718. Retrieved from https://arxiv.org/abs/1812.01718
- SVHN dataset:
- Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., & Ng, A. Y. (2011). Reading digits in natural images with unsupervised feature learning. Retrieved from http://ufldl.stanford.edu/housenumbers/nips2011_housenumbers.pdf / http://ufldl.stanford.edu/housenumbers/
- STL-10 dataset:
- Coates, A., Ng, A., & Lee, H. (2011, June). An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics (pp. 215-223). Retrieved from http://cs.stanford.edu/~acoates/papers/coatesleeng_aistats_2011.pdf
- Iris dataset:
- Fisher,R.A. "The use of multiple measurements in taxonomic problems" Annual Eugenics, 7, Part II, 179-188 (1936); also in "Contributions to Mathematical Statistics" (John Wiley, NY, 1950).
- Wine Quality dataset:
- P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547-553, 2009.
- USPS Handwritten Digits Dataset
- Hull, J. J. (1994). A database for handwritten text recognition research. IEEE Transactions on pattern analysis and machine intelligence, 16(5), 550-554.
The licenseable parts of this repository are licensed under a MIT License, so you're free to use this repo in your machine learning projects / blogs / exercises, and so on. Happy engineering! π