1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
from fuel.datasets import H5PYDataset |
3
|
|
|
from fuel.transformers.defaults import rgb_images_from_encoded_bytes |
4
|
|
|
from fuel.utils import find_in_data_path |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
class ILSVRC2010(H5PYDataset): |
8
|
|
|
u"""The ILSVRC2010 Dataset. |
9
|
|
|
|
10
|
|
|
The ImageNet Large-Scale Visual Recognition Challenge [ILSVRC] |
11
|
|
|
is an annual computer vision competition testing object classification |
12
|
|
|
and detection at large-scale. This is a wrapper around the data for |
13
|
|
|
the 2010 competition, which is (as of 2015) the only year for which |
14
|
|
|
test data groundtruth is available. |
15
|
|
|
|
16
|
|
|
Note that the download site for the images is not publicly |
17
|
|
|
accessible. To download the images, you may sign up for an account |
18
|
|
|
at [SIGNUP]. |
19
|
|
|
|
20
|
|
|
.. [ILSVRC] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, |
21
|
|
|
Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya |
22
|
|
|
Khosla, Michael Bernstein, Alexander C. Berg and Li Fei-Fei. |
23
|
|
|
*ImageNet Large Scale Visual Recognition Challenge*. IJCV, 2015. |
24
|
|
|
|
25
|
|
|
.. [SIGNUP] http://www.image-net.org/signup |
26
|
|
|
|
27
|
|
|
Parameters |
28
|
|
|
---------- |
29
|
|
|
which_sets : tuple of str |
30
|
|
|
Which split to load. Valid values are 'train' (1.2M examples) |
31
|
|
|
'valid' (150,000 examples), and 'test' (50,000 examples). |
32
|
|
|
|
33
|
|
|
""" |
34
|
|
|
filename = 'ilsvrc2010.hdf5' |
35
|
|
|
default_transformers = rgb_images_from_encoded_bytes(('encoded_images',)) |
36
|
|
|
|
37
|
|
|
def __init__(self, which_sets, **kwargs): |
38
|
|
|
kwargs.setdefault('load_in_memory', False) |
39
|
|
|
super(ILSVRC2010, self).__init__( |
40
|
|
|
file_or_path=find_in_data_path(self.filename), |
41
|
|
|
which_sets=which_sets, **kwargs) |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
class ILSVRC2012(H5PYDataset): |
45
|
|
|
u"""The ILSVRC2012 Dataset. |
46
|
|
|
|
47
|
|
|
The ImageNet Large-Scale Visual Recognition Challenge [ILSVRC] |
48
|
|
|
is an annual computer vision competition testing object classification |
49
|
|
|
and detection at large-scale. This is a wrapper around the data for |
50
|
|
|
the 2012 competition. |
51
|
|
|
|
52
|
|
|
Note that the download site for the images is not publicly |
53
|
|
|
accessible. To downlaod the images, you may sign up for an account |
54
|
|
|
at [SIGNUP]. |
55
|
|
|
|
56
|
|
|
.. [ILSVRC] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, |
57
|
|
|
Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya |
58
|
|
|
Khosla, Michael Bernstein, Alexander C. Berg and Li Fei-Fei. |
59
|
|
|
*ImageNet Large Scale Visual Recognition Challenge*. IJCV, 2015. |
60
|
|
|
|
61
|
|
|
.. [SIGNUP] http://www.image-net.org/signup |
62
|
|
|
|
63
|
|
|
Parameters |
64
|
|
|
---------- |
65
|
|
|
which_sets : tuple of str |
66
|
|
|
Which split to load. Valid values are 'train' (1,281,167 examples) |
67
|
|
|
'valid' (50,000 examples), and 'test' (100,000 examples). |
68
|
|
|
|
69
|
|
|
""" |
70
|
|
|
filename = 'ilsvrc2012.hdf5' |
71
|
|
|
default_transformers = rgb_images_from_encoded_bytes(('encoded_images',)) |
72
|
|
|
|
73
|
|
|
def __init__(self, which_sets, **kwargs): |
74
|
|
|
kwargs.setdefault('load_in_memory', False) |
75
|
|
|
super(ILSVRC2012, self).__init__( |
76
|
|
|
file_or_path=find_in_data_path(self.filename), |
77
|
|
|
which_sets=which_sets, **kwargs) |
78
|
|
|
|