class src.loss_func.OffsetLoss(epsilon: float = 1e-05, norm=None)[source]

OffsetLoss Criterion computes a robust loss function based on image pixel offset. Proposed by “Zanfir et al. Deep Learning of Graph Matching. CVPR 2018.”

\[\begin{split}\mathbf{d}_i =& \sum_{j \in V_2} \left( \mathbf{S}_{i, j} P_{2j} \right)- P_{1i} \\ L_{off} =& \sum_{i \in V_1} \sqrt{||\mathbf{d}_i - \mathbf{d}^{gt}_i||^2 + \epsilon}\end{split}\]

\(\mathbf{d}_i\) is the displacement vector. See src.displacement_layer.Displacement or more details

  • epsilon – a small number for numerical stability

  • norm – (optional) division taken to normalize the loss

forward(d1: torch.Tensor, d2: torch.Tensor, mask: Optional[float] = None) torch.Tensor[source]
  • d1 – predicted displacement matrix

  • d2 – ground truth displacement matrix

  • mask – (optional) dummy node mask


computed offset loss

training: bool