Small tweaks and fixes (#17614)

* add ability to use * and ? in recognized plate input

* fix check for active polygon index

* fix broken link

* lpr docs tweaks
This commit is contained in:
Josh Hawkins 2025-04-09 07:26:06 -05:00 committed by GitHub
parent 269cadff15
commit cab701f054
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 14 deletions

View File

@ -92,11 +92,11 @@ Fine-tune the LPR feature using these optional parameters:
### Image Enhancement
- **`enhancement`**: A value between **0 and 10** that adjusts the level of image enhancement applied to captured license plates before they are processed for recognition. This preprocessing step can sometimes improve accuracy but may also have the opposite effect.
- **`enhancement`**: A value between 0 and 10 that adjusts the level of image enhancement applied to captured license plates before they are processed for recognition. This preprocessing step can sometimes improve accuracy but may also have the opposite effect.
- **Default:** `0` (no enhancement)
- Higher values increase contrast, sharpen details, and reduce noise, but excessive enhancement can blur or distort characters, actually making them much harder for Frigate to recognize.
- This setting is best adjusted **at the camera level** if running LPR on multiple cameras.
- If Frigate is already recognizing plates correctly, leave this setting at the default of `0`. However, if you're experiencing frequent character issues or incomplete plates and you can already easily read the plates yourself, try increasing the value gradually, starting at **5** and adjusting as needed. To preview how different enhancement levels affect your plates, use the `debug_save_plates` configuration option (see below).
- This setting is best adjusted at the camera level if running LPR on multiple cameras.
- If Frigate is already recognizing plates correctly, leave this setting at the default of `0`. However, if you're experiencing frequent character issues or incomplete plates and you can already easily read the plates yourself, try increasing the value gradually, starting at 5 and adjusting as needed. You should see how different enhancement levels affect your plates. Use the `debug_save_plates` configuration option (see below).
### Debugging
@ -176,6 +176,7 @@ lpr:
cameras:
dedicated_lpr_camera:
type: "lpr" # required to use dedicated LPR camera mode
ffmpeg: ... # add your streams
detect:
enabled: True
fps: 5 # increase to 10 if vehicles move quickly across your frame. Higher than 10 is unnecessary and is not recommended.
@ -232,7 +233,7 @@ cameras:
lpr:
enabled: True
enhancement: 3 # optional, enhance the image before trying to recognize characters
ffmpeg: ...
ffmpeg: ... # add your streams
detect:
enabled: False # disable Frigate's standard object detection pipeline
fps: 5 # increase if necessary, though high values may slow down Frigate's enrichments pipeline and use considerable CPU
@ -332,7 +333,7 @@ Use `match_distance` to allow small character mismatches. Alternatively, define
- If you are using a Frigate+ model or a model that detects license plates, watch the debug view (Settings --> Debug) to ensure that `license_plate` is being detected with a `car`.
- Watch the debug view to see plates recognized in real-time. For non-dedicated LPR cameras, the `car` label will change to the recognized plate when LPR is enabled and working.
- Adjust `detection_threshold` and `recognition_threshold` settings per the suggestions [above](#advanced-configuration).
- Enable `debug_save_plates` to save images of detected text on plates to the clips directory (`/media/frigate/clips/lpr`).
- Enable `debug_save_plates` to save images of detected text on plates to the clips directory (`/media/frigate/clips/lpr`). Ensure these images are readable and the text is clear.
- Enable debug logs for LPR by adding `frigate.data_processing.common.license_plate: debug` to your `logger` configuration. These logs are _very_ verbose, so only enable this when necessary.
```yaml

View File

@ -28,7 +28,7 @@ For the Dahua/Loryta 5442 camera, I use the following settings:
- Encode Mode: H.264
- Resolution: 2688\*1520
- Frame Rate(FPS): 15
- I Frame Interval: 30 (15 can also be used to prioritize streaming performance - see the [camera settings recommendations](../configuration/live) for more info)
- I Frame Interval: 30 (15 can also be used to prioritize streaming performance - see the [camera settings recommendations](/configuration/live#camera_settings_recommendations) for more info)
**Sub Stream (Detection)**

View File

@ -919,10 +919,21 @@ export function RecognizedLicensePlatesFilterContent({
return null;
}
const filteredRecognizedLicensePlates =
allRecognizedLicensePlates?.filter((id) =>
id.toLowerCase().includes(inputValue.toLowerCase()),
) || [];
const filterItems = (value: string, search: string) => {
if (!search) return 1; // Show all items if no search input
if (search.includes("*") || search.includes("?")) {
const escapedSearch = search
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
.replace(/\*/g, ".*") // * matches any characters
.replace(/\?/g, "."); // ? matches any single character
const regex = new RegExp(`^${escapedSearch}$`, "i");
return regex.test(value) ? 1 : -1; // 1 for match, -1 for no match
}
// fallback to substring matching if no wildcards
return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1;
};
return (
<div className="overflow-x-hidden">
@ -938,19 +949,22 @@ export function RecognizedLicensePlatesFilterContent({
</p>
) : (
<>
<Command className="border border-input bg-background">
<Command
className="border border-input bg-background"
filter={filterItems}
>
<CommandInput
placeholder={t("recognizedLicensePlates.placeholder")}
value={inputValue}
onValueChange={setInputValue}
/>
<CommandList className="max-h-[200px] overflow-auto">
{filteredRecognizedLicensePlates.length === 0 && inputValue && (
{allRecognizedLicensePlates.length > 0 && inputValue && (
<CommandEmpty>
{t("recognizedLicensePlates.noLicensePlatesFound")}
</CommandEmpty>
)}
{filteredRecognizedLicensePlates.map((plate) => (
{allRecognizedLicensePlates.map((plate) => (
<CommandItem
key={plate}
value={plate}

View File

@ -677,7 +677,7 @@ export default function ZoneEditPane({
{form.watch("speedEstimation") &&
polygons &&
activePolygonIndex &&
activePolygonIndex !== undefined &&
polygons[activePolygonIndex].points.length === 4 && (
<>
<FormField