trtutils.image.sahi package

Module contents

SAHI implementation.

Classes

SAHI

SAHI implementation.

class trtutils.image.sahi.SAHI(detector: DetectorInterface, slice_size: tuple[int, int] | None = None, slice_overlap: tuple[float, float] = (0.2, 0.2), iou_threshold: float = 0.5, *, agnostic_nms: bool = False, verbose: bool = False)[source]

Bases: object

Simple implementation of SAHI.

end2end(image: np.ndarray, conf_thres: float | None = None, nms_iou_thres: float | None = None, *, extra_nms: bool | None = None, agnostic_nms: bool | None = None, verbose: bool | None = None) → list[tuple[tuple[int, int, int, int], float, int]][source]

Perform end to end inference using detection model and SAHI.

Parameters:
  • image (np.ndarray) – The image to perform inference with.

  • conf_thres (float, optional) – The confidence threshold with which to retrieve bounding boxes. By default None

  • nms_iou_thres (float) – The IOU threshold to use during the optional/additional NMS operation. By default, None which will use value provided during initialization.

  • extra_nms (bool, optional) – Whether or not to perform an additional NMS operation. By default None, which will use value provided during initialization.

  • agnostic_nms (bool, optional) – Whether or not to perform class-agnostic NMS for the optional/additional operation. By default None, which will use value provided during initialization.

  • verbose (bool, optional) – Whether or not to log additional information.

Returns:

The detections where each entry is bbox, conf, class_id

Return type:

list[tuple[tuple[int, int, int, int], float, int]]