Make default region multiplier consistent (#9685)

* Make default region multiplier consistent

* Adjust tests
This commit is contained in:
Nicolas Mowen 2024-02-13 16:25:00 -07:00 committed by GitHub
parent 63bc1b1582
commit ac0059cc1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 4 deletions

View File

@ -148,8 +148,8 @@ class TestRegion(unittest.TestCase):
def test_combine_boxes(self):
boxes = [
(460, 0, 561, 144),
(565, 0, 586, 71),
(480, 0, 540, 128),
(536, 0, 558, 99),
]
# boundary_boxes = [get_cluster_boundary(box) for box in boxes]
@ -167,8 +167,32 @@ class TestRegion(unittest.TestCase):
# 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),
]
# 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) == 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)

View File

@ -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
)