Detectors¶
Detectors are high-level abstractions of Keras object detection architectures. They share a common API.
-
class
mira.detectors.
Detector
[source]¶ Abstract base class for a detector.
-
abstract
compute_anchor_boxes
(width, height)[source]¶ Return the list of anchor boxes in xyxy format. You can convert these to dimensions using something like:
detector.compute_anchor_boxes(iwidth, iheight)[:, [0, 2, 1, 3]].reshape((-1, 2, 2))
- Return type
ndarray
-
compute_anchor_iou
(collection)[source]¶ Compute the IoU between annotatons for a scene collection and the anchors for the detector. Accounts for scaling depending on this detectors resize configuration.
- Return type
List
[ndarray
]
-
detect
(items, batch_size=32, progress=False, **kwargs)[source]¶ Perform object detection on a batch of images or single image.
- Parameters
images – A list of images or a single image.
threshold – The detection threshold for the images
batch_size (
int
) – The batch size to use with the underlying model
- Return type
Union
[List
[List
[Annotation
]],List
[Annotation
],SceneCollection
,Scene
]- Returns
A list of lists of annotations.
-
mAP
(collection, iou_threshold=0.5, min_threshold=0.01, batch_size=32)[source]¶ Compute the mAP metric for a given collection of ground truth scenes.
- Parameters
collection (
SceneCollection
) – The collection to evaluatemin_threshold – The minimum threshold for initial selection of boxes.
iou_threshold – The IoU threshold required for a match
- Returns
mAP score
-
abstract
There are currently four implemented architectures.