Frigate Tip: Motion Masks #13040
hawkeye217
started this conversation in
Tips
Replies: 2 comments 12 replies
-
Sorry I'm only just getting my system setup, could you expand on the 'Limit detections to specific zones' element? |
Beta Was this translation helpful? Give feedback.
8 replies
-
What about objects that are in between a motion mask? If somebody is between the hedges (i.e only the feet are visible outside the motion mask from debug view), would that trigger object detection on the full area of the moving object or only the feet? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Frigate Tips series is a collection of posts where the Frigate developers give tips on how to best configure, use, and maintain your Frigate installation. This post's tip aims to bring clarity on when to use motion masks, something we've discovered is often misunderstood by new users and users coming from other NVR software.
What is a motion mask?
Motion masks in Frigate are used to prevent areas of a scene on a camera from triggering motion detection. They are most easily configured from the Frigate Web UI. The Frigate documentation says:
This is a really important point that we've found that many users misunderstand: a motion mask only prevents motion from being detected and does not prevent objects from being detected.
Motion masks don't prevent objects from being detected
Motion masks should not be used to block out areas where you aren't interested in detecting things.
Yes, you read that correctly (though there are some caveats). Motion masks should be used very sparingly. In order to understand why, it's important to understand how Frigate works.
Again, from the Frigate documentation:
For a simple example, take this scene of a street in Orlando, Florida. A car is driving along the road, and Frigate's Debug view shows red boxes to indicate that motion is being detected on the frame in the areas where the car is moving. These regions of motion are grouped together and passed onto Frigate's object detector, which identifies the object in the frame as a car. Frigate's Debug view then shows the label and colored bounding box around it.
Let's imagine a scenario with this scene where you're only interested in people that are walking on the sidewalk on the right side of the frame, and you only want those people to be shown in the Review pane in Frigate.
It's often assumed that this is where a motion mask would be the solution. A new user may be tempted to add a motion mask like this:
However, this is not the case, and this kind of a motion mask is actually detrimental to the way Frigate is designed to work.
Again, from the documentation:
So take this hypothetical situation:
A person walks underneath the clock (which, if using the masking example above, is in a masked area) and proceeds down the sidewalk we're interested in (which is now in the unmasked area).
Frigate would detect motion just outside of the masked area and begin tracking the person as they proceed down the sidewalk.
Seems like this would work... But wait.
What if the person realized they had dropped something as they were walking underneath the clock? They would turn around and proceed back into the masked area. Perhaps they spend a couple of minutes there talking to someone else, and then continue back down the sidewalk of interest.
Because of overmasking, the person of interest would actually be tracked by Frigate as an entirely new person as they leave the masked area and proceed down the sidewalk the second time, potentially creating two separate review items. In a high-traffic area, this would certainly not be ideal.
So, what's the solution?
Use
required_zones
instead of motion masksIf you're only interested in keeping track of objects in a particular area of your scene, use
required_zones
.From the documentation:
Using a zone for the sidewalk and then restricting alerts and/or detections to objects in that zone is the correct solution here. This can easily be done with the Frigate UI (0.14 and later).
Create a zone called "sidewalk" in Frigate's mask/zone editor and then restart Frigate:
After restarting, navigate to Settings → Camera Settings, choose the camera in the top right, and then check the boxes to restrict alerts and/or detections to the "sidewalk" zone you just created. Then save and restart Frigate once more.
With this configuration, Frigate will track objects outside of the sidewalk zone, but only the
person
objects appearing in thesidewalk
zone will show as alerts in the UI.When creating zones for your cameras, remember that an object's presence in a zone is evaluated based on the bottom center of the bounding box. The example in the documentation shows that more clearly.
Applicable situations for motion masks
Motion masks are used to prevent unwanted types of motion from triggering object detection. A great use for a motion mask would be to cover a camera timestamp, to cover the sky and any moving clouds, or to cover the top of a tree for moving branches and leaves.
Official Frigate documentation
Masks
Zones
Review - for configuring alerts and detections (Frigate 0.14 and later)
If this has been a helpful post, give it an upvote and thumbs up. If you have any questions, leave them down below for us!
-The Frigate dev team (Blake @blakeblackshear, Nick @NickM-27, Josh @hawkeye217)
Beta Was this translation helpful? Give feedback.
All reactions