def load_dataset(): br = BatchReader2.inputs() br2 = BatchReader2.inputs(testingData=True) X, Y = br.getNPArray(3) X_train = X[:50000 * 0.8].reshape(-1, 1, 48, 48) y_train = Y[:50000 * 0.8].astype('uint8') X_val = X[50000 * 0.8:].reshape(-1, 1, 48, 48) y_val = Y[50000 * 0.8:].astype('uint8') return X_train, y_train, X_val, y_val
def load_dataset(): br = BatchReader2.inputs() br2 = BatchReader2.inputs(testingData = True) X, Y = br.getNPArray(3) X_train = X[:50000*0.8].reshape(-1, 1, 48, 48) y_train = Y[:50000*0.8].astype('uint8') X_val = X[50000*0.8:].reshape(-1, 1, 48, 48) y_val = Y[50000*0.8:].astype('uint8') return X_train, y_train, X_val, y_val
def loadData(): sizeTrain = 0.7 sizeVal = 0.2 br = BatchReader2.inputs() br2 = BatchReader2.inputs(testingData = True) X, Y = br.getNPArray(2) n = X.shape[0] testX = br2.getNPArray(2) trainX = X[:n*sizeTrain].reshape(-1,1,48,48) trainY = Y[:n*sizeTrain].astype('uint8') validationX = X[n*sizeTrain:n*(sizeTrain+sizeVal)+1].reshape(-1,1,48,48) validationY = Y[n*sizeTrain:n*(sizeTrain+sizeVal)+1].astype('uint8') print (trainX.shape) print (validationX.shape) print (validationY.shape) tX = X[n*(sizeTrain+sizeVal)+1:].reshape(-1,1,48,48) tY = Y[n*(sizeTrain+sizeVal)+1:].astype('uint8') print (tX.shape) testX = testX.reshape(-1,1,48,48) return trainX,trainY,validationX,validationY,tX,tY,testX
from theano.tensor.signal import downsample from theano.tensor.nnet import conv from logistic_sgd import LogisticRegression, load_data from mlp import HiddenLayer import BatchReader2 import scipy.misc import pickle import CNNL import CNN theano.config.floatX = 'float32' if __name__ == '__main__': rng = numpy.random.RandomState(42) br = BatchReader2.inputs() br2 = BatchReader2.inputs(testingData=True) X, Y = br.getNPArray(2) testX = br2.getNPArray(2) print testX.shape num_epochs = 200 n = X.shape[0] sizeTrain = 0.8 trainX = X[:n * sizeTrain].reshape(-1, 1, 48, 48) trainY = Y[:n * sizeTrain].astype('uint8') validationX = X[n * sizeTrain:].reshape(-1, 1, 48, 48) validationY = Y[n * sizeTrain:].astype('uint8') testX = testX.reshape(-1, 1, 48, 48) input_var = T.tensor4('inputs') target_var = T.ivector('targets') network = CNNL.convnetL(input_var)
from theano.tensor.signal import downsample from theano.tensor.nnet import conv from logistic_sgd import LogisticRegression, load_data from mlp import HiddenLayer import BatchReader2 import scipy.misc import pickle import CNNL import CNN theano.config.floatX = 'float32' if __name__ == '__main__': rng = numpy.random.RandomState(42) br = BatchReader2.inputs() br2 = BatchReader2.inputs(testingData = True) X, Y = br.getNPArray(2) testX = br2.getNPArray(2) print testX.shape num_epochs = 200 n = X.shape[0] sizeTrain = 0.8 trainX = X[:n*sizeTrain].reshape(-1,1,48,48) trainY = Y[:n*sizeTrain].astype('uint8') validationX = X[n*sizeTrain:].reshape(-1,1,48,48) validationY = Y[n*sizeTrain:].astype('uint8') testX = testX.reshape(-1,1,48,48) input_var = T.tensor4('inputs') target_var = T.ivector('targets') network = CNNL.convnetL(input_var)