ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
412 stars 128 forks source link

[For Comments] Reworking ES objectconfig to make it more intuitive to add other models in future & concurrent execution limit #284

Closed pliablepixels closed 4 years ago

pliablepixels commented 4 years ago

I'll be adding tpu (#283) support on a google coral usb stick, but before I did, I wanted to make some fundamental changes to how the config is set up (objectconfig.ini) to make it more intuitive for the future. Obviously, these are breaking changes, so I wanted to share it, if anyone had an opinion. I've been making too many breaking changes in every release and wanted to reduce it with "one big breaking change" šŸ™„

[general]
#This replaces models=yolo,face
detection_sequence=object,face,something_new

# "object" replaces "yolo" as yolo is really a model. We are detecting objects
# Also, I'm doing away with "tiny" and "full" configs. No reason for them - just switch weights
# and configs on the same attribute

[object]
object_config= # in the case of coral edge tpu, this is empty/ignored
object_weights=
object_labels= 

# object framework tells me which ML framework to use 
object_framework=opencv/edgetpu

# object processor tells me if I need to use GPU or CPU or TPU (if object_franework is tpu, 
# this is moot, but just for consistency
object_processor = gpu/cpu/tpu

# Each "detection_sequence" will have its own detect pattern and min confidence. 
# Different libraries have different algorithms that need different values
object_min_confidence=float
object_detect_pattern=regex

[face]
<existing stuff>
face_min_confidence=float
face_detection_pattern=regex

[something_new]
<when I add something new>
matthewtgilbride commented 4 years ago

A few humble observations:

# use these weights for full yolo v3
object_config={{base_data_path}}/models/yolov3/yolov3.cfg
object_weights={{base_data_path}}/models/yolov3/yolov3.weights
object_labels={{base_data_path}}/models/yolov3/coco.names

# use these weights (and comment out the above) for tiny yolo v3
#object_config={{base_data_path}}/models/tinyyolov3/yolov3-tiny.cfg
#object_weights={{base_data_path}}/models/tinyyolov3/yolov3-tiny.weights
#object_labels={{base_data_path}}/models/tinyyolov3/yolov3-tiny.txt

As long as the sample is clear, I think that works.