Skip to content

Instantly share code, notes, and snippets.

def fphoto_loss(flow, im1, im2, occ=None, max_dis=3, logexp=None):
"""
scale-aware flow self-supervision loss
paper:
https://openaccess.thecvf.com/content_CVPR_2020/html/Yang_Upgrading_Optical_Flow_to_3D_Scene_Flow_Through_Optical_Expansion_CVPR_2020_paper.html
"""
b,_,h,w = flow.shape
im1 = F.interpolate(im1.permute(0,3,1,2), (h,w), mode='area')
im2 = F.interpolate(im2.permute(0,3,1,2), (h,w), mode='area')