Completed
Pull Request — master (#285)
by Bart
14:16 queued 08:01
created

fuel.datasets.DogsVsCats.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
1
from fuel.datasets import H5PYDataset
2
from fuel.transformers import ScaleAndShift
3
from fuel.utils import find_in_data_path
4
5
6
class DogsVsCats(H5PYDataset):
7
    """The Kaggle Dogs vs. Cats dataset of cats and dogs images.
8
9
    Parameters
10
    ----------
11
    which_sets : tuple of str
12
        Which split to load. Valid values are 'train', 'valid' and 'test'.
13
        The 'train' set corresponds to a shuffled subset of 20,000 images
14
        of the original training set, while 'valid' contains 5,000 images
15
        of the same set. The test set is the one released on Kaggle.
16
17
    """
18
    filename = 'dogs_vs_cats.hdf5'
19
20
    default_transformers = ((ScaleAndShift, [1 / 255.0, 0],
21
                             {'which_sources': 'image_features'}),)
22
23
    def __init__(self, which_sets, **kwargs):
24
        super(DogsVsCats, self).__init__(
25
            file_or_path=find_in_data_path(self.filename),
26
            which_sets=which_sets, **kwargs)
27