Пример #1
0
 def __init__(self, config, split='test'):
     self.config = config
     self.db = WaterDataset(config.data_dir, split=split)
Пример #2
0
 def __init__(self, config, split='train'):
     self.config = config
     print(config.data_dir)
     self.db = WaterDataset(config.data_dir,
                            config.num_of_samples,
                            split=split)
Пример #3
0
 def __init__(self, config, split='test'):
     self.config = config
     if config.test_data_dir:
         self.db = WaterDataset(config.test_data_dir, split=split)
     else:
         self.db = WaterDataset(config.data_dir, split=split)
Пример #4
0
        # Normalize by softmax
        all_E[:, :, f + 1] = torch.clamp(all_E[:, :, f + 1], 1e-7, 1 - 1e-7)
        all_E[:, :, f + 1] = torch.log(
            (all_E[:, :, f + 1] / (1 - all_E[:, :, f + 1])))
        all_E[:, :, f + 1] = F.softmax(Variable(all_E[:, :, f + 1]),
                                       dim=1).data

    return all_E


if MO:
    Testset = DAVIS(DAVIS_ROOT, imset='2017/val.txt', multi_object=True)
if SO:
    Testset = DAVIS(DAVIS_ROOT, imset='2016/val.txt')
if test_case is not None:
    Testset = WaterDataset(water_root, test_case)
Testloader = data.DataLoader(Testset,
                             batch_size=1,
                             shuffle=False,
                             num_workers=2,
                             pin_memory=True)

model = nn.DataParallel(RGMP())
if torch.cuda.is_available():
    model.cuda()

model.load_state_dict(torch.load('weights.pth'))

model.eval()  # turn-off BN
for seq, (all_F, all_M, info) in enumerate(Testloader):
    all_F, all_M = all_F[0], all_M[0]