Open TengFeiHan0 opened 4 years ago
Dear @avirambh I have a similar problem. I have adapted the testing script from the IRR repository , however I get nonsense outputs using your checkpoints and model. Is there some preprocessing or post processing I should apply to the inputs or outputs. Attached you can find a snippet of my testing script and an output sample.
`checkpoint_path = '/home/USER/optical_flow_networks/ScopeFlow/checkpoints/' model_ckpt = 'T3/checkpoint_best.ckpt'
model_checkpoint_path = os.path.join(checkpoint_path,model_ckpt)
output_png_pth = '/home/USER/training/plots/test_scopeflow.png'
img1 = imread(im1_pth).astype(np.float32)/ np.float32(255.0) img2 = imread(im2_pth).astype(np.float32)/ np.float32(255.0) im1_tensor = vision_transforms.transforms.ToTensor()(img1).unsqueeze(0).cuda() im2_tensor = vision_transforms.transforms.ToTensor()(img2).unsqueeze(0).cuda()
@dataclass class Config: bilateral_mask = False model = PWCNet(args=Config())
checkpoint = torch.load(model_checkpoint_path, map_location=torch.device('cpu')) model = torch.nn.DataParallel(model) model.load_state_dict(checkpoint, strict=False) model.cuda().eval()
input_dict = {'input1' : im1_tensor, 'input2' : im2_tensor} output_dict = model.forward(input_dict)
flow = output_dict['flow'].squeeze(0).detach().cpu().numpy() imsave(output_png_pth, flow_to_png_middlebury(flow))`
Thank you for your great work! what are the necessary steps to test your given model on my own datasets?