Beispiel #1
0
    args = parser.parse_args()
    training_seed = args.training_seed
    if args.log:
        from pnet.vzlog import default as vz
    ag.set_verbose(True)
    
    sup_ims = []
    sup_labels = []
    net = None
    layers = [
        #pnet.IntensityThresholdLayer(),
        
        pnet.EdgeLayer(k=5, radius=1, spread='orthogonal', minimum_contrast=0.05),
        pnet.PartsLayer(100, (6, 6), settings=dict(outer_frame=0,
                                                  threshold=40, 
                                                  samples_per_image=40, 
                                                  max_samples=1000000, 
                                                  min_prob=0.005,
                                                  )),
        pnet.ExtensionPartsLayer(num_parts = 100, num_components = 10, part_shape = (12,12), lowerLayerShape = (6,6)),        
        pnet.PoolingLayer(shape=(4,4), strides=(4, 4)),
        pnet.MixtureClassificationLayer(n_components=1, min_prob=0.0001,block_size=200),
        #pnet.SVMClassificationLayer(C=None)
    ]

    net = pnet.PartsNet(layers)

    digits = range(10)
    ims = ag.io.load_mnist('training', selection=slice(10000), return_labels=False)

    net.train(ims)
    
Beispiel #2
0
    data = np.load(dataFileName)
    training_seed = args.seed

    for i in range(11):
        print("Inside")
        layers = [
            pnet.EdgeLayer(k=5,
                           radius=1,
                           spread='orthogonal',
                           minimum_contrast=0.05),  #
            pnet.PartsLayer(
                numParts,
                (patchSize, patchSize),
                settings=dict(
                    outer_frame=0,
                    #em_seed=training_seed,
                    threshold=40,
                    samples_per_image=40,
                    max_samples=1000000,
                    min_prob=0.005,
                )),
            pnet.PoolingLayer(shape=(4, 4), strides=(4, 4)),
            pnet.SVMClassificationLayer(C=None)
        ]

        net = pnet.PartsNet(layers)

        digits = range(10)
        print('Extracting subsets...')

        ims10k = data[:10000]