Help in getting me started with right threshold values?

Forum for questions and support relating to the 1.28.x releases only.
Locked
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Help in getting me started with right threshold values?

Post by asker »

Hi all, I have this urge to try ZM's motion detection algorithms again. I am currently using Foscam's own motion detection triggers (via zmtrigger.pl) and its working reasonably well. However, I want to give ZM's own algorithms a good try and I am looking for help to get started. Every time I switch to ZM's own algorithm, I get *gobs* of events.

I need help in people guiding me with initial settings and then I can tweak them. (I've tried many presets)
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
kkrofft
Posts: 41
Joined: Sun Mar 16, 2014 9:55 pm

Re: Help in getting me started with right threshold values?

Post by kkrofft »

First, look at my post at http://www.zoneminder.com/forums/viewto ... 476#p84476 for one approach. Your situation is a bit different being indoors. I recommend Blobs as the alarm check method and percent for units. ( I find it easier to guesstimate the percents I want rather than the number of pixels.)

I would suggest that when you post a question, include as much info as possible. You mention getting gobs of events
but not what sort of events. Each source will have differing solutions. A pet walking through the scene would be handled by increasing the min pixel threshold to a percent higher than what the pet represents. While a change in lighting in the room on in the reflections on the floor would require tweaking either the max threshold to ignore large changes or the max alarmed area.

By using blobs, you can review the alarm frames and statistics to fine tune. Pick the events screen that lists the captures. From there you can pick frames or alarm frames to view the individual captured frames. Look at the highlighted frames to see the blob outline to see what caused the trigger. In the upper right corner of the frame window, click stats to see the recorded numbers for the zone settings. That will guide you into what the alarm percentages should be. Remember that a trigger must meet the criteria in order Alarm/Filter/Blob px/Blobs/Blob Sizes. So looking at an event that you want to miss, increase the percentage that would best have excluded it but not an actual event.

My last suggestion would be to play with the zone sizes. Zones hopefully can be made so that the sensitivity and coverage are useful percentages for both wanted and unwanted triggers. Large zones increase resolution at the expense of sensitivity. If that sounds confusing, think of it like this... The difference in percentage of the total zone between a pet and a person is closer in a large zone than in a small one so in a smaller zone you have more resolution in picking the correct percentage include one and exclude the other. But many small zones increase the load on the cpu while evaluating the numbers from all the zones. It is also unclear to me as I have not seen it specifically stated, what happens in areas that are not in a zone. In your example, I believe that the red zones are evaluated to the specified criteria and the rest of the frame is still active to a base criteria. Otherwise why have the ability to turn a zone inactive? I suppose it could be to allow for time based configurations where you want to ignore something only at certain times of the day. But I just don't know. So in my setups, I cover the entire scene with zones and specify inactive for areas I want to ignore.

I hope this helps and please let me know how it works out.

KK
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Help in getting me started with right threshold values?

Post by asker »

KK, thanks for your help. I'll start reading your link right away. In the mean time, here are my settings:

Stairs == stairs leading down on the left
door == basement door
couch = couch area on right

My logic is as follows:
I am using filtered pixels to first get a sense of the logic
I want a trigger if 5% of the image changes compared to before
I also want to make sure at least 5x5 contiguous pixels change before an alarm is raised
I expect 30% of the frame to change if a person walks around, so per ZM's wiki, 25% of 30% is a good start (why?) which comes to around 7.5
I've also specified overload frame ignore as 2 (I haven't specified a max, I guess I need to, for this to work)

My FPS is 2

Now, when I activate ZM's modect, the basement starts recording almost ALWAYS! Within 10 minutes I have many many events. There is no one in the basement. It's already daylight, so its not switching from IR to daylight. So where am I going wrong?
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Nerre
Posts: 100
Joined: Thu Sep 25, 2014 10:22 am

Re: Help in getting me started with right threshold values?

Post by Nerre »

