Skip to content

Commit

Permalink
Watched plates (#32)
Browse files Browse the repository at this point in the history
* clean up save image

* fix frigate_url error

* fix builds

* Temp reduce debugging.

* Enhancements to save_image

Save full snapshot
Get box co-ordinates from Events API call
Move save_image routine to end of process to avoid delays updating mqtt whilst image processed.

* Updated for comments

* Update test.py

* Test for status code on requests.get

* watched_plates

* watched_plates

* watched_plates

* watched_plates

* watched_plates

* check if first event before skipping due to top_score

* take fuzzy_score into account when reviewing min_score

* take fuzzy_score into account when reviewing min_score

* watched plates debug best match and score

* update frigate+ best plate score check

* Additional duplication debugging

* update frigate+ best plate score check

* update frigate+ best plate score check

* update frigate+ best plate score check

* update frigate+ best plate score check

* update frigate+ best plate score check

* update frigate+ best plate score check

* update frigate+ best plate score check

* update frigate+ best plate score check

* watched plates debug best match and score

* Update index.py

* Update index.py

* Update index.py

* only save image with not plate at end of event

* only save image with not plate at end of event

* Update index.py

* add max_attempts to limit AI calls when Frigate_plus is true

* add max_attempts to limit AI calls when Frigate_plus is true

* starting to tidy up

* Update DATETIME_FORMAT to avoid saving multiple versions of snapshot

* update to match plates based on lower() in CP.AI

* Tidy up watched_plates for PR

* Test updates

* Test updates

* fix tests

---------

Co-authored-by: Leonardo Merza <[email protected]>
  • Loading branch information
gadget-man and ljmerza authored Feb 10, 2024
1 parent 1782e46 commit 8086250
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 142 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
__pycache__
venv
myenv

config/*
plates/*
Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ 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
max_attempts: 20 # Optional: if set, will limit the number of snapshots sent for recognition for any particular event.
```

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:
Expand Down Expand Up @@ -106,10 +107,6 @@ logger_level: DEBUG

Logs will be in `/config/frigate_plate_recognizer.log`

### Synology Diskstation

Anyone trying this on Synology Diskstation, you need to set the volumes to point to `/usr/src/app/config` not just `/config`

### Save Snapshot Images to Path

If you want frigate-plate-recognizer to automatically save snapshots of recognized plates, add the following to your config.yml:
Expand All @@ -136,3 +133,18 @@ services:
- TZ=America/New_York
```

### Monitor Watched Plates

If you want frigate-plate-recognizer to check recognized plates against a list of watched plates for close matches (including fuzzy recognition), add the following to your config.yml:

```yml
frigate:
watched_plates: #list of plates to watch.
- ABC123
- DEF456
fuzzy_match: 0.8 # default is test against plate-recognizer / CP.AI 'candidates' only, but can specify a min score for fuzzy matching if no candidates match watched plates from 0 - 1 for example 0.8
```

If a watched plate is found in the list of candidates plates returned by plate-recognizer / CP.AI, the response will be updated to use that plate and it's score. The original plate will be added to the MQTT response as an additional `original_plate` field.

If no candidates match and fuzzy_match is enabled with a value, the recognized plate is compared against each of the watched_plates using fuzzy matching. If a plate is found with a score > fuzzy_match, the response will be updated with that plate. The original plate and the associated fuzzy_score will be added to the MQTT response as additional fields `original_plate` and `fuzzy_score`.
Loading

0 comments on commit 8086250

Please sign in to comment.