Local realtime person detection for RTSP cameras

The objects that the Coral is trained for is here: https://dl.google.com/coral/canned_models/coco_labels.txt

You can train and use your own models as well: https://blakeblackshear.github.io/frigate/configuration/advanced#custom-models
https://coral.ai/models/

But you would probably be better off with generic motion detection in your case since you really want to capture everything.

1 Like

0.8.4 fixed the “blinking effects” on the camera page when moving the mouse over the toggle detect/clips/snapshot buttons!

1 Like
frigate.events                 WARNING : Unable to create clip for back and event 1614209712.288225-l8ef2e. There were no cache files for this event.

BUMP please help <3

So I managed to fix the reolink stream by switching to RTMP instead of RTSP. Seems to be rock solid now and I turned off mqtt for cars so I’m only getting clips for cars going past but no notifications.
I upped two of the Tapo cams to 1920x1080 and slighlty overclocked the pi so it sits around 80-90% CPU with detection on on all cams. Also upped the gpu memory to 512. I had an issue with my external storage crapping out when things got busy, I think it’s an issue with power with the coral being on the same bus or HassOS and the driver. I had another one lying around anyway so it’s happy now recording to SSD.

The issue with having to use the small resolution for detection on the reolink is annoying but I can live without it. I might stick it on a docker on my other x86 machine soon anyway. I guess stream resolutions (and being able to reduce them slightly) is another issue when buying cameras and using a low power system. Will be interesting to see what’s possible when we can successfully use hardware acceleration on the RPi. Would a 4K x265 camera be within the realms?

I’ve only got one more slight niggle before I’m happy. Detection for the Reolink cam is always switched off when I restart the container. The others stay set on. I thought it was problem in my config but I’ve noticed others switch off as well, apart from one, which is always on! Weird.

1 Like

That was it!! Thank you!
How do you add multiple cams to your config?

Show us your config.yml file.

Edit:
This is your config.yml. I see that you have not enabled CLIPS in camera back

cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://xxxx:[email protected]:554/cam/realmonitor?channel=1&subtype=0&authbasic=aG9tZXNwRGUxc3RyYXRvMnNmZXJhMw==
          roles:
            - detect

Test this:

cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://xxxx:[email protected]:554/cam/realmonitor?channel=1&subtype=0&authbasic=aG9tZXNwRGUxc3RyYXRvMnNmZXJhMw==
          roles:
            - detect
            - clips
2 Likes

You can merge together different types of animals into one big “animal” category. See here under “Customizing the labelmap” at the bottom:

1 Like

Sorry if this has been asked already, searching for nest is tough because it’s in so many phrases.
Anybody with the new Nest integration know how to feed their camera stream into this?
I know it seems redundant but A) I could stop paying for Nest protect with good person recognition and B) when I can, I want to replace the camera with a solution I’ve proved works as well if not better than their cloud solution.

Thanks!

Has anyone gotten the coral m.2 b/m key working in a intel nuc with the frigate home assistant addon?

detectors:
coral_pci:
type: edgetpu
device: pci

I have one working in a dell 5050, not sure how similar everything is though. I have the m.2 in the only m.2 slot on the mb, using an SATA SSD for storage.

Does this support an HLS feed? If so, maybe it can snag the home assistant stream provided by the front end. (I expect not and it just supports rtsp)

1 Like

Might be RTSP only.
At least that’s all the documentation mentions.
I suppose one of my wyze cams can be my test subject for the eventual replacement of my Nest Hello.

It supports anything ffmpeg can accept as an input, so yes it can read HLS along with nearly any source of video you can imagine.

The m.2 and pci versions require the driver on the host according to the documentation on coral.ai

So @keithcroshaw maybe as a test: can you grab the initial HLS url that home assistant serves to your browser and see if it works? (e.g. snag using chrome developer tools).

Would that be like:
rtsps://stream-ue1-bravo.dropcam.com:443/sdm_live_stream/................
?

It would be a url that points to your home assistant instance and ends with something like .m3u (e.g. turn in developer tools and visit your home assistant url and grab the first one)

What this mean in HA log?

