GIoULoss<T>
Models & Types · AiDotNet.ComputerVision.Detection.Losses
Generalized Intersection over Union (GIoU) loss for bounding box regression.
Inheritance: LossFunctionBase<T> → GIoULoss<T>
For Beginners
GIoU loss improves upon standard IoU loss by providing gradients even when boxes don’t overlap. This helps the model learn to move boxes towards their targets even when they start far apart.
How It Works
GIoU = IoU - (|C - U|) / |C|, where C is the smallest enclosing box and U is the union. GIoU Loss = 1 - GIoU
Reference: Rezatofighi et al., “Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression”, CVPR 2019
Constructors
| Constructor | Summary |
|---|---|
GIoULoss() |
Creates a new GIoU loss instance. |
Methods
| Method | Summary |
|---|---|
T CalculateLoss(Tensor<T> predicted, Tensor<T> targets) |
Calculates GIoU loss for tensor inputs. |
T CalculateLoss(Vector<T> predicted, Vector<T> actual) |
Calculates GIoU loss for tensor inputs. |
Tensor<T> ComputeTapeLoss(Tensor<T> predicted, Tensor<T> target) |
|
double CalculateLossForBox(BoundingBox<T> predicted, BoundingBox<T> target) |
Calculates GIoU loss for a pair of bounding boxes. |