Assessment metrics
- class koogu.utils.assessments.PrecisionRecall(audio_annot_list, raw_results_root, annots_root, annotation_reader=None, thresholds=None, post_process_detections=False, **kwargs)
Bases:
BaseMetric
Class for assessing precision-recall values.
- Parameters:
audio_annot_list – A list containing pairs (tuples or sub-lists) of relative paths to audio files and the corresponding annotation files. Alternatively, you could also specify (path to) a 2-column csv file containing these pairs of entries (in the same order). Only use the csv option if the paths are simple (i.e., the filenames do not contain commas or other special characters).
raw_results_root – The full paths of the raw result container files whose filenames will be derived from the audio files listed in
audio_annot_list
will be resolved using this as base directory.annots_root – The full paths of annotations files listed in
audio_annot_list
will be resolved using this as base directory.annotation_reader – If not None, must be an annotation reader instance from
annotations
. Defaults to RavenReader
.thresholds – If not None, must be either a scalar quantity or a list of non-decreasing values (float values in the range 0-1) at which precision and recall value(s) will be assessed. If None, will default to the range 0-1 with an interval of 0.05.
post_process_detections – If True (default: False), a post-processing algorithm will be applied to the raw detections before computing performance stats.
Optional parameters
- Parameters:
suppress_nonmax – If True (default: False), only the top-scoring class per clip will be considered.
squeeze_min_dur – (default: None). If set (duration in seconds), an algorithm “to squeeze together” temporally overlapping regions from successive raw clips will be applied. The ‘squeezing’ will be restricted to produce detections that are at least as long as the specified value. The value must be smaller than the duration of the model inputs. Parameter used only when post-processing is enabled.
Parameters specific to
(when post-processing isn’t enabled)
(when post-processing is enabled)
koogu.utils.detections.assess_annotations_and_detections_match()
can also be specified, and will be passed as-is to the respective functions.
All other kwargs parameters (if any) will be passed as-is to the base class.
When calling
assess()
, passingreturn_counts=True
will return the per-class counts for the numerators and denominators of precision and recall. Otherwise, per-class and overall precision-recall values will be returned.See also
- assess(**kwargs)
Perform the desired assessments.