Exemple #1
0
    def test():
        X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_norb(size=32,mode="serial",want_dense=False)
        # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_whiten(size=32)
        print X.dtype,X.max()
        dp = nn.dp_ram(X=X,T=T,X_test=X_test,T_test=T_test,T_train_labels=None,T_labels=T_labels,data_batch=25)
        while 1:
            x,t,id = dp.train()
            print x.shape
            nn.show_images(x,(5,5))
            print t
            nn.show()   

# np.savez("./dataset/norb_binocular_small_normalized", X=X,T=T,X_test=X_test,T_test=T_test,T_train_labels=T_train_labels,T_labels=T_labels)
# f=np.load(work_address+'./dataset/norb_single_small.npz')
# X=f['X'];T=f['T'];X_test=f['X_test'];T_test=f['T_test'];T_train_labels=f['T_train_labels'];T_labels=f['T_labels']
# f=np.load(work_address+'./dataset/norb_binocular_small.npz')
# X=f['X'];T=f['T'];X_test=f['X_test'];T_test=f['T_test'];T_train_labels=f['T_train_labels'];T_labels=f['T_labels']
# X_std=X.std(axis=0)
# X_mean=X.mean(axis=0)
# X_test_std=X_test.std(axis=0)
# X_test_mean=X_test.mean(axis=0)
# X=(X-X_mean)/X_std
# X_test=(X_test-X_test_mean)/X_test_std

# np.savez("./dataset/norb_binocular_small_normalized", X=X,T=T,X_test=X_test,T_test=T_test,T_train_labels=T_train_labels,T_labels=T_labels)
# f=np.load(work_address+'./dataset/norb_single_small.npz')
# X=f['X'];T=f['T'];X_test=f['X_test'];T_test=f['T_test'];T_train_labels=f['T_train_labels'];T_labels=f['T_labels']
# f=np.load(work_address+'./dataset/norb_binocular_small.npz')
# X=f['X'];T=f['T'];X_test=f['X_test'];T_test=f['T_test'];T_train_labels=f['T_train_labels'];T_labels=f['T_labels']

#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!numpy object dtype correct it
Exemple #2
0
 def test():
     # X = TorontoFace.load(want_mean = True)
     X = TorontoFace.load_whiten(bias=.1)
     # X = TorontoFace.load_contrast(n=21,k=.01)
     # X = TorontoFace.load_contrast(n=3,k=.01,filter="box",contrast="mean")
     dp = nn.dp_ram(X=X, T=X, data_batch=9)
     while 1:
         X, T, _ = dp.train()
         nn.show_images(X, (3, 3))
         nn.show()
Exemple #3
0
 def test():
     # X = TorontoFace.load(want_mean = True)
     X = TorontoFace.load_whiten(bias=.1)
     # X = TorontoFace.load_contrast(n=21,k=.01)
     # X = TorontoFace.load_contrast(n=3,k=.01,filter="box",contrast="mean")
     dp = nn.dp_ram(X=X,T=X,data_batch=9)
     while 1:
         X,T,_ = dp.train()
         nn.show_images(X,(3,3))
         nn.show()        
Exemple #4
0
 def test():
     # X = TorontoFace.load(want_mean = True)
     # X = TorontoFace.load_whiten(p=1)
     # X = TorontoFace.load_contrast(n=21,k=.01)
     X,T,X_test,T_test,T_train_labels,T_labels = MNIST.semi(N=100,want_dense = False)
     dp = nn.dp_ram(X,T,data_batch=100)
     while 1:
         x,t,id = dp.train()
         nn.show_images(x,(10,10))
         print t
         nn.show()        
Exemple #5
0
 def test():
     # X = TorontoFace.load(want_mean = True)
     # X = TorontoFace.load_whiten(p=1)
     # X = TorontoFace.load_contrast(n=21,k=.01)
     X, T, X_test, T_test, T_train_labels, T_labels = MNIST.semi(
         N=100, want_dense=False)
     dp = nn.dp_ram(X, T, data_batch=100)
     while 1:
         x, t, id = dp.train()
         nn.show_images(x, (10, 10))
         print t
         nn.show()
