Local realtime person detection for RTSP cameras

I think you are misunderstanding that metric. Frigate does not run detection unless there is motion. Your average detection fps will be dependent on how much motion there is. Also, detection is often run multiple times in multiple parts of the same frame. What really matters is the inference speed. To see where your detection fps would top out, you take 1000/inference_speed.

Iā€™ve just fired up a fresh Hass OS 64 bit RPi 4 with a USB Coral to start playing with Frigate and Iā€™m impressed how far itā€™s come! Iā€™m having issues getting all cameras added though, I have a total of 6 but Iā€™m starting with my TP Link Tapo C200ā€™s and Iā€™m having troubles getting passed 2 cameras at 1920x1080 5fps without the third green screening when I have HW acceleration enabled.

Iā€™ve enabled debug and seen this in the log. Iā€™ll have a look at GPU memory shortly.

watchdog.test               INFO    : No frames received from test in 20 seconds. Exiting ffmpeg...
watchdog.test               INFO    : Waiting for ffmpeg to exit gracefully...
watchdog.test               INFO    : FFmpeg didnt exit. Force killing...
frigate.video                  INFO    : test: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : test: ffmpeg process is not running. exiting capture thread...

This should be:

logger:
  default: debug
1 Like

I updated to the latest version and now the configuration is empty. I know that itā€™s now trying to read it from HA /config directory. Was the update supposed to move the old file to the new location? Iā€™m not seeing anyone else posting about this. Did I have bad luck?

What was the location of the old configuration file? Iā€™m hoping itā€™s still there. Iā€™d hate it if I have to write everything from scratch again.

Unfortunately the changes that the HA devs made to the Supervisor cause the Frigate configuration to completely disappear. This is of course corrected in the latest version by moving the config out of the Supervisorā€™s control. Unless you have a snapshot or backup, itā€™s unrecoverable. Youā€™ll have to recreate it and place it in the HA config directory as frigate.yml.

I know it has already been asked but I tried without success. Is there a chance to implement openalpr for registration plate recognition and face recognitionā€¦it might be overkill but seen your work so far itā€™s just amazing and would be a masterpiece and all on one solution for a bunch of people :slightly_smiling_face:

Anyone here using Frigate deployed to Kubernetes via helm? I set up a pv/pvc for frigate, and not sure I configured it correctly as doesnā€™t seem to be using it.

pv config:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-frigate
spec:
  capacity:
    storage: 100Gi
  accessModes:
     - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
     namespace: default
     name: pv-frigate-claim
  mountOptions:
    - hard
    - nfsvers=4.1
  nfs:
    path: "/volume1/frigate"
    server: nasservername

pvc config:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-frigate-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi

frigate helm yaml:

persistence:
  data:
    enabled: true
    storageClass: "-"
    existingClaim: pv-frigate-claim
    subPath: /
    accessMode: ReadWriteOnce
    size: 100Gi
    ## Do not delete the pvc upon helm uninstall
    skipuninstall: true

Output of describing the pvc:

