djdd87 / SynoAI

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

Motion detection missing items and errors in logs #106

Closed RejEdm closed 2 years ago

RejEdm commented 2 years ago

Hello,

I got the SynoAI setup last night and now I am just tweaking it. I noticed my kids don't always get detected. I have also noticed, if go in the basement and walk fast past the camera I will not get push notification. I have SSS set very sensitive and it does trigger the camera so the issue has to do with the time it takes for SynoAI or deepstack. If I walk slow it usually will work better. I am trying different MinSizeX and MinSizeY values but it's not helping. I will also try lowering the Threshold. I have deepstack set to medium should I change that maybe?

Any suggestions?

djdd87 commented 2 years ago

Look at the log and see where the time is taken and what it's doing when you're testing it. All the info to work out what's happening should be there.

RejEdm commented 2 years ago

Going through the last logs as the time is off. I did set TZ with my timezone but from what I read online that is a problem with Synology Docker. Anyway, I am seeing it detect couch, bed but I only have person so I am not getting a notification when my child walks passed it. Size for couch is 778x568 should I lower the MinSizeX at 250 and MinSizeY at 500 so I don't understand why it finds a couch as it's bigger then the minSize X and Y

djdd87 commented 2 years ago

Deepstack will still detect everything, SynoAI just excludes the types you don't care about. I'm not sure what you mean. The min sizes are the minimum something needs to be to be included by SynoAI. So if the minx is 100 and the prediction is 95, then it will be ignored.

RejEdm commented 2 years ago

So then if the person is small, it's possible the bigger object like a couch gets detected then? There is no way to tweak things for a person? It seems to work ok when I go in the basement but I am bigger. Hope I am explaining it correctly.

djdd87 commented 2 years ago

No. Why would you be detecting a couch? You set the minimum size in pixels for something to be included in the results. Just set your min sizes to 0 for the time being, but you should just be able to look at the logs to see what was detected and why it was excluded. Try the debug setting for the logging to get literally every piece of info.

RejEdm commented 2 years ago

In my logs I am getting the following errors and wondering if this might be part of my problem:

warn: SynoAI.Controllers.CameraController[0] Basement: Webhook: The end point responded with HTTP status code 'InternalServerError'

and also get this error:

fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HMFCUAOLU0RC", Request id "0HMFCUAOLU0RC:00000002": An unhandled exception was thrown by the application.

Any ideas?

djdd87 commented 2 years ago

Webhook: The end point responded with HTTP status code 'InternalServerError'

That error is from your webhook side, not from SynoAI.

Share your config and I'll see if there's anything obvious, but that error is likely not the fault of SynoAI.

RejEdm commented 2 years ago

When I test the web hook I do get the green checkmark so I was under the impression that it was good. Is the Microsoft fail error also possibly because of the web hook? I have pasted my config below. Thank you for your help on this very much appreciated. I am running DSM 7 on a DS920+ and sometimes I walk past the camera and I get nothing but if I stay standing in front of it, then I do get a notification.

{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Warning" } },

"Url": "http://172.17.0.1:5000", "User": "xxxxx", "Password": "xxxxx",

"MinSizeX": 0, "MinSizeY": 0,

"DaysToKeepCaptures": 14,

"AI": { "Type": "DeepStack", "Url": "http://172.17.0.1:83" },

"Notifiers": [ { "Type": "Pushover", "ApiKey": "xxxxx", "UserKey": "xxxxxxxx", "Device": [ "iphone" ] }, { "Type": "Webhook", "Cameras": ["Basement"], "Url": "http://10.0.1.100:4242/api/webhook/Basement", "Method": "POST", "Field": "image" }, { "Type": "Webhook", "Cameras": ["Garage"], "Url": "http://10.0.1.100:4242/api/webhook/Garage", "Method": "POST", "Field": "image" } ],

"Cameras": [ { "Name": "Basement", "Types": [ "Person", "Cat", "Dog" ], "Threshold": 45, "MinSizeX": 0, "MinSizeY": 0 }, { "Name": "Garage", "Types": [ "Person" ], "Threshold": 45, "MinSizeX": 50, "MinSizeY": 300 } ] }

djdd87 commented 2 years ago

Well, what is the Webhook posting to? i.e. what application are you pointing the Webhook at?

The config looks good by the way, no obvious issues.

RejEdm commented 2 years ago

It's being pointed back to the SynoAI. As you can also see in the config posted above, I changed the IP to the Gateway Docker but that didn't help. Should I change the web hook in the config to the gateway as well? Have a look at the screenshots below of my web hooks.

Screen Shot 2022-02-11 at 7 48 45 AM Screen Shot 2022-02-11 at 7 49 25 AM Screen Shot 2022-02-11 at 7 49 41 AM
djdd87 commented 2 years ago

No. What is http://10.0.1.100:4242/api/webhook/Basement? That's not SynoAI (nor should it be). What Webhook are you calling from SynoAI?

Your notification action rules above look fine, but that's not what I was asking for. In order to know what's wrong, you need to tell me what your webhook notifications are calling, e.g:

{
"Type": "Webhook",
"Cameras": ["Basement"],
"Url": "http://10.0.1.100:4242/api/webhook/Basement",
"Method": "POST",
"Field": "image"
},
RejEdm commented 2 years ago

From what I understand the web hook are calling back to Synoai. The 10.0.1.100 is my Synology IP (should it be changed to Docker Gateway 172.17.0.1?) The port for Synoai is 4242 and the camera name in Surveillance Station is Basement.

Screen Shot 2022-02-11 at 8 11 04 AM
djdd87 commented 2 years ago

Why on Earth are you doing that? Notifications are for sending notifications. If you don't know what the Webhook notifications are for, then please remove them from your SynoAI config. To be explicitly clear, get rid of these:

{
"Type": "Webhook",
"Cameras": ["Basement"],
"Url": "http://10.0.1.100:4242/api/webhook/Basement",
"Method": "POST",
"Field": "image"
},
{
"Type": "Webhook",
"Cameras": ["Garage"],
"Url": "http://10.0.1.100:4242/api/webhook/Garage",
"Method": "POST",
"Field": "image"
}

Webhooks are for sending data to other applications, such as HomeAssistant, NodeRed, etc.

In essence you are basically doing this:

RejEdm commented 2 years ago

Ahhhh.... I didn't realize that. When I was looking at other configs they all had these web hooks and I thought it was required. I have removed them.

So that clears up the web hook problem. I now only have the following warnings are these normal?

warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60] Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.

warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {a18e830c-9177-40bb-ae6f-aae5b74d1ad7} may be persisted to storage in unencrypted form.

djdd87 commented 2 years ago

They're nothing to worry about. They're just MS warnings that aren't of any concern; they are not errors.

RejEdm commented 2 years ago

Well everything looks good now. Thanks for helping out very much appreciated. Now I just need to play with MinsizeX and MinsizeY and see if I can improve the kids being captured.

djdd87 commented 2 years ago

No worries. As I started earlier in the conversation, you can just look at the logs and you'll see all of the relevant data now that explains why things were detected and not notified. All of the timings are there too in milliseconds (ms), so there's always the chance your hardware isn't quite quick enough to get the notification and get the current snapshot in time, or if you're using too high quality of a snapshot.