Post-processing¶
fuse ¶
fuse(
detections: CanvasDetections,
windows: Tensor,
mode: FusionMode = "seam_wbf",
iou_threshold: float | None = None,
class_agnostic: bool = False,
edge_tolerance: float = FUSION_EDGE_TOLERANCE,
min_parallel_iou: float = 0.6,
max_edge_gap: float = 0.1,
per_tile_nms: bool | None = None,
score_mode: ScoreMode | None = None,
min_relative_score: float | None = None,
seam_min_score: float = 0.5,
edge_cleanup: EdgeCleanup | bool = "balanced",
whole_view_gate: WholeViewGate | bool = "class",
) -> BoxTuple
Merge raw per-tile detections into final boxes using the selected fusion mode.
seam_fuse ¶
seam_fuse(
detections: CanvasDetections,
windows: Tensor,
edge_tolerance: float = 2.0,
min_parallel_iou: float = 0.6,
max_edge_gap: float = 0.1,
class_agnostic: bool = False,
) -> BoxTuple
Merge fragments of objects cut by tile edges into one box per object.
Links a truncated box to an overlapping or facing-edge box from another tile when their observed edges agree, groups linked boxes into connected components, and replaces each component with its union (max score and winning label).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detections
|
CanvasDetections
|
Output of :func: |
required |
windows
|
Tensor
|
|
required |
wbf ¶
wbf(
boxes: Tensor,
scores: Tensor,
labels: Tensor,
iou_threshold: float = 0.5,
class_agnostic: bool = False,
score_mode: ScoreMode = "mean",
min_relative_score: float = 0.0,
) -> BoxTuple
Weighted boxes fusion seeded by NMS.
NMS picks one seed per cluster; every box joins its best-overlapping seed of the same class. The fused box is the score-weighted mean of its members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
score_mode
|
ScoreMode
|
Fused score: |
'mean'
|
min_relative_score
|
float
|
Members scoring below this fraction of their seed's score are dropped from the cluster instead of pulling the box and score towards them. |
0.0
|
batched_nms ¶
batched_nms(
boxes: Tensor,
scores: Tensor,
labels: Tensor,
iou_threshold: float = 0.5,
class_agnostic: bool = False,
) -> BoxTuple
Class-aware (or agnostic) NMS via :func:torchvision.ops.batched_nms.
merge_views ¶
merge_views(
detections: CanvasDetections,
windows: Tensor,
canvas_size: tuple[int, int],
iou_threshold: float = 0.55,
class_agnostic: bool = False,
edge_tolerance: float = 2.0,
) -> CanvasDetections
Merge augmented views of the same tiles using WBF and recompute truncation flags.
drop_covered_cut_boxes ¶
drop_covered_cut_boxes(
detections: CanvasDetections,
edge_tolerance: float = FUSION_EDGE_TOLERANCE,
min_inside: float = WHOLE_VIEW_MIN_INSIDE,
class_agnostic: bool = False,
) -> CanvasDetections
Drop cut boxes when another tile saw the whole object covering them.
drop_edge_pieces ¶
drop_edge_pieces(
boxes: Tensor,
scores: Tensor,
labels: Tensor,
windows: Tensor,
edge_tolerance: float = 2.0,
mode: Literal["balanced", "aggressive"] = "balanced",
class_agnostic: bool = False,
) -> BoxTuple
Drop cut edge fragments that are already covered by a fuller box.
box_iou_ios ¶
Pairwise IoU and intersection-over-smaller, each [N, M].