Detection

class detection.Detection(num_classes=None, mask_size=None)[source]

Bases: object

Detection object

Parameters
  • num_classes (int (default=None)) – Number of classes to monitor

  • mask_size (int (default=None)) – Size of the possible mask values

Notes

Note

The detection object stores the detection probability of each class and its “objectness”. Moreover in the member “bbox” are store the detection box infos as Box object, aka (x, y, w, h)

property box

Return the box object as tuple

static do_nms_obj(detections, thresh)[source]

Sort the detection according to the probability of each class and perform the IOU as filter for the boxes

Parameters
  • detections (array_like (1D array)) – Array of detection objects.

  • thresh (float) – Threshold to apply for IoU filtering. If IoU is greater than thresh the corresponding objectness and probabilities are set to null.

Returns

dets – Array of detection objects processed.

Return type

array_like (1D array)

static do_nms_sort(detections, thresh)[source]

Sort the detection according to the objectness and perform the IOU as filter for the boxes.

Parameters
  • detections (array_like (1D array)) – Array of detection objects.

  • thresh (float) – Threshold to apply for IoU filtering. If IoU is greater than thresh the corresponding objectness and probabilities are set to null.

Returns

dets – Array of detection objects processed.

Return type

array_like (1D array)

property objectness

Return the objectness of the detection

property prob

Return the probability of detection for each class

static top_k_predictions(output)[source]

Compute the indices of the sorted output

Parameters

output (array_like (1D array)) – Array of predictions expressed as floats. Its value will be sorted in ascending order and the corresponding array of indices is given in output.

Returns

indexes – Array of indexes which sort the output values in ascending order.

Return type

list (int32 values)