@@ -522,6 +522,55 @@ def expected_name(cls) -> str:
522
522
return "segmentation_to_poly_precision"
523
523
524
524
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
+
525
574
class BoundingBoxIOUConfig (EvalFunctionConfig ):
526
575
def __call__ (
527
576
self ,
@@ -1147,6 +1196,7 @@ def expected_name(cls) -> str:
1147
1196
SegmentationToPolyIOUConfig ,
1148
1197
SegmentationToPolyMAPConfig ,
1149
1198
SegmentationToPolyPrecisionConfig ,
1199
+ SegmentationToPolyAveragePrecisionConfig ,
1150
1200
]
1151
1201
1152
1202
@@ -1226,6 +1276,9 @@ def __init__(self, available_functions: List[EvalFunctionEntry]):
1226
1276
self .segmentation_to_poly_map : SegmentationToPolyMAPConfig = self ._assign_eval_function_if_defined (
1227
1277
SegmentationToPolyMAPConfig # type: ignore
1228
1278
)
1279
+ self .segmentation_to_poly_ap : SegmentationToPolyAveragePrecisionConfig = self ._assign_eval_function_if_defined (
1280
+ SegmentationToPolyAveragePrecisionConfig # type: ignore
1281
+ )
1229
1282
1230
1283
# Add public entries that have not been implemented as an attribute on this class
1231
1284
for func_entry in self ._public_func_entries .values ():
0 commit comments