blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.2k stars 1.76k forks source link

[Support]: Very high CPU Usage at >5 FPS #2937

Closed mdelecate closed 2 years ago

mdelecate commented 2 years ago

Describe the problem you are having

Hi,

I'm surprised that CPU usage rises to 90% - 100% when I increase the detect FPS and am therefore limited to 7 FPS.

Some of my cameras are 10m high which leads the Coral to frequently recognise humans as cats (looking forward to Frigate+ !). I noticed that I can achieve a higher chance of an accurate detection by increasing the FPS, especially for faster moving people.

Default setting: 5 FPS: -Total CPU use: 85% -Frigate NVR Add-on CPU Usage: 70.2%

Unfortunately, I nearly hit a limit when I set all 6 cams to 7 FPS: 7 FPS: -Total CPU use: 94% -Frigate NVR Add-on CPU Usage: 77.4%

8 FPS: -Total CPU use: 100% -Frigate NVR Add-on CPU Usage: 85.5%

The cameras themselves are set to 12 FPS for recording to another NVR. There is no substream available in the native 4K resolution. Retaining the 4K resolution is useful as the cams are located 10-20m away from the further edges of the configured zones.

I have tried reducing frame_height to 20, but this does not make much of a difference to CPU usage.

I have: 6x 4K cameras 3x Google Coral USB

I'm running Home Assistant OS on an 2021 Intel NUC11PAHi7 with 11th Gen 4-core i7 (up to 4.7 Ghz), 16GB RAM, SSD. I thought this CPU would easily be able to to motion detection for six 4K cams?

Version

0.10.0-BFECEE9

Frigate config file

mqtt:
  host: core-mosquitto
  user: mqtt
  password: 1234

detectors:
  coral1:
    type: edgetpu
    device: usb:0
  coral2:
    type: edgetpu
    device: usb:1
  coral3:
    type: edgetpu
    device: usb:2

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128

rtmp:
  enabled: False

detect:
  width: 3840
  height: 2160
  fps: 7

objects:
  track:
    - person
    - umbrella
    - bird
    - dog
    - cat
  filters:
    umbrella:
      threshold: 0.78
    dog:
      threshold: 0.8
    person:
      threshold: 0.7

record:
  enabled: True
  retain: 
    days: 7
    mode: active_objects
  events:
    max_seconds: 300
    pre_capture: 10
    post_capture: 10
    retain:
      # Required: Default retention days
      default: 7
      mode: active_objects