Name:          pv-frigate-claim
Namespace:     default
StorageClass:  microk8s-hostpath
Status:        Bound
Volume:        pv-frigate
Labels:        <none>
Annotations:   control-plane.alpha.kubernetes.io/leader:
                 {"holderIdentity":"c3832541-6fcf-11eb-999d-62bd07d5689f","leaseDurationSeconds":15,"acquireTime":"2021-02-19T13:02:06Z","renewTime":"2021-...
               pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      100Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Used By:       frigate-56ffc44c49-8cdqd
Events:        <none>

I donā€™t see it storing any clips on the nfs side when it detects something, so not sure if I am missing something in my settings. Thank you!

EDIT: Deleted/reposted as replied to the wrong person accidentally, didnā€™t want to mess anyone up.

I do license plate and face recognition already with a couple of other Docker containers and some automations in Home Assistant. Itā€™s not too hard and I actually like having everything separate rather than all together in one container.

How do you guys build a new docker image?
Letā€™s say that I want to try out the 0.8.2 releaseā€¦ Seen that people are making a ā€œbuildā€ ā€¦

Iā€™m new to docker so please bear with my stupidnessā€¦ :stuck_out_tongue:

that sounds interesting! Would you mind sharing this setup? i would be highy interested . I would like using this stuff a lot.

I had the same issue - missed the breaking change and updated before I realised!

I managed to restore mine as I keep snapshot backups on google drive. If you have a snapshot, the config file is in the backup file for your frigate add-on, in the ā€œadd-on.jsonā€ file.

If you donā€™t have a snapshot, then I think you are out of luckā€¦

So I have spent all day today, between here and redditt and cant figure this out for the life of me. I keep getting this error message:

 Starting nginx nginx
...done.
Starting migrations
peewee_migrate INFO : Starting migrations
Starting migrations
peewee_migrate INFO : Starting migrations
There is nothing to migrate
peewee_migrate INFO : There is nothing to migrate
frigate.mqtt INFO : MQTT connected
detector.coral INFO : Starting detection process: 58
frigate.app INFO : Camera processor started for desk: 61
frigate.edgetpu INFO : Attempting to load TPU as usb
frigate.app INFO : Capture process started for desk: 62
Process detector:coral:
frigate.edgetpu INFO : No EdgeTPU detected.
There is nothing to migrate
peewee_migrate INFO : There is nothing to migrate
frigate.mqtt INFO : MQTT connected
detector.coral INFO : Starting detection process: 58
frigate.app INFO : Camera processor started for desk: 61
frigate.edgetpu INFO : Attempting to load TPU as usb
frigate.app INFO : Capture process started for desk: 62
Process detector:coral:
frigate.edgetpu INFO : No EdgeTPU detected.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/usr/local/lib/python3.8/dist-packages/tflite_runtime/interpreter.py", line 111, in __init__
raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/opt/frigate/frigate/edgetpu.py", line 124, in run_detector
object_detector = LocalObjectDetector(tf_device=tf_device, num_threads=num_threads)
File "/opt/frigate/frigate/edgetpu.py", line 63, in __init__
edge_tpu_delegate = load_delegate('libedgetpu.so.1.0', device_config)
File "/usr/local/lib/python3.8/dist-packages/tflite_runtime/interpreter.py", line 154, in load_delegate
raise ValueError('Failed to load delegate from {}\n{}'.format(

ValueError: Failed to load delegate from libedgetpu.so.1.0


frigate.watchdog INFO : Detection appears to have stopped. Restarting frigate
frigate.app INFO : Stopping...
frigate.events INFO : Exiting event processor...
frigate.record INFO : Exiting recording maintenance...
frigate.object_processing INFO : Exiting object processor...
frigate.object_processing INFO : Exiting object processor...
frigate.events INFO : Exiting event cleanup...
frigate.watchdog INFO : Exiting watchdog...
frigate.events INFO : Exiting event cleanup...
frigate.watchdog INFO : Exiting watchdog...

I saw mention of coral but Iā€™m not using coral, this is the very basic config Iā€™m running with

mqtt:

  host: 192.xxx.x.xx

  # Optional: port (default: shown below)

  port: 1883

  # Optional: topic prefix (default: shown below)

  # WARNING: must be unique if you are running multiple instances

  topic_prefix: frigate

  # Optional: client id (default: shown below)

  # WARNING: must be unique if you are running multiple instances

  client_id: frigate

  # Optional: user

  user: frigate

  # Optional: password

  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}. 

  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'

  password: 'password'

cameras:

  # Required: name of the camera

  desk:

    # Required: ffmpeg settings for the camera

    ffmpeg:

      # Required: A list of input streams for the camera. See documentation for more information.

      inputs:

        # Required: the path to the stream

        # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}

        - path: rtsp://username:[email protected]/live

          # Required: list of roles for this stream. valid values are: detect,record,clips,rtmp

          # NOTICE: In addition to assigning the record, clips, and rtmp roles,

          # they must also be enabled in the camera config.

          roles:

            - detect

            - rtmp

    width: 1280

    height: 720

    fps: 5

Iā€™m using two wyze cams with the RTSP firmware.
I appreciate any help or direction

You need to set your detector to cpu (depends on number of cpus you have available):

detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
1 Like

Any idea what the issue is here? Using HassOS on Rpi4, had some internet/lan connectivity issues recently and not too sure when it started.

Moreover, quite a few times per hour all my integration entities become unavailable for a split second and then restore

Tried to uninstall and reinstall but it still persists

* Starting nginx nginx
   ...done.
frigate.app                    INFO    : Creating directory: /tmp/cache
frigate.app                    INFO    : Creating tmpfs of size 512m
mount: /tmp/cache: cannot mount tmpfs read-only.
frigate.app                    ERROR   : Failed to create tmpfs, error code: 8192
Starting migrations
peewee_migrate                 INFO    : Starting migrations
peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.app                    INFO    : Camera processor started for driveway: 41
frigate.app                    INFO    : Camera processor started for garden: 43
frigate.app                    INFO    : Capture process started for driveway: 44
frigate.app                    INFO    : Capture process started for garden: 46
detector.coral                 INFO    : Starting detection process: 38
frigate.edgetpu                INFO    : Attempting to load TPU as usb
frigate.edgetpu                INFO    : TPU found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5568db3c10] moov atom not found
/media/frigate/recordings/driveway-20210219192817.mp4: Invalid data found when processing input
frigate.record                 INFO    : bad file: driveway-20210219192817.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55a2629c10] moov atom not found
/media/frigate/recordings/garden-20210219192818.mp4: Invalid data found when processing input
frigate.record                 INFO    : bad file: garden-20210219192818.mp4

