changeset 1329:0f69f303ba91

forgot to commit... 2 versions: one for /data/lisa6 the other for /data/lisa/data TODO: FIX NOW THAT FRINGANT IS BACK
author gdesjardins
date Thu, 14 Oct 2010 23:54:28 -0400
parents 10113a1050ce
children 3efd0effb2a7
files pylearn/datasets/caltech.py
diffstat 1 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pylearn/datasets/caltech.py	Thu Oct 14 23:54:28 2010 -0400
@@ -0,0 +1,46 @@
+"""
+Various routines to load/access MNIST data.
+"""
+
+import os
+import numpy
+
+from pylearn.io.pmat import PMat
+from pylearn.datasets.config import data_root # config
+from pylearn.datasets.dataset import Dataset
+
+def caltech_silhouette():
+
+    rval = Dataset()
+
+    
+    path = os.path.join(data_root(), 'caltech_silhouettes')
+
+    rval.train = Dataset.Obj(x=numpy.load(os.path.join(path,'train_data.npy')),
+                             y=numpy.load(os.path.join(path,'train_labels.npy')))
+    rval.valid = Dataset.Obj(x=numpy.load(os.path.join(path,'val_data.npy')),
+                             y=numpy.load(os.path.join(path,'val_labels.npy')))
+    rval.test  = Dataset.Obj(x=numpy.load(os.path.join(path,'test_data.npy')),
+                             y=numpy.load(os.path.join(path,'test_labels.npy')))
+
+    rval.n_classes = 101
+    rval.img_shape = (28,28)
+
+    return rval
+
+def caltech_silhouette2():
+
+    rval = Dataset()
+
+    from scipy import io 
+    path = '/data/lisa6/desjagui/caltech101_silhouettes_28_split1.mat'
+
+    data = io.loadmat(open(path,'r'))
+
+    rval.train = Dataset.Obj(x=data['train_data'], y=data['train_labels'])
+    rval.valid = Dataset.Obj(x=data['val_data'],   y=data['val_labels'])
+    rval.test  = Dataset.Obj(x=data['test_data'],  y=data['test_labels'])
+    rval.n_classes = 101
+    rval.img_shape = (28,28)
+
+    return rval