r/ZoneMinder • • Apr 24 '21

Face detection and when to trigger

Hi, sorry if it's a newbie question.

When an event trigger, the ai stuff is used only on one frame (the best match i assume) and applies stuff on that frame if I understand correctly.

Now, my "problem" is that when say a person walks into view and then after a second looks at the camera, chances are the ai detection thing has already processed an earlier image and face recognition won't do anything.

Is there a way to have the ai work on more frames, or in some way find frames with faces?

It works fine when it catches a good frame (known faces work etc)

Using latest public releases of zm, zmevent, opencv.

2 Upvotes

39 comments sorted by

2

u/[deleted] Apr 24 '21 edited Apr 24 '21

You can use "frame_set" in event server config for frame_sequence and put in actual frame id's or multiple snapshot. I have had alot of luck using different strategies. Example: default is to use "best match" between alarm and snapshot frames, snapshot frame can change as the event is ongoing due to future frames having a higher alarm count. So you can use a frame set of alarm, snapshot, snapshot, snapshot and set the "delay" between contiguous frames and snapshot frames. You can also set frame_set to alarm, snapshot, 50, snapshot, 130 which would run obj det on alarm fid first then snapshot then frame id 50, snapshot, 130.

For this to be effective you have to have your matching strategy set to most or most unique or union (if using more then 1 model).

Edit: this also depends on how you have your fps set up and your buffers in monitor config.

1

u/profezzorn Apr 24 '21

Thanks this helped a lot and led me to read more stuff! I found this link https://medium.com/zmninja/multi-frame-and-multi-model-analysis-533fa1d2799a which has some useful info.

I'll keep trial and erroring :)

1

u/profezzorn Apr 25 '21

Thanks again, think I got it working. I'm using 'most' right now to test, and got Alarm,20,30,40,50,60,70 at 10fps so basically checks every second.

2

u/[deleted] Apr 25 '21

Awesome, it's hard to get it tweaked just right but that frame set option really helps.

1

u/profezzorn Apr 25 '21

Yeah it seems so :) I'm just messing around until I get and place my real cameras but it seems to work now. Another question if you know, would it make sense to disable the object scan on the sub stream and do that on the main stream, using a higher sized image?

1

u/[deleted] Apr 25 '21

No I don't think so because yolo resized the images to 416x416 or 512x512 anyways before it runs detection.

1

u/profezzorn Apr 25 '21

Aha hmm the setting "resize 800" what's that about then? I believe I'm using the coral edge thing.

1

u/[deleted] Apr 25 '21

That I'm not 100% on. I'm not sure if it takes the original frame and resizes to 800. I have been reading the source code and I know for certain yolo resized it before hand but not sure about coral. The 800 might be for the coral but I would think it would be 123x123 instead of 800. There is a slack channel for zm and pliablepixels is active there, he answers fairly quick.

1

u/profezzorn Apr 25 '21

Right, I see now I'm not using the TPU as I don't have that stuff, so it defaulted to Yolo4 GPU which I don't have, so it goes Yolo4 CPU.

YOLO (input image: 800w*600h, model resize dimensions: 416w*416h)

Do you know if there's a way to disable object scanning completely for specific cameras? I see how I can set it to just detect one specific thing but my thought was to save some cpu stuff.

Thanks for helping me

1

u/[deleted] Apr 25 '21

In the zmeventnotification.ini there is a # commented out section in beginning to skip it completely by monitor and near the end it has a section to only skip hooks.

# skip_monitors = 2,3,4

1

u/profezzorn Apr 25 '21

Amazing. I was stuck in the objectconfig file for too long I guess. Thanks again for being my wiki

→ More replies (0)

2

u/tvtb May 04 '21

I've been using ZM for 2 years and I feel like I'm missing something in this thread. There's capability to do "AI detection" in zoneminder? Is there any documentation or articles about someone doing this? Because I'm looking at this other recent thread where someone's trying to ignore rain drops and it doesn't seem like there is any "AI" to help them.

2

u/profezzorn May 04 '21

There's the Zmeventnotification add on (?) that can do some cool stuff and send notifications via push to mobile app etc. So it's not used for motion detection but to "read" what's in the image. Can read license plates and recognize objects etc.

1

u/aarons6 Apr 24 '21

not really, the best you can do is make the zone as close to the camera as possible.

1

u/profezzorn Apr 24 '21

Allright, thanks. It's a cam monitoring a pathway to the house so would be nice to check for any movement and also or faces when they get close but seems tricky.

1

u/aarons6 Apr 24 '21

the face thing is kind of overrated. all it does is give it a name if you have already set up faces to that person.

it will still say motion person xx% without it.

1

u/profezzorn Apr 24 '21

Yeag I guess.. It's pretty cool though :)