Local realtime person detection for RTSP cameras

Could you share more details and maybe a sample config file how you’ve achieved this? I’ve been using the HA built in camera recording capabilities to record a stream when frigate detects a person but it’s not been very stable. I’d be keen to give motioneye a try to do the recording but I’m struggling to find any information on how to call motioneye api. Everyone seems to be doing it the other way around - let know HA when motion is triggered.
Thanks in advance!

can this leverage the new production mini PCIe accelerator? just asking as it is now half the price of the USB prototype stick

I haven’t tested it, but I believe it will. If not, I will update whatever is needed to get it working.

Hi,

I have some trouble getting the binary sensors to work on Hassio. There are two configured, but it only shows one.

This is the content of the binary_sensor.yaml

name: Camera Inrit Persoon
platform: mqtt
state_topic: "frigate/inrit/person"
device_class: motion
availability_topic: "frigate/available"
name: Camera Achterhuis Persoon
platform: mqtt
state_topic: "frigate/achterhuis/person"
device_class: motion
availability_topic: "frigate/available"

Any idea why this is?

Have you tried like this?

- name: Camera Inrit Persoon
  platform: mqtt
  state_topic: "frigate/inrit/person"
  device_class: motion
  availability_topic: "frigate/available"
- name: Camera Achterhuis Persoon
  platform: mqtt
  state_topic: "frigate/achterhuis/person"
  device_class: motion
  availability_topic: "frigate/available"

:man_facepalming:

That was the problem! Thanks!

1 Like

This release touched almost every line of code. I am certain there are changes I have missed. I see much better bounding boxes and higher confidence scores for detections on my cameras.

Breaking Changes:

  • Object configuration has changed again. Please reference the updated config example.
  • Region specific object settings are no longer available because objects can be detected outside the bounds of regions dynamically

Changes:

  • By default, frigate only looks for the following object types: person, car, and truck. You must specify others if you want.
  • Detected objects are now assigned an id and tracked across frames
  • Regions are dynamically created for tracked objects
  • If an object is against the edge of a region, a new region is dynamically created to ensure the entire object is included in the detection
  • Dockerfile has been overhauled. Building should take less time and result in a smaller image size. There is still room for more improvement.
  • Updated to the latest EdgeTPU libraries from Google
  • Added a /debug/stats endpoint where you can see FPS for your cameras/Coral and various queue lengths

Docker image is available with docker pull blakeblackshear/frigate:0.4.0-beta

5 Likes

Awesome! I spun up a container to start testing.

quick question. Is the fps overlay on the video the rate directly from the camera or the deduped stream from ffmpeg? Likewise, what about the camera_fps stats value in the debug endpoint.

great work!

It is the fps after ffmpeg removes duplicates.

Thanks blake, will also give it a go!

Two quick thoughts:

  • Does the object ID mean that it could track more than one object of the same type? And possibly give a count in the future?
  • Since an object’s detection will still start in a specific region, you could still consider regional+object MQTT topics? As per this: https://github.com/blakeblackshear/frigate/issues/85

I ask this (selfishly) because I rely on the regions at the moment to ignore cars inside my gate (where mine is parked) versus another region on my gate indicating that there’s a car waiting outside. The suggestion in the Github issue about imagemaps should of course also work.

image

Not the end fo the world (I have mixed success detecting cars through the palisade any way), I just can’t help thinking about more possibilities for frigate :wink:

Absolutely. It tracks multiple objects of the same type and knows speed, direction of movement, historical positions/sizes, etc for each object. At the moment, I am not exposing any of that additional info over MQTT or otherwise. It just helps me create dynamic regions for more accurate detections. this lays the groundwork for lots of new use cases in the future.

I should be able to add back regional object filters easily enough. Implementing imagemaps will be a few releases out.

1 Like

Wow, that sounds cool (and like a pretty major upgrade under the hood). Thanks!!

It looks like the new docker image dropped some Intel HW Accelerated drivers that were working with my nuc (working on 0.3.0-beta).

On 0.4.0-beta I use the following HW Accel config:

ffmpeg:
  global_args:
    - -hide_banner
    - -loglevel
    - panic
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

but it causes it to fail now since it appears to be missing the driver now?

2020-01-15T22:46:14.615136939Z  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
2020-01-15T22:46:19.937968206Z libva info: VA-API version 0.39.4
2020-01-15T22:46:19.938034190Z libva info: va_getDriverName() returns 0
2020-01-15T22:46:19.938056870Z libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
2020-01-15T22:46:19.940025588Z libva info: Found init function __vaDriverInit_0_39
2020-01-15T22:46:19.940071085Z ffmpeg: intel_memman.c:39: intel_memman_init: Assertion `intel->bufmgr' failed.
2020-01-15T22:46:20.056250493Z kitchen: ffmpeg didnt return a frame. something is wrong. exiting capture thread...

When I drop my hwaccel_args it runs again (just without hw accel)

I ran into something similar. Can you tell me more about the host os and post the output of uname -r and vainfo?

It’d be great if the timeout could be configurable per camera. I’ve got a couple of cheap cams that seem to do better with more frequent restarts. The 5 minutes should be good for the 2 other (better) cams I use, though. Thanks @blakeblackshear!

I created a github issue for it. Otherwise things drop off my radar.

1 Like

Please, an addon or a tutorial for hass.io
:cry::cry:

1 Like

Sure.

Host OS is Ubuntu 18.04.3 LTS

uname -r 
4.15.0-74-generic

For vainfo, it posted:

libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Coffee Lake - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSlice
      VAProfileVP9Profile2            : VAEntrypointVLD

@Kyle can you try running the dev tag? ie docker pull blakeblackshear/frigate:dev

@blakeblackshear, I’m testing 0.4.0-beta right now and so far so good - thank you!

Is there any way to disable the timestamp and FPS overlay in the video, via configuration?