neilenns / node-deepstackai-trigger

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

Add support for detection exclusion zones #16

Closed neilenns closed 4 years ago

neilenns commented 4 years ago

The DeepStack API returns a bounding box for the detected object. If the object is one that's supposed to trigger (based on class), there should be an optional secondary check on whether the rectangle intersects at all with a list of defined exclusion zones in the trigger's configuration.

This will enable blocking out parts of an image that are prone to false positives.

neilenns commented 4 years ago

This shouldn't be too bad to do since the predictions already include the bounding rect.

Extend the trigger config to include masks, an array of mask objects: xMinimum, yMinimum, xMaximum, yMaximum.

Then it's just an if (predictions.some((prediction) => masks.some((mask) => mask.overlaps(prediction))) { skip it };