From 64539dc87fdfbdef64e5891a8c7db79c42d4ae2f Mon Sep 17 00:00:00 2001 From: Gangwei Xu Date: Fri, 17 Mar 2023 11:12:32 +0800 Subject: [PATCH] Update evaluate_stereo.py --- IGEV-Stereo/evaluate_stereo.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/IGEV-Stereo/evaluate_stereo.py b/IGEV-Stereo/evaluate_stereo.py index 44fc114..73d35dd 100644 --- a/IGEV-Stereo/evaluate_stereo.py +++ b/IGEV-Stereo/evaluate_stereo.py @@ -36,10 +36,7 @@ def validate_eth3d(model, iters=32, mixed_prec=False): image1, image2 = padder.pad(image1, image2) with autocast(enabled=mixed_prec): - if iters == 0: - flow_pr = model(image1, image2, iters=iters, test_mode=True) - else: - _, flow_pr = model(image1, image2, iters=iters, test_mode=True) + flow_pr = model(image1, image2, iters=iters, test_mode=True) flow_pr = padder.unpad(flow_pr.float()).cpu().squeeze(0) assert flow_pr.shape == flow_gt.shape, (flow_pr.shape, flow_gt.shape) epe = torch.sum((flow_pr - flow_gt)**2, dim=0).sqrt() @@ -88,10 +85,7 @@ def validate_kitti(model, iters=32, mixed_prec=False): with autocast(enabled=mixed_prec): start = time.time() - if iters == 0: - flow_pr = model(image1, image2, iters=iters, test_mode=True) - else: - _, flow_pr = model(image1, image2, iters=iters, test_mode=True) + flow_pr = model(image1, image2, iters=iters, test_mode=True) end = time.time() if val_id > 50: @@ -142,10 +136,7 @@ def validate_sceneflow(model, iters=32, mixed_prec=False): image1, image2 = padder.pad(image1, image2) with autocast(enabled=mixed_prec): - if iters == 0: - flow_pr = model(image1, image2, iters=iters, test_mode=True) - else: - flow_pr = model(image1, image2, iters=iters, test_mode=True) + flow_pr = model(image1, image2, iters=iters, test_mode=True) flow_pr = padder.unpad(flow_pr).cpu().squeeze(0) assert flow_pr.shape == flow_gt.shape, (flow_pr.shape, flow_gt.shape) @@ -194,10 +185,7 @@ def validate_middlebury(model, iters=32, split='F', mixed_prec=False): image1, image2 = padder.pad(image1, image2) with autocast(enabled=mixed_prec): - if iters == 0: - flow_pr = model(image1, image2, iters=iters, test_mode=True) - else: - _, flow_pr = model(image1, image2, iters=iters, test_mode=True) + flow_pr = model(image1, image2, iters=iters, test_mode=True) flow_pr = padder.unpad(flow_pr).cpu().squeeze(0) assert flow_pr.shape == flow_gt.shape, (flow_pr.shape, flow_gt.shape)