from ift6266h15.code.pylearn2.datasets.variable_image_dataset import DogsVsCats, RandomCrop from pylearn2.models.mlp import MLP, ConvRectifiedLinear, Softmax, Tanh from pylearn2.space import Conv2DSpace from pylearn2.training_algorithms.sgd import SGD from pylearn2.costs.cost import MethodCost from pylearn2.training_algorithms.learning_rule import Momentum, MomentumAdjustor from pylearn2.termination_criteria import EpochCounter, MonitorBased from pylearn2.train import Train from pylearn2.train_extensions.best_params import MonitorBasedSaveBest batchSize = 20 cropSize = 200 #Create datasets train = DogsVsCats(RandomCrop(256, cropSize), start=0, stop=19999) valid = DogsVsCats(RandomCrop(256, cropSize), start=20000, stop=22500) #Instantiate layers h0 = ConvRectifiedLinear(output_channels=40, kernel_shape=[7, 7], pool_shape=[2, 2], pool_stride=[2, 2], layer_name="h0", irange=0.1, border_mode="full") h1 = ConvRectifiedLinear(output_channels=40, kernel_shape=[7, 7], pool_shape=[2, 2], pool_stride=[2, 2], layer_name="h1",
''' Created on Feb 2, 2015 @author: Alexandre ''' from ift6266h15.code.pylearn2.datasets.variable_image_dataset import DogsVsCats, RandomCrop dataset = DogsVsCats(RandomCrop(256, 221), start=0, stop=19999) iterator = dataset.iterator(mode='batchwise_shuffled_sequential', batch_size=100) for X, y in iterator: print X.shape, y.shape