Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
8ce00704
Commit
8ce00704
authored
Dec 25, 2018
by
hysts
Committed by
Francisco Massa
Dec 25, 2018
Browse files
Add KMNIST dataset (#687)
* Add KMNIST * Add documentation * Add KMNIST to module's __all__ list
parent
038105ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
docs/source/datasets.rst
docs/source/datasets.rst
+5
-0
torchvision/datasets/__init__.py
torchvision/datasets/__init__.py
+2
-2
torchvision/datasets/mnist.py
torchvision/datasets/mnist.py
+25
-0
No files found.
docs/source/datasets.rst
View file @
8ce00704
...
@@ -35,6 +35,11 @@ Fashion-MNIST
...
@@ -35,6 +35,11 @@ Fashion-MNIST
.. autoclass:: FashionMNIST
.. autoclass:: FashionMNIST
KMNIST
~~~~~~~~~~~~~
.. autoclass:: KMNIST
EMNIST
EMNIST
~~~~~~
~~~~~~
...
...
torchvision/datasets/__init__.py
View file @
8ce00704
...
@@ -3,7 +3,7 @@ from .folder import ImageFolder, DatasetFolder
...
@@ -3,7 +3,7 @@ from .folder import ImageFolder, DatasetFolder
from
.coco
import
CocoCaptions
,
CocoDetection
from
.coco
import
CocoCaptions
,
CocoDetection
from
.cifar
import
CIFAR10
,
CIFAR100
from
.cifar
import
CIFAR10
,
CIFAR100
from
.stl10
import
STL10
from
.stl10
import
STL10
from
.mnist
import
MNIST
,
EMNIST
,
FashionMNIST
from
.mnist
import
MNIST
,
EMNIST
,
FashionMNIST
,
KMNIST
from
.svhn
import
SVHN
from
.svhn
import
SVHN
from
.phototour
import
PhotoTour
from
.phototour
import
PhotoTour
from
.fakedata
import
FakeData
from
.fakedata
import
FakeData
...
@@ -18,6 +18,6 @@ __all__ = ('LSUN', 'LSUNClass',
...
@@ -18,6 +18,6 @@ __all__ = ('LSUN', 'LSUNClass',
'ImageFolder'
,
'DatasetFolder'
,
'FakeData'
,
'ImageFolder'
,
'DatasetFolder'
,
'FakeData'
,
'CocoCaptions'
,
'CocoDetection'
,
'CocoCaptions'
,
'CocoDetection'
,
'CIFAR10'
,
'CIFAR100'
,
'EMNIST'
,
'FashionMNIST'
,
'CIFAR10'
,
'CIFAR100'
,
'EMNIST'
,
'FashionMNIST'
,
'MNIST'
,
'STL10'
,
'SVHN'
,
'PhotoTour'
,
'SEMEION'
,
'MNIST'
,
'KMNIST'
,
'STL10'
,
'SVHN'
,
'PhotoTour'
,
'SEMEION'
,
'Omniglot'
,
'SBU'
,
'Flickr8k'
,
'Flickr30k'
,
'Omniglot'
,
'SBU'
,
'Flickr8k'
,
'Flickr30k'
,
'VOCSegmentation'
,
'VOCDetection'
,
'Cityscapes'
)
'VOCSegmentation'
,
'VOCDetection'
,
'Cityscapes'
)
torchvision/datasets/mnist.py
View file @
8ce00704
...
@@ -179,6 +179,31 @@ class FashionMNIST(MNIST):
...
@@ -179,6 +179,31 @@ class FashionMNIST(MNIST):
'Shirt'
,
'Sneaker'
,
'Bag'
,
'Ankle boot'
]
'Shirt'
,
'Sneaker'
,
'Bag'
,
'Ankle boot'
]
class
KMNIST
(
MNIST
):
"""`Kuzushiji-MNIST <https://github.com/rois-codh/kmnist>`_ Dataset.
Args:
root (string): Root directory of dataset where ``processed/training.pt``
and ``processed/test.pt`` exist.
train (bool, optional): If True, creates dataset from ``training.pt``,
otherwise from ``test.pt``.
download (bool, optional): If true, downloads the dataset from the internet and
puts it in root directory. If dataset is already downloaded, it is not
downloaded again.
transform (callable, optional): A function/transform that takes in an PIL image
and returns a transformed version. E.g, ``transforms.RandomCrop``
target_transform (callable, optional): A function/transform that takes in the
target and transforms it.
"""
urls
=
[
'http://codh.rois.ac.jp/kmnist/dataset/kmnist/train-images-idx3-ubyte.gz'
,
'http://codh.rois.ac.jp/kmnist/dataset/kmnist/train-labels-idx1-ubyte.gz'
,
'http://codh.rois.ac.jp/kmnist/dataset/kmnist/t10k-images-idx3-ubyte.gz'
,
'http://codh.rois.ac.jp/kmnist/dataset/kmnist/t10k-labels-idx1-ubyte.gz'
,
]
classes
=
[
'o'
,
'ki'
,
'su'
,
'tsu'
,
'na'
,
'ha'
,
'ma'
,
'ya'
,
're'
,
'wo'
]
class
EMNIST
(
MNIST
):
class
EMNIST
(
MNIST
):
"""`EMNIST <https://www.nist.gov/itl/iad/image-group/emnist-dataset/>`_ Dataset.
"""`EMNIST <https://www.nist.gov/itl/iad/image-group/emnist-dataset/>`_ Dataset.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment