safe refactoring (#2552)

Co-authored-by: YS <ys@gm.com>
This commit is contained in:
Yuriy Sannikov
2021-12-31 20:59:43 +03:00
committed by Blake Blackshear
parent 9e987fdebc
commit 80627e4989
7 changed files with 36 additions and 36 deletions

View File

@@ -529,15 +529,16 @@ def process_frames(
# combine motion boxes with known locations of existing objects
combined_boxes = reduce_boxes(motion_boxes + tracked_object_boxes)
region_min_size = max(model_shape[0], model_shape[1])
# compute regions
regions = [
calculate_region(frame_shape, a[0], a[1], a[2], a[3], 1.2)
calculate_region(frame_shape, a[0], a[1], a[2], a[3], region_min_size, multiplier=1.2)
for a in combined_boxes
]
# consolidate regions with heavy overlap
regions = [
calculate_region(frame_shape, a[0], a[1], a[2], a[3], 1.0)
calculate_region(frame_shape, a[0], a[1], a[2], a[3], region_min_size, multiplier=1.0)
for a in reduce_boxes(regions, 0.4)
]
@@ -596,7 +597,7 @@ def process_frames(
box = obj[2]
# calculate a new region that will hopefully get the entire object
region = calculate_region(
frame_shape, box[0], box[1], box[2], box[3]
frame_shape, box[0], box[1], box[2], box[3], region_min_size
)
regions.append(region)