cameras:

  Pool:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.4.51:554/Streaming/Channels/101/?transportmode=unicast
          roles:
            - detect
            - record
    best_image_timeout: 15
    zones:
      zone_garden_front:
        coordinates: 2551,2160,3039,1960,2635,1494,1972,1739,1966,2160
    objects:
      filters:
        bird:
          min_area: 1000
          max_area: 700000
          mask:
            - 3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382
        cat:
          min_area: 6000
          max_area: 70000
          mask:
            - 3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382
        dog:
          min_area: 8000
          max_area: 80000
          mask:
            - 3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382
        horse:
          min_area: 8000
          max_area: 80000
          mask:
            - 3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382
        person:
          min_area: 8000
          max_area: 80000
          mask:
            - 3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382
        umbrella:
          min_area: 8000
          max_area: 80000
          mask:
            - 1237,1655,1086,1092,1655,1415,1785,1618,2003,1692,2034,2160,1557,2160
            - 2812,1535,2351,1502,2468,1295,2295,1052,2418,628,2834,822,3283,1403,3840,1138,3840,1354,2945,1935
    motion:
      mask:
        - 2705,1538,3025,1852,3840,2160,3840,0,0,0,0,2160,1643,2160,1714,1305,1982,1166,1988,686,2246,535,2465,1234

  GardenFront:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.4.54:554/Streaming/Channels/101/?transportmode=unicast
          roles:
            - detect
            - record
    best_image_timeout: 15
    zones:
      zone_garden_front:
        coordinates: 3209,855,3840,862,3840,2160,2490,1923,1476,1490,1737,691,3159,716
    objects:
      filters:
        bird:
          min_area: 1000
          max_area: 70000
          mask:
            - 1015,295,1391,680,3234,640,3178,351,2606,360,2498,0
            - 975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372
            - 1538,788,1652,849,1637,1006,1520,1000,1418,889
        cat:
          min_area: 6000
          max_area: 70000
          mask:
            - 1015,295,1391,680,3234,640,3178,351,2606,360,2498,0
            - 975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372
            - 1538,788,1652,849,1637,1006,1520,1000,1418,889
        dog:
          min_area: 8000
          max_area: 80000
          mask:
            - 1015,295,1391,680,3234,640,3178,351,2606,360,2498,0
            - 975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372
            - 1538,788,1652,849,1637,1006,1520,1000,1418,889
        person:
          min_area: 8000
          max_area: 150000
          mask:
            - 1015,295,1391,680,3234,640,3178,351,2606,360,2498,0
            - 975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372
            - 1538,788,1652,849,1637,1006,1520,1000,1418,889
        umbrella:
          min_area: 8000
          max_area: 80000
          mask:
            - 1015,295,1391,680,3234,640,3178,351,2606,360,2498,0
            - 975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372
            - 1538,788,1652,849,1637,1006,1520,1000,1418,889
    motion:
      mask:
        - 3840,0,3840,702,3252,655,3191,585,1502,582,1382,812,1415,917,1431,1022,1378,1212,1265,1163,1182,1345,1400,1394,2412,1622,2600,1757,3080,1800,3018,2009,3840,2160,0,2160,0,0        

  GardenTop:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.4.52:554/Streaming/Channels/101/?transportmode=unicast
          roles:
            - detect
            - record
    best_image_timeout: 15
    motion:
      mask:
        - 1855,55,1945,46,2120,148,2280,222,2502,412,2529,483,2203,945,2178,809,2077,785
        - 3237,477,2575,0,3840,0,3840,858,3668,843,3342,1526,3065,1354,3040,1191,3243,612
        - 2474,511,2514,702,2738,637,2865,514,2695,406,2520,351
    zones:
      zone_garden_back:
        coordinates: 3351,829,2919,367,2490,171,2610,680,2413,760,2086,1182,3117,1585
      zone_garden_top:
        coordinates: 0,665,1668,388,1865,1255,3345,1818,3840,1243,3840,2160,0,2160
    objects:
      filters:
        bird: 
          min_area: 1000
          max_area: 70000
          mask:
            - 2662,551,2615,874,2357,726,2474,458
        cat:
          min_area: 6000
          max_area: 70000
          mask:
            - 2702,0,3840,0,3840,575
            - 1932,286,2077,794,2178,843,2415,508,2058,194
        dog: 
          min_area: 6000
          max_area: 70000
          mask:
            - 2702,0,3840,0,3840,575
            - 1932,286,2077,794,2178,843,2415,508,2058,194
        person:
          min_area: 7000
          max_area: 1500000
          mask:
            - 2702,0,3840,0,3840,575
            - 1932,286,2077,794,2178,843,2415,508,2058,194
            - 3280,1237,3129,1535,3292,1600,3338,1249
        umbrella: 
          min_area: 7000
          max_area: 1500000
          threshold: 0.8
          mask:
            - 2388,351,2628,332,2705,609,2523,800,2252,532
            - 3240,1422,3366,1471,3840,640,3745,440,3363,397,3172,511

  BackFence:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.4.55:554/Streaming/Channels/101/?transportmode=unicast
          roles:
            - detect
            - record
    best_image_timeout: 15
    motion:
      mask:
        - 360,1360,326,942,911,889,954,1255,766,1412
        - 0,0,0,1191,1000,695,1825,480,1769,1009,2040,1348,2363,1372,2769,1342,3006,1142,3028,938,2763,723,3840,1034,3840,0
    zones:
      zone_garden_back:
        coordinates: 0,2160,0,1225,652,1480,945,1375,905,1092,1209,1040,1754,945,1778,1225,2022,1462,2320,1397,2794,1455,2942,1138,3840,1406,3840,2160
    objects:
      filters:
        bird:
          min_area: 1000
          max_area: 10000
          mask:
            - 127,989,989,845,975,1416,520,1876
            - 2705,1434,3686,1760,3640,2018,3317,2160,2277,1729
            - 3840,1034,520,1876,2085,0,3817,0
            - 520,1876,605,2160,254,2160,172,1786,342,1684
        cat:
          min_area: 3000
          max_area: 190000
          mask:
            - 3603,2063,3375,1983,3369,2160,3578,2160
            - 2243,1769,2711,1412,3483,1680,3412,1935,2585,1948
            - 3840,548,2769,471,2609,689,3840,1046
        dog:
          min_area: 12000
          max_area: 190000
          mask:
            - 3603,2063,3375,1983,3369,2160,3578,2160
            - 2243,1769,2711,1412,3483,1680,3412,1935,2585,1948
            - 3840,548,2769,471,2609,689,3840,1046
        person:
          min_area: 27000
          max_area: 1500000
          mask:
            - 3603,2063,3375,1983,3369,2160,3578,2160
            - 2243,1769,2711,1412,3483,1680,3412,1935,2585,1948
            - 3840,548,2914,326,2185,425,2025,1065,2142,1308,2883,1074,3840,1283
        umbrella: 
          min_area: 12000
          max_area: 1500000
          mask:
            - 86,1526,43,1231,462,1012,849,926,994,1246,760,1526
            - 3840,0,3840,806,3840,1175,2640,1372,1797,1455,1345,1345,1788,271,2074,0

  RoofLeft:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.4.56:554/Streaming/Channels/101/?transportmode=unicast
          roles:
            - detect
            - record
    best_image_timeout: 15
    motion:
      mask: 
        - 0,0,3840,0,3840,1046,3692,1055,3695,938,3314,818,3308,671,2609,532,2585,652,2400,612,2314,615,2317,443,2166,348,2074,551,2120,711,1994,729,2006,785,1822,852,1803,766,1686,757,1637,902,1120,935,1154,1037,1046,1071,468,1218,0,1142
    zones:
      zone_roof_left:
        coordinates: 0,1167,492,1280,1025,1222,2566,892,3840,1169,3840,2160,0,2160
    objects: 
      filters:
        bird:
          min_area: 6000
          max_area: 190000
          mask:
            - 2908,1218,2803,1188,2849,945,2945,960
            - 1923,255,1905,409,1788,391,1797,237
            - 1071,1520,1422,1542,1391,1243,1145,1240
        cat:
          min_area: 6000
          max_area: 190000
          mask:
            - 2908,1218,2803,1188,2849,945,2945,960
        dog:
          min_area: 8000
          max_area: 190000
          mask:
            - 2908,1218,2803,1188,2849,945,2945,960
        person:
          min_area: 10000
          max_area: 2000000
          mask:
            - 2908,1218,2803,1188,2849,945,2945,960
        umbrella:
          min_area: 10000
          max_area: 1000000
          mask:
            - 2908,1218,2803,1188,2849,945,2945,960

  RoofRight:
    ffmpeg:
      inputs:
        - path: rtsp://10.0.4.53:554/Streaming/Channels/101/?transportmode=unicast
          roles:
            - detect
            - record
    best_image_timeout: 15
    motion:
      mask:
        - 0,0,3772,0,3609,289,3557,705,3483,923,3351,917,3385,477,2877,375,2858,828,1852,640,1594,640,1129,720,769,754,686,828,511,898,520,1000,0,1203        
    zones:
      zone_roof_right:
        coordinates: 0,2160,3840,2160,3840,1094,3308,978,3300,632,2937,552,2864,901,2034,732,0,1375
    objects:
      filters:
        bird:
          min_area: 1000
          max_area: 190000
          mask:
            - 1800,1271,1520,1255,1489,1618,1788,1649
            - 2717,1951,2794,1197,2508,1114,2323,1794
            - 1292,877,1258,1434,975,1286,985,911
        cat:
          min_area: 5000
          max_area: 190000
          mask:
            - 1800,1271,1520,1255,1489,1618,1788,1649
            - 2717,1951,2794,1197,2508,1114,2323,1794
            - 1292,877,1258,1434,975,1286,985,911
        dog:
          min_area: 8000
          max_area: 190000
          mask:
            - 1800,1271,1520,1255,1489,1618,1788,1649
            - 2717,1951,2794,1197,2508,1114,2323,1794
            - 1292,877,1258,1434,975,1286,985,911
        person:
          min_area: 10000
          max_area: 2000000
          mask:
            - 1800,1271,1520,1255,1489,1618,1788,1649
            - 2717,1951,2794,1197,2508,1114,2323,1794
            - 1292,877,1258,1434,975,1286,985,911
        umbrella:
          min_area: 10000
          max_area: 1000000
          mask:
            - 1800,1271,1520,1255,1489,1618,1788,1649
            - 2717,1951,2794,1197,2508,1114,2323,1794
            - 1292,877,1258,1434,975,1286,985,911

