holocron.ops¶
holocron.ops
implements operators that are specific for Computer Vision.
Note
Those operators currently do not support TorchScript.
Boxes¶
- holocron.ops.box_diou(boxes1, boxes2)[source]¶
Computes the Distance-IoU loss as described in “Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression”
- Parameters:
boxes1 (torch.Tensor[M, 4]) – bounding boxes
boxes2 (torch.Tensor[N, 4]) – bounding boxes
- Returns:
Distance-IoU loss
- Return type:
torch.Tensor[M, N]
- holocron.ops.box_ciou(boxes1, boxes2)[source]¶
Computes the Complete IoU loss as described in “Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression”
- Parameters:
boxes1 (torch.Tensor[M, 4]) – bounding boxes
boxes2 (torch.Tensor[N, 4]) – bounding boxes
- Returns:
Complete IoU loss
- Return type:
torch.Tensor[M, N]
Example
>>> import torch >>> from holocron.ops.boxes import box_ciou >>> boxes1 = torch.tensor([[0, 0, 100, 100], [100, 100, 200, 200]], dtype=torch.float32) >>> boxes2 = torch.tensor([[50, 50, 150, 150]], dtype=torch.float32) >>> box_ciou(boxes1, boxes2)