/frigate_plate_recognizer

Identify license plates via Plate Recognizer and add them as sublabels to Frigate

Primary LanguagePython

Frigate Plate Recognizer

Identify license plates via Plate Recognizer or CodeProject.AI and add them as sublabels to blakeblackshear/frigate

Setup

Create a config.yml file in your docker volume with the following contents:

frigate:
  frigate_url: http://127.0.0.1:5000
  mqtt_server: 127.0.0.1
  mqtt_auth: false
  mqtt_username: username
  mqtt_password: password
  main_topic: frigate
  return_topic: plate_recognizer
  frigate_plus: false
  camera:
    - driveway_camera
  objects:
    - car
  min_score: .8
plate_recognizer:
  token: xxxxxxxxxx
  regions: 
    - us-ca
logger_level: INFO

Update your frigate url, mqtt server settings. If you are using mqtt authentication, update the username and password. Update the camera name(s) to match the camera name in your frigate config. Add your Plate Recognizer API key and region(s).

You'll need to make an account (free) here and get an API key. You get up to 2,500 lookups per month for free. You will also need to enable car object detection for the cameras you want to use this with. See here on how to locally host Plate Recognizer.

You can specify a custom url for the plate_recognizer api by adding api_url to your config:

plate_recognizer:
  api_url: http://HOST-IP:8080/v1/plate-reader
  token: xxxxxxxxxx
  regions: 
    - us-ca

You can also filter by zones and/or cameras. If you want to filter by zones, add zones to your config:

frigate:
  # ...
  zones:
    - front_door
    - back_door

If no objects are speficied in the Frigate options, it will default to [motorcycle, car, bus].

If you have a custom model with Frigate+ then it's able to detect license plates via an event's attributes, you can set frigate_plus to true in your config to activate this feature:

frigate:
  # ... 
  frigate_plus: true
  license_plate_min_score: 0 # default is show all but can speficify a min score from 0 - 1 for example 0.8

If you're using CodeProject.AI, you'll need to comment out plate_recognizer in your config. Then add and update "api_url" with your CodeProject.AI Service API URL. Your config should look like:

#plate_recognizer:
#  token: xxxxxxxxxx
#  regions: 
#    - us-ca
code_project:
  api_url: http://127.0.0.1:32168/v1/image/alpr

Running

docker run -v /path/to/config:/config -e TZ=America/New_York -it --rm --name frigate_plate_recognizer lmerza/frigate_plate_recognizer:latest

or using docker-compose:

services:
  frigate_plate_recognizer:
    image: lmerza/frigate_plate_recognizer:latest
    container_name: frigate_plate_recognizer
    volumes:
      - /path/to/config:/config
    restart: unless-stopped
    environment:
      - TZ=America/New_York

https://hub.docker.com/r/lmerza/frigate_plate_recognizer

Debugging

set logger_level in your config to DEBUG to see more logging information:

logger_level: DEBUG

Logs will be in /config/frigate_plate_recognizer.log