DIoULoss<T>

Models & Types · AiDotNet.ComputerVision.Detection.Losses

Distance Intersection over Union (DIoU) loss for bounding box regression.

Inheritance: LossFunctionBase<T> → DIoULoss<T>

For Beginners

DIoU loss adds a center distance penalty to GIoU loss. This helps the model converge faster by explicitly minimizing the distance between predicted and target box centers.

How It Works

DIoU = IoU - d²/c², where d is the center distance and c is the enclosing diagonal. DIoU Loss = 1 - DIoU

Reference: Zheng et al., “Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression”, AAAI 2020

Constructors

Constructor Summary
DIoULoss() Creates a new DIoU loss instance.

Methods

Method Summary
T CalculateLoss(Tensor<T> predicted, Tensor<T> targets) Calculates the DIoU loss between predicted and target bounding boxes.
T CalculateLoss(Vector<T> predicted, Vector<T> actual) Calculates the DIoU loss between predicted and target bounding boxes.
Tensor<T> ComputeTapeLoss(Tensor<T> predicted, Tensor<T> target)
double CalculateLossForBox(BoundingBox<T> predicted, BoundingBox<T> target) Calculates DIoU loss for a pair of bounding boxes.