Skip to content

Losses

[source]

MultiBoxLoss

paz.optimization.losses.multi_box_loss.MultiBoxLoss(neg_pos_ratio=3, alpha=1.0, max_num_negatives=300)

Multi-box loss for a single-shot detection architecture.

Arguments

  • neg_pos_ratio: Int. Number of negatives used per positive box.
  • alpha: Float. Weight parameter for localization loss.
  • max_num_negatives: Int. Maximum number of negatives per batch.

References


[source]

KeypointNetLoss

paz.optimization.losses.keypointnet_loss.KeypointNetLoss(num_keypoints, focal_length, rotation_noise=0.1, separation_delta=0.05, loss_weights={'consistency': 1.0, 'silhouette': 1.0, 'separation': 1.0, 'relative_pose': 0.2, 'variance': 0.5})

KeypointNet loss for discovering latent keypoints.

Arguments

  • num_keypints: Int. Number of keypoints to discover.
  • focal_length: Float. Focal length of camera
  • rotation_noise: Float. Noise added to the estimation of the rotation.
  • separation_delta: Float. Delta used for the ''separation'' loss.
  • loss_weights: Dict. having as keys strings with the different losses names e.g. ''consistency'' and as value the weight used for that loss.

References


[source]

DiceLoss

paz.optimization.losses.segmentation.dice_loss.DiceLoss(beta=1.0, class_weights=1.0)

Computes the F beta loss. The F beta score is the geometric mean of the precision and recall, where the recall is B times more important than the precision.

Arguments

  • beta: Float.
  • class_weights: Float or list of floats of shape (num_classes).

[source]

FocalLoss

paz.optimization.losses.segmentation.focal_loss.FocalLoss(gamma=2.0, alpha=0.25)

Computes the Focal loss. The Focal loss down weights properly classified examples.

Arguments

  • gamma: Float.
  • alpha: Float.
  • class_weights: Float or list of floats of shape (num_classes).

[source]

JaccardLoss

paz.optimization.losses.segmentation.jaccard_loss.JaccardLoss(class_weights=1.0)

Computes the Jaccard loss. The Jaccard score is the intersection over union of the predicted with respect to real masks.

Arguments

  • class_weights: Float or list of floats of shape (num_classes).

[source]

WeightedReconstruction

paz.optimization.losses.segmentation.weighted_reconstruction.WeightedReconstruction(beta=3.0)

Computes L1 reconstruction loss by multiplying positive alpha mask by beta.

Arguments

  • beta: Float. Value used to multiple positive alpha mask values.
  • RGBA_true: Tensor [batch, H, W, 4]. Color with alpha mask label values.
  • RGB_pred: Tensor [batch, H, W, 3]. Predicted RGB values.

Returns

Tensor [batch, H, W] with weighted reconstruction loss values.


[source]

WeightedReconstructionWithError

paz.optimization.losses.segmentation.weighted_reconstruction.WeightedReconstructionWithError(beta=3.0)

Computes L1 reconstruction loss by multiplying positive alpha mask by beta.

Arguments

  • RGBA_true: Tensor [batch, H, W, 4]. Color with alpha mask label values.
  • RGBE_pred: Tensor [batch, H, W, 4]. Predicted RGB and error mask.
  • beta: Float. Value used to multiple positive alpha mask values.

Returns

Tensor [batch, H, W] with weighted reconstruction loss values.