Is there a specific reason you have several zones? Have you activated statistics? (It's a good way to see what triggers your events.) It's also possible to get zm to highlight the triggering pixels (but maybe just in blob mode?).

You should set a "max alarmed area" to filter out ambient light changes.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Help in getting me started with right threshold values?

Post by asker »

Nerre, yes there is - note the pillars - they have grooves in them - they seem to always cause havoc with ZM's detection - I think the shadow play is quite large there and depending on small lighting variations, ZM seems to always think there is activity on the pillars. So instead of overlaying 3 inactive zones on one large active, I made 3 active zones. The advantage (which I haven't taken advantage of so far) also is then I can apply different rules to different parts - once I get a hang of things.
Nerre wrote:Is there a specific reason you have several zones? Have you activated statistics? (It's a good way to see what triggers your events.) It's also possible to get zm to highlight the triggering pixels (but maybe just in blob mode?).

You should set a "max alarmed area" to filter out ambient light changes.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Help in getting me started with right threshold values?

Post by asker »

Kkroft, thanks for linking to your post. It was extremely useful. I've made excellent progress.

Can you confirm if my understanding is right - I am not sure if ZM is applying each layer of checks on the complete area or the area detected by the previous layer of checks

For example, take the zone on the left of the image above (stairs area down to basement)
Units: %
Check Method: Blob
Min/Max Pixel Thres: 25
Filter Width/height (pixels): 3x3
Min/Max Alarmed Area: 3/60
Min/Max Filtered Area: 3/60
Min/Max Blob Area: 2/0
Min/Max Blobs: 1
Overload Frame Ignore Cnt: 2
My understanding is this is how ZM is doing the checks:

a) Set A = full zone pixels

a) (Min/Max Pixel Thres) In the *Full* area defined by the zone, check if there are any pixels that have have a 25 count difference in pixel color from a previous. Assign to Set B. If Set B = null, don't raise alarm, don't proceed with rest.

b) (Min/Max Alarmed Area) check if Set B is at least 3% of Set A and not more than 60% of Set A. If Set B does not fall in this range, don't raise alarm, don't proceed with rest.

c) (Filter Width/Height) In the set of pixels (Set B) that are different in color value of 25, check if there are pixels that are surrounded by 3 more pixels around them that are also different in color value of 25. Assign to Set C. If Set C = null, don't raise alarm, don't proceed with rest

d) (Min/Max Filtered Area) check if Set C forms at least 3% of Set A but no more than 60% of Set A. If Set C does not fall in this range, don't raise alarm, don't proceed with rest

e) (Min/Max Blob Area) use Blob logic on Set C to figure out how many Blobs are there. A blob that is at least 2% in size of Set A (full pixels) is considered a blob. Assign this to Set D. [Not sure about this - is this 2% relative to Set A?]

f) (Min/Max Blobs) - If the # of blobs in Set D is less than 1, don't raise an alarm, don't proceed with rest

g) Alarm!
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
kkrofft
Posts: 41
Joined: Sun Mar 16, 2014 9:55 pm

Re: Help in getting me started with right threshold values?

Post by kkrofft »

My understanding is the same as yours. I believe the 2% blob area refers to set A. Check out the description
of blobs in the Wiki at http://www.zoneminder.com/wiki/index.php/Defining_Zones . I read it that way.

Glad you found my tips useful.

KK
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Help in getting me started with right threshold values?

Post by asker »

Great thanks - yes I've read the Wiki several times to try and confirm my understanding.

I'm extremely pleased with my ZM settings for zones and owe you a beer. I followed your overall advice and split zones based on distance instead of putting them together. Very very good advice. As of now, I'm getting excellent detection with only a few false positives -and they are times when the sun blasts through my basement door blinds - hard to eliminate that and not people at the same time and some other cases like when the lights come on - I'm going to use preclusive zones for that to further optimize.

I had initially modified my system to directly use Foscam's own motion detection via triggers, but I've disabled that now. ZM's own detection is working incredibly well, and actually better.

And you were also right, that settings of 4,3 (percent) work very well.
kkrofft wrote:My understanding is the same as yours. I believe the 2% blob area refers to set A. Check out the description
of blobs in the Wiki at http://www.zoneminder.com/wiki/index.php/Defining_Zones . I read it that way.

Glad you found my tips useful.

KK
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
kkrofft
Posts: 41
Joined: Sun Mar 16, 2014 9:55 pm

Re: Help in getting me started with right threshold values?

Post by kkrofft »

Glad to help. Hopefully others will stumble on our discussion and benefit as well.

KK
Locked