Sfoglia il codice sorgente

update config merging and example config

Blake Blackshear 4 anni fa
parent
commit
2937dac4c3
2 ha cambiato i file con 4 aggiunte e 10 eliminazioni
  1. 2 3
      config/config.example.yml
  2. 2 7
      detect_objects.py

+ 2 - 3
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

+ 2 - 7
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