print folder trainDirect = folder+"tempTrain/" trainNP = folder+"tempTrainNP/" testDirect = folder+"tempTest/" testNP = folder+"tempTestNP/" """Load the train/test split information""" trainFs, testFs = helperFuncs.getTrainTestSplit(True,folder) trainL = len(trainFs) testL = len(testFs) features,labels = helperFuncs.getTargets(outType) #get the OCR vector for each CID outsize = len(features[features.keys()[0]]) #this it the size of the target (# of OCRfeatures) means,stds = helperFuncs.getMeansStds(features) """load model""" model = helperFuncs.loadModel(folder+"wholeModel") while not isfile(testNP+"Xtest.h5"): print "sleeping because Test folder empty \r", time.sleep(1.) print "" print "Loading np test arrays" loadedUp = False while not loadedUp:
def getSize(folder): fold = folder[folder[-1].rfind("/")+1:] fold = fold[:fold.find("_")] print fold fold = fold[fold.rfind("/")+1:] print fold return fold with open(sys.argv[1]+"wholeModel.pickle",'rb') as f: model = cPickle.load(f) size = int(getSize(sys.argv[1])) imdim = size #OCRfeatures, labels = getOCRScaledTargets() OCRTargets, labels = getOCRTargets() means,stds = getMeansStds() if True: ld = listdir("/home/test/usan/") images = np.zeros((1,1,imdim,imdim),dtype=np.float) for x in ld: print x try: CID = x print "reading in" image = io.imread("/home/test/usan/"+x,as_grey=True) image = minusOnes(image) print "numpying" image = np.array(image) #image = convertIt(image)
fold = folder[folder[-1].rfind("/") + 1:] fold = fold[:fold.find("_")] print fold fold = fold[fold.rfind("/") + 1:] print fold return fold with open(sys.argv[1] + "wholeModel.pickle", 'rb') as f: model = cPickle.load(f) size = int(getSize(sys.argv[1])) imdim = size #OCRfeatures, labels = getOCRScaledTargets() OCRTargets, labels = getOCRTargets() means, stds = getMeansStds() if True: ld = listdir("/home/test/usan/") images = np.zeros((1, 1, imdim, imdim), dtype=np.float) for x in ld: print x try: CID = x print "reading in" image = io.imread("/home/test/usan/" + x, as_grey=True) image = minusOnes(image) print "numpying" image = np.array(image) #image = convertIt(image) print "resizing"
print folder trainDirect = folder+"tempTrain/" trainNP = folder+"tempTrainNP/" testDirect = folder+"tempTest/" testNP = folder+"tempTestNP/" """Load the train/test split information""" trainFs, testFs = helperFuncs.getTrainTestSplit(True,folder) trainL = len(trainFs) testL = len(testFs) features,labels = helperFuncs.getTargets(outType) #get the OCR vector for each CID outsize = len(features[features.keys()[0]]) #this it the size of the target (# of OCRfeatures) means,stds = helperFuncs.getMeansStds() """load model""" #with open(folder+"bestModel.pickle",'rb') as f: # model = cPickle.load(f) model = helperFuncs.loadModel(folder+"wholeModel") while not isfile(testNP+"Xtest.h5"): print "sleeping because Test folder empty \r", time.sleep(1.) print "" print "Loading np test arrays"