Bugfix: get_min_region_size() returned half-size

All users expect the returned value to be the full model size, not the
half size. The effect of this bug was to increase the number of regions
that must be detected, reduce the context provided to the detector for
each, and force most regions to have to be scaled up, which became a CPU
bottleneck.
This commit is contained in:
Andrew Reiter 2023-07-31 10:28:00 -04:00
parent f57d21039e
commit c8e6f4718d

View File

@ -99,12 +99,9 @@ def filtered(obj, objects_to_track, object_filters):
def get_min_region_size(model_config: ModelConfig) -> int: def get_min_region_size(model_config: ModelConfig) -> int:
"""Get the min region size and ensure it is divisible by 4.""" """Get the min region size and ensure it is divisible by 4."""
half = int(max(model_config.height, model_config.width) / 2) size = int(max(model_config.height, model_config.width))
if half % 4 == 0: return ((size + 3) // 4) * 4
return half
return int((half + 3) / 4) * 4
def create_tensor_input(frame, model_config: ModelConfig, region): def create_tensor_input(frame, model_config: ModelConfig, region):