Exemple #6
0
 def test():
     # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load(size=32,want_mean=True)
     # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_whiten(size=32,bias=.1)
     X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_contrast()
     print X.dtype,X.max()
     dp = nn.dp_ram(X=X,T=T,X_test=X_test,T_test=T_test,T_train_labels=None,T_labels=T_labels,data_batch=25)
     while 1:
         x,t,id = dp.train()
         print x.shape
         nn.show_images(x,(5,5))
         print t
         nn.show()        
Exemple #7
0
 def test(want_dense=False):
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_contrast_extra(n=21,k=.01,want_dense=False)
     # dataset.load_svhn_contrast_extra_make()
     # X,T,X_test,T_test,T_train_labels,T_labels = SVHN.load_contrast(n=13,k=.01,want_dense=False)
     X,T,X_test,T_test,_,_,lst = SVHN.semi(N=20)
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_contrast(n=13,want_dense=False)
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_pylearn2(want_dense=False)
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_torch(want_dense=False)
     # n = 0
     # print X.shape
     dp = nn.dp_ram(X,T,data_batch=20)        
     x,t,_ = dp.train()
     nn.show_images(x,(2,10))
     nn.show()
Exemple #8
0
 def test(want_dense=False):
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_contrast_extra(n=21,k=.01,want_dense=False)
     # dataset.load_svhn_contrast_extra_make()
     # X,T,X_test,T_test,T_train_labels,T_labels = SVHN.load_contrast(n=13,k=.01,want_dense=False)
     X, T, X_test, T_test, _, _, lst = SVHN.semi(N=20)
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_contrast(n=13,want_dense=False)
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_pylearn2(want_dense=False)
     # X,T,X_test,T_test,T_train_labels,T_labels = dataset.load_svhn_torch(want_dense=False)
     # n = 0
     # print X.shape
     dp = nn.dp_ram(X, T, data_batch=20)
     x, t, _ = dp.train()
     nn.show_images(x, (2, 10))
     nn.show()
Exemple #9
0
 def test():
     # X,T,X_test,T_test,T_train_labels,T_labels = CIFAR10.load(want_mean=True,want_dense=False)
     # X,T,X_test,T_test,T_train_labels,T_labels = CIFAR10.load_whiten(bias=.1)
     X,T,X_test,T_test,T_train_labels,T_labels = CIFAR10.load_contrast(n=13,k=.01)
     # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_whiten(size=32,bias=.1)
     # X = CIFAR10.load_cifar10_adam_patch(num_patch=100000,size=11,backend="numpy")
     # print X.dtype,X.max()
     dp = nn.dp_ram(X=X,X_test=X,data_batch=25)
     while 1:
         x,t,id = dp.train()
         print x.shape
         nn.show_images(x,(5,5))
         print t
         nn.show()        
Exemple #10
0
 def test():
     # X,T,X_test,T_test,T_train_labels,T_labels = CIFAR10.load(want_mean=True,want_dense=False)
     # X,T,X_test,T_test,T_train_labels,T_labels = CIFAR10.load_whiten(bias=.1)
     X, T, X_test, T_test, T_train_labels, T_labels = CIFAR10.load_contrast(
         n=13, k=.01)
     # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_whiten(size=32,bias=.1)
     # X = CIFAR10.load_cifar10_adam_patch(num_patch=100000,size=11,backend="numpy")
     # print X.dtype,X.max()
     dp = nn.dp_ram(X=X, X_test=X, data_batch=25)
     while 1:
         x, t, id = dp.train()
         print x.shape
         nn.show_images(x, (5, 5))
         print t
         nn.show()
Exemple #11
0
 def test():
     # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load(size=32,want_mean=True)
     # X,T,X_test,T_test,T_train_labels,T_labels = NORB.load_whiten(size=32,bias=.1)
     X, T, X_test, T_test, T_train_labels, T_labels = NORB.load_contrast()
     print X.dtype, X.max()
     dp = nn.dp_ram(X=X,
                    T=T,
                    X_test=X_test,
                    T_test=T_test,
                    T_train_labels=None,
                    T_labels=T_labels,
                    data_batch=25)
     while 1:
         x, t, id = dp.train()
         print x.shape
         nn.show_images(x, (5, 5))
         print t
         nn.show()