Relevant log output

-

FFprobe output from your camera

-

Frigate stats

{
  "birdseye": {
    "enabled": true,
    "height": 720,
    "mode": "objects",
    "quality": 8,
    "width": 1280
  },
  "cameras": {
    "BackFence": {
      "best_image_timeout": 15,
      "detect": {
        "enabled": true,
        "fps": 7,
        "height": 2160,
        "max_disappeared": 35,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 70
        },
        "width": 3840
      },
      "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://10.0.4.55:554/Streaming/Channels/101/?transportmode=unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "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://10.0.4.55:554/Streaming/Channels/101/?transportmode=unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/BackFence-%Y%m%d%H%M%S.mp4 -r 7 -s 3840x2160 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "360,1360,326,942,911,889,954,1255,766,1412",
          "0,0,0,1191,1000,695,1825,480,1769,1009,2040,1348,2363,1372,2769,1342,3006,1142,3028,938,2763,723,3840,1034,3840,0"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "BackFence",
      "objects": {
        "filters": {
          "bird": {
            "mask": [
              "127,989,989,845,975,1416,520,1876",
              "2705,1434,3686,1760,3640,2018,3317,2160,2277,1729",
              "3840,1034,520,1876,2085,0,3817,0",
              "520,1876,605,2160,254,2160,172,1786,342,1684"
            ],
            "max_area": 10000,
            "min_area": 1000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": [
              "3603,2063,3375,1983,3369,2160,3578,2160",
              "2243,1769,2711,1412,3483,1680,3412,1935,2585,1948",
              "3840,548,2769,471,2609,689,3840,1046"
            ],
            "max_area": 190000,
            "min_area": 3000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": [
              "3603,2063,3375,1983,3369,2160,3578,2160",
              "2243,1769,2711,1412,3483,1680,3412,1935,2585,1948",
              "3840,548,2769,471,2609,689,3840,1046"
            ],
            "max_area": 190000,
            "min_area": 12000,
            "min_score": 0.5,
            "threshold": 0.8
          },
          "person": {
            "mask": [
              "3603,2063,3375,1983,3369,2160,3578,2160",
              "2243,1769,2711,1412,3483,1680,3412,1935,2585,1948",
              "3840,548,2914,326,2185,425,2025,1065,2142,1308,2883,1074,3840,1283"
            ],
            "max_area": 1500000,
            "min_area": 27000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "umbrella": {
            "mask": [
              "86,1526,43,1231,462,1012,849,926,994,1246,760,1526",
              "3840,0,3840,806,3840,1175,2640,1372,1797,1455,1345,1345,1788,271,2074,0"
            ],
            "max_area": 1500000,
            "min_area": 12000,
            "min_score": 0.5,
            "threshold": 0.78
          }
        },
        "mask": "",
        "track": [
          "person",
          "umbrella",
          "bird",
          "dog",
          "cat"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 10,
          "pre_capture": 10,
          "required_zones": [],
          "retain": {
            "default": 7,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 7,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "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_garden_back": {
          "coordinates": "0,2160,0,1225,652,1480,945,1375,905,1092,1209,1040,1754,945,1778,1225,2022,1462,2320,1397,2794,1455,2942,1138,3840,1406,3840,2160",
          "filters": {},
          "objects": []
        }
      }
    },
    "GardenFront": {
      "best_image_timeout": 15,
      "detect": {
        "enabled": true,
        "fps": 7,
        "height": 2160,
        "max_disappeared": 35,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 70
        },
        "width": 3840
      },
      "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://10.0.4.54:554/Streaming/Channels/101/?transportmode=unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "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://10.0.4.54:554/Streaming/Channels/101/?transportmode=unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/GardenFront-%Y%m%d%H%M%S.mp4 -r 7 -s 3840x2160 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "3840,0,3840,702,3252,655,3191,585,1502,582,1382,812,1415,917,1431,1022,1378,1212,1265,1163,1182,1345,1400,1394,2412,1622,2600,1757,3080,1800,3018,2009,3840,2160,0,2160,0,0"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "GardenFront",
      "objects": {
        "filters": {
          "bird": {
            "mask": [
              "1015,295,1391,680,3234,640,3178,351,2606,360,2498,0",
              "975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372",
              "1538,788,1652,849,1637,1006,1520,1000,1418,889"
            ],
            "max_area": 70000,
            "min_area": 1000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": [
              "1015,295,1391,680,3234,640,3178,351,2606,360,2498,0",
              "975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372",
              "1538,788,1652,849,1637,1006,1520,1000,1418,889"
            ],
            "max_area": 70000,
            "min_area": 6000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": [
              "1015,295,1391,680,3234,640,3178,351,2606,360,2498,0",
              "975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372",
              "1538,788,1652,849,1637,1006,1520,1000,1418,889"
            ],
            "max_area": 80000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.8
          },
          "person": {
            "mask": [
              "1015,295,1391,680,3234,640,3178,351,2606,360,2498,0",
              "975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372",
              "1538,788,1652,849,1637,1006,1520,1000,1418,889"
            ],
            "max_area": 150000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "umbrella": {
            "mask": [
              "1015,295,1391,680,3234,640,3178,351,2606,360,2498,0",
              "975,1551,2988,2055,3037,1772,2582,1711,2431,1452,1662,1320,1129,1372",
              "1538,788,1652,849,1637,1006,1520,1000,1418,889"
            ],
            "max_area": 80000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.78
          }
        },
        "mask": "",
        "track": [
          "person",
          "umbrella",
          "bird",
          "dog",
          "cat"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 10,
          "pre_capture": 10,
          "required_zones": [],
          "retain": {
            "default": 7,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 7,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "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_garden_front": {
          "coordinates": "3209,855,3840,862,3840,2160,2490,1923,1476,1490,1737,691,3159,716",
          "filters": {},
          "objects": []
        }
      }
    },
    "GardenTop": {
      "best_image_timeout": 15,
      "detect": {
        "enabled": true,
        "fps": 7,
        "height": 2160,
        "max_disappeared": 35,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 70
        },
        "width": 3840
      },
      "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://10.0.4.52:554/Streaming/Channels/101/?transportmode=unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "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://10.0.4.52:554/Streaming/Channels/101/?transportmode=unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/GardenTop-%Y%m%d%H%M%S.mp4 -r 7 -s 3840x2160 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "1855,55,1945,46,2120,148,2280,222,2502,412,2529,483,2203,945,2178,809,2077,785",
          "3237,477,2575,0,3840,0,3840,858,3668,843,3342,1526,3065,1354,3040,1191,3243,612",
          "2474,511,2514,702,2738,637,2865,514,2695,406,2520,351"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "GardenTop",
      "objects": {
        "filters": {
          "bird": {
            "mask": [
              "2662,551,2615,874,2357,726,2474,458"
            ],
            "max_area": 70000,
            "min_area": 1000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": [
              "2702,0,3840,0,3840,575",
              "1932,286,2077,794,2178,843,2415,508,2058,194"
            ],
            "max_area": 70000,
            "min_area": 6000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": [
              "2702,0,3840,0,3840,575",
              "1932,286,2077,794,2178,843,2415,508,2058,194"
            ],
            "max_area": 70000,
            "min_area": 6000,
            "min_score": 0.5,
            "threshold": 0.8
          },
          "person": {
            "mask": [
              "2702,0,3840,0,3840,575",
              "1932,286,2077,794,2178,843,2415,508,2058,194",
              "3280,1237,3129,1535,3292,1600,3338,1249"
            ],
            "max_area": 1500000,
            "min_area": 7000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "umbrella": {
            "mask": [
              "2388,351,2628,332,2705,609,2523,800,2252,532",
              "3240,1422,3366,1471,3840,640,3745,440,3363,397,3172,511"
            ],
            "max_area": 1500000,
            "min_area": 7000,
            "min_score": 0.5,
            "threshold": 0.8
          }
        },
        "mask": "",
        "track": [
          "person",
          "umbrella",
          "bird",
          "dog",
          "cat"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 10,
          "pre_capture": 10,
          "required_zones": [],
          "retain": {
            "default": 7,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 7,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "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_garden_back": {
          "coordinates": "3351,829,2919,367,2490,171,2610,680,2413,760,2086,1182,3117,1585",
          "filters": {},
          "objects": []
        },
        "zone_garden_top": {
          "coordinates": "0,665,1668,388,1865,1255,3345,1818,3840,1243,3840,2160,0,2160",
          "filters": {},
          "objects": []
        }
      }
    },
    "Pool": {
      "best_image_timeout": 15,
      "detect": {
        "enabled": true,
        "fps": 7,
        "height": 2160,
        "max_disappeared": 35,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 70
        },
        "width": 3840
      },
      "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://10.0.4.51:554/Streaming/Channels/101/?transportmode=unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "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://10.0.4.51:554/Streaming/Channels/101/?transportmode=unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Pool-%Y%m%d%H%M%S.mp4 -r 7 -s 3840x2160 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "2705,1538,3025,1852,3840,2160,3840,0,0,0,0,2160,1643,2160,1714,1305,1982,1166,1988,686,2246,535,2465,1234"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "Pool",
      "objects": {
        "filters": {
          "bird": {
            "mask": [
              "3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382"
            ],
            "max_area": 700000,
            "min_area": 1000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": [
              "3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382"
            ],
            "max_area": 70000,
            "min_area": 6000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": [
              "3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382"
            ],
            "max_area": 80000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.8
          },
          "horse": {
            "mask": [
              "3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382"
            ],
            "max_area": 80000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "person": {
            "mask": [
              "3806,1111,3160,1471,3071,1240,2865,1052,2505,818,2431,1071,2658,1271,2812,1535,3074,1831,3840,1382"
            ],
            "max_area": 80000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "umbrella": {
            "mask": [
              "1237,1655,1086,1092,1655,1415,1785,1618,2003,1692,2034,2160,1557,2160",
              "2812,1535,2351,1502,2468,1295,2295,1052,2418,628,2834,822,3283,1403,3840,1138,3840,1354,2945,1935"
            ],
            "max_area": 80000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.78
          }
        },
        "mask": "",
        "track": [
          "person",
          "umbrella",
          "bird",
          "dog",
          "cat"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 10,
          "pre_capture": 10,
          "required_zones": [],
          "retain": {
            "default": 7,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 7,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "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_garden_front": {
          "coordinates": "2551,2160,3039,1960,2635,1494,1972,1739,1966,2160",
          "filters": {},
          "objects": []
        }
      }
    },
    "RoofLeft": {
      "best_image_timeout": 15,
      "detect": {
        "enabled": true,
        "fps": 7,
        "height": 2160,
        "max_disappeared": 35,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 70
        },
        "width": 3840
      },
      "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://10.0.4.56:554/Streaming/Channels/101/?transportmode=unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "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://10.0.4.56:554/Streaming/Channels/101/?transportmode=unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/RoofLeft-%Y%m%d%H%M%S.mp4 -r 7 -s 3840x2160 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "0,0,3840,0,3840,1046,3692,1055,3695,938,3314,818,3308,671,2609,532,2585,652,2400,612,2314,615,2317,443,2166,348,2074,551,2120,711,1994,729,2006,785,1822,852,1803,766,1686,757,1637,902,1120,935,1154,1037,1046,1071,468,1218,0,1142"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "RoofLeft",
      "objects": {
        "filters": {
          "bird": {
            "mask": [
              "2908,1218,2803,1188,2849,945,2945,960",
              "1923,255,1905,409,1788,391,1797,237",
              "1071,1520,1422,1542,1391,1243,1145,1240"
            ],
            "max_area": 190000,
            "min_area": 6000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": [
              "2908,1218,2803,1188,2849,945,2945,960"
            ],
            "max_area": 190000,
            "min_area": 6000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": [
              "2908,1218,2803,1188,2849,945,2945,960"
            ],
            "max_area": 190000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.8
          },
          "person": {
            "mask": [
              "2908,1218,2803,1188,2849,945,2945,960"
            ],
            "max_area": 2000000,
            "min_area": 10000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "umbrella": {
            "mask": [
              "2908,1218,2803,1188,2849,945,2945,960"
            ],
            "max_area": 1000000,
            "min_area": 10000,
            "min_score": 0.5,
            "threshold": 0.78
          }
        },
        "mask": "",
        "track": [
          "person",
          "umbrella",
          "bird",
          "dog",
          "cat"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 10,
          "pre_capture": 10,
          "required_zones": [],
          "retain": {
            "default": 7,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 7,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "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_roof_left": {
          "coordinates": "0,1167,492,1280,1025,1222,2566,892,3840,1169,3840,2160,0,2160",
          "filters": {},
          "objects": []
        }
      }
    },
    "RoofRight": {
      "best_image_timeout": 15,
      "detect": {
        "enabled": true,
        "fps": 7,
        "height": 2160,
        "max_disappeared": 35,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 70
        },
        "width": 3840
      },
      "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://10.0.4.53:554/Streaming/Channels/101/?transportmode=unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "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://10.0.4.53:554/Streaming/Channels/101/?transportmode=unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/RoofRight-%Y%m%d%H%M%S.mp4 -r 7 -s 3840x2160 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "mask": [
          "0,0,3772,0,3609,289,3557,705,3483,923,3351,917,3385,477,2877,375,2858,828,1852,640,1594,640,1129,720,769,754,686,828,511,898,520,1000,0,1203"
        ],
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "RoofRight",
      "objects": {
        "filters": {
          "bird": {
            "mask": [
              "1800,1271,1520,1255,1489,1618,1788,1649",
              "2717,1951,2794,1197,2508,1114,2323,1794",
              "1292,877,1258,1434,975,1286,985,911"
            ],
            "max_area": 190000,
            "min_area": 1000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": [
              "1800,1271,1520,1255,1489,1618,1788,1649",
              "2717,1951,2794,1197,2508,1114,2323,1794",
              "1292,877,1258,1434,975,1286,985,911"
            ],
            "max_area": 190000,
            "min_area": 5000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": [
              "1800,1271,1520,1255,1489,1618,1788,1649",
              "2717,1951,2794,1197,2508,1114,2323,1794",
              "1292,877,1258,1434,975,1286,985,911"
            ],
            "max_area": 190000,
            "min_area": 8000,
            "min_score": 0.5,
            "threshold": 0.8
          },
          "person": {
            "mask": [
              "1800,1271,1520,1255,1489,1618,1788,1649",
              "2717,1951,2794,1197,2508,1114,2323,1794",
              "1292,877,1258,1434,975,1286,985,911"
            ],
            "max_area": 2000000,
            "min_area": 10000,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "umbrella": {
            "mask": [
              "1800,1271,1520,1255,1489,1618,1788,1649",
              "2717,1951,2794,1197,2508,1114,2323,1794",
              "1292,877,1258,1434,975,1286,985,911"
            ],
            "max_area": 1000000,
            "min_area": 10000,
            "min_score": 0.5,
            "threshold": 0.78
          }
        },
        "mask": "",
        "track": [
          "person",
          "umbrella",
          "bird",
          "dog",
          "cat"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 10,
          "pre_capture": 10,
          "required_zones": [],
          "retain": {
            "default": 7,
            "mode": "active_objects",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 7,
          "mode": "active_objects"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "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_roof_right": {
          "coordinates": "0,2160,3840,2160,3840,1094,3308,978,3300,632,2937,552,2864,901,2034,732,0,1375",
          "filters": {},
          "objects": []
        }
      }
    }
  },
  "database": {
    "path": "/media/frigate/frigate.db"
  },
  "detect": {
    "enabled": true,
    "fps": 7,
    "height": 2160,
    "max_disappeared": null,
    "stationary": {
      "interval": 0,
      "max_frames": {
        "default": null,
        "objects": {}
      },
      "threshold": null
    },
    "width": 3840
  },
  "detectors": {
    "coral1": {
      "device": "usb:0",
      "num_threads": 3,
      "type": "edgetpu"
    },
    "coral2": {
      "device": "usb:1",
      "num_threads": 3,
      "type": "edgetpu"
    },
    "coral3": {
      "device": "usb:2",
      "num_threads": 3,
      "type": "edgetpu"
    }
  },
  "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",
        "-an"
      ],
      "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": {
    "contour_area": 30,
    "delta_alpha": 0.2,
    "frame_alpha": 0.2,
    "frame_height": 50,
    "mask": "",
    "threshold": 25
  },
  "mqtt": {
    "client_id": "frigate",
    "host": "core-mosquitto",
    "password": "1234",
    "port": 1883,
    "stats_interval": 60,
    "tls_ca_certs": null,
    "tls_client_cert": null,
    "tls_client_key": null,
    "tls_insecure": null,
    "topic_prefix": "frigate",
    "user": "mqtt"
  },
  "objects": {
    "filters": {
      "dog": {
        "mask": null,
        "max_area": 24000000,
        "min_area": 0,
        "min_score": 0.5,
        "threshold": 0.8
      },
      "person": {
        "mask": null,
        "max_area": 24000000,
        "min_area": 0,
        "min_score": 0.5,
        "threshold": 0.7
      },
      "umbrella": {
        "mask": null,
        "max_area": 24000000,
        "min_area": 0,
        "min_score": 0.5,
        "threshold": 0.78
      }
    },
    "mask": "",
    "track": [
      "person",
      "umbrella",
      "bird",
      "dog",
      "cat"
    ]
  },
  "record": {
    "enabled": true,
    "events": {
      "max_seconds": 300,
      "objects": null,
      "post_capture": 10,
      "pre_capture": 10,
      "required_zones": [],
      "retain": {
        "default": 7,
        "mode": "active_objects",
        "objects": {}
      }
    },
    "expire_interval": 60,
    "retain": {
      "days": 7,
      "mode": "active_objects"
    },
    "retain_days": null
  },
  "rtmp": {
    "enabled": false
  },
  "snapshots": {
    "bounding_box": true,
    "clean_copy": true,
    "crop": false,
    "enabled": false,
    "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
  }
}

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

