forked from Github/frigate
Add object filter ratio (#2952)
* Add object ratio config parameters Issue: #2948 * Add config test for object filter ratios Issue: #2948 * Address review comments - Accept `ratio` default - Rename `bounds` to `box` for consistency - Add migration for new field Issue: #2948 * Fix logical errors - field migrations require default values - `clipped` referenced the wrong index for region, since it shifted - missed an inclusion of `ratio` for detections in `process_frames` - revert naming `o[2]` as `box` since it is out of scope! This has now been test-run against a video, so I believe the kinks are worked out. Issue: #2948 * Update contributing notes for `make` Issue: #2948 * Fix migration - Ensure that defaults match between Event and migration script - Deconflict migration script number (from rebase) Issue: #2948 * Filter objects out of ratio bounds Issue: #2948 * Update migration file to 009 Issue: #2948
This commit is contained in:
@@ -192,6 +192,7 @@ class TrackedObject:
|
||||
"score": self.obj_data["score"],
|
||||
"box": self.obj_data["box"],
|
||||
"area": self.obj_data["area"],
|
||||
"ratio": self.obj_data["ratio"],
|
||||
"region": self.obj_data["region"],
|
||||
"stationary": self.obj_data["motionless_count"]
|
||||
> self.camera_config.detect.stationary.threshold,
|
||||
@@ -341,6 +342,14 @@ def zone_filtered(obj: TrackedObject, object_config):
|
||||
if obj_settings.threshold > obj.computed_score:
|
||||
return True
|
||||
|
||||
# if the object is not proportionally wide enough
|
||||
if obj_settings.min_ratio > obj.obj_data["ratio"]:
|
||||
return True
|
||||
|
||||
# if the object is proportionally too wide
|
||||
if obj_settings.max_ratio < obj.obj_data["ratio"]:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user