21-02-26 13:49:47 WARNING (MainThread) [supervisor.addons.validate] Add-on have full device access, and selective device access in the configuration. Please report this to the maintainer of Frigate NVR
21-02-26 13:49:47 WARNING (MainThread) [supervisor.addons.validate] Add-on have full device access, and selective device access in the configuration. Please report this to the maintainer of Frigate NVR Beta (outdated)

Hello and sorry for the noob questions. I have looked for answers but finally decided to ask for help.

A little background. I worked in Home Automation starting in the 1980’s and retired a few years back. I’ve designed products for multiple companies and have more than a casual knowledge of home systems and software. That said, my knowledge is a bit stale and I’m entirely new to Home Assistant and frigate. My linux knowledge is basic but I can usually make things work.

I have HA currently deployed in my loft running Supervised HA on a Pi 4b with 4G ram & Debian 10. Debian was used because I wanted to eliminate the SD card and go with a more robust SSD.

My loft is being used as a testbed for a very large system for a home I’m building in Costa Rica. The loft has 38 Hue Lights, 8 TPLink Light dimmers, Lutron Pro bridge to use Lutron Pico remotes, a tempest weather station, 1-wire environmental sensors, ecobee thermostats, and a variety of Audio/Video devices. The home in CR will be 3-4 times as many devices, but I intend to test any integrations here before shipping stuff to CR.

This brings me to frigate. I really want this to work but am running into walls. I should also note that I know the Pi4 will be under powered for my camera needs, but I was hoping to try out frigate before upgrading hardware. I’m testing with a reolink RLC-520 camera. I have a coral on order.

First I tried using the HACS custom component. HACS install works fine, but it fails to configure after I add the integration. No logs are visible since it never starts.

I also tried the add-on and had some success. Frigate installs OK but crashes after startup

I’m asking for assistance but also hopeful that I can find someone with expertise to assist me for a fee. I know this is generally frowned upon, but I’m willing to learn. When I’m over my head I’d like to have an experienced mentor to help guide me.

Lastly, my home in CR is on a 17 acre parcel of land. I intend to install somewhere between 12 and 15 cameras which are integral to my security system. This will obviously take more horsepower than a Pi can supply. I need guidance on which platforms I should consider and also how I might segment the system so that simple automation runs on a Pi and the processor intensive stuff like cameras runs on a more powerful platform.

Here’s the log

* Starting nginx nginx
   ...done.
frigate.app                    INFO    : Creating directory: /tmp/cache
frigate.app                    INFO    : Creating tmpfs of size 256m
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
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.mqtt                   INFO    : MQTT connected
detector.coral                 INFO    : Starting detection process: 40
frigate.edgetpu                INFO    : Attempting to load TPU as usb
frigate.app                    INFO    : Camera processor started for back: 43
frigate.app                    INFO    : Capture process started for back: 44
frigate.edgetpu                INFO    : No EdgeTPU detected.
Process detector:coral:
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. Exiting 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.yml

cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554//h264Preview_01_main
          roles:
            - detect
            - rtmp
    width: 640
    height: 480
    fps: 4


mqtt:
  # Required: host name

  host: core-mosquitto
  # 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: mqtt_user
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  #password: password
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
  
clips:
  # Optional: Maximum length of time to retain video during long events. (default: shown below)
  # NOTE: If an object is being tracked for longer than this amount of time, the cache
  #       will begin to expire and the resulting clip will be the last x seconds of the event.
  max_seconds: 300
  # Optional: size of tmpfs mount to create for cache files (default: not set)
  # mount -t tmpfs -o size={tmpfs_cache_size} tmpfs /tmp/cache
  # NOTICE: Addon users must have Protection mode disabled for the addon when using this setting.
  # Also, if you have mounted a tmpfs volume through docker, this value should not be set in your config.
  tmpfs_cache_size: 256m
  # Optional: Retention settings for clips (default: shown below)
  retain:
    # Required: Default retention days (default: shown below)
    default: 10
    # Optional: Per object retention days
    objects:
      person: 15

Looks like you need to define your detector. Check the docs: https://blakeblackshear.github.io/frigate/configuration/detectors

1 Like