blakeblackshear / frigate

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

[Config Support]: Zones only use person detection #3628

Closed petper closed 2 years ago

petper commented 2 years ago

Describe the problem you are having

When using zoning for detecting specific objects, it only sets it as a person independent of how i format it. (also confirmed that it only tracks person, not car as configured.

image

I think I am missing something in my configuration.

Version

0.10.1

Frigate config file

mqtt:
  host: 10.254.251.235
  user: user_secret
  password: pwd_secret
cameras:
  frontside:
    ffmpeg:
      inputs:
        - path: rtsp://10.254.251.238:554/axis-media/media.amp
          roles:
            - detect
            - rtmp
            - record
    snapshots:
       enabled: true
       timestamp: true
       bounding_box: true
       retain: 
          default: 10
    record:
      enabled: True
      events:
        retain:
          default: 10
    zones:
      walkway:
        coordinates: 928,181,419,566,517,720,923,720,1236,350
        objects:
          - motorcycle
          - car
          - person
      driveway:
        coordinates: 445,33,669,93,306,258,244,109
        objects:
          - person
          - car
          - motorcycle

detectors:
  coral:
    type: edgetpu
    device: usb

Relevant log output

{
  "birdseye": {
    "enabled": true,
    "height": 720,
    "mode": "objects",
    "quality": 8,
    "width": 1280
  },
  "cameras": {
    "frontside": {
      "best_image_timeout": 60,
      "detect": {
        "enabled": true,
        "fps": 5,
        "height": 720,
        "max_disappeared": 25,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 50
        },
        "width": 1280
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [],
        "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.254.251.238:554/axis-media/media.amp",
            "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 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://10.254.251.238:554/axis-media/media.amp -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/frontside-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/frontside -r 5 -s 1280x720 -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,
        "improve_contrast": false,
        "mask": "",
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "frontside",
      "objects": {
        "filters": {
          "person": {
            "mask": null,
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "",
        "track": [
          "person"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [],
          "retain": {
            "default": 10,
            "mode": "motion",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 0,
          "mode": "all"
        },
        "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": true
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "zones": {
        "driveway": {
          "coordinates": "445,33,669,93,306,258,244,109",
          "filters": {},
          "objects": [
            "person",
            "car",
            "motorcycle"
          ]
        },
        "walkway": {
          "coordinates": "928,181,419,566,517,720,923,720,1236,350",
          "filters": {},
          "objects": [
            "motorcycle",
            "car",
            "person"
          ]
        }
      }
    }
  },
  "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": {
    "coral": {
      "device": "usb",
      "num_threads": 3,
      "type": "edgetpu"
    }
  },
  "environment_vars": {},
  "ffmpeg": {
    "global_args": [
      "-hide_banner",
      "-loglevel",
      "warning"
    ],
    "hwaccel_args": [],
    "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": null,
  "mqtt": {
    "client_id": "frigate",
    "host": "10.254.251.235",
    "password": "pwd_secret",
    "port": 1883,
    "stats_interval": 60,
    "tls_ca_certs": null,
    "tls_client_cert": null,
    "tls_client_key": null,
    "tls_insecure": null,
    "topic_prefix": "frigate",
    "user": "peter"
  },
  "objects": {
    "filters": null,
    "mask": "",
    "track": [
      "person"
    ]
  },
  "record": {
    "enabled": false,
    "events": {
      "max_seconds": 300,
      "objects": null,
      "post_capture": 5,
      "pre_capture": 5,
      "required_zones": [],
      "retain": {
        "default": 10,
        "mode": "motion",
        "objects": {}
      }
    },
    "expire_interval": 60,
    "retain": {
      "days": 0,
      "mode": "all"
    },
    "retain_days": null
  },
  "rtmp": {
    "enabled": true
  },
  "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
  }
}

Frigate stats

{"detection_fps":2.5,"detectors":{"coral":{"detection_start":0.0,"inference_speed":7.67,"pid":232}},"frontside":{"camera_fps":5.0,"capture_pid":243,"detection_fps":2.5,"pid":240,"process_fps":5.0,"skipped_fps":0.0},"service":{"storage":{"/dev/shm":{"free":65.1,"mount_type":"tmpfs","total":67.1,"used":2.0},"/media/frigate/clips":{"free":9511900.2,"mount_type":"zfs","total":9570227.6,"used":58327.4},"/media/frigate/recordings":{"free":9511900.2,"mount_type":"zfs","total":9570227.6,"used":58327.4},"/tmp/cache":{"free":976.8,"mount_type":"tmpfs","total":1000.0,"used":23.2}},"temperatures":{},"uptime":99,"version":"0.10.1-83481af"}}

Operating system

Debian

Install method

Docker CLI

Coral version

USB

Any other information that may be helpful

No response

NickM-27 commented 2 years ago

Zones are just a sublist of cameras -> your_camera -> objects -> track so you must add all objects that camera is tracking to that list, then set the zones to the appropriate objects from that list.

petper commented 2 years ago

Zones are just a sublist of cameras -> your_camera -> objects -> track so you must add all objects that camera is tracking to that list, then set the zones to the appropriate objects from that list.

When I used it as `objects: track:

NickM-27 commented 2 years ago

It will always detect the objects outside of the zones just won't create an event unless they enter the zone (when required_zones is set). Without required_zones set it just keeps track of when an object enters a zone, this is how frigate is designed to work.

You haven't defined required_zones so events will always be created still

NickM-27 commented 2 years ago

You will need to set required_zones on snapshots and on record -> events

github-actions[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.