Hikvision DS-2CD3T87WD

Any other information that may be helpful

No response

NickM-27 commented 2 years ago

Running motion detection on 4K is very expensive, are you looking to run object detection on objects that small that a sub stream with lower resolution won't work?

This docs section explains the how in many cases 4K detect doesn't help except with smaller objects https://docs.frigate.video/guides/camera_setup#choosing-a-detect-resolution

Also this section explaining why resolution affects it so much even with a coral: https://docs.frigate.video/configuration/masks#further-clarification

mdelecate commented 2 years ago

Hi, thanks for the response. Yes, for some of the higher mounted cameras, the subjects in my frame are often a bit smaller than the 320x320 dimension of the models currently in use by Frigate.

Despite this, the detection is often not quite accurate due to the top down perspective, so people are being detected as dogs or cats. Apart from using a different set of models, lowering the resolution would probably make recognition accuracy worse.

Here is an example frame from one of the cameras, with a purple box (320x320) on the subjects: Screenshot 2022-03-10 at 10 55 52 AM

mdelecate commented 2 years ago

I've got Blue Iris running as well, so decided to do a comparison. Blue Iris is running on a Windows PC with an older 4-core i7-6700K, 16GB RAM, SSD, no GPU (a bit less powerful than my NUC).

I activated motion detection for all cameras and enabled the "high definition" option to increase motion detection resolution to an estimated 188x94 px.

