Local realtime person detection for RTSP cameras

I am running Hypriot.

1 Like

Have you run benchmark.py on the Odroid-H2? I am curious what the inference speeds are.

Will this image work with a Raspberry 3?

I havenā€™t tried, but I think so.

Hi, Iā€™m on RPI4 and when I run:

sudo docker run --rm --privileged -v /dev/bus/usb:/dev/bus/usb -v /home/pi/frigate/config:/config:ro -p 5000:5000 -e RTSP_PASSWORD='admin' blakeblackshear/frigate:0.2.2-beta

Iā€™ve got this error:

Traceback (most recent call last):
  File "detect_objects.py", line 99, in <module>
    main()
  File "detect_objects.py", line 53, in main
On connect called
    cameras[name] = Camera(name, config, prepped_frame_queue, client, MQTT_TOPIC_PREFIX)
  File "/opt/frigate/frigate/video.py", line 122, in __init__
    self.rtsp_url = get_rtsp_url(self.config['rtsp'])
  File "/opt/frigate/frigate/video.py", line 63, in get_rtsp_url
    rtsp_config['path'])
KeyError: 'path'

Any help would be appreciatedā€¦
Thanks

I was able to get hardware acceleration working on the RPi4 for decoding the h264 stream. Unfortunately, I discovered that there is no acceleration available on the ARM architecture for converting from yuv420p to rgb24 in ffmpeg. Because of this, the CPU usage isnā€™t much better with it enabled. :frowning:

Thatā€™s a shame. Iā€™m also running on an rpi 4 and got excited about your previous comment about hwaccel. Maybe I need to buy a usb3 pci card for my server. Appreciate the multi-arch container though! Was taking forever to build on my pi.

I finally got time to get on this great piece of software. Thank you @blakeblackshear for developing this!

Did someone get this running using Android IPWebcam as a rtsp source?

Iā€™m running the odroid branch on an Odroid XU4 with the following config:

web_port: 5000

mqtt:
  host: mosquitto
  topic_prefix: frigate
  user: frigate
  password: frigate

cameras:
  ipwebcamdoor:
    rtsp:
      user: ipwebcamdoor
      host: <host>
      port: 8080
      password: password
      path: /h264_ulaw.sdp
    regions:
      - size: 720
        x_offset: 0
        y_offset: 0
        min_person_area: 5000
        threshold: 0.5

And I get the following error:

frigate    | On connect called
frigate    | [h264_v4l2m2m @ 0x8095b0] capture: driver decode error
frigate    | INFO: Initialized TensorFlow Lite runtime.
frigate    | Creating a new capture process...
frigate    | Starting a new capture process...
frigate    | Capture process for ipwebcamdoor: 26
frigate    |  * Serving Flask app "detect_objects" (lazy loading)
frigate    |  * Environment: production
frigate    |    WARNING: This is a development server. Do not use it in a production deployment.
frigate    |    Use a production WSGI server instead.
frigate    |  * Debug mode: off
frigate    |  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
frigate    | Opening the RTSP Url...
frigate    | [h264_v4l2m2m @ 0x807990] capture: driver decode error

I did get it to work, I had VLC Player open on the same stream. Once I closed it frigate worked without problems.

Thanks a lot for the great job, it take me a while but finally works.
The only problem is that after some time the video is like the image below and some time it recognize my dog as a person.
Iā€™m on Rpi 4.

Ok lowered the resolution do the job. Now it works like a charm.

thanks

is there a way to run this without docker? I donā€™t run docker or hass io

Technically the Dockerfile contains all the things you would need to install. Honestly, you should just run docker even if itā€™s just for this. There are some heavy dependencies and upgrades are going to be a complete nightmare. Using docker will be infinitely easier than trying to reverse engineer and maintain your install manually.

2 Likes

Well after ordering my Coral back on the 4th of April!!! I have finally just got this setup, thanks for your hard work.

Just need to finish the automationā€™s off.
Looking forward to see if you can get it to recognise previously seen people at some point in the future.

whatā€™s up with your camera? Very hard to tell whatā€™s going on in that scene.

Was the framerate too highā€¦for rpi 4 1080 itā€™s too much.

Could someone please share their frigate config.yml file for Reolink cameras? The feed I use is visible in HomeAssistant and VLC but i cant for the life of me get the Frigate generated camera to work.

Also, user and pass needed in the config file if its all contained in the streaming URL?

I dont have those cameras. I have unifi but here is an exampleā€¦dont use the full url with un/pw included. break it apart.

HypriotOS/armv7: pirate@pirate in ~
$ cat /opt/frigate/config/config.yml 
web_port: 5000

mqtt:
  host: 10.1.99.113
  topic_prefix: frigate

cameras:
  unifi:
    rtsp:
      host: 10.2.2.2
      port: 554
      path: /live
      user: this
      password: could
    regions:
      - size: 350
        x_offset: 0
        y_offset: 100
        min_person_area: 5000
        threshold: 0.6
      - size: 300
        x_offset: 350
        y_offset: 130
        min_person_area: 5000
        threshold: 0.6
#  unifi2:
##    rtsp:
#      host: 10.2.2.2
#      port: 554
#      path: /live
#      user: this
#      password: could
#    regions:
#      - size: 400
#        x_offset: 0
#        y_offset: 100
##        min_person_area: 5000
#        threshold: 0.6
#      - size: 300
#        x_offset: 400
#        y_offset: 200
#        min_person_area: 5000
#        threshold: 0.6      
  unifi3:
    rtsp:
      host: 10.1.1.2 ##IP ONLY
      port: <YOUR_PORT_NUMBER>
      path: /LIVE ###WHATEVER IS AFTER THE '/'  RTSP://TEST:[email protected]:554/<THIS PART>
      user: ubnt ##USER NAME FROM ORIGINAL URL
      password: ##PW FROM ORIGINAL URL
    regions:
      - size: 330
        x_offset: 0
        y_offset: 75
        min_person_area: 5000
        threshold: 0.6
      - size: 330
        x_offset: 330
        y_offset: 75
        min_person_area: 5000
        threshold: 0.6
#      - size: 660
#        x_offset: 1280
#        y_offset: 400
#        min_person_area: 5000
#        threshold: 0.6
1 Like

How do I limit my alerts to a certain person recognition confidence factor (ie 90%+)? I have been using frigate for a few months now (currently running the latest version) and i often get alerts for low % probability persons. For example headlights will trigger my car parked on the street as being recognized 60% person or my mailbox will send a flood of 40% person alerts. Looking to limit alerts to > 90% confidence factor. Thanks!

Itā€™s in your config.yml. Last line in region I believe. ā€˜thresholdā€™