From 2937dac4c3e5502237a5268d0a63d8abcff1a470 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Thu, 24 Sep 2020 07:03:05 -0500 Subject: [PATCH] update config merging and example config --- config/config.example.yml | 5 ++--- detect_objects.py | 9 ++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index dc895d5d7..2e7040ac9 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -78,8 +78,6 @@ save_clips: objects: track: - person - - car - - truck filters: person: min_area: 5000 @@ -215,11 +213,12 @@ cameras: draw_zones: False ################ - # Camera level object config. This config is merged with the global config above. + # Camera level object config. If defined, this is used instead of the global config. ################ objects: track: - person + - car filters: person: min_area: 5000 diff --git a/detect_objects.py b/detect_objects.py index 88dfa7e9a..c069d5c21 100644 --- a/detect_objects.py +++ b/detect_objects.py @@ -267,13 +267,8 @@ def main(): camera_objects_config = config.get('objects', {}) # get objects to track for camera objects_to_track = camera_objects_config.get('track', GLOBAL_OBJECT_CONFIG.get('track', ['person'])) - # merge object filters - global_object_filters = GLOBAL_OBJECT_CONFIG.get('filters', {}) - camera_object_filters = camera_objects_config.get('filters', {}) - objects_with_config = set().union(global_object_filters.keys(), camera_object_filters.keys()) - object_filters = {} - for obj in objects_with_config: - object_filters[obj] = {**global_object_filters.get(obj, {}), **camera_object_filters.get(obj, {})} + # get object filters + object_filters = camera_objects_config.get('filters', GLOBAL_OBJECT_CONFIG.get('filters', {})) config['objects'] = { 'track': objects_to_track, 'filters': object_filters