示例#1
0
 def __init__(self, args):
     self.args = args
     torch.manual_seed(self.args.seed)
     np.random.seed(self.args.seed)
     print('{} detection...'.format(args.dataset))
     white_noise = dp.DatasetReader(white_noise=self.args.dataset,
                                    data_path=data_path,
                                    len_seg=self.args.len_seg
                                    )
     self.testset = torch.tensor(torch.from_numpy(white_noise.dataset_), dtype=torch.float32)
     self.spots = np.load('{}/spots.npy'.format(info_path))
     self.Generator = Generator(args)  # Generator
     self.Discriminator = Discriminator(args)  # Discriminator
示例#2
0
 def __init__(self, args):
     self.args = args
     torch.manual_seed(self.args.seed)
     np.random.seed(self.args.seed)
     print('{} detection...'.format(args.dataset))
     white_noise = dp.DatasetReader(white_noise=self.args.dataset,
                                    data_path=data_path,
                                    data_source=args.data_source,
                                    len_seg=self.args.len_seg)
     _, self.testset = white_noise(args.net_name)
     self.spots = np.load('{}/spots.npy'.format(info_path))
     self.AE = AutoEncoder(args)
     self.latent = np.load('{}/features/{}.npy'.format(
         save_path, self.file_name()))
示例#3
0
 def __init__(self, args):
     self.args = args
     torch.manual_seed(self.args.seed)
     np.random.seed(self.args.seed)
     print('> Training arguments:')
     for arg in vars(args):
         print('>>> {}: {}'.format(arg, getattr(args, arg)))
     white_noise = dp.DatasetReader(white_noise=self.args.dataset,
                                    data_path=data_path,
                                    data_source=args.data,
                                    len_seg=self.args.len_seg)
     dataset, _ = white_noise(args.net_name)
     self.data_loader = DataLoader(dataset=dataset,
                                   batch_size=args.batch_size,
                                   shuffle=True)
     self.Generator = Generator(args)  # Generator
     self.Discriminator = Discriminator(args)  # Discriminator
示例#4
0
 def __init__(self, args):
     self.args = args
     torch.manual_seed(self.args.seed)
     np.random.seed(self.args.seed)
     print('> Training arguments:')
     for arg in vars(args):
         print('>>> {}: {}'.format(arg, getattr(args, arg)))
     white_noise = dp.DatasetReader(white_noise=self.args.dataset,
                                    data_path=data_path,
                                    data_source=args.data_source,
                                    len_seg=self.args.len_seg)
     dataset, _ = white_noise(args.net_name)
     self.data_loader = DataLoader(dataset=dataset,
                                   batch_size=args.batch_size,
                                   shuffle=False)
     self.spots = np.load('{}/spots.npy'.format(info_path))
     self.AE = AutoEncoder(args).to(device)  # AutoEncoder
     self.AE.apply(self.weights_init)
     self.criterion = nn.MSELoss()
     self.vis = visdom.Visdom(
         env='{}'.format(self.file_name()),
         log_to_filename='{}/visualization/{}.log'.format(
             save_path, self.file_name()))
     plt.figure(figsize=(15, 15))