bboxes_2d_detector

Welcome to the documentation about the detectors for Bounding Boxes 2D.

All functions are defined in details further down the page.

background_subtractor

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson (2021-2022)

class BackgroundSubtractor(proc_parameters: dict)[source]

Bases: pytb.detection.bboxes.bboxes_2d_detector.bboxes_2d_detector.BBoxes2DDetector

__init__(proc_parameters: dict)[source]

Initializes the detector with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the BackgroundSubstractor detector parameters

detect(frame: numpy.array) pytb.output.bboxes_2d.BBoxes2D[source]

Performs an inference using a background subtraction method on the given frame.

Parameters

frame (np.array) – The frame to infer detections from a background substractor.

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

detectron2

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson (2021-2022)

class Detectron2(proc_parameters: dict)[source]

Bases: pytb.detection.bboxes.bboxes_2d_detector.bboxes_2d_detector.BBoxes2DDetector

__init__(proc_parameters: dict)[source]

Initializes the detector with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the Detectron2 detector parameters

detect(org_frame: numpy.array) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a Detectron2 inference on the given frame.

Parameters

frame (np.array) – The frame to infer Detectron2 detections

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

faster_rcnn

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson and Benoît Gérin (2022)

class FasterRCNN(proc_parameters: dict)[source]

Bases: pytb.detection.bboxes.bboxes_2d_detector.bboxes_2d_detector.BBoxes2DDetector

__init__(proc_parameters: dict)[source]

Initializes the detector with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the FasterRCNN parameters.

detect(frame: numpy.array) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a Faster-RCNN inference on the given frame.

Parameters

frame (np.array) – The frame to infer Faster-RCNN detections

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

_detect_torch_resnet50_pretrained(org_frame) pytb.output.bboxes_2d.BBoxes2D[source]

Performs the inference using the implementation PyTorch Resnet50.

Parameters

org_frame (np.array) – The frame to infer Faster-RCNN detections.

mask_rcnn

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson and Benoît Gérin (2022)

class MaskRCNN(proc_parameters: dict)[source]

Bases: pytb.detection.bboxes.bboxes_2d_detector.bboxes_2d_detector.BBoxes2DDetector

__init__(proc_parameters: dict)[source]

Initializes the detector with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the MaskRCNN parameters.

detect(frame: numpy.ndarray) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a Mask-RCNN inference on the given frame.

Parameters

frame (np.ndarray) – The frame to infer Mask-RCNN detections

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

_detect_torch_resnet50_pretrained(org_frame) pytb.output.bboxes_2d.BBoxes2D[source]

Performs the inference using the implementation PyTorch Resnet50.

Parameters

detections. (The frame to infer Mask-RCNN) –

yolo_2_3_4

class YOLO4(proc_parameters: dict)[source]

Bases: pytb.detection.bboxes.bboxes_2d_detector.bboxes_2d_detector.BBoxes2DDetector

__init__(proc_parameters: dict)[source]

This class can be used for YOLO v2, v3, v4 models from Darknet.

Initializes the detector with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the YOLO detector parameters

detect(frame: numpy.array) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a YOLO inference on the given frame.

Parameters

frame (np.array) – The frame to infer YOLO detections.

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

_setup_cv2()[source]

Setup OpenCV framework with the required backend.

_detect_cv2_detection_model(cv2_org_frame: numpy.array) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a YOLOv2-3-4 inference on the given frame using cv2-DetectionModel of openCV.

Parameters

frame (np.array) – The frame to infer YOLOv2-3-4 detections.

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

_detect_cv2_read_net(blob_org_frame) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a YOLOv2-4 inference on the given frame using cv2-ReadNet of openCV.

Parameters

frame (Any) – The frame to infer YOLOv2-3-4 detections.

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D

yolo_5

class YOLO5(proc_parameters: dict)[source]

Bases: pytb.detection.bboxes.bboxes_2d_detector.bboxes_2d_detector.BBoxes2DDetector

__init__(proc_parameters: dict)[source]

Initializes the detector with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the YOLO detector parameters

detect(frame: numpy.array) pytb.output.bboxes_2d.BBoxes2D[source]

Performs a YOLOv5 inference on the given frame using ultralytics on PyTorch.

Parameters

frame (np.array) – The frame to infer YOLOv5 detections.

Returns

A set of 2D bounding boxes identifying the detected objects.

Return type

BBoxes2D