xdim = image.shape[1] - wSize + 1 output = [] xran = np.linspace(0,xdim,(xdim/stride)) yran = np.linspace(0,ydim,(ydim/stride)) for y in yran: for x in xran: output.append(canvas[y:y+wSize,x:x+wSize]) return np.reshape(np.array(output),(len(output),1,wSize,wSize)) #Process the arguments given (see helperFuncs.py for details) size, indir, binarize, blur, padding, targetType = helperFuncs.dataProcessorArgs(sys.argv[1:]) targets, labels = helperFuncs.getTargets(targetType) outsize = helperFuncs.getOutSize(targets) #wait until the folder exists while not isdir(indir+"tempTrain/"): time.sleep(10.) print "I'm sleeping", isdir(indir), indir, " \r", if not isdir(indir+"tempTrainNP/"): mkdir(indir+"tempTrainNP/") mkdir(indir+"tempTestNP/") #define folders trainFolder = indir+"tempTrain/" trainNPfolder = indir+"tempTrainNP/" testFolder = indir+"tempTest/"
# stop = raw_input("Loading from folder "+folder+" : Hit enter to proceed or ctrl+C to cancel") #else: # print "Initializing in folder "+folder """Load the train/test split information if update, else split and write out which images are in which dataset""" trainFs, testFs = helperFuncs.getTrainTestSplit(False, folder, numEx, trainTestSplit, ld) trainL = len(trainFs) testL = len(testFs) print "number of examples: ", numEx print "training examples : ", trainL print "test examples : ", testL features, labels = helperFuncs.getTargets( "justbonds") #get the target vector for each CID outsize = helperFuncs.getOutSize(features) """DEFINE THE MODEL HERE""" model = Sequential() model.add(Convolution2D(8, 8, 8, input_shape=(1, size, size))) model.add(Activation('relu')) model.add(Convolution2D(8, 5, 5)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(3, 3))) model.add(Dropout(0.25)) model.add(Convolution2D(8, 5, 5)) model.add(Activation('relu'))