From 790baa615f01e45282593ed7ca75d2f5e49c417a Mon Sep 17 00:00:00 2001 From: rafaelpadilla Date: Wed, 7 May 2025 21:36:24 +0000 Subject: [PATCH] Removing spaces --- supervision/metrics/mean_average_precision.py | 44 ++++--------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/supervision/metrics/mean_average_precision.py b/supervision/metrics/mean_average_precision.py index d0294526..1a7365e3 100644 --- a/supervision/metrics/mean_average_precision.py +++ b/supervision/metrics/mean_average_precision.py @@ -91,18 +91,18 @@ class MeanAveragePrecisionResult: ``` """ return ( - f" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | " + f"Average Precision (AP) @[ IoU=0.50:0.95 | area= all | " f"maxDets=100 ] = {self.map50_95:.3f}\n" - f" Average Precision (AP) @[ IoU=0.50 | area= all | " + f"Average Precision (AP) @[ IoU=0.50 | area= all | " f"maxDets=100 ] = {self.map50:.3f}\n" - f" Average Precision (AP) @[ IoU=0.75 | area= all | " + f"Average Precision (AP) @[ IoU=0.75 | area= all | " f"maxDets=100 ] = {self.map75:.3f}\n" - f" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] \ - = {self.small_objects.map50_95:.3f}\n" - f" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] \ - = {self.medium_objects.map50_95:.3f}\n" - f" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] \ - = {self.large_objects.map50_95:.3f}" + f"Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] " + f"= {self.small_objects.map50_95:.3f}\n" + f"Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] " + f"= {self.medium_objects.map50_95:.3f}\n" + f"Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] " + f"= {self.large_objects.map50_95:.3f}" ) def to_pandas(self) -> "pd.DataFrame": @@ -1281,32 +1281,6 @@ class MeanAveragePrecision(Metric): return self - def _compute_polygon_area(self, coords: List[float]) -> float: - """ - Computes the area of a polygon using the Shoelace formula. - - Args: - coords (list of float): Flat list of x, y coordinates, e.g., [x1, y1, x2, - y2, ..., xn, yn] - - Returns: - float: Area of the polygon. - """ - if len(coords) < 6: - raise ValueError("Polygon must have at least 3 points (6 coordinates)") - - x = coords[0::2] - y = coords[1::2] - - n = len(x) - area = 0.0 - for i in range(n): - j = (i + 1) % n - area += x[i] * y[j] - area -= y[i] * x[j] - - return abs(area) / 2.0 - def _prepare_targets(self, targets): """Transform targets into a dictionary that can be used by the COCO evaluator""" images = [{"id": img_id} for img_id in range(len(targets))]