the main class for running Gary Cottrell's The Model @author Davis Liang @version 1.0 @date August 6, 2015 """ def __init__(self): print('Initializing The Model') if __name__ == '__main__': dataPath = "/Users/Davis/Desktop/theModel/data/dummy" #setting up dataPath to dataset directory imp1 = importer.importerClass( ) #initializing a new importer class to import images x = imp1.load(dataPath) #import all images from the directory dataPath imData = x[ 0] #holds all the images in the dataset. imData[i] corresponds to image i. imName = x[ 1] #holds the name of the image. imName[i] corresponds the name of image i. See how the names are formatted to extract label data. imLabel = x[ 2] #holds all the labeling data to be used in the network. imLabel[i] corresponds to labeling for image i. pp = preprocessor.preprocessorClass() #initialize a preprocessor class gaborDict = pp.createConvFilterBank(5, 8) #build your gabor dictionaries filtData = [None] * len( imData) #initialize an array to hold the filtered Data #filter your entire dataset
@author Davis Liang @version 1.0 @date August 6, 2015 """ def __init__(self): print('Initializing The Model') if __name__ == '__main__': dataPath = "/Users/Davis/Desktop/theModel/data/dummy" #setting up dataPath to dataset directory imp1 = importer.importerClass() #initializing a new importer class to import images x = imp1.load(dataPath) #import all images from the directory dataPath imData = x[0] #holds all the images in the dataset. imData[i] corresponds to image i. imName = x[1] #holds the name of the image. imName[i] corresponds the name of image i. See how the names are formatted to extract label data. imLabel = x[2] #holds all the labeling data to be used in the network. imLabel[i] corresponds to labeling for image i. pp = preprocessor.preprocessorClass() #initialize a preprocessor class gaborDict = pp.createConvFilterBank(5,8) #build your gabor dictionaries filtData = [None]*len(imData) #initialize an array to hold the filtered Data #filter your entire dataset for i in range(len(imData)): print(' filtering image {}').format(i+1) filtData[i] = pp.filterData(imData[i], gaborDict)
return gabor #return the gabor dictionary. #def PCA(self, trainSet): if __name__ == '__main__': pp = preprocessorClass() gaborDict = pp.createConvFilterBank(5,8) #import an image #then, filter it and see what the dimensionality is, if it makes sense, and how we would split that up dataPath = "/Users/Davis/Desktop/theModel/data/dummy" imp1 = importer.importerClass() x = imp1.load(dataPath) imData = x[0] imName = x[1] imLabel = x[2] filtIm = pp.filterData(imData[0], gaborDict) #imgplot = plt.imshow(imData[0]) #plt.show() #imgplot = plt.imshow((gaborDict[:,:,0,3]).real) #plt.show() #imgplot = plt.imshow(filtIm[:,:,3,0].real)
# your gabors are now built... print(' gabors have been successfully built') return gabor #return the gabor dictionary. #def PCA(self, trainSet): if __name__ == '__main__': pp = preprocessorClass() gaborDict = pp.createConvFilterBank(5, 8) #import an image #then, filter it and see what the dimensionality is, if it makes sense, and how we would split that up dataPath = "/Users/Davis/Desktop/theModel/data/dummy" imp1 = importer.importerClass() x = imp1.load(dataPath) imData = x[0] imName = x[1] imLabel = x[2] filtIm = pp.filterData(imData[0], gaborDict) #imgplot = plt.imshow(imData[0]) #plt.show() #imgplot = plt.imshow((gaborDict[:,:,0,3]).real) #plt.show() #imgplot = plt.imshow(filtIm[:,:,3,0].real)