vis4d.op.loss.orthogonal_transform_loss

Orthogonal Transform Loss.

Classes

OrthogonalTransformRegularizationLoss([reducer])

Loss that punishes linear transformations that are not orthogonal.

class OrthogonalTransformRegularizationLoss(reducer=<function identity_loss>)[source]

Loss that punishes linear transformations that are not orthogonal.

Calculates difference of X’*X and identity matrix using norm( X’*X - I)

Initialize a loss functor.

Parameters:
  • reducer (LossReducer) – A function to aggregate the loss values into

  • prediction (a single tensor value. It is commonly used for dense)

  • loss. (tasks to merge pixel-wise loss to a final)

  • Example::

    def mean_loss(loss: torch.Tensor) -> torch.Tensor:

    return loss.mean()

__call___(transforms)[source]

Calculates the loss.

Calculates difference of X’*X and the identity matrix using norm(X’*X - I) for each transformation

Parameters:

transforms (list[Tensor]) – (list(torch.tensor)) list with transformation matrices batched ([N, 3, 3], [N, x, x], ….)

Return type:

Tensor

Returns:

torch.Tensor containing the mean loss value (mean(norm(X’*X - I)))

forward(transforms)[source]

Calculates the loss.

Calculates difference of X’*X and the identity matrix using norm(X’*X - I) for each transformation

Parameters:

transforms (list[Tensor]) – (list(torch.tensor)) list with transformation matrices batched ([N, 3, 3], [N, x, x], ….)

Return type:

Tensor

Returns:

torch.Tensor containing the mean loss value (mean(norm(X’*X - I)))