d3d.box

This module contains bounding box related autograd operations implemented with CUDA support.

class d3d.box.Iou2D[source]

Bases: torch.autograd.function.Function

Differentiable axis aligned IoU function for 2D boxes

class d3d.box.Iou2DR[source]

Bases: torch.autograd.function.Function

Differentiable rotated IoU function for 2D boxes

class d3d.box.DIou2DR[source]

Bases: torch.autograd.function.Function

Differentiable rotated DIoU function for 2D boxes

class d3d.box.GIou2DR[source]

Bases: torch.autograd.function.Function

Differentiable rotated GIoU function for 2D boxes

d3d.box.box2d_iou(boxes1, boxes2, method='box', precise=True)[source]

Differentiable IoU on axis-aligned or rotated 2D boxes

Parameters
  • boxes1 – Input boxes, shape is N x 5 (x,y,w,h,r)

  • boxes2 – Input boxes, shape is N x 5 (x,y,w,h,r)

  • method – ‘box’ - axis-aligned box, ‘rbox’ - rotated box, ‘grbox’ - giou for rotated box, ‘drbox’ - diou for rotated box

  • precise – force using double precision to calculate iou

d3d.box.box2d_nms(boxes, scores, iou_method='box', supression_method='hard', iou_threshold=0, score_threshold=0, supression_param=0, precise=True)[source]

NMS on axis-aligned or rotated 2D boxes

Parameters
  • method – ‘box’ - axis-aligned box, ‘rbox’ - rotated box

  • precise – force using double precision to calculate iou

  • iou_threshold – IoU threshold for two boxes to be considered as overlapped

  • score_threshold – Minimum score for a box to be considered as valid

  • suppression_param

    Type of suppression. {0: hard, 1: linear, 2: gaussian}. See reference below for details ..

    Soft-NMS: Bodla, Navaneeth, et al. “Soft-NMS–improving object detection with one line of code.” Proceedings of the IEEE international conference on computer vision. 2017.

d3d.box.seg1d_iou(seg1, seg2)[source]

Calculate IoU of 1D segments The input should be n*2, where the last dim is [center, width]

Parameters
  • boxes1 – Input segments, shape is Nx2

  • boxes2 – Input segments, shape is Nx2