From 1b74f142a1fb673189490dd31443a95201f2a01d Mon Sep 17 00:00:00 2001 From: Junyang Kong <1156807819@qq.com> Date: Fri, 22 Nov 2024 19:17:51 +0800 Subject: [PATCH] Standardize default region points (#17715) --- tests/test_solutions.py | 2 +- ultralytics/cfg/solutions/default.yaml | 2 +- ultralytics/solutions/solutions.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_solutions.py b/tests/test_solutions.py index e01da6d818..fbf6b954c9 100644 --- a/tests/test_solutions.py +++ b/tests/test_solutions.py @@ -16,7 +16,7 @@ def test_major_solutions(): safe_download(url=MAJOR_SOLUTIONS_DEMO) cap = cv2.VideoCapture("solutions_ci_demo.mp4") assert cap.isOpened(), "Error reading video file" - region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360)] + region_points = [(20, 400), (1080, 400), (1080, 360), (20, 360)] counter = solutions.ObjectCounter(region=region_points, model="yolo11n.pt", show=False) # Test object counter heatmap = solutions.Heatmap(colormap=cv2.COLORMAP_PARULA, model="yolo11n.pt", show=False) # Test heatmaps speed = solutions.SpeedEstimator(region=region_points, model="yolo11n.pt", show=False) # Test queue manager diff --git a/ultralytics/cfg/solutions/default.yaml b/ultralytics/cfg/solutions/default.yaml index 69e430b8c3..b50a2a3255 100644 --- a/ultralytics/cfg/solutions/default.yaml +++ b/ultralytics/cfg/solutions/default.yaml @@ -2,7 +2,7 @@ # Configuration for Ultralytics Solutions # Object counting settings -region: # Object counting, queue or speed estimation region points. Default region points are [(20, 400), (1080, 404), (1080, 360), (20, 360)] +region: # Object counting, queue or speed estimation region points. Default region points are [(20, 400), (1080, 400), (1080, 360), (20, 360)] show_in: True # Flag to display objects moving *into* the defined region show_out: True # Flag to display objects moving *out of* the defined region diff --git a/ultralytics/solutions/solutions.py b/ultralytics/solutions/solutions.py index ba3f1ec2cc..fc05d42d6e 100644 --- a/ultralytics/solutions/solutions.py +++ b/ultralytics/solutions/solutions.py @@ -135,7 +135,7 @@ class BaseSolution: def initialize_region(self): """Initialize the counting region and line segment based on configuration settings.""" if self.region is None: - self.region = [(20, 400), (1080, 404), (1080, 360), (20, 360)] + self.region = [(20, 400), (1080, 400), (1080, 360), (20, 360)] self.r_s = ( self.Polygon(self.region) if len(self.region) >= 3 else self.LineString(self.region) ) # region or line