robokudo.utils.hypothesis_comparators¶
Attributes¶
Classes¶
A comparator that can compare two hypotheses. |
|
Module Contents¶
- robokudo.utils.hypothesis_comparators.THyothesis¶
- class robokudo.utils.hypothesis_comparators.HypothesisComparator(cas_fn: typing_extensions.Callable[[], robokudo.cas.CAS])¶
-
Bases:
typing_extensions.Generic[THyothesis]A comparator that can compare two hypotheses.
- cas_fn¶
-
Function to get a CAS instance, to be used for annotation filtering.
- annotation_comparators: typing_extensions.Dict[typing_extensions.Type[robokudo.types.core.Annotation], robokudo.utils.comparators.FeatureComparator]¶
-
Feature comparators used by this hypothesis comparator to compare annotations.
- type_comparators: typing_extensions.Dict[typing_extensions.Type[robokudo.types.core.Type], robokudo.utils.comparators.FeatureComparator]¶
-
Feature comparators used by this hypothesis comparator to compare other robokudo types.
- abstract compute_similarity(hypothesis1: THyothesis, hypothesis2: THyothesis) float¶
-
Compute the similarity between two hypotheses.
- Parameters:
-
hypothesis1 – The first hypothesis to compare.
hypothesis2 – The second hypothesis to compare.
- Returns:
-
The similarity of the two hypotheses between 0.0 (no similarity) and 1.0 (identical).
- with_comparator_for(compared_type: typing_extensions.Type[typing_extensions.Union[robokudo.types.core.Annotation, robokudo.types.core.Type]], weight: float, **kwargs) HypothesisComparator¶
-
Add a feature comparator for the given annotation using the given weight to the comparator.
- Parameters:
-
compared_type – The type that should be compared by the hypothesis comparator.
weight – The weight the hypothesis comparator should use for the compared type.
- Returns:
-
The hypothesis comparator with the added comparator.
- Raises:
-
KeyError – If no comparator can be found for the given type.
ValueError – If the given type cannot be compared.
- class robokudo.utils.hypothesis_comparators.ObjectHypothesisComparator¶
-
Bases:
HypothesisComparator[robokudo.types.scene.ObjectHypothesis]- compute_similarity(hypothesis1: robokudo.types.scene.ObjectHypothesis, hypothesis2: robokudo.types.scene.ObjectHypothesis) float¶
-
Compute the similarity between two hypotheses.
- Parameters:
-
hypothesis1 – The first hypothesis to compare.
hypothesis2 – The second hypothesis to compare.
- Returns:
-
The similarity of the two hypotheses between 0.0 (no similarity) and 1.0 (identical).