ZoneMinder / mlapi

An easy to use/extend object recognition API you can locally install. Python+Flask. Also works with ZMES!
Other
58 stars 34 forks source link

Fix for not loading polygons from zm_detect API call #52

Closed jantman closed 10 months ago

jantman commented 10 months ago

I can't tell if this was intentional or not, but the current mlapi code ignores the polygons key in the stream_options provided by zm_detect requests. The result of this is that trying to override the object detection pattern on a per-zone basis does not work when using zm_detect with a remote mlapi.

My personal use case is that I have a number of monitors where I want to completely ignore everything outside of specific zones. More specifically, I have cameras covering the front of my property and also the street; I set a pattern of (NeverMatched) on the monitor itself, to suppress all matches, and then add zone-specific pattern overrides of what I'd like to match, resulting in the final object detections from mlapi only containing objects that intersect my configured zones.

Note that I've only tested the code path explained above, and the "normal" path of a single pattern provided by zm_detect.

I've also included a few minor style/syntax fixes (mostly whitespace) when I happened to run into them.

To fully work, this PR also depends on https://github.com/ZoneMinder/pyzm/pull/49