def load_test_data(self, m_5=6000, k=1000): test_bgs_data = model_utils.load_test_bg_data(self.path_dataset) test_signal_data = model_utils.load_test_signal_data(self.path_dataset, m_5=m_5, k=k) factor = -1 * np.log(0.01) # # factor = 1 norm_test_bgs_data = model_utils.normalize(test_bgs_data, factor) norm_test_signal_data = model_utils.normalize(test_signal_data, factor) reshape_norm_test_bg = np.reshape(norm_test_bgs_data, ( norm_test_bgs_data.shape[0], norm_test_bgs_data.shape[1], norm_test_bgs_data.shape[2], 1)) reshape_norm_train_bg = np.reshape(norm_test_signal_data, ( norm_test_signal_data.shape[0], norm_test_signal_data.shape[1], norm_test_signal_data.shape[2], 1)) return reshape_norm_test_bg, reshape_norm_train_bg
def load_train_data(self): train_data = model_utils.load_train_data(self.path_dataset) test_bgs_data = model_utils.load_test_bgs_data(self.path_dataset) factor = -1 * np.log(0.01) norm_train_data = model_utils.normalize(train_data, factor) norm_test_bgs_data = model_utils.normalize(test_bgs_data, factor) return norm_train_data, norm_test_bgs_data
def load_test_data(self, signal_id=1): test_bgs_data = model_utils.load_test_bgs_data(self.path_dataset) test_signal_data = model_utils.load_test_signal_data( self.path_dataset, signal_id=signal_id) factor = -1 * np.log(0.01) norm_test_bgs_data = model_utils.normalize(test_bgs_data, factor) norm_test_signal_data = model_utils.normalize(test_signal_data, factor) return norm_test_bgs_data, norm_test_signal_data
def load_train_data(self): train_data = model_utils.load_train_data(self.path_dataset) test_bgs_data = model_utils.load_test_bgs_data(self.path_dataset) train_shape = (self.dataset_config['TRAIN_SIZE'], self.shape) test_bgs_shape = (self.dataset_config['TEST_BACKGROUND_SIZE'], self.shape) factor = -1 * np.log(0.01) norm_train_data = model_utils.normalize(train_data.reshape(train_shape), factor) norm_test_bgs_data = model_utils.normalize(test_bgs_data.reshape(test_bgs_shape), factor) return norm_train_data, norm_test_bgs_data
def load_test_data(self, signal_id=1): test_bgs_data = model_utils.load_test_bgs_data(self.path_dataset) test_signal_data = model_utils.load_test_signal_data(self.path_dataset, signal_id=signal_id) test_bgs_shape = (len(test_bgs_data), self.shape) test_signal_shape = (len(test_signal_data), self.shape) print(test_signal_data.shape) factor = -1 * np.log(0.01) norm_test_bgs_data = model_utils.normalize(test_bgs_data.reshape(test_bgs_shape), factor) norm_test_signal_data = model_utils.normalize(test_signal_data.reshape(test_signal_shape), factor) return norm_test_bgs_data, norm_test_signal_data
def forward(self, input): gpu_ids = None if isinstance(input.data, torch.cuda.FloatTensor) and self.ngpu > 0: gpu_ids = range(self.ngpu) output = nn.parallel.data_parallel(self.main, input, gpu_ids) else: output = self.main(input) output = output.view(output.size(0), -1) if self.noise == 'sphere': output = utils.normalize(output) return output
def load_train_data(self): train_bg = model_utils.load_train_bg_data(self.path_dataset) test_bg = model_utils.load_test_bg_data(self.path_dataset) factor = -1 * np.log(0.01) norm_train_bg = model_utils.normalize(train_bg, factor) norm_test_bg = model_utils.normalize(test_bg, factor) # norm_train_bg = train_bg # norm_test_bg = test_bg reshape_norm_train_bg = np.reshape(norm_train_bg, ( norm_train_bg.shape[0], norm_train_bg.shape[1], norm_train_bg.shape[2], 1)) reshape_norm_test_bg = np.reshape(norm_test_bg, ( norm_test_bg.shape[0], norm_test_bg.shape[1], norm_test_bg.shape[2], 1)) return reshape_norm_train_bg, reshape_norm_test_bg