Page 1 of 1
Zone fine tuning / best practices
Posted: Fri Jun 08, 2007 10:00 pm
by akupsta
Hi Everyone,
I have ZM up and operational, it's running great with currently two outdoor IP cams -- Toshiba WB-IK15As. I set everything up before leaving on my vacation and just returned after roaming the globe for the past month.
During this trial of ZM and my outdoor cams, I came across a few rather interesting (unexpected) events that would of caused an alarm trigger:
- Sun intensity -- varied by fast-moving clouds.
- Camera going to BW mode from color at dusk (auto-BW function) and back to color at sunrise.
- car headlights streaming across driveway (defined) zone as neighbour pulls car out of their driveway.
Stuff like high-wind conditions swaying tree branches beyond usual limits have been already corrects, the and odd insect that decides to land on the camera dome are unavoidable, however its really amazing how much goes on when I'm not home. Thankfully there were was no unlawful activity, but I finally figured out which neighbor’s cat has been playing in my backyard
I checked the wiki and didn't find any info on fine tuning zones to help resolve some of the unexpected but unavoidable triggers mentioned above. Any hints would be greatly appreciated.
Adam.
Re: Zone fine tuning / best practices
Posted: Tue Jun 12, 2007 12:33 pm
by jamescollings
akupsta wrote:Any hints would be greatly appreciated.
The main "tools" in your armoury would be
a) A preclusive zone. If this zone catches an event, then it STOPS the other zones from causing an event. A good example would be a small section of your driveway, that no-one would EVER walk-through but that the neighbours car headlights illuminate.
b) The Max-min settings on a zone. Most people know that increasing the MIN threshold will stop small activities from triggering an alarm, but having the MAX setting will stop BIG changes from triggering an alarm too (e.g. the change from colour to B&W).
Turn the STATS option on, and then dump out the MySQL database. Load it into Excel and you can then see what the stats are for each frame.
For What it is Worth... I had fine tuned all of my zones during the winter, and managed to eradicate all false-positives without losing a single alarm. Now that Summer is here, I have a problem with flashing sunlight poking through the trees, and I am having to start again!
Thanks for the hint!
Posted: Tue Jun 12, 2007 2:23 pm
by akupsta
Thanks! I was just about to post a "clarifing" question how to apply preclusive zones.
I'll give it a try. My main issues are "stray" headlights very early in the AM and sunlight through clouds.
I'll post my results.
Regards,
Adam.
Lessons Learned --- So Far
Posted: Fri Jun 15, 2007 10:57 pm
by akupsta
Ok, looks like preclusive zones seemed to do the trick. by defining narrow bands in areas prone to unwanted light, many false alarms can be eliminated.
The other lesson comes from camera setup. In the case of my camera the IKWB15A, disabling AGC seemed to stop pixelation that caused ZM go into alarm mode.
Also, optimizing zone sensitivity to the desired alarm triggers helped as well.
Hope this helps someone.
Adam.
General Q's
Posted: Mon Jun 25, 2007 2:55 pm
by akupsta
Alarm detection is getting alot better. I managed to get rid of about 98% of all false alarms.
Can someone explain what the following parameters do and what effect they have on how alarms are triggered in zones:
From Monitor Config:
Reference Image Blend %ge
From Zone Config:
Min/Max Pixel Threshold
Filter Width/Height (pixels)
Min/Max Alarmed Area
Min/Max Filtered Area
Min/Max Blob Area
Min/Max Blobs
The last 4 I understand. However I would like to know how (if at all) they get impacted if the first two parameters are changed (Pixel Threshold and Filter width/height).
Thanks.
Adam.
Posted: Fri Jun 29, 2007 3:42 pm
by jameswilson
Reference Image Blend %ge
Is the % of the new image blended into the new, leave at default or 10
Min/Max Pixel Threshold
Is the min and max pixel threshold, ie all below and above will be ignored
Filter Width/Height (pixels)
is designed to help remove noise, ie if 3 and 3 then all pixels less than 3x3 will be ignored
Thanks!
Posted: Fri Jun 29, 2007 4:02 pm
by akupsta
Min/Max Pixel Threshold
Is the min and max pixel threshold, ie all below and above will be ignored
Ok, kind of get it. Valid values are 0-255. So if I set this at let say 8 and my Filter width/height is 5 x 5, what does it do?
My thinking:
Atleast a 40x40 pixel area (a unit) must change before anything is analyzed.
If I happen to be using blobs and my min blob area is set to 2%, then 2% of the zone must consist of these 40x40 pixel unit / units?
Am I way off on this?
Thanks,
Adam.
Re: Lessons Learned --- So Far
Posted: Sat Jun 30, 2007 7:47 am
by jamescollings
akupsta wrote:Ok, looks like preclusive zones seemed to do the trick. by defining narrow bands in areas prone to unwanted light, many false alarms can be eliminated.
I would like to start using preclusive zones (I have very finetuned normal zones) but I have a question before I start... Does the preclusive zone only prevent alarms from being triggered for that individual frame, or for N frames either side as well? I presume it is the former?
e.g.
Code: Select all
Frame ActiveZone PreclusiveZone Alarm?
A Yes No Yes
B Yes Yes No
C No Yes No
D No No No
I am assuming that one could put a small preclusive zone in the MIDDLE of an image. That way any light changes affecting the WHOLE image will be "precluded", whereas someone walking through the image will cause an alarm (because the outer zones will trigger an alarm before the preclusive zone is reached).
Am I correct?
Should Work
Posted: Sat Jun 30, 2007 12:17 pm
by akupsta
Yes this is how it works.
You may need to analyze (frame by frame) your event to see what triggers it. Then place any preclusive zones accordingly.
Does the preclusive zone only prevent alarms from being triggered for that individual frame, or for N frames either side as well? I presume it is the former?
Since you have a fined tuned system, can you shed some light on my questions?
Quote:
Min/Max Pixel Threshold
Is the min and max pixel threshold, ie all below and above will be ignored
Ok, kind of get it. Valid values are 0-255. So if I set this at let say 8 and my Filter width/height is 5 x 5, what does it do?
My thinking:
Atleast a 40x40 pixel area (a unit) must change before anything is analyzed.
If I happen to be using blobs and my min blob area is set to 2%, then 2% of the zone must consist of these 40x40 pixel unit / units?
Am I way off on this?
Thanks,
Adam.
Re: Thanks!
Posted: Sun Jul 01, 2007 8:55 am
by jamescollings
akupsta wrote:Min/Max Pixel Threshold
Is the min and max pixel threshold, ie all below and above will be ignored
Ok, kind of get it. Valid values are 0-255. So if I set this at let say 8 and my Filter width/height is 5 x 5, what does it do?
My thinking:
Atleast a 40x40 pixel area (a unit) must change before anything is analyzed.
If I happen to be using blobs and my min blob area is set to 2%, then 2% of the zone must consist of these 40x40 pixel unit / units?
This is described in the manual
http://www.zoneminder.com/fileadmin/dow ... c151468571 in section 8.2... but I appreciate that manuals quite often only make sense once you already understand things!!!
The min/max pixel threshold is used like this: Each pixel in the image is given a "value", and this threshold decides whether the change in the pixel is sufficient to have made the pixel cause an alarm or not. (the change has to be MORE than the minimum and LESS than the maximum).
You now have an image made up of ALARMED and nonalarmed pixels.
The filter width/height settings then dictate that any cluster of ALARMED pixels are smaller than this setting are thrown away. ie: if your setting is 5x5, then a cluster of alarmed pixels that are 6x4 would be thrown away, but a cluster of 40x36 would still be "in the frame".
You now have an image made up of clusters of ALARMED pixels that are at least as big as your filter size.
Min/Max alarmed area then comes into play. This states that, the remaining alarmed pixels must be at least (and no more) than these settings for this frame still to be considered to be worth of raising an alarm.
The Filter area setting can further narrow down the number of pixels that contribute to the "alarm"-ness of this frame (But I have to admit to not understanding how).
The Blob setting says that the remaining alarmed pixels can be joined up into contiguous groupings.. that is.. if two clusters of alarmed pixels touch, then they are made into a single "blob". This setting decides that only blobs that are above the min % of the whole frame are allowed to be kept, anything smaller is discarded.
Finally, min/max blobs says that, if you have more (or less) than this number of "blobs" of alarmed pixels still remaining within the frame, then zoneminder will raise an "alarm".
it is quite easy to fine tune these settings by putting them to their least sensitive (ie: minimums of 1, maximums of 100) and turning stats on. You can then dump out the STATS database and read it into Excel. This will show the pixeldiff, alarm pixels, filter pixles, blob pixels, number of blobs for each frame in an alarm set. You can then use a simple "IF xx> yy" formula to see whether you can find a level that would have ignored false alarms, without losing REAL alarms (unfortunately, you have to manually watch EVERY alarm to work out which are REAL and which are false).
stats
Posted: Sun Jul 01, 2007 12:43 pm
by darkpaw
Can somebody post the SQL command that would be needed to do this, for those of us who aren't overly familiar with MySQL?
Re: stats
Posted: Sun Jul 01, 2007 6:50 pm
by jamescollings
darkpaw wrote:Can somebody post the SQL command that would be needed to do this, for those of us who aren't overly familiar with MySQL?
First, log in to your mysql database (something similar to this)
mysql -u zm_admin -p zm
To list the contents of the EVENTS table:
select * from Events;
This'll show you each alarm EVENT with the following details
| Id | MonitorId | Name | Cause | StartTime | EndTime | Width | Height | Length | Frames | AlarmFrames | TotScore | AvgScore | MaxScore | Archived | Videoed | Uploaded | Emailed | Messaged | Executed | LearnState | Notes |
To list the statistics for each frame:
select * from Stats;
This'll show you the statistics for each frame and zone that triggered an alarm for each event (lots of information).
| MonitorId | ZoneId | EventId | FrameId | PixelDiff | AlarmPixels | FilterPixels | BlobPixels | Blobs | MinBlobSize | MaxBlobSize | MinX | MaxX | MinY | MaxY | Score |
By trying different thresholds against the pixeldif, alarmpixels, filterpixels etc.. you can see whether an event would still have triggered (and therefore whether you could have missed the falsies, without losing a real event!
Thanks James
Posted: Mon Jul 02, 2007 1:08 pm
by akupsta
Thanks. I'll apply your clarifications to my zone config. One thing I noticed is that not all events have stats captured about them, even through stats are enabled.
Regards,
ADam.
thanks
Posted: Tue Jul 03, 2007 1:08 pm
by darkpaw
Thanks for the DB commands.
One thing I noticed which is weird is that when I turn stats on (debug), that I go from getting a lot of false alarms to having it practically not alarm at all....even if I'm standing in front of the camera and waving my arms. The CPU load is still less than 1, so it's not that it's too busy to calculate the alarm.
Anyone else see this when trying to debug and tune?
Posted: Tue Jul 03, 2007 2:37 pm
by akupsta
Do you get stats for EVERY frame of your event?
My setup only gives stats for some frames (Alarmed), not all of them.