Local realtime person detection for RTSP cameras

I have fixed FPS to 7 fps. Recommendation from documentation is 5 fps for recognition. But since my cameras don’t have option of 5fps, only 4 or 7, used that value.

A small question…
To use the Frigate (blakeblackshear/frigate:stable-amd64nvidia) docker, is the
nVidia closed source driver still required when running on Ubuntu 20 LTE?

Sorry I ment Coral Inference Speed

Any one managed to set up frigate with Nvidia?
Trying but it fails big time… My Linux knowledge must be worse then a … :frowning:

Using ubuntu 20.4 LTE and have a Nvidia 1050 card.

@Minglarn
Below my docker compose. You must have the nvidia drivers installed in the host

  frigate: # https://blakeblackshear.github.io/frigate/
    container_name: frigate
    image: blakeblackshear/frigate:0.9.0-rc2-amd64nvidia 
    restart: unless-stopped
    privileged: true
    hostname: UNRAID  
    shm_size: '8gb'
    volumes:
    - /mnt/cache/appdata/cctv/frigate:/config
    - /etc/localtime:/etc/localtime:ro
    - type: bind
      source: /mnt/disks/storage/cctv/frigate
      target: /media/frigate
      bind:
        propagation: slave
    - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
      target: /tmp/cache
      tmpfs:
        size: '2g'
    environment: 
    - FRIGATE_RTSP_PASSWORD=<>
    - NVIDIA_VISIBLE_DEVICES=<>
    - NVIDIA_DRIVER_CAPABILITIES=all
    ports:
    - 5000:5000
    - 1935:1935 # RTMP feeds
    labels:
    - "com.centurylinklabs.watchtower.enable=true"  
    runtime: nvidia
1 Like

Nvidia drivers installed… I think…

root@ubuntuserver:/home/minglarn/frigate# nvidia-smi
Mon Sep  6 16:42:21 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0 Off |                  N/A |
| 30%   26C    P8    N/A /  75W |     13MiB /  1999MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1084      G   /usr/lib/xorg/Xorg                  8MiB |
|    0   N/A  N/A      1260      G   /usr/bin/gnome-shell                2MiB |
+-----------------------------------------------------------------------------+

Seems right?

  frigate: # https://blakeblackshear.github.io/frigate/
    container_name: frigate
    image: blakeblackshear/frigate:0.9.0-rc2-amd64nvidia 
    ...
    runtime: nvidia

[/quote]
When adding “runtime” I get a error:

ERROR: for frigate  Cannot create container for service frigate: Unknown runtime specified nvidia

And all the fun stops here… Dont really know what to do… :frowning:

Maybe?

I managed to do something…
Seems that I was missing nvidia-docker2

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0 Off |                  N/A |
| 30%   36C    P0    N/A /  75W |    931MiB /  1999MiB |     26%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1084      G   /usr/lib/xorg/Xorg                  8MiB |
|    0   N/A  N/A      1260      G   /usr/bin/gnome-shell                2MiB |
|    0   N/A  N/A    272960      C   ffmpeg                             58MiB |
|    0   N/A  N/A    272966      C   ffmpeg                             58MiB |
|    0   N/A  N/A    272967      C   ffmpeg                             58MiB |
|    0   N/A  N/A    272984      C   ffmpeg                             58MiB |
|    0   N/A  N/A    272996      C   ffmpeg                            257MiB |
|    0   N/A  N/A    273001      C   ffmpeg                            257MiB |
|    0   N/A  N/A    273002      C   ffmpeg                             58MiB |
|    0   N/A  N/A    273003      C   ffmpeg                             49MiB |
|    0   N/A  N/A    273007      C   ffmpeg                             58MiB |
+-----------------------------------------------------------------------------+

Looks good… :slight_smile:

2 Likes

When trying to install this via docker-compose I keep getting:

[+] Running 0/1
 - Container frigate  Creating                                                                                    40.3s
Error response from daemon: Post "http://ipc/filesharing/share": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Then in docker it shows:
Error parsing config: [Errno 2] No such file or directory: '/config/config.yml'

It used to work but after updating docker nothing works…

Seems that your config.yml is not found?

    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${PWD}/config.yml:/config/config.yml:ro
      - /media/mynewdrive/frigate/media:/media/frigate
      - /home/minglarn/frigate/coco_labels.txt:/labelmap.txt

This is my setup in docker-compose…

nope, I even tried:- C:/compose/config.yml:/config/config.yml:ro

compose folder

It keeps giving me an error after I do a: docker-compose up -d
Error: Error response from daemon: Post "http://ipc/filesharing/share": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

And then in docker I see this error:
Error parsing config: [Errno 2] No such file or directory: '/config/config.yml'

Ok fixed the issue, apparently I had to login to my docker first…

My config is no longer working with the latest beta release, anyone has a sample config.yml that works with the later beta release?

Now I get: [Errno 18] Invalid cross-device link: '/media/frigate/clips/frigate.db' -> '/media/frigate/frigate.db'

Edit: it started working afterwards so all is back to normal now.

Question about Nvidia version…

It’s up and running, but I don’t see any big difference between frigate-amd64 and frigate-nvidia.
In config.yml I have this for ffmpeg:

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - cuda
    - -c:v
    - h264_cuvid

Am I missing something?

what is your config?
When I pass

coral:
type: edgetpu
device: usb

I also tried

coral:
type: edgetpu
device: usb:2

I still see the following in my logs.
This is on a DS918+ with DSM 7

2021-09-06T20:56:18.317711259Z [2021-09-06 16:56:18] frigate.edgetpu ERROR : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.

This is what the Synology shows with lsusb

without Coral plugged in

|__usb1 1d6b:0002:0404 09 2.00 480MBit/s 0mA 1IF (Linux 4.4.180+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
|__1-4 f400:f400:0100 00 2.00 480MBit/s 200mA 1IF (Synology DiskStation 7F0099BA22E5F125)
|__usb2 1d6b:0003:0404 09 3.00 5000MBit/s 0mA 1IF (Linux 4.4.180+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub

with Coral plugged in

|__usb1 1d6b:0002:0404 09 2.00 480MBit/s 0mA 1IF (Linux 4.4.180+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
|__1-4 f400:f400:0100 00 2.00 480MBit/s 200mA 1IF (Synology DiskStation 7F0099BA22E5F125)
|__usb2 1d6b:0003:0404 09 3.00 5000MBit/s 0mA 1IF (Linux 4.4.180+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
|__2-1 1a6e:089a:0100 00 3.10 5000MBit/s 896mA 1IF ( ffffffd1ffffffb2ffffffdbffffffad)

lsusb doesn’t show anything from within the frigate container

What’s the point of having BlueIris at this point? :slight_smile:

Depends on your use case of course, but it (blue iris) is much more feature rich as a NVR.

Not sure if this was asked before but my camera keeps detecting my parked cars, is there a way to teach frigate what my cars look like and not trigger? I guess it keeps triggering because of the Sun light…

Try to adjust:

max_disappeared: 25

I use Synology VMM (not docker) to run HA, since I experienced much less problems than with docker.
For the coral to work inside VMM you have to modify the configuration of the VM running HA like this:

I haven’t messed with the Synology VM.

Is there a writeup on the install?