@@ -522,6 +522,55 @@ def expected_name(cls) -> str:
522522 return "segmentation_to_poly_precision"
523523
524524
525+ class SegmentationToPolyAveragePrecisionConfig (EvalFunctionConfig ):
526+ def __call__ (
527+ self ,
528+ label : str = "label" ,
529+ iou_threshold : float = 0.5 ,
530+ annotation_filters : Optional [
531+ Union [ListOfOrAndFilters , ListOfAndFilters ]
532+ ] = None ,
533+ prediction_filters : Optional [
534+ Union [ListOfOrAndFilters , ListOfAndFilters ]
535+ ] = None ,
536+ ** kwargs ,
537+ ):
538+ """Initializes SegmentationToPolyAveragePrecision object.
539+
540+ Args:
541+ iou_threshold: IOU threshold to consider detection as valid. Must be in [0, 1]. Default 0.5
542+ annotation_filters: Filter predicates. Allowed formats are:
543+ ListOfAndFilters where each Filter forms a chain of AND predicates.
544+ or
545+ ListOfOrAndFilters where Filters are expressed in disjunctive normal form (DNF), like
546+ [[MetadataFilter("short_haired", "==", True), FieldFilter("label", "in", ["cat", "dog"]), ...].
547+ DNF allows arbitrary boolean logical combinations of single field predicates. The innermost structures
548+ each describe a single column predicate. The list of inner predicates is interpreted as a conjunction
549+ (AND), forming a more selective `and` multiple field predicate.
550+ Finally, the most outer list combines these filters as a disjunction (OR).
551+ prediction_filters: Filter predicates. Allowed formats are:
552+ ListOfAndFilters where each Filter forms a chain of AND predicates.
553+ or
554+ ListOfOrAndFilters where Filters are expressed in disjunctive normal form (DNF), like
555+ [[MetadataFilter("short_haired", "==", True), FieldFilter("label", "in", ["cat", "dog"]), ...].
556+ DNF allows arbitrary boolean logical combinations of single field predicates. The innermost structures
557+ each describe a single column predicate. The list of inner predicates is interpreted as a conjunction
558+ (AND), forming a more selective `and` multiple field predicate.
559+ Finally, the most outer list combines these filters as a disjunction (OR).
560+ """
561+ return super ().__call__ (
562+ label = label ,
563+ iou_threshold = iou_threshold ,
564+ annotation_filters = annotation_filters ,
565+ prediction_filters = prediction_filters ,
566+ ** kwargs ,
567+ )
568+
569+ @classmethod
570+ def expected_name (cls ) -> str :
571+ return "segmentation_to_poly_ap"
572+
573+
525574class BoundingBoxIOUConfig (EvalFunctionConfig ):
526575 def __call__ (
527576 self ,
@@ -1147,6 +1196,7 @@ def expected_name(cls) -> str:
11471196 SegmentationToPolyIOUConfig ,
11481197 SegmentationToPolyMAPConfig ,
11491198 SegmentationToPolyPrecisionConfig ,
1199+ SegmentationToPolyAveragePrecisionConfig ,
11501200]
11511201
11521202
@@ -1226,6 +1276,9 @@ def __init__(self, available_functions: List[EvalFunctionEntry]):
12261276 self .segmentation_to_poly_map : SegmentationToPolyMAPConfig = self ._assign_eval_function_if_defined (
12271277 SegmentationToPolyMAPConfig # type: ignore
12281278 )
1279+ self .segmentation_to_poly_ap : SegmentationToPolyAveragePrecisionConfig = self ._assign_eval_function_if_defined (
1280+ SegmentationToPolyAveragePrecisionConfig # type: ignore
1281+ )
12291282
12301283 # Add public entries that have not been implemented as an attribute on this class
12311284 for func_entry in self ._public_func_entries .values ():
0 commit comments