Skip to content

Commit

Permalink
Standardize default region points (ultralytics#17715)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry-Kon authored Nov 22, 2024
1 parent 3e48829 commit 1b74f14
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/test_solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ultralytics/cfg/solutions/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ultralytics/solutions/solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def store_tracking_history(self, track_id, box):
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
Expand Down

0 comments on commit 1b74f14

Please sign in to comment.