'u_vocab_file': path + 'u.txt', 'v_vocab_file': path + 'v.txt', 't_vocab_file': path + 't.txt', 'train_data_file': path + 'train.txt', 'test_data_file': path + 'test.txt', 'coor_nor_file': path + 'coor_nor.txt', 'distance_file': path + 'distance.txt', 'train_log_file': path + 'log.txt', 'candidate_file': path + 'candidate.pk', 'id_offset': 1, 'n_epoch': 80, 'batch_size': 50, 'data_worker': 1, 'load_model': False, 'emb_dim_d': 16, # for distance embedding #best 16 'emb_dim_v': 16, #origin 32 best 16 'emb_dim_t': 8, #origin 8 'emb_dim_u': 32, # !!!jiayi copy from v3 origin 32 best 32 'hidden_dim': 16, #origin 16 'nb_cnt': 16, 'save_gap': 10, 'dropout': 0.5, 'epoch': 80 } dataset = DataSet(opt) manager = ModelManager(opt) model_type = 'birnnt' manager.build_model(model_type, dataset) print "evaluate" manager.evaluate(model_type, dataset)
# Go to real space data = np.fft.fftshift(np.fft.irfftn(data_ft)) # Load the NN model config = tf.ConfigProto(gpu_options=tf.GPUOptions( per_process_gpu_memory_fraction=0.3)) net = ModelManager(config) net.load(nn_model_fn) nets = net.get_input_size() # Reshape the array to match the input shape data = np.resize(data, (1, nets[0], nets[1], nets[2], 1)) # Run the network and unload the NN model denoised = net.evaluate(data)[0, ..., 0] net.end() # Back to Fourier space denoised_ft = np.fft.rfftn(np.fft.fftshift(denoised)) # Apply confidence weighting denoised_ft *= confidence # We define a lower regime for tau2 where the # numerical accuracy in the division becomes an issue tau2lim = 1e-8 imix = tau2 >= tau2lim # Define the results container result_ft = np.zeros(data_ft.shape, dtype=np.complex)