annotate pylearn/datasets/caltech.py @ 1476:8c10bda4bb5f

Configured default train/valid/test split for icml07.MNIST_rotated_background dataset. Defaults are the ones used by Hugo in the ICML07 paper and in all contracting auto-encoder papers.
author gdesjardins
date Fri, 20 May 2011 16:53:00 -0400
parents 124b939d997f
children 4727a7e4d506
rev   line source
1329
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
1 """
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
2 Various routines to load/access MNIST data.
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
3 """
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
4
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
5 import os
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
6 import numpy
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
7
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
8 from pylearn.io.pmat import PMat
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
9 from pylearn.datasets.config import data_root # config
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
10 from pylearn.datasets.dataset import Dataset
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
11
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
12 def caltech_silhouette():
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
13
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
14 rval = Dataset()
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
15
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
16
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
17 path = os.path.join(data_root(), 'caltech_silhouettes')
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
18
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
19 rval.train = Dataset.Obj(x=numpy.load(os.path.join(path,'train_data.npy')),
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
20 y=numpy.load(os.path.join(path,'train_labels.npy')))
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
21 rval.valid = Dataset.Obj(x=numpy.load(os.path.join(path,'val_data.npy')),
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
22 y=numpy.load(os.path.join(path,'val_labels.npy')))
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
23 rval.test = Dataset.Obj(x=numpy.load(os.path.join(path,'test_data.npy')),
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
24 y=numpy.load(os.path.join(path,'test_labels.npy')))
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
25
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
26 rval.n_classes = 101
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
27 rval.img_shape = (28,28)
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
28
0f69f303ba91 forgot to commit... 2 versions: one for /data/lisa6 the other for
gdesjardins
parents:
diff changeset
29 return rval