Metrics

Detectools provide metrics for detection, instance segmentation and semantic segmentation (semantic mask from a stack of object masks). Those metrics inherits from Torchmetrics Metric class. ()

class detectools.metrics.ClassifF1score(*args, **kwargs)[source]

F1 score for classification task.

Parameters:

num_classes (int) – Number of classes for the task.

class detectools.metrics.ClassifPrecision(*args, **kwargs)[source]

F1 score for classification task.

Parameters:

num_classes (int) – Number of classes for the task.

class detectools.metrics.ClassifRecall(*args, **kwargs)[source]

F1 score for classification task.

Parameters:

num_classes (int) – Number of classes for the task.

class detectools.metrics.DetectF1score(*args, **kwargs)[source]

F1 score for detection task.

Parameters:

iou_threshold (float) – IoU threshold to consider taht prediction and target boxes match. Default to 0.5.

class detectools.metrics.DetectPrecision(*args, **kwargs)[source]

Precision for detection task.

Parameters:

iou_threshold (float) – IoU threshold to consider taht prediction and target boxes match. Default to 0.5.

class detectools.metrics.DetectRecall(*args, **kwargs)[source]

Recall for detection task.

Parameters:

iou_threshold (float) – IoU threshold to consider taht prediction and target boxes match. Default to 0.5.

class detectools.metrics.MeanAP(*args, **kwargs)[source]

Compute Mean Average Precision (from torchmetrics MAP ).

prepare_input(input: BaseFormat) Dict[str, Tensor][source]

Transform BaseFormat into MAp inputs type.

Parameters:

input (BaseFormat) – BaseFormat to convert.

Returns:

  • Dict of values for MAP computation.

Return type:

Dict[str, Tensor]

update(prediction: BaseFormat, target: BaseFormat)[source]

Prepare inputs and call MAP.

Parameters:
  • prediction (BaseFormat) – Predictions.

  • target (BaseFormat) – Targets.

class detectools.metrics.SemanticAccuracy(*args, **kwargs)[source]

Accuracy for semantic segmentation task.

Parameters:

num_classes (int) – Number of classes for the task.

class detectools.metrics.SemanticF1score(*args, **kwargs)[source]

F1 score for semantic segmentation task.

Parameters:

num_classes (int) – Number of classes for the task.

class detectools.metrics.SemanticIoU(*args, **kwargs)[source]

IoU for semantic segmentation task.

Parameters:

num_classes (int) – Number of classes for the task.