GIoULoss
classkeras_cv.losses.GIoULoss(bounding_box_format, axis=-1, **kwargs)
Implements the Generalized IoU Loss
GIoU loss is a modified IoU loss commonly used for object detection. This loss aims to directly optimize the IoU score between true boxes and predicted boxes. GIoU loss adds a penalty term to the IoU loss that takes in account the area of the smallest box enclosing both the boxes being considered for the iou. The length of the last dimension should be 4 to represent the bounding boxes.
Arguments
References
Example
y_true = np.random.uniform(size=(5, 10, 5), low=0, high=10)
y_pred = np.random.uniform(size=(5, 10, 4), low=0, high=10)
loss = GIoULoss(bounding_box_format = "xyWH")
loss(y_true, y_pred).numpy()
Usage with the compile()
API:
model.compile(optimizer='adam', loss=keras_cv.losses.GIoULoss())