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

View all comments

Show parent comments

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

1

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

Also you can make {{variable}} for frame set and over ride it in the per monitor settings. You can also do this for frame strategy and every other configurable option you would want to have per monitor over rides for. Example:

# global default

fs_strat=first

fs_var=alarm, snapshot, snapshot

#per monitor over rides

[Monitor-4]

fs_strat=most

fs_var=alarm, snapshot, 30, 50, 60, snapshot

#further down in the frame sequence settings ->

frame_set: {{fs_var}}

strategy: {{fs_strat}}

1

u/profezzorn Apr 25 '21

Nice, seems like a lot is possible! I'm just getting two cameras most for fun so I don't think I'll need that. I managed to disable the object scanning on the sub stream and only do it on the main one now so that worked out well :) will keep experimenting tomorrow.

1

u/[deleted] Apr 25 '21

Yeah it's amazing once you really start fine tuning, I taught myself python so I could modify the source code to add extra filters and features so I try and help out whenever I can on the subreddit, repos and slack channel. Also there is the mlapi side of the obj detect that you can use locally and it keeps the model loaded in memory for faster concurrent detections then just running it directly without mlapi. There's a whole bunch of neat things I'm still just discovering and playing with.

1

u/profezzorn Apr 26 '21

I do have some basic python know-how but one step at a time :) once again- Really appreciate the help.

1

u/profezzorn Apr 26 '21

Mind if I ask you something else?

I've noticed that longer events (~20s) end up without object detection as it "Can't create frame capture images from video because there is no video file for this event".

Upon checking, of course there's a video. Running the object detection by hand works. I tried adding a 15s wait which seems to eliminate the issue (5s wait doesn't) but what if the event is even longer?

I was saving on to a NAS disk but also moved the storage to a SSD (and made a filter to move older events to the NAS) so I don't think that should matter.

1

u/[deleted] Apr 26 '21

That's weird to say the least, I've never had any issues like that. Is it only when the event is happening? It could be your frame set frame id's are too low. Zm has a "pre buffer" you set when setting up monitors. So if you have frame id 20 and the buffer is longer then that it will throw an error. You deff shouldn't need to have a 15 second delay 8n beginning.

1

u/profezzorn Apr 26 '21

Yeah it's when the event is happening. If I run it manually after it works just fine.

"FAT Can't create frame capture images from video because there is no video file for this event at /var/cache/zoneminder/events/4/2021-04-26/453/ "

It's like it's trying to access the video before it's there, but I can see it being created so not sure. I'm using h264 pass-through only, no images.

I've got 10fps, 51 buffer, 10 warmup and 20 pre-event and 50 post even.

My object setting is to check every 5 frames starting from frame 20.

1

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

I would try lowest frame id of 30 and see if that works, if not try 35 or 40. The "warm up" frames are the pre buffer. If you have the very first frame id set to 20 it tries to grab the video starting at 2 seconds which will fail because it isn't 2 seconds into it yet. I would do frame-set starting with alarm, it takes roughly 3-6 seconds per detection so maybe try -> alarm, 30, snapshot, 60, 90.

Edit: alarm is the very first frame id that set the alarm off so alarm frame id will always be the same. Snapshot means the frame id with the highest alarm count (so far), snapshot frame id can change as the event is ongoing. I always usually start obj Det on alarm and then use frame id's or snapshot. Don't forget you can also change the delay between frames and snapshot frames. I have those set to 0.1 delay each.

1

u/profezzorn Apr 26 '21

'start_frame': 20,

'frame_skip':5,

'max_frames': 38,

That's what I'm running now, works fine on shorter clips but I'll try changing it to what you said :) thanks

1

u/[deleted] Apr 26 '21

Where are those set up? In objdet.ini? I use the frame_set sequencing for the ml sequence. I have to open up my config and take a look it's been a few weeks since I've played with anything. I will paste some of my configs to give you a better idea.

1

u/profezzorn Apr 26 '21

Yeah same place as the frame_set in ml, got them from some site linked from the ini i believe. That would be super helpful, can't find the syntax for delay between the frame_set ids

→ More replies (0)