CIoULoss<T>
Models & Types · AiDotNet.ComputerVision.Detection.Losses
Complete Intersection over Union (CIoU) loss for bounding box regression.
Inheritance: LossFunctionBase<T> → CIoULoss<T>
For Beginners
CIoU loss extends DIoU by also considering aspect ratio. This provides the most accurate bounding box regression and is used in modern YOLO versions (v5, v7, v8, etc.).
How It Works
CIoU = IoU - d²/c² - αv, where:
- d is the center distance
- c is the enclosing diagonal
- v measures aspect ratio consistency
- α is a balancing factor
CIoU Loss = 1 - CIoU
Reference: Zheng et al., “Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression”, AAAI 2020
Constructors
| Constructor | Summary |
|---|---|
CIoULoss() |
Creates a new CIoU loss instance. |
Methods
| Method | Summary |
|---|---|
T CalculateLoss(Tensor<T> predicted, Tensor<T> targets) |
Calculates the CIoU loss between predicted and target bounding boxes. |
T CalculateLoss(Vector<T> predicted, Vector<T> actual) |
Calculates the CIoU 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 CIoU loss for a pair of bounding boxes. |