Wow canā€™t believe it was that simpleā€¦thank you very much!

Has anyone been able to get the wyze cams to work? I have tried multiple resolutions and it just comes over as a green screen.

I use Facebox for face recognition (https://www.home-assistant.io/integrations/facebox), it works pretty well. I messed around with OpenALPR a while ago (https://www.home-assistant.io/integrations/openalpr_local/) and couldnā€™t get it to work, so I switched over to the free API with Plate Recognizer (platerecognizer.com) and have some simple automations that make everything work together with Frigate. Itā€™s even easier with Frigate 0.8.x than it was with earlier versions.

1 Like

I run OpenALPR but separate from HA. I run it in a dedicated VM and have a dedicated camera just for that. Love it!

I found the solution to my issue with helm chart and my pvc not storing data. It looks like it defaulted the pvc to /data which nothing was stored in. I used this with extraVolume and extraVolumeMounts and now persists my frigate data on my pv as i expected: https://github.com/blakeblackshear/blakeshome-charts/pull/7

@blakeblackshear
issue initializing tmpfs.
This is new.
Running Frigate as add-on in homeassistant. Protection Mode = off


 * Starting nginx nginx
   ...done.
frigate.app                    INFO    : Creating directory: /tmp/cache
frigate.app                    INFO    : Creating tmpfs of size 8g
mount: /tmp/cache: cannot mount tmpfs read-only.

You can add tags to an image name when you perform a run command or write a docker-compose file. For example blakeblackshear/frigate:stable-armv7 is the stable image for arm architecture. You can change that to blakeblackshear/frigate:0.8.1-armv7 to use the version 0.8.1 image instead.

You can search images on Docker Hub to find out what tags are available: Docker

I use docker-compose and the stable image. So whenever the stable image changes versions I can just run docker-compose pull frigate to download the latest image. Running docker-compose up -d frigate will then recreate my frigate container using the latest image that was pulled.