Skip to content

NVR with realtime local object detection for IP cameras

Make default region multiplier consistent (#9685)

Nicolas Mowenac0059cc1aba
diff --git a/frigate/test/test_video.py b/frigate/test/test_video.py
index cba63c950f..938e2f2c90 100644
--- a/frigate/test/test_video.py
+++ b/frigate/test/test_video.py
@@ -147,6 +147,27 @@ class TestRegion(unittest.TestCase):
assert len(regions) == 2
def test_combine_boxes(self):
+ boxes = [
+ (480, 0, 540, 128),
+ (536, 0, 558, 99),
+ ]
+
+ # boundary_boxes = [get_cluster_boundary(box) for box in boxes]
+ # save_cluster_boundary_image("combine_bound", boxes, boundary_boxes)
+
+ cluster_candidates = get_cluster_candidates(
+ self.frame_shape, self.min_region_size, boxes
+ )
+
+ regions = [
+ get_cluster_region(self.frame_shape, self.min_region_size, candidate, boxes)
+ for candidate in cluster_candidates
+ ]
+
+ # save_clusters_image("combine", boxes, cluster_candidates, regions)
+ assert len(regions) == 1
+
+ def test_dont_combine_smaller_boxes(self):
boxes = [
(460, 0, 561, 144),
(565, 0, 586, 71),
@@ -165,10 +186,13 @@ class TestRegion(unittest.TestCase):
]
# save_clusters_image("combine", boxes, cluster_candidates, regions)
- assert len(regions) == 1
+ assert len(regions) == 2
def test_dont_combine_boxes(self):
- boxes = [(460, 0, 532, 129), (586, 0, 606, 46)]
+ boxes = [
+ (460, 0, 532, 129),
+ (586, 0, 606, 46),
+ ]
# boundary_boxes = [get_cluster_boundary(box) for box in boxes]
# save_cluster_boundary_image("dont_combine_bound", boxes, boundary_boxes)
diff --git a/frigate/util/object.py b/frigate/util/object.py
index 0bf7ea1799..862ee3fe23 100644
--- a/frigate/util/object.py
+++ b/frigate/util/object.py
@@ -414,7 +414,7 @@ def get_cluster_region(frame_shape, min_region, cluster, boxes):
max_x = max(boxes[b][2], max_x)
max_y = max(boxes[b][3], max_y)
return calculate_region(
- frame_shape, min_x, min_y, max_x, max_y, min_region, multiplier=1.2
+ frame_shape, min_x, min_y, max_x, max_y, min_region, multiplier=1.35
)