1
|
|
|
from fuel.datasets import H5PYDataset |
2
|
|
|
from fuel.transformers.defaults import uint8_pixels_to_floatX |
3
|
|
|
from fuel.utils import find_in_data_path |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class CIFAR100(H5PYDataset): |
7
|
|
|
"""The CIFAR100 dataset of natural images. |
8
|
|
|
|
9
|
|
|
This dataset is a labeled subset of the ``80 million tiny images`` |
10
|
|
|
dataset [TINY]. It consists of 60,000 32 x 32 colour images labelled |
11
|
|
|
into 100 fine-grained classes and 20 super-classes. There are |
12
|
|
|
600 images per fine-grained class. There are 50,000 training |
13
|
|
|
images and 10,000 test images [CIFAR100]. |
14
|
|
|
|
15
|
|
|
The dataset contains three sources: |
16
|
|
|
- features: the images themselves, |
17
|
|
|
- coarse_labels: the superclasses 1-20, |
18
|
|
|
- fine_labels: the fine-grained classes 1-100. |
19
|
|
|
|
20
|
|
|
.. [TINY] Antonio Torralba, Rob Fergus and William T. Freeman, |
21
|
|
|
*80 million tiny images: a large dataset for non-parametric |
22
|
|
|
object and scene recognition*, Pattern Analysis and Machine |
23
|
|
|
Intelligence, IEEE Transactions on 30.11 (2008): 1958-1970. |
24
|
|
|
|
25
|
|
|
.. [CIFAR100] Alex Krizhevsky, *Learning Multiple Layers of Features |
26
|
|
|
from Tiny Images*, technical report, 2009. |
27
|
|
|
|
28
|
|
|
Parameters |
29
|
|
|
---------- |
30
|
|
|
which_sets : tuple of str |
31
|
|
|
Which split to load. Valid values are 'train' and 'test', |
32
|
|
|
corresponding to the training set (50,000 examples) and the test |
33
|
|
|
set (10,000 examples). Note that CIFAR100 does not have a |
34
|
|
|
validation set; usually you will create your own |
35
|
|
|
training/validation split using the `subset` argument. |
36
|
|
|
|
37
|
|
|
""" |
38
|
|
|
filename = 'cifar100.hdf5' |
39
|
|
|
default_transformers = uint8_pixels_to_floatX(('features',)) |
40
|
|
|
|
41
|
|
|
def __init__(self, which_sets, **kwargs): |
42
|
|
|
kwargs.setdefault('load_in_memory', True) |
43
|
|
|
super(CIFAR100, self).__init__( |
44
|
|
|
file_or_path=find_in_data_path(self.filename), |
45
|
|
|
which_sets=which_sets, **kwargs) |
46
|
|
|
|