deepness.processing.models.detector.Detection

class Detection(bbox: BoundingBox, conf: float, clss: int, mask: ndarray | None = None, mask_offsets: Tuple[int, int] | None = None)

Bases: object

Class that represents single detection result in object detection model

Parameters:
  • bbox (BoundingBox) – bounding box describing the detection rectangle

  • conf (float) – confidence of the detection

  • clss (int) – class of the detected object

Methods

convert_to_global

Apply (x,y) offset to bounding box coordinates

get_bbox_center

Get center of the bounding box

get_bbox_xyxy

Convert stored bounding box into x1y1x2y2 format

Attributes

mask

mask of the detected object

mask_offsets

bbox

bounding box describing the detection rectangle

conf

confidence of the detection

clss

class of the detected object

bbox: BoundingBox

bounding box describing the detection rectangle

Type:

BoundingBox

clss: int

class of the detected object

Type:

int

conf: float

confidence of the detection

Type:

float

convert_to_global(offset_x: int, offset_y: int)

Apply (x,y) offset to bounding box coordinates

Parameters:
  • offset_x (int) – _description_

  • offset_y (int) – _description_

get_bbox_center() Tuple[int, int]

Get center of the bounding box

Returns:

Center of the bounding box

Return type:

Tuple[int, int]

get_bbox_xyxy() ndarray

Convert stored bounding box into x1y1x2y2 format

Returns:

Array in (x1, y1, x2, y2) format

Return type:

np.ndarray

mask: ndarray | None = None

mask of the detected object

Type:

np.ndarray