apply_detection_threshold
- ketos.neural_networks.dev_utils.detection.apply_detection_threshold(scores, threshold=0.5, highest_score_only=False)[source]
Filters out detection scores below or at a specified threshold and returns a list of tuples, where each tuple consists of a label (the index of the score) and the score itself.
- Args:
- scores: list of floats
The list of scores.
- threshold: float
The threshold below which scores are filtered out. Default is 0.5.
- highest_score_only: bool
If True, only the highest score is returned. Default is False.
- Returns:
list of tuples: Each tuple contains a label (the index of the score in the input list) and the score itself.
Examples:
>>> apply_detection_threshold([0.2, 0.7, 0.3], 0.5) [(1, 0.7)] >>> apply_detection_threshold([0.6, 0.4, 0.8], 0.55) [(0, 0.6), (2, 0.8)] >>> apply_detection_threshold([0.6, 0.4, 0.8], 0.6, True) [(2, 0.8)]