nextcv.postprocessing.boxes ⚓︎
Bounding box postprocessing functions.
| FUNCTION | DESCRIPTION |
|---|---|
iou_np | Calculate intersection over union of target box with all others. |
nms_cpp | Non-Maximum-Supression (NMS) algorithm to remove overlapping bounding boxes. |
nms_np | Non-Maximum-Supression (NMS) algorithm to remove overlapping bounding boxes. |
wbf_cpp | Fuse detections from multiple models using Weighted Box Fusion (WBF). |
wbf_np | Reference WBF implementation from |
nextcv.postprocessing.boxes.iou_np ⚓︎
iou_np(target_box: NDArray, boxes: NDArray, target_area: NDArray, areas: NDArray, inclusive: bool = False) -> NDArray
Calculate intersection over union of target box with all others.
| PARAMETER | DESCRIPTION |
|---|---|
target_box | The bounding box as (top_left_x, top_left_y, bottom_right_x, bottom_right_y). TYPE: |
boxes | The bounding boxes as (top_left_x, top_left_y, bottom_right_x, bottom_right_y). TYPE: |
target_area | The area of the target box. TYPE: |
areas | The areas of all boxes. TYPE: |
inclusive | If True, uses (x2 - x1 + 1) * (y2 - y1 + 1) for area. Enable only for integer, pixel-indexed boxes (VOC/OpenCV style). TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
NDArray | The intersection over union of the target box with all others. |
nextcv.postprocessing.boxes.nms_cpp ⚓︎
Non-Maximum-Supression (NMS) algorithm to remove overlapping bounding boxes.
| PARAMETER | DESCRIPTION |
|---|---|
bboxes | The bounding boxes as (top_left_x, top_left_y, bottom_right_x, bottom_right_y). TYPE: |
scores | The confidence scores for each bounding box. TYPE: |
iou_thresh | The threshold for intersection over union. TYPE: |
nextcv.postprocessing.boxes.nms_np ⚓︎
Non-Maximum-Supression (NMS) algorithm to remove overlapping bounding boxes.
| PARAMETER | DESCRIPTION |
|---|---|
bboxes | The bounding boxes as (top_left_x, top_left_y, bottom_right_x, bottom_right_y). TYPE: |
scores | The confidence scores for each bounding box. TYPE: |
iou_thresh | The threshold for intersection over union. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
NDArray | The indices of the bounding boxes to keep. |
nextcv.postprocessing.boxes.wbf_cpp ⚓︎
wbf_cpp(boxes_list: list[NDArray], scores_list: list[NDArray], labels_list: list[NDArray], weights: list[float] | None = None, iou_thr: float = 0.55, skip_box_thr: float = 0.0, conf_type: str = 'avg', allows_overflow: bool = False) -> tuple[NDArray[float32], NDArray[float32], NDArray[int32]]
Fuse detections from multiple models using Weighted Box Fusion (WBF).
| PARAMETER | DESCRIPTION |
|---|---|
boxes_list | Per-model boxes with shape (N_i, 4) in normalized xyxy format. |
scores_list | Per-model confidence scores with shape (N_i,). |
labels_list | Per-model integer labels with shape (N_i,). |
weights | Optional per-model weights. Defaults to equal weights. |
iou_thr | IoU threshold for clustering boxes into the same fused box. TYPE: |
skip_box_thr | Drop boxes with score lower than this threshold. TYPE: |
conf_type | Confidence mode. One of: "avg", "max", "box_and_model_avg", "absent_model_aware_avg". TYPE: |
allows_overflow | If True, confidence can exceed 1.0 for avg mode. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
tuple[NDArray[float32], NDArray[float32], NDArray[int32]] | Tuple of (fused_boxes, fused_scores, fused_labels). |