djdd87 / SynoAI

A Synology Surveillance Station notification system utilising DeepStack AI
GNU General Public License v3.0
213 stars 24 forks source link

Feature Request: DeepStack Face Recognition Support #139

Open filthyrake opened 2 years ago

filthyrake commented 2 years ago

It would be pretty cool (and I think fairly simple) to add support for DeepStack's face recognition into SynoAI.

How I would do it (roughly):

Add "Face" as an option somewhere. Maybe a detection type like Car or Person? Doesnt really matter, you just want to get the flag set that people want it.

Then create a Path variable for face detection in Config.cs like public static string AIRecognizePath { get; private set; }

Then in the same file when you set the AIPath you can set the new AIRecognizePath like AIRecognizePath = aiSection.GetValue<string>("Path","v1/vision/face/recognize");

Then just call the recognize API only if face is set, and return the results just like you do for normal object detection.

djdd87 commented 2 years ago

This would be a good piece of functionality to add. I could probably add something like this to avoid a breaking change to types:

    {
      "Name": "Example2",
      "Types": [ "Car", "Truck" ],
      "Faces": [ "Bob", "Dave", "Karen"],
      "Threshold": 75
    },

Then when Types is specified, it uses the standard AI end point and when Faces is specified it uses the Faces end point.

I'm writing this blindly though as I've not looked at the faces API much, but I'm sure it's doable.

I'd probably aim to get #117 finished first though before making any further changes on the AI side.

filthyrake commented 2 years ago

That's fair on 117! Good call on the Faces thing too. I may try to just write it up and submit a PR for you if I've got time!

scottrhoyt commented 2 years ago

This would be a cool feature. If the intent is to also support multiple AIs (custom DeepStack, Coral, .etc) as in #117, the configuration might need to be refactored in a breaking way. It might be good to move assumptions on AI stack out of the camera config and instead create multiple AI configs that include connection info as well as parameters. These configs could then be referenced by name in the camera configs.

djdd87 commented 2 years ago

Yep, exactly. I'm part of the way through this work. It's going to be a breaking change, so I also want to time it with how notifications are referenced (instead of saying which cameras notifications are for, I'm changing it so the cameras say which notifications they want).

jib-au commented 1 year ago

Here's me thinking this would already support this, I went into ENV variables and added "VISION-FACE=True", recognized and registered my face with Deepstack, no wonder why it wasn't working, should've checked here first. facepalm but yeah this would be a great feature to have. Also does SynoAI support the environment variable mode anything higher than low?