change d1 to err2.0 in middlebury

This commit is contained in:
HTensor 2023-04-27 13:29:57 +08:00
parent 1080b823a5
commit 875a1eec05
2 changed files with 5 additions and 4 deletions

View File

@ -157,6 +157,7 @@ def groupwise_correlation(fea1, fea2, num_groups):
return cost return cost
def build_gwc_volume(refimg_fea, targetimg_fea, maxdisp, num_groups): def build_gwc_volume(refimg_fea, targetimg_fea, maxdisp, num_groups):
# batch, groups, max_disp, height, width
B, C, H, W = refimg_fea.shape B, C, H, W = refimg_fea.shape
volume = refimg_fea.new_zeros([B, num_groups, maxdisp, H, W]) volume = refimg_fea.new_zeros([B, num_groups, maxdisp, H, W])
for i in range(maxdisp): for i in range(maxdisp):

View File

@ -200,7 +200,7 @@ def validate_middlebury(model, iters=32, split='F', mixed_prec=False, max_disp=1
out = (epe_flattened > 2.0) out = (epe_flattened > 2.0)
image_out = out[val].float().mean().item() image_out = out[val].float().mean().item()
image_epe = epe_flattened[val].mean().item() image_epe = epe_flattened[val].mean().item()
logging.info(f"Middlebury Iter {val_id+1} out of {len(val_dataset)}. EPE {round(image_epe,4)} D1 {round(image_out,4)}") logging.info(f"Middlebury Iter {val_id+1} out of {len(val_dataset)}. EPE {round(image_epe,4)} Err2.0 {round(image_out,4)}")
epe_list.append(image_epe) epe_list.append(image_epe)
out_list.append(image_out) out_list.append(image_out)
@ -208,10 +208,10 @@ def validate_middlebury(model, iters=32, split='F', mixed_prec=False, max_disp=1
out_list = np.array(out_list) out_list = np.array(out_list)
epe = np.mean(epe_list) epe = np.mean(epe_list)
d1 = 100 * np.mean(out_list) err2 = 100 * np.mean(out_list)
print(f"Validation Middlebury{split}: EPE {epe}, D1 {d1}") print(f"Validation Middlebury{split}: EPE {epe}, Err2.0 {err2}")
return {f'middlebury{split}-epe': epe, f'middlebury{split}-d1': d1} return {f'middlebury{split}-epe': epe, f'middlebury{split}-err2.0': err2}
if __name__ == '__main__': if __name__ == '__main__':