def load_one_data(path): data=[] print('load_one_data') load.load(data,path,'jpg',num_ide=77,num_exp=47,num_land=73) print(data) return data
def load_set_data(): data=[] fwhs_path='/home/weiliu/fitting_dde/fitting_psp_f_l12_slt/fw' lfw_path='/home/weiliu/fitting_dde/fitting_psp_f_l12_slt/lfw_image' gtav_path='/home/weiliu/fitting_dde/fitting_psp_f_l12_slt/GTAV_image' load.load(data,fwhs_path,'jpg',num_ide=77,num_exp=47,num_land=73) load.load(data,lfw_path,'jpg',num_ide=77,num_exp=47,num_land=73) load.load(data,gtav_path,'png',num_ide=77,num_exp=47,num_land=73) # test_path='/home/weiliu/fitting_dde/4_psp_f_cal_test/data_me/test_only_three/' # load.load(data,test_path,'jpg',num_ide=77,num_exp=47,num_land=73) return data
_, Z = forward(X, Node, W, B, h) L = len(Node) arg = np.argmax(Z[L-1], axis=0) return np.average(arg == t) def noise_on_train(X): num_rand = np.random.binomial(n=784*N, p=noise*0.05) rand_mask_arg = np.random.choice(784*N, num_rand, replace=False) rand_mask = np.zeros(784*N).astype(np.bool_) rand_mask[rand_mask_arg] = True rand_mask.shape = [784, N] X[rand_mask] = np.random.rand(num_rand) return X if __name__ == "__main__": dataset = load.load() t_train = one_of_k(dataset["train_labels"]).T #shape (10, 60000) t_test = dataset["test_labels"] X_train = dataset["train_images"].T/255 #shape (784, 60000) X_test = dataset["test_images"].T/255 #shape (784, 10000) #Hyper Param N = 1000 # number of minibatch M = 2000 # maximum iterations (epoch) e = 0.1 # learning rate w_init_mean = 0 w_init_sigma = 0.1 Node = [784, 256, 128, 64, 10] L = len(Node)