Since Blue Iris uses the lower resolution substreams for motion detection by default, I also disabled all substreams for a fair comparison.

While displaying 6 live streams: 640x320 substream at 12 FPS: CPU at 11% usage 3840x2160 stream at 12 FPS: CPU at 48% usage

Running in background as a service: 640x320 substream at 12 FPS: CPU at 6% usage 3840x2160 stream at 12 FPS: CPU at 31% usage

So even with a 33% lower FPS (not even taking into account the lower default frame_height of 50px) and a slightly more powerful CPU, Frigate has roughly double the CPU consumption in %.

Despite the base frequency of the newer Gen i7 being lower at 2.8GHz, it scores a bit higher in all benchmarks: image

I'm not sure what motion detection algo Blue Iris is using, but it appears to be extremely efficient.

NickM-27 commented 2 years ago

Yeah, I'm less knowledgeable on that side of things. I believe adding motion masks for parts of the images that don't have important motion could help but not 100%.

@blakeblackshear will know a lot more on this and may have suggestions.

This is something that I think Frigate+ trained models could help with as you may not need the higher res streams if you're running a model that is optimized for cameras at that height.

mdelecate commented 2 years ago

Yes, I tried adding a lot of motion masks so roughly 50% of the areas (which include a lot of moving trees) are masked, but this didn't seem to have much of an effect, so maybe the motion detection runs before the motion mask is evaluated?

And yes, I'm looking forward to Frigate+!

blakeblackshear commented 2 years ago

There are a lot of different things happening, so it would be helpful if you can track down where that CPU usage is coming from. It's not really fair to compare Frigate to Blue Iris with object detection enabled since it isn't doing any of that work.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.