Beispiel #1
0
    #testing.params_lbp['pproc__feature_extractor__method'] = ['uniform']
    testing.params_lbp['pproc__feature_extractor__n_tiles'] = [[1,1],[3,3],[5,5],[7,7]]
    #testing.params_lbp['pproc__feature_extractor__n_tiles'] = [[1,1],[7,7]]
    testing.params_auto['pca__n_components'] = [10, 30, 50, 100, 300, 500]
    #testing.params_auto['pca__n_components'] = [100]
    testing.params_svm['pred__C'] = [0.0001, 0.01, 0.01, 1, 100, 5000]
    #testing.params_svm['pred__C'] = [1000]
    testing.params_svm['pred__gamma'] = [0.0001, 0.001, 0.01, 0.1]
    #testing.params_svm['pred__gamma'] = [0.001]
    testing.var_sensor('LBP',datasettrain='all',sensortrain ='all',datasettest='all',sensortest ='all')
    #testing.var_sensor('LBP','all','')
    """

    testing = Testing()
    testing.size_percentage = 1.0
    testing.divide_by = 80
    testing.cross_validation = False
    testing.augmentation = False
    testing.aug_rotate = False
    testing.multi_column = False
    testing.roi = False
    testing.low_pass = False
    testing.high_pass = False
    testing.n_processes_pproc = 3
    testing.n_processes_cv = 1
    testing.lbp__method = 'uniform'
    testing.lbp__n_tiles = [1, 1]
    testing.predict = 'SVM'
    testing.svm__kernel = 'rbf'
    testing.svm__gamma = 0.01
    testing.svm__C = 1000
    #ConvNets+PCA
    pproc = PreProcess('ConvNet',1,False,False,False,False,1.0,[(9, 9), (9, 9), (7, 7), (5, 5), (5, 5)],\
        [(9, 9), (9, 9), (7, 7), (5, 5), (5, 5)],[(9, 9), (9, 9), (7, 7), (5, 5), (5, 5)],\
        [64, 128, 256, 512, 1024],[(3,3),(2,2),(2,2),(2,2),(2,2)],False,False,None,None,False)
    X = pproc.transform(lstFilesX)
    pca = RandomizedPCA(n_components=2)
    X = pca.fit_transform(X)
    fig = pyplot.figure()
    pyplot.plot(X[y==False,0],X[y==False,1],'ro')
    pyplot.plot(X[y==True,0],X[y==True,1],'bo')
    pyplot.title('2D Visualization, Crossmatch LivDet 2013 Testing, ConvNet 5 Layers+PCA')
    pyplot.show()
    """

    testing = Testing()
    testing.divide_by = 5
    testing.n_processes_pproc = 3
    lstFilesX, y = testing.load_dataset('Training', 'LivDet2011', 'digital')

    #PCA only
    pproc = PreProcess('',1,False,False,False,False,1.0,None,\
        None,None,None,None,None,None,None,None,None)
    X = pproc.transform(lstFilesX)
    pca = RandomizedPCA(n_components=2)
    X = pca.fit_transform(X)
    fig = pyplot.figure()
    pyplot.plot(X[y == False, 0], X[y == False, 1], 'ro')
    pyplot.plot(X[y == True, 0], X[y == True, 1], 'bo')
    pyplot.title('2D Visualization, Digital LivDet 2011 Training, PCA only')
    pyplot.show()
    #ConvNets+PCA
    pproc = PreProcess('ConvNet',1,False,False,False,False,1.0,[(9, 9), (9, 9), (7, 7), (5, 5), (5, 5)],\
        [(9, 9), (9, 9), (7, 7), (5, 5), (5, 5)],[(9, 9), (9, 9), (7, 7), (5, 5), (5, 5)],\
        [64, 128, 256, 512, 1024],[(3,3),(2,2),(2,2),(2,2),(2,2)],False,False,None,None,False)
    X = pproc.transform(lstFilesX)
    pca = RandomizedPCA(n_components=2)
    X = pca.fit_transform(X)
    fig = pyplot.figure()
    pyplot.plot(X[y==False,0],X[y==False,1],'ro')
    pyplot.plot(X[y==True,0],X[y==True,1],'bo')
    pyplot.title('2D Visualization, Crossmatch LivDet 2013 Testing, ConvNet 5 Layers+PCA')
    pyplot.show()
    """

    testing = Testing()
    testing.divide_by = 5
    testing.n_processes_pproc =3
    lstFilesX,y = testing.load_dataset('Training', 'LivDet2011', 'digital')
    
    #PCA only
    pproc = PreProcess('',1,False,False,False,False,1.0,None,\
        None,None,None,None,None,None,None,None,None)
    X = pproc.transform(lstFilesX)
    pca = RandomizedPCA(n_components=2)
    X = pca.fit_transform(X)
    fig = pyplot.figure()
    pyplot.plot(X[y==False,0],X[y==False,1],'ro')
    pyplot.plot(X[y==True,0],X[y==True,1],'bo')
    pyplot.title('2D Visualization, Digital LivDet 2011 Training, PCA only')
    pyplot.show()
    
 #testing.params_lbp['pproc__feature_extractor__method'] = ['uniform']
 testing.params_lbp['pproc__feature_extractor__n_tiles'] = [[1,1],[3,3],[5,5],[7,7]]
 #testing.params_lbp['pproc__feature_extractor__n_tiles'] = [[1,1],[7,7]]
 testing.params_auto['pca__n_components'] = [10, 30, 50, 100, 300, 500]
 #testing.params_auto['pca__n_components'] = [100]
 testing.params_svm['pred__C'] = [0.0001, 0.01, 0.01, 1, 100, 5000]
 #testing.params_svm['pred__C'] = [1000]
 testing.params_svm['pred__gamma'] = [0.0001, 0.001, 0.01, 0.1]
 #testing.params_svm['pred__gamma'] = [0.001]
 testing.var_sensor('LBP',datasettrain='all',sensortrain ='all',datasettest='all',sensortest ='all')
 #testing.var_sensor('LBP','all','')
 """
 
 testing = Testing()
 testing.size_percentage = 1.0
 testing.divide_by = 80
 testing.cross_validation = False
 testing.augmentation = False
 testing.aug_rotate = False
 testing.multi_column = False       
 testing.roi = False
 testing.low_pass = False
 testing.high_pass = False
 testing.n_processes_pproc = 3
 testing.n_processes_cv =1
 testing.lbp__method = 'uniform'
 testing.lbp__n_tiles = [1,1]
 testing.predict = 'SVM'
 testing.svm__kernel='rbf'
 testing.svm__gamma = 0.01
 testing.svm__C = 1000