question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Support]: Masks are completely ignored.

See original GitHub issue

Describe the problem you are having

It looks like the masks are being ignore completely. Frigate is detecting objects directly in the area that have been masked. See the screenshot from live debug with and without the mask filter.

Version

0.10.0-BFECEE9

Frigate config file

{
  "birdseye": {
    "enabled": false,
    "height": 720,
    "mode": "objects",
    "quality": 8,
    "width": 1280
  },
  "cameras": {
    "forhave": {
      "best_image_timeout": 60,
      "detect": {
        "enabled": true,
        "fps": 6,
        "height": 1080,
        "max_disappeared": 30,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 60
        },
        "width": 1920
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [
          "-hwaccel",
          "qsv",
          "-qsv_device",
          "/dev/dri/renderD128"
        ],
        "input_args": [
          "-avoid_negative_ts",
          "make_zero",
          "-fflags",
          "+genpts+discardcorrupt",
          "-rtsp_transport",
          "tcp",
          "-stimeout",
          "5000000",
          "-use_wallclock_as_timestamps",
          "1"
        ],
        "inputs": [
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://xxx:xxx@xxx:554/streaming/channels/103",
            "roles": [
              "detect"
            ]
          },
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://xxx:xxx@xxx:554/streaming/channels/101",
            "roles": [
              "record",
              "rtmp"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": "-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy",
          "rtmp": [
            "-c",
            "copy",
            "-f",
            "flv"
          ]
        }
      },
      "ffmpeg_cmds": [
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://xxx:xxx@xxx:554/streaming/channels/103 -r 6 -s 1920x1080 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "detect"
          ]
        },
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://xxx:xxx@xxx:554/streaming/channels/101 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy /tmp/cache/forhave-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/forhave",
          "roles": [
            "record",
            "rtmp"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "1159,567,1205,727,1016,772,978,606",
          "0,1080,611,1080,410,610,298,135,848,0,0,0"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "forhave",
      "objects": {
        "filters": {
          "car": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "person": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "",
        "track": [
          "person",
          "car",
          "cat",
          "dog"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [],
          "retain": {
            "default": 14,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 14,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": true
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": true,
        "height": null,
        "quality": 70,
        "required_zones": [],
        "retain": {
          "default": 10,
          "mode": "motion",
          "objects": {}
        },
        "timestamp": false
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "zones": {
        "zone_forhave": {
          "coordinates": "387,506,0,644,0,1080,1502,1080,1570,510,1558,187,905,203,734,293,819,328,565,508",
          "filters": {},
          "objects": []
        }
      }
    },
    "terasse": {
      "best_image_timeout": 60,
      "detect": {
        "enabled": true,
        "fps": 6,
        "height": 1080,
        "max_disappeared": 30,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 60
        },
        "width": 1920
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [
          "-hwaccel",
          "qsv",
          "-qsv_device",
          "/dev/dri/renderD128"
        ],
        "input_args": [
          "-avoid_negative_ts",
          "make_zero",
          "-fflags",
          "+genpts+discardcorrupt",
          "-rtsp_transport",
          "tcp",
          "-stimeout",
          "5000000",
          "-use_wallclock_as_timestamps",
          "1"
        ],
        "inputs": [
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://xxx:xxx@xxx:554/streaming/channels/103",
            "roles": [
              "detect"
            ]
          },
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://xxx:xxx@xxx:554/streaming/channels/101",
            "roles": [
              "record",
              "rtmp"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": "-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy",
          "rtmp": [
            "-c",
            "copy",
            "-f",
            "flv"
          ]
        }
      },
      "ffmpeg_cmds": [
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://xxx:xxx@xxx:554/streaming/channels/103 -r 6 -s 1920x1080 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "detect"
          ]
        },
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -hwaccel qsv -qsv_device /dev/dri/renderD128 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://xxx:xxx@xxx:554/streaming/channels/101 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy /tmp/cache/terasse-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/terasse",
          "roles": [
            "record",
            "rtmp"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "0,198,947,0,0,0",
          "1920,209,1920,0,988,0"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "terasse",
      "objects": {
        "filters": {
          "car": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "person": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "",
        "track": [
          "person",
          "car",
          "cat",
          "dog"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [],
          "retain": {
            "default": 14,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 14,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": true
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": true,
        "height": null,
        "quality": 70,
        "required_zones": [],
        "retain": {
          "default": 10,
          "mode": "motion",
          "objects": {}
        },
        "timestamp": false
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "zones": {
        "haven": {
          "coordinates": "1920,1080,1920,1080,1920,430,1736,302,1197,276,562,293,0,392,0,1080",
          "filters": {},
          "objects": []
        }
      }
    }
  },
  "database": {
    "path": "/media/frigate/frigate.db"
  },
  "detect": {
    "enabled": true,
    "fps": 5,
    "height": 720,
    "max_disappeared": null,
    "stationary": {
      "interval": 0,
      "max_frames": {
        "default": null,
        "objects": {}
      },
      "threshold": null
    },
    "width": 1280
  },
  "detectors": {
    "cpu": {
      "device": "usb",
      "num_threads": 3,
      "type": "cpu"
    }
  },
  "environment_vars": {},
  "ffmpeg": {
    "global_args": [
      "-hide_banner",
      "-loglevel",
      "warning"
    ],
    "hwaccel_args": [
      "-hwaccel",
      "qsv",
      "-qsv_device",
      "/dev/dri/renderD128"
    ],
    "input_args": [
      "-avoid_negative_ts",
      "make_zero",
      "-fflags",
      "+genpts+discardcorrupt",
      "-rtsp_transport",
      "tcp",
      "-stimeout",
      "5000000",
      "-use_wallclock_as_timestamps",
      "1"
    ],
    "output_args": {
      "detect": [
        "-f",
        "rawvideo",
        "-pix_fmt",
        "yuv420p"
      ],
      "record": "-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy",
      "rtmp": [
        "-c",
        "copy",
        "-f",
        "flv"
      ]
    }
  },
  "live": {
    "height": 720,
    "quality": 8
  },
  "logger": {
    "default": "info",
    "logs": {}
  },
  "model": {
    "height": 320,
    "labelmap": {},
    "labelmap_path": null,
    "path": null,
    "width": 320
  },
  "motion": null,
  "mqtt": {
    "client_id": "frigate",
    "host": "xxx",
    "password": "xxx",
    "port": 1883,
    "stats_interval": 60,
    "tls_ca_certs": null,
    "tls_client_cert": null,
    "tls_client_key": null,
    "tls_insecure": null,
    "topic_prefix": "frigate",
    "user": "frigate"
  },
  "objects": {
    "filters": null,
    "mask": "",
    "track": [
      "person",
      "car",
      "cat",
      "dog"
    ]
  },
  "record": {
    "enabled": true,
    "events": {
      "max_seconds": 300,
      "objects": null,
      "post_capture": 5,
      "pre_capture": 5,
      "required_zones": [],
      "retain": {
        "default": 14,
        "mode": "active_objects",
        "objects": {}
      }
    },
    "expire_interval": 60,
    "retain": {
      "days": 14,
      "mode": "active_objects"
    },
    "retain_days": null
  },
  "rtmp": {
    "enabled": true
  },
  "snapshots": {
    "bounding_box": true,
    "clean_copy": true,
    "crop": false,
    "enabled": true,
    "height": null,
    "quality": 70,
    "required_zones": [],
    "retain": {
      "default": 10,
      "mode": "motion",
      "objects": {}
    },
    "timestamp": false
  },
  "timestamp_style": {
    "color": {
      "blue": 255,
      "green": 255,
      "red": 255
    },
    "effect": null,
    "format": "%m/%d/%Y %H:%M:%S",
    "position": "tl",
    "thickness": 2
  }
}

Relevant log output

N/A

FFprobe output from your camera

N/A

Frigate stats

{"detection_fps":12.0,"detectors":{"cpu":{"detection_start":0.0,"inference_speed":36.53,"pid":241}},"forhave":{"camera_fps":6.0,"capture_pid":250,"detection_fps":0.0,"pid":247,"process_fps":6.0,"skipped_fps":0.0},"service":{"storage":{"/dev/shm":{"free":5361.5,"mount_type":"tmpfs","total":5368.7,"used":7.2},"/media/frigate/clips":{"free":6285934.5,"mount_type":"fuse.shfs","total":15998746.8,"used":9712812.4},"/media/frigate/recordings":{"free":6285934.5,"mount_type":"fuse.shfs","total":15998746.8,"used":9712812.4},"/tmp/cache":{"free":15552.0,"mount_type":"rootfs","total":16673.8,"used":1121.8}},"temperatures":{},"uptime":184249,"version":"0.10.0-bfecee9"},"terasse":{"camera_fps":6.0,"capture_pid":254,"detection_fps":12.0,"pid":249,"process_fps":6.1,"skipped_fps":0.0}}

Operating system

UNRAID

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Hikvision DS-2CD2347G2-LU

Any other information that may be helpful

frigate

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Apr 5, 2022

Frigate is built around the idea that you tell it where you care about activity rather than where you want to ignore activity. It’s the inverse of what many people are used to. You want it to identify objects of interest outside of your zones and follow them so notifications are quicker and more accurate when they do enter your zone. I really need to add another guide to the docs as a follow on to the basic config setup.

1reaction
NickM-27commented, Apr 5, 2022

Ok, thanks for the feedback. I’ll try using Zones here, and see if I fare better.

It is confusing though, the thing I take away from this is: “do not use masks to block out objects”. The challenge is, that this is the exact intention of masks in other software/paradigms; so will take some getting used to.

Well part of the nuance is that there are two different types of masks. In this case you were using a motion mask while there are also object masks that would be used to block out objects.

That being said, frigate is designed to not have true positive objects blocked out to ensure accurate tracking and objects are tracked as early / quickly as possible in the case they move into an area of interest. Zones are the best way to limit events / notifications to areas of interest while also having the tracking working as well as it can.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Masks Still Don't Work | City Journal
More than two years on, the best scientific evidence says that masks don't stop Covid—and public health officials continue to ignore it.
Read more >
How to resist peer pressure when you're the only one wearing ...
Identifying others in a group setting who are masked, so people don't feel like the only ones. Also, seeing leaders in a group...
Read more >
Anti-maskers explain themselves - Vox
Viral videos of people having meltdowns over masks are commonplace, and in many parts of the country, it's not abnormal for strangers to ......
Read more >
One-Way Masking Works - The Atlantic
Because most people's masks aren't perfectly sealed onto their faces, ... people ignored mask mandates when the scourge of COVID seemed weak ...
Read more >
Mask Mandates Didn't Make Much of a Difference Anyway
Both groups need to take a deep breath: Dropping mask mandates isn't the same thing as ignoring Covid-19. Masks have been the most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found