Local realtime person detection for RTSP cameras

Need to test the new version… I have BlueIris too, and I need to test more Frigate at night. This was an issue so far, as it seems detection was working not as good.

Hi, I can’t get working clips (save clips).
I’m running Frigate on Raspberry Pi4 (32bit) and don’t using HA.

Starting container with:

sudo docker run --rm \
--privileged \
--name frigate0.8.0-beta1 \
--shm-size=64m \
-v /dev/bus/usb:/dev/bus/usb \
-v /home/pi/frigate0.8.0-beta1/config:/config:ro \
-v /etc/localtime:/etc/localtime:ro \
-p 5000:5000 \
blakeblackshear/frigate:0.8.0-beta1-armv7

my config.yml:

detectors:
  coral:
    type: edgetpu
    device: usb
mqtt:
  host: 10.0.0.151
  topic_prefix: frigate
save_clips:
  max_seconds: 300
  retain:
    default: 5
    objects:
      person: 15
track:
    - person
  
  filters:
    person:
      min_area: 5000
      max_area: 100000
      min_score: 0.6
      threshold: 0.85

cameras:
  outdoor:
    ffmpeg:
      inputs:
        - path: rtsp://user:[email protected]:554/11
          roles:
            - detect
            - rtmp
            - clips
    height: 1920
    width: 2560
    fps: 4
    
    mask: poly,1749,1140,1749,993,1899,995,1889,1135
    best_image_timeout: 60

    save_clips:
      enabled: True
      pre_capture: 30
      objects:
        - person 
         
    rtmp:
      enabled: True

    snapshots:
      show_timestamp: True
      draw_zones: True
      draw_bounding_boxes: True

     objects:
      track:
        - person
      filters:
        person:
          min_area: 5000
          max_area: 100000
          min_score: 0.6
          threshold: 0.85

In previous version of Frigate (0.7.0) I specified location for saving clips with:
-v /tmp/motion:/clips in run container command and saving clips are working.

After run frigate container I see info that directories were created, but If I look to /media directory there is no folder called frigate.

* Starting nginx nginx
   ...done.
frigate.app                    INFO    : Creating directory: /media/frigate/recordings
frigate.app                    INFO    : Creating directory: /media/frigate/clips
frigate.app                    INFO    : Creating directory: /tmp/cache
frigate.mqtt                   INFO    : MQTT connected
frigate.app                    INFO    : Camera processor started for outdoor: 35
frigate.app                    INFO    : Capture process started for outdoor: 36
detector.coral                 INFO    : Starting detection process: 32
frigate.edgetpu                INFO    : Attempting to load TPU as usb
frigate.edgetpu                INFO    : TPU found

What I’m doing wrong?
Please could you tell me what I’m missing? Thanks.

Asking the dumb questions first: did you walk in front of the camera so that the motion event is triggered and it starts recording a clip?

The docker compose part of the readme has been updated but not the “command line” one.
Here is a more complete setup for the new 0.8.x frigate setup using docker command line.

Will try to remember to make a PR for Blake to adapt tomorrow.

docker run -d --name frigate0.8.0 \
--privileged \
--shm-size=300m \
--mount type=tmpfs,target=/tmp/cache,tmpfs-size=200000000 \
-v /dev/bus/usb:/dev/bus/usb \
-v /mnt/usbdisk01/share/frigate_spool/clips:/media/frigate/clips \
-v /mnt/usbdisk01/share/frigate_spool/recordings:/media/frigate/recordings \
-v /usr/share/dockers/frigate_0.8.0/config:/config:ro \
-v /etc/localtime:/etc/localtime:ro \
-p 5000:5000 \
-p 1935:1935 \
blakeblackshear/frigate:0.8.0-beta1-amd64

Thank you very much!

On HA 177.6 and frigate:0.8.0-beta1-amd64 with the beta custom_component

I noticed the created sensors are displayed with the histogram bar chart instead of a line graph. Some quick research indicated this is because there is no defined unit_of_measurement. Using the customizations in the UI I added the unit to one of the sensors and now its showing with a line graph.

ps. this all rocks.

1 Like

nvidia 1080 or rx580 are great for tensorflow but old school. The high power consumption isnt trendy when you can have similar performance with a small low power coral too. Yep i know its limitation but something for something. We may need to wait a half year when nvidia jetson xavier will be more widespread and then we can have all in one small board. hwaccel for ffmpeg, tensorflow support if Black will add it, also it has tensor cores for Deep Learning but you can still add your existing Coral to it.

1 Like

its crazy that its old skool alreadyt, but you’re right.
I think i’ll try CoralTPU anyway - and use the GPU for ffmpeg - see what i get compared to Zoneminder (dlandon’s docker) using OpenCV 4.5.0 and CUDA 11.1 or even Shinobi with Tensorflow (as I can use my GPU for those)

i work in this area, and thats what i see there. On the other hand i like this trend as it’s annoying to run a 500-600watt home server 24/7 basically just for security monitoring. I also use Zoneminder, Shinobi too, but for Home Assistant, i recommend this Frigate.

2 Likes

The rabbit hole for GPU support is deep. There are version incompatibilities for python versions. It could be implemented as a sidecar container that shares memory with the frigate container. A lot of work, and only a small number of people would benefit. Hoping that nvidia will make some of this stuff open source so others can make it easier to integrate.

2 Likes

it is annoying, and i have a pretty solid NUC i’d rather use (~120W), so maybe the CoralTPU is the way to go with frigate.

Question to saving clips.
Is there any chance to set format of filename for saving clips? I mean something like: camera-name-YYYY-mm-dd_hhmmss.
At the moment they are using for me strange format that I don’t understand.

[M.2 Accelerator with Dual Edge TPU | Coral](https://coral.ai/products/m2-accelerator-dual-edgetpu)
huh - didnt even know this was a thing!

Well shoot, I was hoping that the NVR would somehow work with Frigate being on a different system. It seems like this is not the case, am I wrong?

HassOS runs on RPI, but I have Frigate on an intel machine. Is there any way to get the NVR functionality on HASSOS to communicate with the other system?

That should work fine as long as homeassistant can access ports 5000 and 1935. What are you seeing?

Just to make sure, I am talking about adding it through the hassos add-on store at https://github.com/blakeblackshear/frigate-hass-addons

And not the custom_components version at https://github.com/blakeblackshear/frigate-hass-integration

When I add it through the hassos store, it is showing the following for configuration:

detectors:
  coral:
    type: edgetpu
    device: 'usb:0'
mqtt:
  host: core-mosquitto.local.hass.io
ffmpeg: {}
cameras: {}

I don’t see any way of specifying the host that is running frigate.

I double checked the config options to make sure I am not missing anything.

I see the confusion. The addon is for running the container within HassOS on the same machine as Homeassistant. You need the integration for connecting to a separate host.

Shoot. Any chance of getting that integration as an addon to HASSOS? I don’t necessarily like putting custom_components in – no easy way to keep it up to date unless I remember to do it manually.

I think you are confused about the difference between an integration (aka custom_components or core components) and an addon. Addons are containers managed by the HassOS supervisor. Integrations are python code that runs within homeassistant, and that is the only way to integrate with the media browser, notifications, etc. I do plan to get frigate added to HACS which helps manage custom_components (and some other things).

2 Likes

There is no way to configure the clip names. The name includes the internal id from frigate, and changing it would break the media browser feature. Are you not using the new integration with media browser support? With the media browser and the retention features built into frigate, I’m not sure why you would want/need to manage the clips yourself.