neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
165 stars 28 forks source link

Changing thresholds/values based on sun location #402

Closed ghzgod closed 3 years ago

ghzgod commented 3 years ago

I have been doing this process manually with node red and recently moved over to node-deepstackai-trigger (we gotta make the name NDT or something haha). Anywho, during the day (when it is bright) I had my thresholds between 70-100 for my object detection, but at night I automatically lowered it to 50-100 (because it is dark). I was using the node-red sun node for this. I just wanted to throw the idea out there if you're looking for items to implement. I don't think it would be too difficult. Maybe not even the sun location but the overall brightness value of the image to determine threshold change.

neilenns commented 3 years ago

For tasks like this it really starts to stray into the automation space and is better handled outside (via NodeRed). Use this project as a wide net to send MQTT events to NodeRed, then have NodeRed apply the logic:

  1. Set all triggers to have a threshold between 50 and 100
  2. Only fire MQTT messages from the triggers, don't send web requests or anything else
  3. Have NodeRed listen for the MQTT messages then do whatever post-detection logic you want (sun-based thresholds, etc.)
  4. Have NodeRed send web request events to BlueIris to trigger recording if appropriate

This is basically how I have my system running. I simply generate MQTT events from this project then have NodeRed handle all the decision-making for whether the cameras should actually record.

neilenns commented 3 years ago

See https://github.com/danecreekphotography/node-deepstackai-trigger/wiki/Defining-triggers#defining-mqtt-handlers for an example of the payload that comes with the MQTT messages by default. It includes all of the detected objects and their confidence values.