mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 16:42:18 +03:00
Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4f3fbff69 | ||
|
|
0f636a17f3 | ||
|
|
6cd33fcde1 | ||
|
|
846a38b056 | ||
|
|
7ed7ed56cf | ||
|
|
860772f9f4 | ||
|
|
66f5511a51 | ||
|
|
b9bf0ff0a0 | ||
|
|
5be587787d | ||
|
|
5e61fad934 | ||
|
|
b259c3fb1d | ||
|
|
23c42c8ed8 | ||
|
|
581689a29b | ||
|
|
85d11bf66f | ||
|
|
bbaed4bf85 | ||
|
|
7d89efd05d | ||
|
|
360ab357b3 | ||
|
|
bdea5f4061 | ||
|
|
87dcdf35cb | ||
|
|
ac484187b8 | ||
|
|
2cc2cdcaec | ||
|
|
6e1c141c5f | ||
|
|
96c8a30649 | ||
|
|
6d0e1a2555 | ||
|
|
d4c2b46bb0 | ||
|
|
08d4b895d8 | ||
|
|
27a3d4754c | ||
|
|
36db13b104 | ||
|
|
7e08f7b821 | ||
|
|
49e0ad93c2 | ||
|
|
12dd242151 | ||
|
|
a573ea49bf | ||
|
|
9f918362e9 |
@@ -82,6 +82,7 @@ frontdoor
|
||||
fstype
|
||||
fullchain
|
||||
fullscreen
|
||||
gatekeep
|
||||
genai
|
||||
generativeai
|
||||
genpts
|
||||
|
||||
@@ -10,8 +10,11 @@ body:
|
||||
|
||||
Before submitting, read the [beta documentation][docs].
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[docs]: https://docs-dev.frigate.video/
|
||||
[discussions]: https://github.com/blakeblackshear/frigate/discussions
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -8,9 +8,12 @@ body:
|
||||
|
||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -8,9 +8,12 @@ body:
|
||||
|
||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -8,9 +8,12 @@ body:
|
||||
|
||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -8,9 +8,12 @@ body:
|
||||
|
||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -8,9 +8,12 @@ body:
|
||||
|
||||
Before submitting your support request, please [search the discussions][discussions], read the [official Frigate documentation][docs], and read the [Frigate FAQ][faq] pinned at the Discussion page to see if your question has already been answered by the community.
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -10,9 +10,12 @@ body:
|
||||
|
||||
**If you are looking for support, start a new discussion and use a support category.**
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
@@ -12,11 +12,14 @@ body:
|
||||
|
||||
**If you are unsure if your issue is actually a bug or not, please submit a support request first.**
|
||||
|
||||
By posting here you agree to follow our [AI policy][ai-policy]. Posts that appear to be written by an AI on your behalf may be closed without a response.
|
||||
|
||||
[discussions]: https://www.github.com/blakeblackshear/frigate/discussions
|
||||
[prs]: https://www.github.com/blakeblackshear/frigate/pulls
|
||||
[docs]: https://docs.frigate.video
|
||||
[faq]: https://github.com/blakeblackshear/frigate/discussions/12724
|
||||
[ai]: https://docs.frigate.video
|
||||
[ai-policy]: https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Checklist
|
||||
|
||||
@@ -7,6 +7,13 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
By posting here you agree to follow our AI policy:
|
||||
https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md
|
||||
|
||||
Requests that appear to be written by an AI on your behalf may be closed without a response.
|
||||
-->
|
||||
|
||||
**Describe what you are trying to accomplish and why in non technical terms**
|
||||
I want to be able to ... so that I can ...
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_Please read the [contributing guidelines](https://github.com/blakeblackshear/frigate/blob/dev/CONTRIBUTING.md) before submitting a PR._
|
||||
_Please read the [contributing guidelines](https://github.com/blakeblackshear/frigate/blob/dev/CONTRIBUTING.md) and the [AI policy](https://github.com/blakeblackshear/frigate/blob/dev/AI_POLICY.md) before submitting a PR. Every PR must be read and submitted by a person, and PRs that appear to be unreviewed AI output will be closed without review._
|
||||
|
||||
## Proposed change
|
||||
|
||||
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
# Frigate AI Policy
|
||||
|
||||
## TL;DR
|
||||
|
||||
- **Use AI tools if they help you.** We do too. This is about what you post, not which tools you use to write it.
|
||||
- **A person has to read it and send it.** Don't wire a bot or an agent up to post on your behalf.
|
||||
- **Write your posts yourself.** Your own words, the template filled in, and you answering maintainers rather than your assistant.
|
||||
- **Don't paste an AI's guess at the cause as though it were a diagnosis.** Tell us what you actually observed.
|
||||
- **Read your code before you submit it.** Disclose that AI was used, and be ready to explain every line.
|
||||
- **If we misjudge something you wrote, just say so.** We'll take you at your word.
|
||||
|
||||
The rest of this document explains each of these, and why.
|
||||
|
||||
## Scope
|
||||
|
||||
AI tools are a reality of modern development and we're not opposed to their use. You are responsible for anything you submit, however it was produced, and we are responsible for anything we merge and release. We hold a high bar for both.
|
||||
|
||||
This policy applies everywhere this project is discussed: issues, discussions, pull requests, code reviews, and commit comments.
|
||||
|
||||
## Why this exists
|
||||
|
||||
Frigate is built and supported by a small group of maintainers and a community of volunteers who read every post and review every pull request. Nobody here is paid to do it, and time spent reading a post is time not spent fixing bugs or building features.
|
||||
|
||||
We're not opposed to AI tools. We use them too. But content generated by an AI and submitted without review costs a real person real time, and usually gives them less to work with than a few honest sentences would have. That is the problem this policy addresses.
|
||||
|
||||
## A person has to be in the loop
|
||||
|
||||
Every issue, discussion, comment, and pull request here must be read and submitted by a person. Using an AI tool to help you write is fine. Wiring one up to post on your behalf is not.
|
||||
|
||||
Specifically, do not:
|
||||
|
||||
- Connect a bot or agent to GitHub that opens issues, discussions, or pull requests without you reading them first
|
||||
- Post output from a tool you have not read
|
||||
- Use tooling to file bulk or drive-by contributions across the repository
|
||||
|
||||
We will close anything we believe was posted without a person reading it, and we may mark it as spam. Posts that skip the templates are the most common sign of this.
|
||||
|
||||
## Issues, discussions, and comments
|
||||
|
||||
We do not mind if you use AI tools to help you write. Do not have tools post unreviewed content on your behalf. We may hide any comment we believe to be unreviewed AI output.
|
||||
|
||||
Keep posts to what is needed to communicate your point. A long, confidently written, AI-padded post is harder to help with than a short direct one, not easier, and it is usually obvious.
|
||||
|
||||
**Describe your actual problem in your own words.** Tell us what you did, what you expected, and what actually happened. That is the information we need, and only you have it.
|
||||
|
||||
**Do not paste an AI's guess at the cause as though it were a diagnosis.** It is frequently wrong in ways that send everyone down the wrong path, and it buries the details that would have led to the real answer. We would rather see what you observed than what a model inferred.
|
||||
|
||||
**Fill in the template completely.** The templates ask for logs, config, version, and hardware because those are the things needed to help you. An AI cannot supply them for you, and a post missing them cannot be acted on.
|
||||
|
||||
**Answer maintainers yourself.** If we ask you a question, we are asking _you_, not your AI assistant. These are the spaces where we build trust and understanding with the community, and that only works if we're talking to each other. Using AI to fix your grammar or clarity is fine, but the substance has to be yours.
|
||||
|
||||
This applies to pull request descriptions and review replies as much as it does to bug reports and discussions.
|
||||
|
||||
### Quoting AI output
|
||||
|
||||
If you want to include something an AI told you, it must be:
|
||||
|
||||
- In a quote block, using `>`
|
||||
- Disclosed as AI output, saying which tool it came from
|
||||
- Accompanied by your own comment explaining why you think it is relevant
|
||||
|
||||
Keep the excerpt short. Do not paste long transcripts.
|
||||
|
||||
### Non-native English speakers
|
||||
|
||||
AI is genuinely useful for participating in a project that operates in English, and we would rather hear from you through a translation tool than not hear from you at all. Using AI to improve the grammar or clarity of something you wrote yourself is fine.
|
||||
|
||||
If you are translating your posts, make sure the translation says what you meant. Including your original text in a `<details>` block helps us verify the translation if something reads oddly, and keeps the thread readable.
|
||||
|
||||
## Code contributions
|
||||
|
||||
We need to understand your relationship with the code you're submitting. The more AI was involved, the more important it is that you've genuinely reviewed, tested, and understood what it produced.
|
||||
|
||||
Because of the long-term maintenance burden every merged change creates, we require a human in the loop who understands the work the AI produced. Pull requests that appear to be unreviewed AI output will be closed without review.
|
||||
|
||||
### Requirements when AI is used
|
||||
|
||||
If AI is used to generate any portion of the code, contributors must adhere to the following requirements:
|
||||
|
||||
1. **Explicitly disclose the manner in which AI was employed.** The PR template asks for this. Be honest, this won't automatically disqualify your PR. We'd rather have an honest disclosure than find out later. Trust matters more than method.
|
||||
2. **Perform a comprehensive manual review prior to submitting the pull request.** Don't submit code you haven't read carefully and tested locally.
|
||||
3. **Be prepared to explain every line of code you submitted when asked about it by a maintainer.** If you can't explain why something works the way it does, you're not ready to submit it.
|
||||
4. **Check for an existing pull request addressing the same change.** If one exists, comment there and work with its author instead of opening a duplicate.
|
||||
5. **It is strictly prohibited to use AI to write your posts for you** (bug reports, feature requests, pull request descriptions, GitHub discussions, responding to humans, etc.). We need to hear from _you_, not your AI assistant. These are the spaces where we build trust and understanding with contributors, and that only works if we're talking to each other.
|
||||
|
||||
### Established contributors
|
||||
|
||||
Contributors with a long history of thoughtful, quality contributions to Frigate have earned trust through that track record. The level of scrutiny we apply to AI usage naturally reflects that trust. This isn't a formal exemption, it's just how trust works. If you've been around, we know how you think and how you work. If you're new, we're still getting to know you, and clear disclosure helps build that relationship.
|
||||
|
||||
### What this means in practice
|
||||
|
||||
We're not trying to gatekeep how you write code. Use whatever tools make you productive. But there's a difference between using AI as a tool to implement something you understand and handing a feature request to an AI and submitting whatever comes back. The former is fine. The latter creates maintenance risk for the project.
|
||||
|
||||
Some honest context: when we review a PR, we're not just evaluating whether the code works today. We're evaluating whether we can maintain it, debug it, and extend it long-term, often without the original author's involvement. Code that the author doesn't deeply understand is code that nobody understands, and that's a liability.
|
||||
|
||||
One more thing worth saying directly: most maintainers already have access to the same AI tools you do. A PR that's entirely AI-generated, where the author can't explain the design, debug issues independently, or engage substantively in design discussions, doesn't offer something we couldn't produce ourselves. What makes a contribution genuinely valuable is the human judgment and domain understanding behind it, as well as the engagement during review that shapes it into something we can confidently take on long-term.
|
||||
|
||||
## Our use of AI
|
||||
|
||||
The Frigate documentation site has an "Ask AI" search that answers questions from the docs, and we may use AI tooling to help with triage and project management. Like any automated tooling, it is not always right.
|
||||
|
||||
If an AI tool leaves a comment on your contribution, treat it the way you would any other comment. If you think it is wrong, say so, and a brief explanation is enough. Maintainers always have the final say.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Contributions and posts that do not follow this policy will be closed. Depending on the situation, maintainers may also:
|
||||
|
||||
- Hide or delete comments that appear to be unreviewed AI output
|
||||
- Mark automated content as spam
|
||||
- Close an issue, discussion, or pull request without further review
|
||||
- Lock a conversation
|
||||
- Temporarily or permanently block an account from participating in the project
|
||||
|
||||
Repeated violations may result in being blocked from contributing to Frigate.
|
||||
|
||||
### When we get it wrong
|
||||
|
||||
There is no reliable way to detect this, and we're not going to pretend otherwise. Whether something reads as unreviewed AI output is a judgment call, usually made quickly, by a volunteer with limited time and no way to know for certain. These calls are subjective and we won't always get them right.
|
||||
|
||||
If it happens to you, just say so. A short reply telling us you wrote it yourself is enough, and we'll take you at your word and pick the conversation back up. We would much rather occasionally reopen something we misjudged than treat everyone who posts here as a suspect.
|
||||
|
||||
We'd ask for some understanding in return. These calls get made quickly because the volume is real, and time spent second-guessing them is time not spent helping the person in the next thread.
|
||||
|
||||
## Attribution
|
||||
|
||||
Portions of this policy are adapted from the [Open Home Foundation AI Policy](https://developers.home-assistant.io/docs/ai_policy/).
|
||||
+9
-19
@@ -2,6 +2,8 @@
|
||||
|
||||
Thank you for your interest in contributing to Frigate. This document covers the expectations and guidelines for contributions. Please read it before submitting a pull request.
|
||||
|
||||
All participation in this project, including pull requests, issues, and discussions, is covered by our [AI policy](AI_POLICY.md).
|
||||
|
||||
## Before you start
|
||||
|
||||
### Bugfixes
|
||||
@@ -21,28 +23,16 @@ Before writing code for a new feature:
|
||||
|
||||
## AI usage policy
|
||||
|
||||
AI tools are a reality of modern development and we're not opposed to their use. But we need to understand your relationship with the code you're submitting. The more AI was involved, the more important it is that you've genuinely reviewed, tested, and understood what it produced.
|
||||
AI tools are a reality of modern development and we're not opposed to their use. But we need to understand your relationship with the code you're submitting, and we need to hear from you rather than from your AI assistant.
|
||||
|
||||
### Requirements when AI is used
|
||||
**Read the [AI policy](AI_POLICY.md) before you open a pull request.** It is short, and it applies to everything you post here. The parts that most often catch people out:
|
||||
|
||||
If AI is used to generate any portion of the code, contributors must adhere to the following requirements:
|
||||
- A person has to be in the loop. Don't wire a bot or agent up to open pull requests, issues, or discussions on your behalf.
|
||||
- Disclose how AI was used. The PR template asks for this. Be honest, it won't automatically disqualify your PR.
|
||||
- Review and test everything you submit, and be prepared to explain every line when asked.
|
||||
- Don't use AI to write your PR description or your replies to maintainers.
|
||||
|
||||
1. **Explicitly disclose the manner in which AI was employed.** The PR template asks for this. Be honest — this won't automatically disqualify your PR. We'd rather have an honest disclosure than find out later. Trust matters more than method.
|
||||
2. **Perform a comprehensive manual review prior to submitting the pull request.** Don't submit code you haven't read carefully and tested locally.
|
||||
3. **Be prepared to explain every line of code they submitted when asked about it by a maintainer.** If you can't explain why something works the way it does, you're not ready to submit it.
|
||||
4. **It is strictly prohibited to use AI to write your posts for you** (bug reports, feature requests, pull request descriptions, GitHub discussions, responding to humans, etc.). We need to hear from _you_, not your AI assistant. These are the spaces where we build trust and understanding with contributors, and that only works if we're talking to each other.
|
||||
|
||||
### Established contributors
|
||||
|
||||
Contributors with a long history of thoughtful, quality contributions to Frigate have earned trust through that track record. The level of scrutiny we apply to AI usage naturally reflects that trust. This isn't a formal exemption — it's just how trust works. If you've been around, we know how you think and how you work. If you're new, we're still getting to know you, and clear disclosure helps build that relationship.
|
||||
|
||||
### What this means in practice
|
||||
|
||||
We're not trying to gatekeep how you write code. Use whatever tools make you productive. But there's a difference between using AI as a tool to implement something you understand and handing a feature request to an AI and submitting whatever comes back. The former is fine. The latter creates maintenance risk for the project.
|
||||
|
||||
Some honest context: when we review a PR, we're not just evaluating whether the code works today. We're evaluating whether we can maintain it, debug it, and extend it long-term — often without the original author's involvement. Code that the author doesn't deeply understand is code that nobody understands, and that's a liability.
|
||||
|
||||
One more thing worth saying directly: most maintainers already have access to the same AI tools you do. A PR that's entirely AI-generated — where the author can't explain the design, debug issues independently, or engage substantively in design discussions — doesn't offer something we couldn't produce ourselves. What makes a contribution genuinely valuable is the human judgment and domain understanding behind it, as well as the engagement during review that shapes it into something we can confidently take on long-term.
|
||||
Pull requests that appear to be unreviewed AI output will be closed without review.
|
||||
|
||||
## Pull request guidelines
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
default_target: local
|
||||
|
||||
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1)
|
||||
VERSION = 0.18.0
|
||||
VERSION = 0.19.0
|
||||
IMAGE_REPO ?= ghcr.io/blakeblackshear/frigate
|
||||
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
BOARDS= #Initialized empty
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
"""Convert the default SSDLite MobileNet v2 model to OpenVINO IR.
|
||||
|
||||
Replaces the legacy openvino-dev Model Optimizer conversion. The TensorFlow
|
||||
frontend converts the Object Detection API frozen graph natively; the four TF
|
||||
outputs are then repacked into the single [1, 1, 100, 7] DetectionOutput-style
|
||||
tensor that Frigate's OpenVINO detector expects, and the input is flipped to
|
||||
BGR to match the legacy reverse_input_channels behavior.
|
||||
frontend translates the Object Detection API pre and post processors literally,
|
||||
producing per-class NonMaxSuppression, NonZero ops and map loops with data
|
||||
dependent shapes that the GPU plugin handles very badly. Both are cut out the
|
||||
way ssd_v2_support.json used to do it: the preprocessor is an identity at the
|
||||
native 300x300 input, and the postprocessor becomes a single fused
|
||||
DetectionOutput. The result is the [1, 1, 100, 7] tensor that Frigate's
|
||||
OpenVINO detector expects, with the input flipped to BGR to match the legacy
|
||||
reverse_input_channels behavior.
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
@@ -12,31 +16,91 @@ import openvino as ov
|
||||
from openvino import opset8 as ops
|
||||
from openvino.preprocess import PrePostProcessor
|
||||
|
||||
MODEL_DIR = "/models/ssdlite_mobilenet_v2_coco_2018_05_09"
|
||||
OUTPUT_PATH = "/models/ssdlite_mobilenet_v2.xml"
|
||||
INPUT_SHAPE = [1, 300, 300, 3]
|
||||
|
||||
# faster_rcnn_box_coder divides the deltas by pipeline.config's y/x/height/width
|
||||
# scales of 10/10/5/5, which DetectionOutput expresses as per-prior variances.
|
||||
BOX_VARIANCES = np.float32([0.1, 0.1, 0.2, 0.2])
|
||||
|
||||
model = ov.convert_model(
|
||||
"/models/ssdlite_mobilenet_v2_coco_2018_05_09/frozen_inference_graph.pb",
|
||||
input=[("image_tensor:0", [1, 300, 300, 3])],
|
||||
f"{MODEL_DIR}/frozen_inference_graph.pb",
|
||||
input=[("image_tensor:0", INPUT_SHAPE)],
|
||||
)
|
||||
|
||||
# rows of (image_id, class_id, score, xmin, ymin, xmax, ymax)
|
||||
boxes = model.output("detection_boxes:0").get_node().input_value(0)
|
||||
classes = model.output("detection_classes:0").get_node().input_value(0)
|
||||
scores = model.output("detection_scores:0").get_node().input_value(0)
|
||||
nodes = {op.get_friendly_name(): op for op in model.get_ordered_ops()}
|
||||
parameter = model.get_parameters()[0]
|
||||
|
||||
# (ymin,xmin,ymax,xmax) -> (xmin,ymin,xmax,ymax)
|
||||
boxes = ops.gather(boxes, [1, 0, 3, 2], 2)
|
||||
classes = ops.unsqueeze(classes, 2)
|
||||
scores = ops.unsqueeze(scores, 2)
|
||||
image_id = ops.multiply(scores, np.float32(0.0))
|
||||
preprocessor = nodes["Preprocessor/map/TensorArrayStack/TensorArrayGatherV3"]
|
||||
box_deltas = nodes["Postprocessor/Reshape_1"].output(0)
|
||||
class_scores = nodes["Postprocessor/convert_scores"].output(0)
|
||||
anchors_output = nodes["Postprocessor/Reshape"].output(0)
|
||||
|
||||
detections = ops.concat([image_id, classes, scores, boxes], 2)
|
||||
detections = ops.unsqueeze(detections, 1)
|
||||
# The anchors only depend on the static input shape, so fold them into a
|
||||
# constant and drop the generator subgraph with the rest of the postprocessor.
|
||||
probe = ov.Core().compile_model(
|
||||
ov.Model([anchors_output, preprocessor.output(0)], [parameter], "probe"), "CPU"
|
||||
)
|
||||
probe_input = np.random.default_rng(0).integers(0, 255, INPUT_SHAPE, dtype=np.uint8)
|
||||
anchors, resized = (out.copy() for out in probe([probe_input]).values())
|
||||
|
||||
assert np.allclose(resized, probe_input, atol=1e-3), (
|
||||
"preprocessor is not an identity at 300x300, it cannot be bypassed"
|
||||
)
|
||||
|
||||
image = ops.convert(parameter, "f32")
|
||||
|
||||
for consumer in list(preprocessor.output(0).get_target_inputs()):
|
||||
consumer.replace_source_output(image.output(0))
|
||||
|
||||
# (ymin, xmin, ymax, xmax) -> (xmin, ymin, xmax, ymax)
|
||||
priors = anchors[:, [1, 0, 3, 2]].astype(np.float32).reshape(-1)
|
||||
variances = np.tile(BOX_VARIANCES, len(anchors))
|
||||
proposals = ops.constant(np.stack([priors, variances])[np.newaxis])
|
||||
|
||||
# (ty, tx, th, tw) -> (dx, dy, dw, dh) for the CENTER_SIZE decode
|
||||
box_logits = ops.reshape(ops.gather(box_deltas, [1, 0, 3, 2], 1), [1, -1], False)
|
||||
class_preds = ops.reshape(class_scores, [1, -1], False)
|
||||
|
||||
detections = ops.detection_output(
|
||||
box_logits,
|
||||
class_preds,
|
||||
proposals,
|
||||
{
|
||||
"background_label_id": 0,
|
||||
"top_k": 100,
|
||||
"keep_top_k": [100],
|
||||
"nms_threshold": 0.6,
|
||||
"confidence_threshold": 0.3,
|
||||
"code_type": "caffe.PriorBoxParameter.CENTER_SIZE",
|
||||
"share_location": True,
|
||||
"variance_encoded_in_target": False,
|
||||
"normalized": True,
|
||||
"clip_before_nms": False,
|
||||
"clip_after_nms": True,
|
||||
"decrease_label_id": False,
|
||||
},
|
||||
)
|
||||
detections.output(0).get_tensor().set_names({"detection_out"})
|
||||
|
||||
model = ov.Model([detections], model.get_parameters(), "ssdlite_mobilenet_v2")
|
||||
model = ov.Model([detections], [parameter], "ssdlite_mobilenet_v2")
|
||||
|
||||
ppp = PrePostProcessor(model)
|
||||
ppp.input().tensor().set_layout(ov.Layout("NHWC"))
|
||||
ppp.input().preprocess().reverse_channels()
|
||||
model = ppp.build()
|
||||
|
||||
ov.save_model(model, "/models/ssdlite_mobilenet_v2.xml", compress_to_fp16=True)
|
||||
# Fail the build rather than silently ship the dynamically shaped graph again.
|
||||
op_types = [op.get_type_name() for op in model.get_ordered_ops()]
|
||||
assert op_types.count("DetectionOutput") == 1, "postprocessor was not fused"
|
||||
|
||||
for dynamic_op in ("NonMaxSuppression", "NonZero", "Loop", "TensorIterator"):
|
||||
assert dynamic_op not in op_types, f"{dynamic_op} left in the graph"
|
||||
|
||||
output_shape = model.outputs[0].get_partial_shape()
|
||||
assert output_shape.is_static and list(output_shape) == [1, 1, 100, 7], (
|
||||
f"unexpected detector output shape {output_shape}"
|
||||
)
|
||||
|
||||
ov.save_model(model, OUTPUT_PATH, compress_to_fp16=True)
|
||||
|
||||
@@ -34,13 +34,12 @@ edgeTPU:
|
||||
type: edgetpu
|
||||
device: usb
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize of the model, typically 320
|
||||
height: 320 # <--- should match the imgsize of the model, typically 320
|
||||
path: /config/model_cache/yolov9-s-relu6-best_320_int8_edgetpu.tflite
|
||||
labelmap_path: /config/labels-coco17.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize of the model, typically 320
|
||||
height: 320 # <--- should match the imgsize of the model, typically 320
|
||||
path: /config/model_cache/yolov9-s-relu6-best_320_int8_edgetpu.tflite
|
||||
labelmap_path: /config/labels-coco17.txt
|
||||
hailo8l:
|
||||
title: Hailo-8/Hailo-8L
|
||||
models:
|
||||
@@ -68,28 +67,27 @@ hailo8l:
|
||||
type: hailo8l
|
||||
device: PCIe
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
input_dtype: int
|
||||
model_type: yolo-generic
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
input_dtype: int
|
||||
model_type: yolo-generic
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
|
||||
# The detector automatically selects the default model based on your hardware:
|
||||
# - For Hailo-8 hardware: YOLOv6n (default: yolov6n.hef)
|
||||
# - For Hailo-8L hardware: YOLOv6n (default: yolov6n.hef)
|
||||
#
|
||||
# Optionally, you can specify a local model path to override the default.
|
||||
# If a local path is provided and the file exists, it will be used instead of downloading.
|
||||
# Example:
|
||||
# path: /config/model_cache/hailo/yolov6n.hef
|
||||
#
|
||||
# You can also override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8/yolov6n.hef
|
||||
# just make sure to give it the write configuration based on the model
|
||||
# The detector automatically selects the default model based on your hardware:
|
||||
# - For Hailo-8 hardware: YOLOv6n (default: yolov6n.hef)
|
||||
# - For Hailo-8L hardware: YOLOv6n (default: yolov6n.hef)
|
||||
#
|
||||
# Optionally, you can specify a local model path to override the default.
|
||||
# If a local path is provided and the file exists, it will be used instead of downloading.
|
||||
# Example:
|
||||
# path: /config/model_cache/hailo/yolov6n.hef
|
||||
#
|
||||
# You can also override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8/yolov6n.hef
|
||||
# just make sure to give it the write configuration based on the model
|
||||
- key: ssd
|
||||
label: SSD MobileNet v1
|
||||
recommended: false
|
||||
@@ -113,19 +111,18 @@ hailo8l:
|
||||
type: hailo8l
|
||||
device: PCIe
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
model_type: ssd
|
||||
# Specify the local model path (if available) or URL for SSD MobileNet v1.
|
||||
# Example with a local path:
|
||||
# path: /config/model_cache/h8l_cache/ssd_mobilenet_v1.hef
|
||||
#
|
||||
# Or override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8l/ssd_mobilenet_v1.hef
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: rgb
|
||||
model_type: ssd
|
||||
# Specify the local model path (if available) or URL for SSD MobileNet v1.
|
||||
# Example with a local path:
|
||||
# path: /config/model_cache/h8l_cache/ssd_mobilenet_v1.hef
|
||||
#
|
||||
# Or override using a custom URL:
|
||||
# path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8l/ssd_mobilenet_v1.hef
|
||||
openvino:
|
||||
title: OpenVINO
|
||||
models:
|
||||
@@ -174,15 +171,14 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU # or NPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: ssd
|
||||
label: SSDLite MobileNet v2
|
||||
recommended: false
|
||||
@@ -206,14 +202,13 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU # Or NPU
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
- key: yolo-legacy
|
||||
label: YOLO (v3, v4, v7)
|
||||
recommended: false
|
||||
@@ -245,15 +240,14 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU # or NPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolonas
|
||||
label: YOLO-NAS
|
||||
recommended: false
|
||||
@@ -286,15 +280,14 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_tensor: nchw
|
||||
input_pixel_format: bgr
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_tensor: nchw
|
||||
input_pixel_format: bgr
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolox
|
||||
label: YOLOX
|
||||
recommended: false
|
||||
@@ -315,11 +308,10 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolox
|
||||
path: /config/model_cache/yolox.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolox
|
||||
path: /config/model_cache/yolox.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: rfdetr
|
||||
label: RF-DETR
|
||||
recommended: false
|
||||
@@ -358,14 +350,13 @@ openvino:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
model:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
- key: dfine
|
||||
label: D-FINE / DEIMv2
|
||||
recommended: false
|
||||
@@ -457,15 +448,14 @@ openvino:
|
||||
type: openvino
|
||||
device: CPU
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine-s.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine-s.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
appleSilicon:
|
||||
title: Apple Silicon
|
||||
models:
|
||||
@@ -514,15 +504,14 @@ appleSilicon:
|
||||
type: zmq
|
||||
endpoint: tcp://host.docker.internal:5555
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolo-legacy
|
||||
label: YOLO (v3, v4, v7)
|
||||
recommended: false
|
||||
@@ -554,15 +543,14 @@ appleSilicon:
|
||||
type: zmq
|
||||
endpoint: tcp://host.docker.internal:5555
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
onnx:
|
||||
title: ONNX
|
||||
models:
|
||||
@@ -610,15 +598,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: rfdetr
|
||||
label: RF-DETR
|
||||
recommended: false
|
||||
@@ -656,14 +643,13 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
model:
|
||||
model_type: rfdetr
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/rfdetr.onnx # use the filename you generated above
|
||||
- key: yolonas
|
||||
label: YOLO-NAS
|
||||
recommended: false
|
||||
@@ -695,15 +681,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_pixel_format: bgr
|
||||
input_tensor: nchw
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolonas
|
||||
width: 320 # <--- should match whatever was set in notebook
|
||||
height: 320 # <--- should match whatever was set in notebook
|
||||
input_pixel_format: bgr
|
||||
input_tensor: nchw
|
||||
path: /config/yolo_nas_s.onnx
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolox
|
||||
label: YOLOX
|
||||
recommended: false
|
||||
@@ -726,15 +711,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolox
|
||||
width: 416 # <--- should match the imgsize set during model export
|
||||
height: 416 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
path: /config/model_cache/yolox_tiny.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolox
|
||||
width: 416 # <--- should match the imgsize set during model export
|
||||
height: 416 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
path: /config/model_cache/yolox_tiny.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: dfine
|
||||
label: D-FINE / DEIMv2
|
||||
recommended: false
|
||||
@@ -825,15 +809,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine_m_obj2coco.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: dfine
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/dfine_m_obj2coco.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
- key: yolo-legacy
|
||||
label: YOLO (v3, v4, v7)
|
||||
recommended: false
|
||||
@@ -864,15 +847,14 @@ onnx:
|
||||
onnx:
|
||||
type: onnx
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # <--- should match the imgsize set during model export
|
||||
height: 320 # <--- should match the imgsize set during model export
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
path: /config/model_cache/yolo.onnx # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
cpu:
|
||||
title: CPU
|
||||
models:
|
||||
@@ -946,19 +928,18 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolonas
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolonas.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolonas.dfp (a file ending with .dfp)
|
||||
# └── yolonas_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
model:
|
||||
model_type: yolonas
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolonas.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolonas.dfp (a file ending with .dfp)
|
||||
# └── yolonas_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
- key: yolov9
|
||||
label: YOLOv9
|
||||
recommended: false
|
||||
@@ -984,18 +965,17 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolo-generic
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolov9.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolov9.dfp (a file ending with .dfp)
|
||||
model:
|
||||
model_type: yolo-generic
|
||||
width: 320 # (Can be set to 640 for higher resolution)
|
||||
height: 320 # (Can be set to 640 for higher resolution)
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolov9.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolov9.dfp (a file ending with .dfp)
|
||||
- key: yolox
|
||||
label: YOLOX
|
||||
recommended: false
|
||||
@@ -1021,18 +1001,17 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: yolox
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolox.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolox.dfp (a file ending with .dfp)
|
||||
model:
|
||||
model_type: yolox
|
||||
width: 640
|
||||
height: 640
|
||||
input_tensor: nchw
|
||||
input_dtype: float_denorm
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/yolox.zip
|
||||
# The .zip file must contain:
|
||||
# ├── yolox.dfp (a file ending with .dfp)
|
||||
- key: ssd
|
||||
label: SSDLite MobileNet v2
|
||||
recommended: false
|
||||
@@ -1058,19 +1037,18 @@ memryx:
|
||||
type: memryx
|
||||
device: PCIe:0
|
||||
|
||||
models:
|
||||
default:
|
||||
model_type: ssd
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/ssdlite_mobilenet.zip
|
||||
# The .zip file must contain:
|
||||
# ├── ssdlite_mobilenet.dfp (a file ending with .dfp)
|
||||
# └── ssdlite_mobilenet_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
model:
|
||||
model_type: ssd
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: nchw
|
||||
input_dtype: float
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
# Optional: The model is normally fetched through the runtime, so 'path' can be omitted unless you want to use a custom or local model.
|
||||
# path: /config/ssdlite_mobilenet.zip
|
||||
# The .zip file must contain:
|
||||
# ├── ssdlite_mobilenet.dfp (a file ending with .dfp)
|
||||
# └── ssdlite_mobilenet_post.onnx (optional; only if the model includes a cropped post-processing network)
|
||||
tensorrt:
|
||||
title: TensorRT
|
||||
models:
|
||||
@@ -1109,14 +1087,13 @@ tensorrt:
|
||||
type: tensorrt
|
||||
device: 0 #This is the default, select the first GPU
|
||||
|
||||
models:
|
||||
default:
|
||||
path: /config/model_cache/tensorrt/yolov7-320.trt # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
input_tensor: nchw
|
||||
input_pixel_format: rgb
|
||||
width: 320 # MUST match the chosen model i.e yolov7-320 -> 320, yolov4-416 -> 416
|
||||
height: 320 # MUST match the chosen model i.e yolov7-320 -> 320 yolov4-416 -> 416
|
||||
model:
|
||||
path: /config/model_cache/tensorrt/yolov7-320.trt # use the filename you generated above
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
input_tensor: nchw
|
||||
input_pixel_format: rgb
|
||||
width: 320 # MUST match the chosen model i.e yolov7-320 -> 320, yolov4-416 -> 416
|
||||
height: 320 # MUST match the chosen model i.e yolov7-320 -> 320 yolov4-416 -> 416
|
||||
synaptics:
|
||||
title: Synaptics
|
||||
models:
|
||||
@@ -1284,15 +1261,14 @@ axengine:
|
||||
axengine:
|
||||
type: axengine
|
||||
|
||||
models:
|
||||
default:
|
||||
path: frigate-yolov9-tiny
|
||||
model_type: yolo-generic
|
||||
width: 320
|
||||
height: 320
|
||||
input_dtype: int
|
||||
input_pixel_format: bgr
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
model:
|
||||
path: frigate-yolov9-tiny
|
||||
model_type: yolo-generic
|
||||
width: 320
|
||||
height: 320
|
||||
input_dtype: int
|
||||
input_pixel_format: bgr
|
||||
labelmap_path: /labelmap/coco-80.txt
|
||||
degirumAiServer:
|
||||
title: DeGirum AI Server
|
||||
models:
|
||||
|
||||
@@ -157,51 +157,44 @@ auth:
|
||||
- front_door
|
||||
- back_yard
|
||||
|
||||
# Optional: named object detection models (default: a single model named "default")
|
||||
# Each entry defines a model; cameras choose which model to use with detect.model.
|
||||
# Detectors that support multiple models (openvino, onnx, tensorrt, cpu, rknn) run
|
||||
# one instance per model in use. Detectors that only support a single model
|
||||
# (edgetpu, hailo8l, memryx, and others) are assigned to models round robin, so at
|
||||
# least as many of those detectors as models are required when no multi-model
|
||||
# capable detector is configured.
|
||||
# Optional: model modifications
|
||||
# NOTE: The default values are for the EdgeTPU detector.
|
||||
# Other detectors will require the model config to be set.
|
||||
models:
|
||||
default:
|
||||
# Required: path to the model. Frigate+ models use plus://<model_id> (default: automatic based on detector)
|
||||
path: /edgetpu_model.tflite
|
||||
# Required: path to the labelmap (default: shown below)
|
||||
labelmap_path: /labelmap.txt
|
||||
# Required: Object detection model input width (default: shown below)
|
||||
width: 320
|
||||
# Required: Object detection model input height (default: shown below)
|
||||
height: 320
|
||||
# Required: Object detection model input colorspace
|
||||
# Valid values are rgb, bgr, or yuv. (default: shown below)
|
||||
input_pixel_format: rgb
|
||||
# Required: Object detection model input tensor format
|
||||
# Valid values are nhwc, nchw, hwnc, or hwcn (default: shown below)
|
||||
input_tensor: nhwc
|
||||
# Optional: Data type of the model input tensor
|
||||
# Valid values are float, float_denorm, or int (default: shown below)
|
||||
input_dtype: int
|
||||
# Required: Object detection model architecture, used by detectors that support more
|
||||
# than one model type (openvino, onnx, rknn, memryx, axengine, synaptics, and others)
|
||||
# Valid values are ssd, yolox, yolonas, yolo-generic, rfdetr, dfine (default: shown below)
|
||||
model_type: ssd
|
||||
# Required: Label name modifications. These are merged into the standard labelmap.
|
||||
labelmap:
|
||||
2: vehicle
|
||||
# Optional: Map of object labels to their attribute labels (default: depends on model)
|
||||
attributes_map:
|
||||
person:
|
||||
- amazon
|
||||
- face
|
||||
car:
|
||||
- amazon
|
||||
- fedex
|
||||
- license_plate
|
||||
- ups
|
||||
model:
|
||||
# Required: path to the model. Frigate+ models use plus://<model_id> (default: automatic based on detector)
|
||||
path: /edgetpu_model.tflite
|
||||
# Required: path to the labelmap (default: shown below)
|
||||
labelmap_path: /labelmap.txt
|
||||
# Required: Object detection model input width (default: shown below)
|
||||
width: 320
|
||||
# Required: Object detection model input height (default: shown below)
|
||||
height: 320
|
||||
# Required: Object detection model input colorspace
|
||||
# Valid values are rgb, bgr, or yuv. (default: shown below)
|
||||
input_pixel_format: rgb
|
||||
# Required: Object detection model input tensor format
|
||||
# Valid values are nhwc, nchw, hwnc, or hwcn (default: shown below)
|
||||
input_tensor: nhwc
|
||||
# Optional: Data type of the model input tensor
|
||||
# Valid values are float, float_denorm, or int (default: shown below)
|
||||
input_dtype: int
|
||||
# Required: Object detection model architecture, used by detectors that support more
|
||||
# than one model type (openvino, onnx, rknn, memryx, axengine, synaptics, and others)
|
||||
# Valid values are ssd, yolox, yolonas, yolo-generic, rfdetr, dfine (default: shown below)
|
||||
model_type: ssd
|
||||
# Required: Label name modifications. These are merged into the standard labelmap.
|
||||
labelmap:
|
||||
2: vehicle
|
||||
# Optional: Map of object labels to their attribute labels (default: depends on model)
|
||||
attributes_map:
|
||||
person:
|
||||
- amazon
|
||||
- face
|
||||
car:
|
||||
- amazon
|
||||
- fedex
|
||||
- license_plate
|
||||
- ups
|
||||
|
||||
# Optional: Audio Events Configuration
|
||||
# NOTE: Can be overridden at the camera level
|
||||
@@ -309,9 +302,6 @@ ffmpeg:
|
||||
detect:
|
||||
# Optional: enables detection for the camera (default: shown below)
|
||||
enabled: False
|
||||
# Optional: name of the model (key under models) used by this camera
|
||||
# (default: the only defined model, or the model named "default")
|
||||
model: default
|
||||
# Optional: width of the frame for the input with the detect role (default: use native stream resolution)
|
||||
width: 1280
|
||||
# Optional: height of the frame for the input with the detect role (default: use native stream resolution)
|
||||
|
||||
@@ -192,13 +192,12 @@ Navigate to <NavPath path="Settings > System > Detectors and model" /> and open
|
||||
|
||||
```yaml
|
||||
# Optional: model config
|
||||
models:
|
||||
default:
|
||||
path: /path/to/model
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: "nhwc"
|
||||
input_pixel_format: "bgr"
|
||||
model:
|
||||
path: /path/to/model
|
||||
width: 320
|
||||
height: 320
|
||||
input_tensor: "nhwc"
|
||||
input_pixel_format: "bgr"
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -215,16 +214,15 @@ If the labelmap is customized then the labels used for alerts will need to be ad
|
||||
The labelmap can be customized to your needs. A common reason to do this is to combine multiple object types that are easily confused when you don't need to be as granular such as car/truck. By default, truck is renamed to car because they are often confused. You cannot add new object types, but you can change the names of existing objects in the model.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
labelmap:
|
||||
2: vehicle
|
||||
3: vehicle
|
||||
5: vehicle
|
||||
7: vehicle
|
||||
15: animal
|
||||
16: animal
|
||||
17: animal
|
||||
model:
|
||||
labelmap:
|
||||
2: vehicle
|
||||
3: vehicle
|
||||
5: vehicle
|
||||
7: vehicle
|
||||
15: animal
|
||||
16: animal
|
||||
17: animal
|
||||
```
|
||||
|
||||
Note that if you rename objects in the labelmap, you will also need to update your `objects -> track` list as well.
|
||||
|
||||
@@ -165,7 +165,7 @@ If available, recommended settings are:
|
||||
|
||||
#### Setup via the Add Camera Wizard
|
||||
|
||||
The Add Camera Wizard is the recommended way to add a standard Reolink camera. Before starting, make sure [HTTP is enabled](https://support.reolink.com/articles/360003452893-How-to-Access-Reolink-Cameras-NVRs-Home-Hub-Locally-via-Web-Browsers/) in the camera's advanced network settings. The wizard uses the camera's HTTP API to determine its resolution and choose the recommended stream type from the table above.
|
||||
The [Add Camera Wizard](cameras.md#adding-a-camera-with-the-add-camera-wizard) is the recommended way to add a standard Reolink camera. Before starting, make sure [HTTP is enabled](https://support.reolink.com/articles/360003452893-How-to-Access-Reolink-Cameras-NVRs-Home-Hub-Locally-via-Web-Browsers/) in the camera's advanced network settings. The wizard uses the camera's HTTP API to determine its resolution and choose the recommended stream type from the table above.
|
||||
|
||||
1. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />.
|
||||
2. Choose **Manual selection** as the stream detection method and select **Reolink** as the camera brand.
|
||||
|
||||
@@ -7,6 +7,49 @@ import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
## Adding a camera with the Add Camera Wizard
|
||||
|
||||
The Add Camera Wizard is the recommended way to add a camera. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />. The wizard connects to your camera, tests each stream, and writes the camera's configuration for you, including the [go2rtc](go2rtc.md) restream and the live view stream mapping, so a standard setup needs no hand-written YAML.
|
||||
|
||||
### Step 1: Name and connection
|
||||
|
||||
Enter a name for the camera along with its host or IP address and credentials, then choose how the wizard should find the camera's streams:
|
||||
|
||||
- **Probe camera** queries the camera over ONVIF (the ONVIF port is usually 80 or 8080) and asks it for its stream URLs. Some cameras use a separate ONVIF/service account rather than the device admin user, and some require **Use digest authentication** to be enabled.
|
||||
- **Manual selection** builds a stream URL from a template for the camera brand you pick (Dahua/Amcrest/EmpireTech, Hikvision/Uniview/Annke, Ubiquiti, Reolink, Axis, TP-Link, or Foscam). Choose **Other** to enter a custom RTSP URL directly. Non-RTSP stream types must be [configured manually](#setting-up-camera-inputs).
|
||||
|
||||
The name you enter is lowercased and spaces become underscores. If the result still isn't a valid config key, the wizard generates a safe name and stores what you typed as `friendly_name`.
|
||||
|
||||
### Step 2: Probe or snapshot
|
||||
|
||||
In probe mode, the wizard reports what the camera returned (manufacturer, model, firmware, profile count, and whether PTZ, presets, and [autotracking](autotracking.md) are supported) along with the RTSP URLs it discovered. Test each candidate to see its resolution, frame rate, and codecs together with a snapshot, then select the one you want to use.
|
||||
|
||||
In manual mode, the wizard tests the templated URL and shows the same metadata and snapshot.
|
||||
|
||||
If no RTSP URLs are found, the credentials may be wrong or the camera may not support ONVIF. Go back and use manual selection instead.
|
||||
|
||||
### Step 3: Stream configuration
|
||||
|
||||
Assign [roles](#setting-up-camera-inputs) to the stream, and use **Add Another Stream** to add the camera's other streams, for example a substream for `detect` alongside the main stream for `record`. At least one stream must have the `detect` role before you can continue.
|
||||
|
||||
**Reduce connections to camera** routes that input through the go2rtc restream so Frigate and the live view share a single connection to the camera instead of each opening their own. See [restream](restream.md) for more detail.
|
||||
|
||||
### Step 4: Validation and testing
|
||||
|
||||
Connect each stream to get a live preview, an estimated bandwidth figure, and a list of validation results. The wizard checks for the most common misconfigurations, including:
|
||||
|
||||
- A detect resolution that is too high (increased resource usage) or too low for reliable detection, or one it could not probe at all
|
||||
- A stream marked `record` whose audio codec is not AAC, or that has no audio at all
|
||||
- A stream marked `audio` that carries no audio stream
|
||||
- Using a restreamed input for the `record` role
|
||||
- Brand-specific issues, such as an RTSP stream on a Reolink camera that should use http-flv, or a Dahua/Hikvision substream selected for `detect`
|
||||
|
||||
**Use stream compatibility mode** passes the stream through go2rtc's ffmpeg module. Enable it if a stream fails to load after several attempts. Note that this also prevents [two way talk](/configuration/live#two-way-talk) from being detected for that stream.
|
||||
|
||||
**Save New Camera** writes the configuration and starts the camera right away. No restart is required.
|
||||
|
||||
Other features, including [hardware acceleration](hardware_acceleration_video.md), [two way talk](/configuration/live#two-way-talk), and audio transcoding, is configured after the camera has been added. For camera model specific quirks, see the [camera specific](camera_specific.md) docs.
|
||||
|
||||
## Setting Up Camera Inputs
|
||||
|
||||
Several inputs can be configured for each camera and the role of each input can be mixed and matched based on your needs. This allows you to use a lower resolution stream for object detection, but create recordings from a higher resolution stream, or vice versa.
|
||||
@@ -69,7 +112,7 @@ Additional cameras are simply added under the camera configuration section.
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
Navigate to <NavPath path="Settings > Global configuration > Camera management" /> and use the add camera button to configure each additional camera.
|
||||
Navigate to <NavPath path="Settings > Global configuration > Camera management" /> and use the [Add Camera Wizard](#adding-a-camera-with-the-add-camera-wizard) to configure each additional camera.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
@@ -334,14 +334,13 @@ detectors:
|
||||
type: openvino
|
||||
device: AUTO
|
||||
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
|
||||
record:
|
||||
enabled: True
|
||||
|
||||
@@ -6,6 +6,7 @@ title: Configuring Generative AI
|
||||
import ConfigTabs from "@site/src/components/ConfigTabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import NavPath from "@site/src/components/NavPath";
|
||||
import FaqItem from "@site/src/components/FaqItem";
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -13,6 +14,18 @@ A Generative AI provider can be configured in the global config, which will make
|
||||
|
||||
`genai` is a map of named providers. Each key under `genai` is a name you choose, and its value is that provider's settings:
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
1. Navigate to <NavPath path="Settings > Enrichments > Generative AI" />.
|
||||
- Click **Add** and enter a **Provider name**. Any name of letters, numbers, hyphens, and underscores is accepted, but it cannot be changed from the UI after the provider is created.
|
||||
- Set **Provider** to the service you are using (e.g., `ollama`)
|
||||
- Set **Base URL**, **API key**, and **Model** as required by that provider
|
||||
- Set **Roles** to the roles this provider should handle.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
genai:
|
||||
my_provider: # any name you like
|
||||
@@ -25,6 +38,9 @@ genai:
|
||||
- chat
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
The examples on this page all use `my_provider`, but the name is arbitrary and is only used to reference the provider elsewhere in the config (for example, `semantic_search.model`).
|
||||
|
||||
Each provider handles one or more **roles**: `chat`, `descriptions`, and `embeddings`. A provider handles all three by default, and each role may be assigned to exactly one provider. Define a single provider if you want it to do everything, or split the roles across several providers using the `roles` option.
|
||||
@@ -43,15 +59,20 @@ Running Generative AI models on CPU is not recommended, as high inference times
|
||||
|
||||
### Recommended Local Models
|
||||
|
||||
You must use a vision-capable model with Frigate. The following models are recommended for local deployment:
|
||||
You must use a vision-capable model with Frigate. The following models are recommended for local deployment of the `descriptions` and `chat` roles:
|
||||
|
||||
| Model | Notes |
|
||||
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `qwen3-vl` | Strong visual and situational understanding, enhanced ability to identify smaller objects and interactions with object. |
|
||||
| `qwen3.5` | Strong situational understanding, but missing DeepStack from qwen3-vl leading to worse performance for identifying objects in people's hand and other small details. |
|
||||
| `qwen3.6` | Strong situational understanding, similar to qwen3-vl |
|
||||
| `qwen3.6` | Strong situational understanding, but missing DeepStack from qwen3-vl leading to worse performance for identifying objects in people's hand and other small details. |
|
||||
| `gemma4` | Strong situational understanding, sometimes resorts to more vague terms like 'interacts' instead of assigning a specific action. |
|
||||
|
||||
The `embeddings` role needs a different kind of model. Text queries are matched against the stored image embeddings, so the model must be trained to place images and text into the same vector space. A chat or description model will still return vectors when asked, but those vectors are not trained for retrieval and text searches will return poor matches with no error to indicate why.
|
||||
|
||||
| Model | Notes |
|
||||
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `qwen3-vl-embedding` | Multimodal embeddings for [Semantic Search](/configuration/semantic_search#genai-provider). Must be served by llama.cpp started with `--embeddings` and `--mmproj`. |
|
||||
|
||||
:::info
|
||||
|
||||
Each model is available in multiple parameter sizes (3b, 4b, 8b, etc.). Larger sizes are more capable of complex tasks and understanding of situations, but requires more memory and computational resources. It is recommended to try multiple models and experiment to see which performs best.
|
||||
@@ -416,3 +437,82 @@ genai:
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
## FAQ
|
||||
|
||||
<FaqItem id="how-do-i-debug-genai-issues" question="How do I debug GenAI issues?">
|
||||
|
||||
Frigate's Generative AI features are configured and enabled separately. [Review descriptions and summaries](/configuration/genai/genai_review) live under `review.genai`, and [object descriptions](/configuration/genai/genai_objects) live under `objects.genai`. Configuring a provider on this page does not enable either feature, and enabling one does not enable the other. Decide which of the two is not working, then work through the steps below.
|
||||
|
||||
1. Confirm a provider is available and holds the `descriptions` role.
|
||||
- Review descriptions, review summaries, and object descriptions all use the provider that has the `descriptions` role assigned in <NavPath path="Settings > Enrichments > Generative AI > Roles" /> (`genai.<provider>.roles`).
|
||||
- A provider is contacted the first time one of its roles is actually used. A provider holding the `embeddings` role for semantic search is initialized during startup, while a `descriptions` provider is not initialized until the first description is requested, which may be well after boot.
|
||||
- In <NavPath path="Settings > Enrichments > Generative AI" />, use **Refresh models** next to the model field. It queries the provider for its model list and is a quick way to verify that the base URL, API key, and network path between Frigate and your provider are correct.
|
||||
|
||||
2. Confirm the feature you expect is actually enabled.
|
||||
- Object descriptions are disabled by default. Turn on <NavPath path="Settings > Global configuration > Objects > GenAI object config > Enable GenAI" /> (`objects.genai.enabled`), either globally or per camera. This is the most common reason custom prompts appear to be ignored while review summaries are still being generated.
|
||||
- Review descriptions are disabled by default. Turn on <NavPath path="Settings > Global configuration > Review > GenAI config > Enable GenAI descriptions" /> (`review.genai.enabled`). Once enabled, alerts are described by default but detections are not, so a detection-only review item will never get a summary unless **Enable GenAI for detections** (`review.genai.detections`) is also on.
|
||||
|
||||
3. If object descriptions are never requested, check the filters that skip generation.
|
||||
- <NavPath path="Settings > Global configuration > Objects > GenAI object config > GenAI objects" /> (`objects.genai.objects`) limits generation to specific labels, and **Required zones** (`objects.genai.required_zones`) requires the object to have entered one of those zones. If either is set and does not match, Frigate skips the request silently.
|
||||
- Thumbnails are only collected while an object is moving. Objects that go stationary early contribute fewer frames.
|
||||
- **Use snapshots** (`objects.genai.use_snapshot`) requires snapshots to be enabled for the camera. If the snapshot cannot be read, Frigate logs `Cannot load snapshot for <id>, file not found` and no description is generated.
|
||||
- **Send on end** (`objects.genai.send_triggers.tracked_object_end`) is on by default. If you have turned it off in favor of **Early GenAI trigger** (`objects.genai.send_triggers.after_significant_updates`), descriptions are only requested once that number of updates is reached.
|
||||
|
||||
4. Enable debug logs to see exactly what Frigate is doing. Restart Frigate after this change. The next step also requires a restart, so turn both on at the same time to avoid restarting twice.
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
default: info
|
||||
logs:
|
||||
# highlight-start
|
||||
frigate.genai: debug
|
||||
frigate.data_processing.post.object_descriptions: debug
|
||||
frigate.data_processing.post.review_descriptions: debug
|
||||
# highlight-end
|
||||
```
|
||||
|
||||
5. Save the exact images and prompts that were sent to your provider.
|
||||
- Turn on **Save thumbnails** for the feature you are debugging (`review.genai.debug_save_thumbnails` or `objects.genai.debug_save_thumbnails`). Both features write to `/media/frigate/clips/genai-requests/`, and these files are admin-only.
|
||||
- Review descriptions write `genai-requests/<review_id>/` containing the numbered frames that were sent, plus `prompt.txt` and `response.txt` with the exact prompt and the raw, unparsed model response.
|
||||
- Review summary reports write `genai-requests/<start_ts>-<end_ts>/prompt.txt` and `response.txt`. No images are involved, since a report summarizes existing review descriptions.
|
||||
- Object descriptions write `genai-requests/<event_id>/` containing the numbered thumbnails. The prompt for object descriptions is not written to a file, it is only visible in the debug logs from step 4.
|
||||
- Look at the saved images before blaming the model. If the object is small, blurry, or out of frame, no prompt will fix the result. For object descriptions, consider turning on **Use snapshots** (`objects.genai.use_snapshot`) to send a higher quality image. For review items, consider setting **Review image source** (`review.genai.image_source`) to `recordings` for 480p frames instead of the lower resolution preview frames.
|
||||
|
||||
<ConfigTabs>
|
||||
<TabItem value="ui">
|
||||
|
||||
For review descriptions, navigate to <NavPath path="Settings > Global configuration > Review" /> and set **GenAI config > Save thumbnails** to on.
|
||||
|
||||
For object descriptions, navigate to <NavPath path="Settings > Global configuration > Objects" />, expand **GenAI object config**, and set **Save thumbnails** to on.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yaml">
|
||||
|
||||
```yaml
|
||||
review:
|
||||
genai:
|
||||
enabled: true
|
||||
# highlight-next-line
|
||||
debug_save_thumbnails: true
|
||||
|
||||
objects:
|
||||
genai:
|
||||
enabled: true
|
||||
# highlight-next-line
|
||||
debug_save_thumbnails: true
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</ConfigTabs>
|
||||
|
||||
6. Verify the prompt is what you think it is.
|
||||
- Object description prompts are the ones you control directly. A camera-level <NavPath path="Settings > Camera configuration > Objects > GenAI object config > Caption prompt" /> (`objects.genai.prompt`) overrides the global one, and an entry in **Object prompts** (`objects.genai.object_prompts`) for a label overrides both for that label. Only `{label}`, `{sub_label}`, and `{camera}` are substituted.
|
||||
- Review description prompts are built by Frigate and request a structured JSON response, so they are not fully replaceable. The parts you control are <NavPath path="Settings > Global configuration > Review > GenAI config > Activity context prompt" /> (`review.genai.activity_context_prompt`) and **Additional concerns** (`review.genai.additional_concerns`). Keep the activity context prompt general, since overly specific rules will sway the model's threat level scoring.
|
||||
|
||||
7. If descriptions are generated but the results are poor or inconsistent, look at the model and the context window.
|
||||
- Empty fields, missing `shortSummary` values, or `Failed to parse review description` errors usually mean the model is not following the requested JSON schema. Smaller models struggle with structured output. Try a larger parameter size or one of the [recommended models](#recommended-local-models).
|
||||
- Frigate calculates how many frames to send from the context size the provider reports. If your server reports a different value than it is actually running with, frames will be truncated or the request will fail. Pin the value by adding `context_size` under <NavPath path="Settings > Enrichments > Generative AI > Provider options" /> (`genai.<provider>.provider_options`), and for Ollama also confirm `options.num_ctx` there matches the context you have configured.
|
||||
- Check **Review Description Speed** and **Object Description Speed** in <NavPath path="System metrics > Enrichments" />. If inference takes tens of seconds, requests will queue behind each other and descriptions will appear to stop. For Ollama, review `OLLAMA_NUM_PARALLEL`, `OLLAMA_MAX_QUEUE`, and `OLLAMA_MAX_LOADED_MODELS` so that concurrent requests from Frigate are handled the way you expect.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
@@ -113,3 +113,7 @@ Many providers also have a public facing chat interface for their models. Downlo
|
||||
- OpenAI - [ChatGPT](https://chatgpt.com)
|
||||
- Gemini - [Google AI Studio](https://aistudio.google.com)
|
||||
- Ollama - [Open WebUI](https://docs.openwebui.com/)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If descriptions are not being generated, or the generated descriptions are not what you expect, see [How do I debug GenAI issues?](/configuration/genai/genai_config#how-do-i-debug-genai-issues).
|
||||
|
||||
@@ -201,3 +201,7 @@ Along with individual review item summaries, Generative AI can also produce a si
|
||||
Review reports can be requested via the [API](/integrations/api/generate-review-summary-review-summarize-start-start-ts-end-end-ts-post) by sending a POST request to `/api/review/summarize/start/{start_ts}/end/{end_ts}` with Unix timestamps.
|
||||
|
||||
For Home Assistant users, there is a built-in service (`frigate.review_summarize`) that makes it easy to request review reports as part of automations or scripts. This allows you to automatically generate daily summaries, vacation reports, or custom time period reports based on your specific needs.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If summaries are not being generated, or the generated summaries are not what you expect, see [How do I debug GenAI issues?](/configuration/genai/genai_config#how-do-i-debug-genai-issues).
|
||||
|
||||
@@ -15,7 +15,7 @@ Frigate uses the bundled go2rtc to power a number of key features:
|
||||
|
||||
:::tip[Most users no longer need to configure go2rtc by hand]
|
||||
|
||||
The **camera setup wizard** is the recommended way to add cameras. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />, and the wizard probes your camera and writes its configuration for you, including the go2rtc restream and the live stream mapping, so go2rtc is set up automatically.
|
||||
The [**camera setup wizard**](cameras.md#adding-a-camera-with-the-add-camera-wizard) is the recommended way to add cameras. Click **Add Camera** in <NavPath path="Settings > Global configuration > Camera management" />, and the wizard probes your camera and writes its configuration for you, including the go2rtc restream and the live stream mapping, so go2rtc is set up automatically.
|
||||
|
||||
This guide is mainly useful if you are **upgrading from an older version and have existing cameras that don't yet use go2rtc**, or if you want to fine-tune a stream by hand (for example, to transcode a codec your browser can't play). The [go2rtc troubleshooting guide](/troubleshooting/go2rtc) applies regardless of how your cameras were added.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ If you are using go2rtc, you should adjust the following settings in your camera
|
||||
|
||||
- Video codec: **H.264** - provides the most compatible video codec with all Live view technologies and browsers. Avoid any kind of "smart codec" or "+" codec like _H.264+_ or _H.265+_. as these non-standard codecs remove keyframes (see below).
|
||||
- Audio codec: **AAC** - provides the most compatible audio codec with all Live view technologies and browsers that support audio.
|
||||
- I-frame interval (sometimes called the keyframe interval, the interframe space, or the GOP length): match your camera's frame rate, or choose "1x" (for interframe space on Reolink cameras). For example, if your stream outputs 20fps, your i-frame interval should be 20 (or 1x on Reolink). Values higher than the frame rate will cause the stream to take longer to begin playback. See [this page](https://gardinal.net/understanding-the-keyframe-interval/) for more on keyframes. For many users this may not be an issue, but it should be noted that a 1x i-frame interval will cause more storage utilization if you are using the stream for the `record` role as well.
|
||||
- I-frame interval (sometimes called the keyframe interval, the interframe space, or the GOP length): match your camera's frame rate, or choose "1x" (for interframe space on Reolink cameras). For example, if your stream outputs 20fps, your i-frame interval should be 20 (or 1x on Reolink). Values higher than the frame rate will cause the stream to take longer to begin playback. See [this page](https://web.archive.org/web/20251213190836/https://gardinal.net/understanding-the-keyframe-interval/) for more on keyframes. For many users this may not be an issue, but it should be noted that a 1x i-frame interval will cause more storage utilization if you are using the stream for the `record` role as well.
|
||||
|
||||
The default video and audio codec on your camera may not always be compatible with your browser, which is why setting them to H.264 and AAC is recommended. See the [go2rtc docs](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#codecs-madness) for codec support information.
|
||||
|
||||
|
||||
@@ -91,41 +91,6 @@ The best detection accuracy comes from a model trained on images that look like
|
||||
|
||||
:::
|
||||
|
||||
### Running multiple models
|
||||
|
||||
Models are defined as named entries under `models`, and each camera selects the model it uses with `detect.model`. This makes it possible to run different models for different groups of cameras, for example a dedicated model for indoor cameras, outdoor cameras, or thermal cameras.
|
||||
|
||||
```yaml
|
||||
detectors:
|
||||
ov:
|
||||
type: openvino
|
||||
device: GPU
|
||||
|
||||
models:
|
||||
indoor:
|
||||
path: /config/model_cache/indoor-model.xml
|
||||
model_type: yolo-generic
|
||||
width: 320
|
||||
height: 320
|
||||
outdoor:
|
||||
path: plus://<your_model_id>
|
||||
|
||||
cameras:
|
||||
living_room:
|
||||
detect:
|
||||
model: indoor
|
||||
driveway:
|
||||
detect:
|
||||
model: outdoor
|
||||
```
|
||||
|
||||
When only one model is defined, all cameras use it automatically. With multiple models, cameras use the model named `default` unless `detect.model` selects another one; `detect.model` can also be set globally and overridden per camera.
|
||||
|
||||
How detectors handle multiple models depends on the hardware:
|
||||
|
||||
- **Detectors that support multiple models** (`openvino`, `onnx`, `tensorrt`, `cpu`, `rknn`): a single detector entry is automatically expanded into one instance per model in use. For example, detector `ov` with models `indoor` and `outdoor` runs as `ov_indoor` and `ov_outdoor`, and each instance appears separately in the System Metrics page. Keep in mind that each instance loads its own copy of the model, which increases GPU memory usage.
|
||||
- **Detectors that only support a single model** (`edgetpu`, `hailo8l`, `memryx`, and other single-session hardware): each detector entry serves exactly one model. Detector entries are assigned to models round robin, so running two models on Coral hardware requires two Corals. If these are the only detectors configured and there are fewer of them than models in use, Frigate will fail to start with an error explaining the options.
|
||||
|
||||
# Officially Supported Detectors
|
||||
|
||||
Frigate provides a number of builtin detector types. By default, Frigate will use a single CPU detector. Other detectors may require additional configuration as described below. When using multiple detectors they will run in dedicated processes, but pull from a common queue of detection requests from across all cameras.
|
||||
@@ -824,12 +789,11 @@ You can set it to:
|
||||
- A path to some model.json.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: ./mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1 # directory to model .json and file
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
model:
|
||||
path: ./mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1 # directory to model .json and file
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
```
|
||||
|
||||
#### Local Inference
|
||||
@@ -845,12 +809,11 @@ It is also possible to eliminate the need for an AI server and run the hardware
|
||||
Once `degirum_detector` is setup, you can choose a model through 'model' section in the `config.yml` file.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
model:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
```
|
||||
|
||||
#### AI Hub Cloud Inference
|
||||
@@ -866,12 +829,11 @@ If you do not possess whatever hardware you want to run, there's also the option
|
||||
Once `degirum_detector` is setup, you can choose a model through 'model' section in the `config.yml` file.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
model:
|
||||
path: mobilenet_v2_ssd_coco--300x300_quant_n2x_orca1_1
|
||||
width: 300 # width is in the model name as the first number in the "int"x"int" section
|
||||
height: 300 # height is in the model name as the second number in the "int"x"int" section
|
||||
input_pixel_format: rgb/bgr # look at the model.json to figure out which to put here
|
||||
```
|
||||
|
||||
## AXERA
|
||||
|
||||
@@ -144,7 +144,7 @@ At this point you should be able to start Frigate and a basic config will be cre
|
||||
|
||||
### Step 2: Add a camera
|
||||
|
||||
Click the **Add Camera** button in <NavPath path="Settings > Global configuration > Camera management" /> to use the camera setup wizard to get your first camera added into Frigate.
|
||||
Click the **Add Camera** button in <NavPath path="Settings > Global configuration > Camera management" /> to use the camera setup wizard to get your first camera added into Frigate. See [Adding a camera with the Add Camera Wizard](../configuration/cameras.md#adding-a-camera-with-the-add-camera-wizard) for a walkthrough of each step.
|
||||
|
||||
### Step 3: Configure hardware acceleration (recommended)
|
||||
|
||||
@@ -228,14 +228,13 @@ detectors: # <---- add detectors
|
||||
device: GPU
|
||||
|
||||
# We will use the default MobileNet_v2 model from OpenVINO.
|
||||
models:
|
||||
default:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
model:
|
||||
width: 300
|
||||
height: 300
|
||||
input_tensor: nhwc
|
||||
input_pixel_format: bgr
|
||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||
|
||||
cameras:
|
||||
name_of_your_camera:
|
||||
|
||||
@@ -64,9 +64,8 @@ You can either choose the new model from the <NavPath path="Settings > System >
|
||||
```yaml
|
||||
detectors: ...
|
||||
|
||||
models:
|
||||
default:
|
||||
path: plus://<your_model_id>
|
||||
model:
|
||||
path: plus://<your_model_id>
|
||||
```
|
||||
|
||||
:::note
|
||||
@@ -80,11 +79,10 @@ Models are downloaded into the `/config/model_cache` folder and only downloaded
|
||||
If needed, you can override the labelmap for Frigate+ models. This is not recommended as renaming labels will break the Submit to Frigate+ feature if the labels are not available in Frigate+.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
default:
|
||||
path: plus://<your_model_id>
|
||||
labelmap:
|
||||
3: animal
|
||||
4: animal
|
||||
5: animal
|
||||
model:
|
||||
path: plus://<your_model_id>
|
||||
labelmap:
|
||||
3: animal
|
||||
4: animal
|
||||
5: animal
|
||||
```
|
||||
|
||||
@@ -38,9 +38,8 @@ Navigate to <NavPath path="Settings > System > Detectors and model" />. In the *
|
||||
```yaml
|
||||
detectors: ...
|
||||
|
||||
models:
|
||||
default:
|
||||
path: plus://<your_model_id>
|
||||
model:
|
||||
path: plus://<your_model_id>
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
@@ -34,11 +34,15 @@ The detect FFmpeg process exited on its own. This message is only the notificati
|
||||
|
||||
</FaqItem>
|
||||
|
||||
<FaqItem id="non-monotonically-increasing-dts" question="Application provided invalid, non monotonically increasing dts to muxer">
|
||||
<FaqItem id="non-monotonically-increasing-dts" question="Non-monotonic DTS / non monotonically increasing dts to muxer / Queue input is backward in time">
|
||||
|
||||
An FFmpeg message meaning the camera sent packets with out-of-order timestamps. Because recordings are copied without re-encoding, FFmpeg cannot fix them, and the segment muxer often splits early, producing one-second segments and a cache backlog. The usual cause is a camera "Smart Codec" / H.264+ / H.265+ mode or a camera clock that jumps.
|
||||
These are FFmpeg messages indicating the camera sent packets with out-of-order timestamps, either on the video or the audio stream. Timestamp jitter like this is common with WiFi cameras and restreamed or proxied sources; other causes are a camera "Smart Codec" / H.264+ / H.265+ mode or a camera clock that jumps. A sustained flood of these messages usually precedes the stream stalling and the watchdog restarting FFmpeg.
|
||||
|
||||
See [Recordings: segments are only 1 second long](/troubleshooting/recordings#segments-are-only-1-second-long).
|
||||
In most cases, the fix is to improve the network, reduce system resource usage, or switch to non-WiFi cameras. In general, WiFi cameras are [not recommended](https://ipcamtalk.com/threads/multiple-cameras-high-bandwidth.77100/#post-861110).
|
||||
|
||||
On the video stream, this can affect recordings: because they are copied without re-encoding, FFmpeg cannot fix the timestamps, and the segment muxer often splits early, producing one-second segments and a cache backlog. See [Recordings: segments are only 1 second long](/troubleshooting/recordings#segments-are-only-1-second-long).
|
||||
|
||||
On the audio stream, the messages can come from the output's audio encoding. If the audio stream is the problem, it may help to have go2rtc transcode it by adding `#audio=aac` to the camera's go2rtc stream to produce clean timestamps for everything consuming the restream.
|
||||
|
||||
</FaqItem>
|
||||
|
||||
|
||||
Vendored
+38
@@ -2872,6 +2872,44 @@ paths:
|
||||
- frigateUserAuth: []
|
||||
x-required-role: any
|
||||
description: '**Access:** Any authenticated user.'
|
||||
/categorized_object_names:
|
||||
get:
|
||||
tags:
|
||||
- App
|
||||
summary: Get known object names by object type
|
||||
description: |-
|
||||
**Access:** Any authenticated user.
|
||||
|
||||
Returns the sub labels and attributes this install can attach,
|
||||
grouped by object type. Unlike /sub_labels, which reflects what has already been
|
||||
detected, this reads the config and model files, so it covers recognized face
|
||||
names, named license plates, custom object classification categories, and the
|
||||
detector attributes of tracked objects.
|
||||
operationId: categorized_object_names_categorized_object_names_get
|
||||
parameters:
|
||||
- name: object_type
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
title: Object Type
|
||||
responses:
|
||||
'200':
|
||||
description: Successful Response
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'422':
|
||||
description: Validation Error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HTTPValidationError'
|
||||
security:
|
||||
- frigateUserAuth: []
|
||||
x-required-role: any
|
||||
/audio_labels:
|
||||
get:
|
||||
tags:
|
||||
|
||||
+63
-38
@@ -31,7 +31,10 @@ from frigate.api.auth import (
|
||||
get_allowed_cameras_for_filter,
|
||||
require_role,
|
||||
)
|
||||
from frigate.api.config_util import swap_runtime_config
|
||||
from frigate.api.config_util import (
|
||||
publish_camera_section_updates,
|
||||
swap_runtime_config,
|
||||
)
|
||||
from frigate.api.defs.query.app_query_parameters import AppTimelineHourlyQueryParameters
|
||||
from frigate.api.defs.request.app_body import (
|
||||
AppConfigSetBody,
|
||||
@@ -68,6 +71,7 @@ from frigate.util.config import (
|
||||
find_config_file,
|
||||
redact_credential,
|
||||
)
|
||||
from frigate.util.object_names import get_categorized_object_names
|
||||
from frigate.util.schema import get_config_schema
|
||||
from frigate.util.services import (
|
||||
get_nvidia_driver_info,
|
||||
@@ -372,40 +376,31 @@ def config(request: Request):
|
||||
config["go2rtc"]["streams"][stream_name] = cleaned
|
||||
|
||||
config["plus"] = {"enabled": request.app.frigate_config.plus_api.is_active()}
|
||||
config["model"]["colormap"] = config_obj.model.colormap
|
||||
config["model"]["all_attributes"] = config_obj.model.all_attributes
|
||||
config["model"]["non_logo_attributes"] = config_obj.model.non_logo_attributes
|
||||
|
||||
for model_key, model in config_obj.models.items():
|
||||
model_dict = config["models"][model_key]
|
||||
model_dict["colormap"] = model.colormap
|
||||
model_dict["all_attributes"] = model.all_attributes
|
||||
model_dict["non_logo_attributes"] = model.non_logo_attributes
|
||||
# Add model plus data if plus is enabled
|
||||
if config["plus"]["enabled"]:
|
||||
model_path = config.get("model", {}).get("path")
|
||||
if model_path:
|
||||
model_json_path = FilePath(model_path).with_suffix(".json")
|
||||
try:
|
||||
with open(model_json_path) as f:
|
||||
model_plus_data = json.load(f)
|
||||
config["model"]["plus"] = model_plus_data
|
||||
except FileNotFoundError:
|
||||
config["model"]["plus"] = None
|
||||
except json.JSONDecodeError:
|
||||
config["model"]["plus"] = None
|
||||
else:
|
||||
config["model"]["plus"] = None
|
||||
|
||||
# Add model plus data if plus is enabled
|
||||
if config["plus"]["enabled"]:
|
||||
model_plus_data = None
|
||||
|
||||
if model.path:
|
||||
model_json_path = FilePath(model.path).with_suffix(".json")
|
||||
try:
|
||||
with open(model_json_path) as f:
|
||||
model_plus_data = json.load(f)
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
model_plus_data = None
|
||||
|
||||
model_dict["plus"] = model_plus_data
|
||||
|
||||
# legacy single-model block kept for frontend compatibility, remove
|
||||
# once the UI is fully multi-model aware
|
||||
default_model_key = (
|
||||
"default" if "default" in config_obj.models else next(iter(config_obj.models))
|
||||
)
|
||||
config["model"] = config["models"][default_model_key]
|
||||
|
||||
# use each detector's assigned merged labelmap
|
||||
for key, detector_config in config["detectors"].items():
|
||||
if config_obj.detectors[key].model:
|
||||
detector_config["model"]["labelmap"] = config_obj.detectors[
|
||||
key
|
||||
].model.merged_labelmap
|
||||
# use merged labelamp
|
||||
for detector_config in config["detectors"].values():
|
||||
detector_config["model"]["labelmap"] = (
|
||||
request.app.frigate_config.model.merged_labelmap
|
||||
)
|
||||
|
||||
return JSONResponse(content=config)
|
||||
|
||||
@@ -972,6 +967,17 @@ def config_set(request: Request, body: AppConfigSetBody):
|
||||
body.update_topic, settings
|
||||
)
|
||||
|
||||
# a config/cameras/* topic publishes camera copies, a
|
||||
# global topic the global object. FrigateConfig.parse
|
||||
# folds some global sections down into every camera,
|
||||
# and workers read both objects, so any such section
|
||||
# needs its camera copies sent alongside the global
|
||||
# publish above.
|
||||
if body.update_topic == "config/birdseye":
|
||||
publish_camera_section_updates(
|
||||
request.app, config, CameraConfigUpdateEnum.birdseye
|
||||
)
|
||||
|
||||
return JSONResponse(
|
||||
content=(
|
||||
{
|
||||
@@ -1308,6 +1314,28 @@ def get_sub_labels(
|
||||
return JSONResponse(content=sub_labels)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/categorized_object_names",
|
||||
dependencies=[Depends(allow_any_authenticated())],
|
||||
summary="Get known object names by object type",
|
||||
description="""Returns the sub labels and attributes this install can attach,
|
||||
grouped by object type. Unlike /sub_labels, which reflects what has already been
|
||||
detected, this reads the config and model files, so it covers recognized face
|
||||
names, named license plates, custom object classification categories, and the
|
||||
detector attributes of tracked objects.""",
|
||||
)
|
||||
def categorized_object_names(
|
||||
request: Request,
|
||||
object_type: str | None = None,
|
||||
allowed_cameras: list[str] = Depends(get_allowed_cameras_for_filter),
|
||||
):
|
||||
return JSONResponse(
|
||||
content=get_categorized_object_names(
|
||||
request.app.frigate_config, allowed_cameras, object_type
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@router.get("/audio_labels", dependencies=[Depends(allow_any_authenticated())])
|
||||
def get_audio_labels():
|
||||
labels = load_labels("/audio-labelmap.txt", prefill=521)
|
||||
@@ -1332,11 +1360,8 @@ def plusModels(request: Request, filterByCurrentModelDetector: bool = False):
|
||||
|
||||
modelList = models["list"]
|
||||
|
||||
# current model type, based on the default model until the UI is
|
||||
# fully multi-model aware
|
||||
config_models = request.app.frigate_config.models
|
||||
default_model = config_models.get("default") or next(iter(config_models.values()))
|
||||
modelType = default_model.model_type
|
||||
# current model type
|
||||
modelType = request.app.frigate_config.model.model_type
|
||||
|
||||
# current detectorType for comparing to supportedDetectors
|
||||
detectorType = list(request.app.frigate_config.detectors.values())[0].type
|
||||
|
||||
@@ -83,6 +83,7 @@ def require_admin_by_default():
|
||||
"/nvinfo",
|
||||
"/labels",
|
||||
"/sub_labels",
|
||||
"/categorized_object_names",
|
||||
"/plus/models",
|
||||
"/recognized_license_plates",
|
||||
"/timeline",
|
||||
|
||||
+37
-2
@@ -50,6 +50,7 @@ from frigate.jobs.vlm_watch import (
|
||||
stop_vlm_watch_job,
|
||||
)
|
||||
from frigate.models import Event
|
||||
from frigate.util.object_names import get_categorized_object_names
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -539,6 +540,13 @@ async def execute_tool(
|
||||
if tool_name == "search_objects":
|
||||
return await _execute_search_objects(request, arguments, allowed_cameras)
|
||||
|
||||
if tool_name == "get_categorized_object_names":
|
||||
return JSONResponse(
|
||||
content=_execute_get_categorized_object_names(
|
||||
request, arguments, allowed_cameras
|
||||
)
|
||||
)
|
||||
|
||||
if tool_name == "find_similar_objects":
|
||||
result = await _execute_find_similar_objects(
|
||||
request, arguments, allowed_cameras
|
||||
@@ -717,6 +725,29 @@ async def _execute_set_camera_state(
|
||||
return {"success": True, "camera": camera, "feature": feature, "value": value}
|
||||
|
||||
|
||||
def _execute_get_categorized_object_names(
|
||||
request: Request,
|
||||
arguments: dict[str, Any],
|
||||
allowed_cameras: list[str],
|
||||
) -> dict[str, Any]:
|
||||
object_type = arguments.get("object_type") or None
|
||||
names = get_categorized_object_names(
|
||||
request.app.frigate_config, allowed_cameras, object_type
|
||||
)
|
||||
|
||||
if not names:
|
||||
return {
|
||||
"names": {},
|
||||
"message": (
|
||||
f"No names configured for '{object_type}'."
|
||||
if object_type
|
||||
else "No names configured; search by label or semantic_query."
|
||||
),
|
||||
}
|
||||
|
||||
return {"names": names}
|
||||
|
||||
|
||||
async def _execute_tool_internal(
|
||||
tool_name: str,
|
||||
arguments: dict[str, Any],
|
||||
@@ -741,6 +772,10 @@ async def _execute_tool_internal(
|
||||
except (json.JSONDecodeError, AttributeError) as e:
|
||||
logger.warning(f"Failed to extract tool result: {e}")
|
||||
return {"error": "Failed to parse tool result"}
|
||||
elif tool_name == "get_categorized_object_names":
|
||||
return _execute_get_categorized_object_names(
|
||||
request, arguments, allowed_cameras
|
||||
)
|
||||
elif tool_name == "find_similar_objects":
|
||||
return await _execute_find_similar_objects(request, arguments, allowed_cameras)
|
||||
elif tool_name == "set_camera_state":
|
||||
@@ -773,8 +808,8 @@ async def _execute_tool_internal(
|
||||
else:
|
||||
logger.error(
|
||||
"Tool call failed: unknown tool %r. Expected one of: search_objects, find_similar_objects, "
|
||||
"get_live_context, start_camera_watch, stop_camera_watch, get_profile_status, get_recap. "
|
||||
"Arguments received: %s",
|
||||
"get_categorized_object_names, get_live_context, start_camera_watch, stop_camera_watch, "
|
||||
"get_profile_status, get_recap. Arguments received: %s",
|
||||
tool_name,
|
||||
json.dumps(arguments),
|
||||
)
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.config.camera.updater import (
|
||||
CameraConfigUpdateEnum,
|
||||
CameraConfigUpdateTopic,
|
||||
)
|
||||
|
||||
|
||||
def publish_camera_section_updates(
|
||||
app: FastAPI, config: FrigateConfig, update_type: CameraConfigUpdateEnum
|
||||
) -> None:
|
||||
"""Broadcast every camera's re-resolved value for a global section.
|
||||
|
||||
Global sections are folded into each camera at parse time and the camera
|
||||
copies are what workers read, so send them rather than leave a worker to
|
||||
guess which cameras were inheriting.
|
||||
"""
|
||||
for camera_name, camera_config in config.cameras.items():
|
||||
settings = getattr(camera_config, update_type.name, None)
|
||||
|
||||
if settings is None:
|
||||
continue
|
||||
|
||||
app.config_publisher.publish_update(
|
||||
CameraConfigUpdateTopic(update_type, camera_name), settings
|
||||
)
|
||||
|
||||
|
||||
def swap_runtime_config(app: FastAPI, config: FrigateConfig) -> None:
|
||||
@@ -16,6 +40,10 @@ def swap_runtime_config(app: FastAPI, config: FrigateConfig) -> None:
|
||||
camera the user turned off would silently come back on.
|
||||
"""
|
||||
app.frigate_config = config
|
||||
|
||||
if app.config_holder is not None:
|
||||
app.config_holder.set(config)
|
||||
|
||||
app.genai_manager.update_config(config)
|
||||
|
||||
if app.profile_manager is not None:
|
||||
|
||||
@@ -35,6 +35,7 @@ from frigate.comms.event_metadata_updater import (
|
||||
)
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.config.camera.updater import CameraConfigUpdatePublisher
|
||||
from frigate.config.holder import ConfigHolder
|
||||
from frigate.config.profile_manager import ProfileManager
|
||||
from frigate.debug_replay import DebugReplayManager, debug_replay_auto_stop_watchdog
|
||||
from frigate.embeddings import EmbeddingsContext
|
||||
@@ -74,6 +75,7 @@ def create_fastapi_app(
|
||||
dispatcher: Dispatcher | None = None,
|
||||
profile_manager: ProfileManager | None = None,
|
||||
enforce_default_admin: bool = True,
|
||||
config_holder: ConfigHolder | None = None,
|
||||
):
|
||||
logger.info("Starting FastAPI app")
|
||||
app = FastAPI(
|
||||
@@ -162,6 +164,7 @@ def create_fastapi_app(
|
||||
app.replay_manager = replay_manager
|
||||
app.dispatcher = dispatcher
|
||||
app.profile_manager = profile_manager
|
||||
app.config_holder = config_holder
|
||||
|
||||
if frigate_config.auth.enabled:
|
||||
secret = get_jwt_secret()
|
||||
|
||||
@@ -574,11 +574,11 @@ async def vod_ts(
|
||||
Recordings.start_time,
|
||||
)
|
||||
.where(
|
||||
Recordings.start_time.between(start_ts, end_ts)
|
||||
| Recordings.end_time.between(start_ts, end_ts)
|
||||
| ((start_ts > Recordings.start_time) & (end_ts < Recordings.end_time))
|
||||
Recordings.camera == camera_name,
|
||||
Recordings.start_time >= start_ts - MAX_SEGMENT_DURATION,
|
||||
Recordings.start_time <= end_ts,
|
||||
Recordings.end_time >= start_ts,
|
||||
)
|
||||
.where(Recordings.camera == camera_name)
|
||||
.order_by(Recordings.start_time.asc())
|
||||
.iterator()
|
||||
)
|
||||
@@ -813,7 +813,7 @@ async def event_snapshot(
|
||||
timestamp_style=request.app.frigate_config.cameras[
|
||||
event.camera
|
||||
].timestamp_style,
|
||||
colormap=request.app.frigate_config.model_for_camera(event.camera).colormap,
|
||||
colormap=request.app.frigate_config.model.colormap,
|
||||
)
|
||||
except DoesNotExist:
|
||||
# see if the object is currently being tracked
|
||||
|
||||
@@ -25,7 +25,7 @@ from frigate.api.defs.query.recordings_query_parameters import (
|
||||
)
|
||||
from frigate.api.defs.response.generic_response import GenericResponse
|
||||
from frigate.api.defs.tags import Tags
|
||||
from frigate.const import RECORD_DIR
|
||||
from frigate.const import MAX_SEGMENT_DURATION, RECORD_DIR
|
||||
from frigate.models import Event, Recordings
|
||||
from frigate.util.time import get_dst_transitions
|
||||
|
||||
@@ -243,6 +243,7 @@ async def recordings(
|
||||
)
|
||||
.where(
|
||||
Recordings.camera == camera_name,
|
||||
Recordings.start_time >= after - MAX_SEGMENT_DURATION,
|
||||
Recordings.end_time >= after,
|
||||
Recordings.start_time <= before,
|
||||
)
|
||||
|
||||
+31
-20
@@ -30,6 +30,7 @@ from frigate.comms.ws import WebSocketClient
|
||||
from frigate.comms.zmq_proxy import ZmqProxy
|
||||
from frigate.config.camera.updater import CameraConfigUpdatePublisher
|
||||
from frigate.config.config import FrigateConfig
|
||||
from frigate.config.holder import ConfigHolder
|
||||
from frigate.config.profile_manager import ProfileManager
|
||||
from frigate.const import (
|
||||
CACHE_DIR,
|
||||
@@ -97,9 +98,7 @@ class FrigateApp:
|
||||
self.metrics_manager = manager
|
||||
self.audio_process: mp.Process | None = None
|
||||
self.stop_event = stop_event
|
||||
self.detection_queues: dict[str, Queue] = {
|
||||
model_key: mp.Queue() for model_key in config.models
|
||||
}
|
||||
self.detection_queue: Queue = mp.Queue()
|
||||
self.detectors: dict[str, ObjectDetectProcess] = {}
|
||||
self.detection_shms: list[mp.shared_memory.SharedMemory] = []
|
||||
self.log_queue: Queue = mp.Queue()
|
||||
@@ -124,7 +123,18 @@ class FrigateApp:
|
||||
self.processes: dict[str, int] = {}
|
||||
self.embeddings: EmbeddingsContext | None = None
|
||||
self.profile_manager: ProfileManager | None = None
|
||||
self.config = config
|
||||
self.config_holder = ConfigHolder(config)
|
||||
|
||||
@property
|
||||
def config(self) -> FrigateConfig:
|
||||
"""The current config, not the one Frigate booted with.
|
||||
|
||||
Read through the holder so the deferred watchdog factories below build
|
||||
a replacement process from the config as it is now. There is no setter
|
||||
on purpose: a plain attribute would let a caller pin this back to a
|
||||
single object and reintroduce the staleness.
|
||||
"""
|
||||
return self.config_holder.config
|
||||
|
||||
def ensure_dirs(self) -> None:
|
||||
dirs = [
|
||||
@@ -365,14 +375,20 @@ class FrigateApp:
|
||||
)
|
||||
|
||||
def start_detectors(self) -> None:
|
||||
for name, camera_config in self.config.cameras.items():
|
||||
camera_model = self.config.models[camera_config.detect.model]
|
||||
|
||||
for name in self.config.cameras.keys():
|
||||
try:
|
||||
largest_frame = max(
|
||||
[
|
||||
det.model.height * det.model.width * 3
|
||||
if det.model is not None
|
||||
else 320
|
||||
for det in self.config.detectors.values()
|
||||
]
|
||||
)
|
||||
shm_in = UntrackedSharedMemory(
|
||||
name=name,
|
||||
create=True,
|
||||
size=camera_model.height * camera_model.width * 3,
|
||||
size=largest_frame,
|
||||
)
|
||||
except FileExistsError:
|
||||
shm_in = UntrackedSharedMemory(name=name)
|
||||
@@ -387,16 +403,11 @@ class FrigateApp:
|
||||
self.detection_shms.append(shm_in)
|
||||
self.detection_shms.append(shm_out)
|
||||
|
||||
for name, detector_config in self.config.detector_instances.items():
|
||||
cameras_using_model = [
|
||||
camera_name
|
||||
for camera_name, camera_config in self.config.cameras.items()
|
||||
if camera_config.detect.model == detector_config.model_key
|
||||
]
|
||||
for name, detector_config in self.config.detectors.items():
|
||||
self.detectors[name] = ObjectDetectProcess(
|
||||
name,
|
||||
self.detection_queues[detector_config.model_key],
|
||||
cameras_using_model,
|
||||
self.detection_queue,
|
||||
list(self.config.cameras.keys()),
|
||||
self.config,
|
||||
detector_config,
|
||||
self.stop_event,
|
||||
@@ -431,7 +442,7 @@ class FrigateApp:
|
||||
def start_camera_processor(self) -> None:
|
||||
self.camera_maintainer = CameraMaintainer(
|
||||
self.config,
|
||||
self.detection_queues,
|
||||
self.detection_queue,
|
||||
self.detected_frames_queue,
|
||||
self.camera_metrics,
|
||||
self.ptz_metrics,
|
||||
@@ -646,6 +657,7 @@ class FrigateApp:
|
||||
self.replay_manager,
|
||||
self.dispatcher,
|
||||
self.profile_manager,
|
||||
config_holder=self.config_holder,
|
||||
),
|
||||
host="127.0.0.1",
|
||||
port=5001,
|
||||
@@ -686,9 +698,8 @@ class FrigateApp:
|
||||
for detector in self.detectors.values():
|
||||
detector.stop()
|
||||
|
||||
for detection_queue in self.detection_queues.values():
|
||||
empty_and_close_queue(detection_queue)
|
||||
logger.info("Detection queues closed")
|
||||
empty_and_close_queue(self.detection_queue)
|
||||
logger.info("Detection queue closed")
|
||||
|
||||
self.detected_frames_processor.join()
|
||||
empty_and_close_queue(self.detected_frames_queue)
|
||||
|
||||
@@ -178,7 +178,7 @@ class CameraActivityManager:
|
||||
return
|
||||
|
||||
for label in camera_config.objects.track:
|
||||
if label in self.config.model_for_camera(camera).non_logo_attributes:
|
||||
if label in self.config.model.non_logo_attributes:
|
||||
continue
|
||||
|
||||
new_count = all_objects[label]
|
||||
|
||||
@@ -29,7 +29,7 @@ class CameraMaintainer(threading.Thread):
|
||||
def __init__(
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
detection_queues: dict[str, Queue],
|
||||
detection_queue: Queue,
|
||||
detected_frames_queue: Queue,
|
||||
camera_metrics: DictProxy,
|
||||
ptz_metrics: dict[str, PTZMetrics],
|
||||
@@ -38,7 +38,7 @@ class CameraMaintainer(threading.Thread):
|
||||
):
|
||||
super().__init__(name="camera_processor")
|
||||
self.config = config
|
||||
self.detection_queues = detection_queues
|
||||
self.detection_queue = detection_queue
|
||||
self.detected_frames_queue = detected_frames_queue
|
||||
self.stop_event = stop_event
|
||||
self.camera_metrics = camera_metrics
|
||||
@@ -79,11 +79,10 @@ class CameraMaintainer(threading.Thread):
|
||||
# create or update region grids for each camera
|
||||
for camera in self.config.cameras.values():
|
||||
assert camera.name is not None
|
||||
camera_model = self.config.models[camera.detect.model]
|
||||
self.region_grids[camera.name] = get_camera_regions_grid(
|
||||
camera.name,
|
||||
camera.detect,
|
||||
max(camera_model.width, camera_model.height),
|
||||
max(self.config.model.width, self.config.model.height),
|
||||
)
|
||||
|
||||
def __calculate_shm_frame_count(self) -> int:
|
||||
@@ -116,8 +115,6 @@ class CameraMaintainer(threading.Thread):
|
||||
|
||||
camera_stop_event = self.__ensure_camera_stop_event(name)
|
||||
|
||||
camera_model = self.config.models[config.detect.model]
|
||||
|
||||
if runtime:
|
||||
self.camera_metrics[name] = CameraMetrics(self.metrics_manager)
|
||||
self.ptz_metrics[name] = PTZMetrics(
|
||||
@@ -126,24 +123,32 @@ class CameraMaintainer(threading.Thread):
|
||||
self.region_grids[name] = get_camera_regions_grid(
|
||||
name,
|
||||
config.detect,
|
||||
max(camera_model.width, camera_model.height),
|
||||
max(self.config.model.width, self.config.model.height),
|
||||
)
|
||||
|
||||
try:
|
||||
largest_frame = max(
|
||||
[
|
||||
det.model.height * det.model.width * 3
|
||||
if det.model is not None
|
||||
else 320
|
||||
for det in self.config.detectors.values()
|
||||
]
|
||||
)
|
||||
UntrackedSharedMemory(name=f"out-{name}", create=True, size=20 * 6 * 4)
|
||||
UntrackedSharedMemory(
|
||||
name=name,
|
||||
create=True,
|
||||
size=camera_model.height * camera_model.width * 3,
|
||||
size=largest_frame,
|
||||
)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
camera_process = CameraTracker(
|
||||
config,
|
||||
camera_model,
|
||||
camera_model.merged_labelmap,
|
||||
self.detection_queues[config.detect.model],
|
||||
self.config.model,
|
||||
self.config.model.merged_labelmap,
|
||||
self.detection_queue,
|
||||
self.detected_frames_queue,
|
||||
self.camera_metrics[name],
|
||||
self.ptz_metrics[name],
|
||||
|
||||
@@ -40,7 +40,6 @@ class CameraState:
|
||||
self.name = name
|
||||
self.config = config
|
||||
self.camera_config = config.cameras[name]
|
||||
self.model_config = config.model_for_camera(name)
|
||||
self.frame_manager = frame_manager
|
||||
self.best_objects: dict[str, TrackedObject] = {}
|
||||
self.tracked_objects: dict[str, TrackedObject] = {}
|
||||
@@ -102,7 +101,7 @@ class CameraState:
|
||||
thickness = 1
|
||||
else:
|
||||
thickness = 2
|
||||
color = self.model_config.colormap.get(
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
else:
|
||||
@@ -126,7 +125,7 @@ class CameraState:
|
||||
and obj["frame_time"] == frame_time
|
||||
):
|
||||
thickness = 5
|
||||
color = self.model_config.colormap.get(
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
|
||||
@@ -262,7 +261,7 @@ class CameraState:
|
||||
if draw_options.get("paths"):
|
||||
for obj in tracked_objects.values():
|
||||
if obj["frame_time"] == frame_time and obj["path_data"]:
|
||||
color = self.model_config.colormap.get(
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
|
||||
@@ -367,7 +366,7 @@ class CameraState:
|
||||
for id in new_ids:
|
||||
logger.debug(f"{self.name}: New tracked object ID: {id}")
|
||||
new_obj = tracked_objects[id] = TrackedObject(
|
||||
self.model_config,
|
||||
self.config.model,
|
||||
self.camera_config,
|
||||
self.config.ui,
|
||||
self.frame_cache,
|
||||
@@ -511,7 +510,7 @@ class CameraState:
|
||||
sub_label = None
|
||||
|
||||
if obj.obj_data.get("sub_label"):
|
||||
if obj.obj_data["sub_label"][0] in self.model_config.all_attributes:
|
||||
if obj.obj_data["sub_label"][0] in self.config.model.all_attributes:
|
||||
label = obj.obj_data["sub_label"][0]
|
||||
else:
|
||||
label = f"{object_type}-verified"
|
||||
|
||||
@@ -156,11 +156,10 @@ class Dispatcher:
|
||||
if camera not in self.config.cameras:
|
||||
return None
|
||||
|
||||
camera_model = self.config.model_for_camera(camera)
|
||||
grid = get_camera_regions_grid(
|
||||
camera,
|
||||
self.config.cameras[camera].detect,
|
||||
max(camera_model.width, camera_model.height),
|
||||
max(self.config.model.width, self.config.model.height),
|
||||
)
|
||||
return grid
|
||||
|
||||
|
||||
@@ -50,11 +50,6 @@ class DetectConfig(FrigateBaseModel):
|
||||
title="Enable object detection",
|
||||
description="Enable or disable object detection for all cameras; can be overridden per-camera.",
|
||||
)
|
||||
model: str | None = Field(
|
||||
default=None,
|
||||
title="Detection model name",
|
||||
description="Name of the model (key under `models`) used by this camera. Defaults to the only defined model, or the model named 'default'.",
|
||||
)
|
||||
height: int | None = Field(
|
||||
default=None,
|
||||
title="Detect height",
|
||||
|
||||
+32
-154
@@ -4,7 +4,6 @@ import io
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from typing import Any, Self
|
||||
|
||||
import numpy as np
|
||||
@@ -12,7 +11,6 @@ from pydantic import (
|
||||
BaseModel,
|
||||
ConfigDict,
|
||||
Field,
|
||||
PrivateAttr,
|
||||
TypeAdapter,
|
||||
ValidationInfo,
|
||||
field_validator,
|
||||
@@ -21,11 +19,7 @@ from pydantic import (
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from frigate.const import REGEX_JSON
|
||||
from frigate.detectors import (
|
||||
DetectorConfig,
|
||||
ModelConfig,
|
||||
assign_detector_instances,
|
||||
)
|
||||
from frigate.detectors import DetectorConfig, ModelConfig
|
||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||
from frigate.plus import PlusApi
|
||||
from frigate.util.builtin import (
|
||||
@@ -115,7 +109,7 @@ DEFAULT_CONFIG = f"""
|
||||
mqtt:
|
||||
enabled: False
|
||||
|
||||
{_render_default_yaml({"detectors": NEW_CONFIG_DETECTORS, "models": {"default": DEFAULT_MODEL}})}
|
||||
{_render_default_yaml({"detectors": NEW_CONFIG_DETECTORS, "model": DEFAULT_MODEL})}
|
||||
cameras: {{}} # No cameras defined, UI wizard should be used
|
||||
version: {CURRENT_CONFIG_VERSION}
|
||||
"""
|
||||
@@ -509,10 +503,10 @@ class FrigateConfig(FrigateBaseModel):
|
||||
title="Detector hardware",
|
||||
description="Configuration for object detectors (CPU, GPU, ONNX backends) and any detector-specific model settings.",
|
||||
)
|
||||
models: dict[str, ModelConfig] = Field(
|
||||
default_factory=lambda: {"default": ModelConfig()},
|
||||
title="Detection models",
|
||||
description="Named object detection models. Cameras select a model with detect.model; detectors are assigned to models automatically.",
|
||||
model: ModelConfig = Field(
|
||||
default_factory=ModelConfig,
|
||||
title="Detection model",
|
||||
description="Settings to configure a custom object detection model and its input shape.",
|
||||
)
|
||||
|
||||
# GenAI config (named provider configs: name -> GenAIConfig)
|
||||
@@ -627,37 +621,11 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
|
||||
_plus_api: PlusApi
|
||||
_detector_instances: dict[str, BaseDetectorConfig] = PrivateAttr(
|
||||
default_factory=dict
|
||||
)
|
||||
|
||||
@property
|
||||
def plus_api(self) -> PlusApi:
|
||||
return self._plus_api
|
||||
|
||||
@property
|
||||
def detector_instances(self) -> dict[str, BaseDetectorConfig]:
|
||||
"""Runtime detector instances expanded per assigned model."""
|
||||
return self._detector_instances
|
||||
|
||||
def model_for_camera(self, camera_name: str) -> ModelConfig:
|
||||
"""Return the detection model config used by the given camera."""
|
||||
return self.models[self.cameras[camera_name].detect.model]
|
||||
|
||||
@field_validator("models")
|
||||
@classmethod
|
||||
def validate_model_names(cls, v: dict[str, ModelConfig]):
|
||||
if not v:
|
||||
raise ValueError("At least one model must be defined under models")
|
||||
|
||||
for name in v.keys():
|
||||
if not re.match(r"^[a-zA-Z0-9_-]+$", name):
|
||||
raise ValueError(
|
||||
f"Invalid model name '{name}'. Model names can only contain letters, numbers, underscores, and hyphens"
|
||||
)
|
||||
|
||||
return v
|
||||
|
||||
@model_validator(mode="after")
|
||||
def post_validation(self, info: ValidationInfo) -> Self:
|
||||
# Load plus api from context, if possible.
|
||||
@@ -703,12 +671,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
|
||||
# set default min_score for object attributes
|
||||
all_model_attributes = {
|
||||
attribute
|
||||
for model in self.models.values()
|
||||
for attribute in model.all_attributes
|
||||
}
|
||||
for attribute in sorted(all_model_attributes):
|
||||
for attribute in self.model.all_attributes:
|
||||
existing = self.objects.filters.get(attribute)
|
||||
if existing is None:
|
||||
self.objects.filters[attribute] = FilterConfig(min_score=0.7)
|
||||
@@ -758,18 +721,8 @@ class FrigateConfig(FrigateBaseModel):
|
||||
exclude_unset=True,
|
||||
)
|
||||
|
||||
# capture raw model dumps before plus models are loaded so detector
|
||||
# instances can run their own detector-specific plus validation
|
||||
raw_model_dumps = {
|
||||
name: model.model_dump(exclude_unset=True, warnings="none")
|
||||
for name, model in self.models.items()
|
||||
}
|
||||
|
||||
for model in self.models.values():
|
||||
model.check_and_load_plus_model(self.plus_api)
|
||||
|
||||
adapter = TypeAdapter(DetectorConfig)
|
||||
for key, detector in self.detectors.items():
|
||||
adapter = TypeAdapter(DetectorConfig)
|
||||
model_dict = (
|
||||
detector
|
||||
if isinstance(detector, dict)
|
||||
@@ -784,6 +737,27 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
detector_config.model = None
|
||||
|
||||
model_config = self.model.model_dump(exclude_unset=True, warnings="none")
|
||||
|
||||
if detector_config.model_path:
|
||||
model_config["path"] = detector_config.model_path
|
||||
|
||||
if "path" not in model_config:
|
||||
if detector_config.type == "cpu" or detector_config.type.endswith(
|
||||
"_tfl"
|
||||
):
|
||||
model_config["path"] = "/cpu_model.tflite"
|
||||
elif detector_config.type == "edgetpu":
|
||||
model_config["path"] = "/edgetpu_model.tflite"
|
||||
elif detector_config.type == "openvino":
|
||||
for default_key, default_value in DEFAULT_MODEL.items():
|
||||
model_config.setdefault(default_key, default_value)
|
||||
|
||||
model = ModelConfig.model_validate(model_config)
|
||||
model.check_and_load_plus_model(self.plus_api, detector_config.type)
|
||||
model.compute_model_hash()
|
||||
labelmap_objects = model.merged_labelmap.values()
|
||||
detector_config.model = model
|
||||
self.detectors[key] = detector_config
|
||||
|
||||
for name, camera in self.cameras.items():
|
||||
@@ -811,21 +785,6 @@ class FrigateConfig(FrigateBaseModel):
|
||||
{"name": name, **merged_config}
|
||||
)
|
||||
|
||||
# resolve which named model this camera uses
|
||||
if camera_config.detect.model is not None:
|
||||
if camera_config.detect.model not in self.models:
|
||||
raise ValueError(
|
||||
f"Camera {name} references model '{camera_config.detect.model}' which is not defined under models. Defined models: {', '.join(self.models.keys())}"
|
||||
)
|
||||
elif len(self.models) == 1:
|
||||
camera_config.detect.model = next(iter(self.models))
|
||||
elif "default" in self.models:
|
||||
camera_config.detect.model = "default"
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Camera {name} does not specify detect.model and multiple models are defined. Set detect.model on the camera or globally, or name one of the models 'default'."
|
||||
)
|
||||
|
||||
if camera_config.ffmpeg.hwaccel_args == "auto":
|
||||
camera_config.ffmpeg.hwaccel_args = self.ffmpeg.hwaccel_args
|
||||
|
||||
@@ -1046,10 +1005,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
verify_profile_overrides_match_base(camera_config)
|
||||
verify_autotrack_zones(camera_config)
|
||||
verify_motion_and_detect(camera_config)
|
||||
verify_objects_track(
|
||||
camera_config,
|
||||
self.models[camera_config.detect.model].merged_labelmap.values(),
|
||||
)
|
||||
verify_objects_track(camera_config, labelmap_objects)
|
||||
verify_lpr_and_face(self, camera_config)
|
||||
|
||||
# Validate camera profiles reference top-level profile definitions
|
||||
@@ -1066,11 +1022,8 @@ class FrigateConfig(FrigateBaseModel):
|
||||
config.name = name
|
||||
|
||||
self.objects.parse_all_objects(self.cameras)
|
||||
for model in self.models.values():
|
||||
model.create_colormap(sorted(self.objects.all_objects))
|
||||
|
||||
# expand detectors into per-model runtime instances
|
||||
self.__build_detector_instances(raw_model_dumps)
|
||||
self.model.create_colormap(sorted(self.objects.all_objects))
|
||||
self.model.check_and_load_plus_model(self.plus_api)
|
||||
|
||||
# Check audio transcription and audio detection requirements
|
||||
if self.audio_transcription.enabled:
|
||||
@@ -1101,81 +1054,6 @@ class FrigateConfig(FrigateBaseModel):
|
||||
|
||||
return self
|
||||
|
||||
def __build_detector_instances(
|
||||
self, raw_model_dumps: dict[str, dict[str, Any]]
|
||||
) -> None:
|
||||
"""Expand detector entries into runtime instances, one per assigned model."""
|
||||
used_models = list(
|
||||
dict.fromkeys(camera.detect.model for camera in self.cameras.values())
|
||||
) or list(self.models.keys())
|
||||
|
||||
unused_models = set(self.models.keys()) - set(used_models)
|
||||
if unused_models:
|
||||
logger.warning(
|
||||
f"Models {', '.join(sorted(unused_models))} are defined but not used by any camera, no detector instances will be created for them"
|
||||
)
|
||||
|
||||
assignments = assign_detector_instances(
|
||||
{key: detector.type for key, detector in self.detectors.items()},
|
||||
used_models,
|
||||
)
|
||||
|
||||
models_per_detector: dict[str, int] = {}
|
||||
for _, detector_key, _ in assignments:
|
||||
models_per_detector[detector_key] = (
|
||||
models_per_detector.get(detector_key, 0) + 1
|
||||
)
|
||||
|
||||
instances: dict[str, BaseDetectorConfig] = {}
|
||||
|
||||
for instance_name, detector_key, model_key in assignments:
|
||||
instance = self.detectors[detector_key].model_copy(deep=True)
|
||||
instance.model_key = model_key
|
||||
|
||||
model_dict = raw_model_dumps[model_key].copy()
|
||||
|
||||
if instance.model_path:
|
||||
if models_per_detector[detector_key] > 1:
|
||||
logger.warning(
|
||||
f"Detector {detector_key} runs multiple models, its model_path will be ignored"
|
||||
)
|
||||
else:
|
||||
model_dict["path"] = instance.model_path
|
||||
|
||||
if "path" not in model_dict:
|
||||
if instance.type == "cpu" or instance.type.endswith("_tfl"):
|
||||
model_dict["path"] = "/cpu_model.tflite"
|
||||
elif instance.type == "edgetpu":
|
||||
model_dict["path"] = "/edgetpu_model.tflite"
|
||||
elif instance.type == "openvino":
|
||||
for default_key, default_value in DEFAULT_MODEL.items():
|
||||
model_dict.setdefault(default_key, default_value)
|
||||
|
||||
model = ModelConfig.model_validate(model_dict)
|
||||
|
||||
try:
|
||||
model.check_and_load_plus_model(self.plus_api, instance.type)
|
||||
except ValueError as e:
|
||||
raise ValueError(f"Model '{model_key}': {e}") from e
|
||||
|
||||
model.compute_model_hash()
|
||||
instance.model = model
|
||||
instances[instance_name] = instance
|
||||
logger.log(
|
||||
logging.INFO if len(used_models) > 1 else logging.DEBUG,
|
||||
f"Detector instance {instance_name} ({instance.type}) will run model '{model_key}'",
|
||||
)
|
||||
|
||||
# populate user-facing detector entries with their first assigned
|
||||
# model for display purposes
|
||||
for instance_name, detector_key, model_key in assignments:
|
||||
detector = self.detectors[detector_key]
|
||||
if detector.model is None:
|
||||
detector.model = instances[instance_name].model
|
||||
detector.model_key = model_key
|
||||
|
||||
self._detector_instances = instances
|
||||
|
||||
@field_validator("cameras")
|
||||
@classmethod
|
||||
def ensure_zones_and_cameras_have_different_names(cls, v: dict[str, CameraConfig]):
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Shared handle on the config object that is current for this instance."""
|
||||
|
||||
from .config import FrigateConfig
|
||||
|
||||
__all__ = ["ConfigHolder"]
|
||||
|
||||
|
||||
class ConfigHolder:
|
||||
"""Indirection for the most recently parsed config.
|
||||
|
||||
/api/config/set re-parses yaml into a brand new FrigateConfig instead of
|
||||
mutating the old one, so any reference captured during startup goes stale
|
||||
the first time a user saves. Anything that has to build something after
|
||||
startup, most importantly the watchdog factories that rebuild a crashed
|
||||
process, must read through a holder rather than close over a config
|
||||
object, or the rebuilt process comes back with the config as it was at
|
||||
boot and silently discards every change made since.
|
||||
|
||||
There is deliberately no setter on the read side: the swap runs in exactly
|
||||
one place (frigate.api.config_util.swap_runtime_config) and everyone else
|
||||
only reads.
|
||||
"""
|
||||
|
||||
def __init__(self, config: FrigateConfig) -> None:
|
||||
self._config = config
|
||||
|
||||
@property
|
||||
def config(self) -> FrigateConfig:
|
||||
"""The config as of the most recent successful save."""
|
||||
return self._config
|
||||
|
||||
def set(self, config: FrigateConfig) -> None:
|
||||
"""Install a freshly parsed config as the current one."""
|
||||
self._config = config
|
||||
@@ -72,10 +72,9 @@ class LicensePlateProcessingMixin:
|
||||
# Object config
|
||||
self.lp_objects: list[str] = []
|
||||
|
||||
for model in self.config.models.values():
|
||||
for obj, attributes in model.attributes_map.items():
|
||||
if "license_plate" in attributes and obj not in self.lp_objects:
|
||||
self.lp_objects.append(obj)
|
||||
for obj, attributes in self.config.model.attributes_map.items():
|
||||
if "license_plate" in attributes:
|
||||
self.lp_objects.append(obj)
|
||||
|
||||
# Detection specific parameters
|
||||
self.min_size = 8
|
||||
|
||||
@@ -231,12 +231,8 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
||||
final_data,
|
||||
thumbs,
|
||||
camera_config.review.genai,
|
||||
list(
|
||||
self.config.model_for_camera(
|
||||
camera_config.name
|
||||
).merged_labelmap.values()
|
||||
),
|
||||
self.config.model_for_camera(camera_config.name).all_attributes,
|
||||
list(self.config.model.merged_labelmap.values()),
|
||||
self.config.model.all_attributes,
|
||||
),
|
||||
).start()
|
||||
|
||||
|
||||
@@ -1,69 +1,11 @@
|
||||
import logging
|
||||
|
||||
from .detector_config import InputTensorEnum, ModelConfig, PixelFormatEnum # noqa: F401
|
||||
from .detector_types import ( # noqa: F401
|
||||
DetectorConfig,
|
||||
DetectorTypeEnum,
|
||||
api_types,
|
||||
detector_supports_multiple_models,
|
||||
)
|
||||
from .detector_types import DetectorConfig, DetectorTypeEnum, api_types # noqa: F401
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def assign_detector_instances(
|
||||
detector_types: dict[str, str],
|
||||
used_models: list[str],
|
||||
) -> list[tuple[str, str, str]]:
|
||||
"""Assign detector entries to models.
|
||||
|
||||
Detector types that support multiple models get one instance per model.
|
||||
Single-model detector entries are round-robin assigned across the models,
|
||||
wrapping around so that every detector entry is assigned.
|
||||
|
||||
Args:
|
||||
detector_types: Detector key to detector type, in config order
|
||||
used_models: Ordered model keys in use by cameras
|
||||
|
||||
Returns:
|
||||
List of (instance_name, detector_key, model_key) assignments
|
||||
"""
|
||||
multi = [
|
||||
key
|
||||
for key, type_key in detector_types.items()
|
||||
if detector_supports_multiple_models(type_key)
|
||||
]
|
||||
single = [key for key in detector_types if key not in multi]
|
||||
|
||||
if not multi and len(single) < len(used_models):
|
||||
single_types = sorted({detector_types[key] for key in single})
|
||||
raise ValueError(
|
||||
f"Detectors {', '.join(single)} (types: {', '.join(single_types)}) can each only run a single model, "
|
||||
f"but {len(used_models)} models are in use ({', '.join(used_models)}). "
|
||||
"Add more detectors, use a detector type that supports multiple models, or reduce the number of models assigned to cameras."
|
||||
)
|
||||
|
||||
assignments: list[tuple[str, str, str]] = []
|
||||
|
||||
for key in multi:
|
||||
for model_key in used_models:
|
||||
instance_name = key if len(used_models) == 1 else f"{key}_{model_key}"
|
||||
assignments.append((instance_name, key, model_key))
|
||||
|
||||
for i, key in enumerate(single):
|
||||
assignments.append((key, key, used_models[i % len(used_models)]))
|
||||
|
||||
instance_names = [name for name, _, _ in assignments]
|
||||
duplicates = {name for name in instance_names if instance_names.count(name) > 1}
|
||||
if duplicates:
|
||||
raise ValueError(
|
||||
f"Detector instance names collide: {', '.join(sorted(duplicates))}. "
|
||||
"Rename the conflicting detectors or models so that expanded instance names (detector_model) are unique."
|
||||
)
|
||||
|
||||
return assignments
|
||||
|
||||
|
||||
def create_detector(detector_config):
|
||||
if detector_config.type == DetectorTypeEnum.cpu:
|
||||
logger.warning(
|
||||
|
||||
@@ -11,10 +11,6 @@ logger = logging.getLogger(__name__)
|
||||
class DetectionApi(ABC):
|
||||
type_key: str
|
||||
supported_models: list[ModelTypeEnum]
|
||||
# whether this detector type can run multiple model instances concurrently
|
||||
# on the same hardware (one detector config entry can be expanded to an
|
||||
# instance per model); single-model detectors serve exactly one model each
|
||||
supports_multiple_models: bool = False
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, detector_config: BaseDetectorConfig):
|
||||
|
||||
@@ -250,11 +250,6 @@ class BaseDetectorConfig(BaseModel):
|
||||
title="Detector specific model path",
|
||||
description="File path to the detector model binary if required by the chosen detector.",
|
||||
)
|
||||
model_key: str | None = Field(
|
||||
default=None,
|
||||
title="Assigned model name",
|
||||
description="Name of the model (key under `models`) this detector instance serves. Set automatically at runtime, users should not set this.",
|
||||
)
|
||||
model_config = ConfigDict(
|
||||
extra="allow", arbitrary_types_allowed=True, protected_namespaces=()
|
||||
)
|
||||
|
||||
@@ -29,12 +29,6 @@ for _, name, _ in _included_modules:
|
||||
api_types = {det.type_key: det for det in DetectionApi.__subclasses__()}
|
||||
|
||||
|
||||
def detector_supports_multiple_models(type_key: str) -> bool:
|
||||
"""Return whether the given detector type can run multiple model instances."""
|
||||
detector = api_types.get(type_key)
|
||||
return bool(detector and getattr(detector, "supports_multiple_models", False))
|
||||
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
pass
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class CpuDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class CpuTfl(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, detector_config: CpuDetectorConfig):
|
||||
# Suppress TFLite delegate creation messages that bypass Python logging
|
||||
|
||||
@@ -41,7 +41,6 @@ class ONNXDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class ONNXDetector(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, detector_config: ONNXDetectorConfig):
|
||||
super().__init__(detector_config)
|
||||
|
||||
@@ -36,7 +36,6 @@ class OvDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class OvDetector(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
supported_models = [
|
||||
ModelTypeEnum.dfine,
|
||||
ModelTypeEnum.rfdetr,
|
||||
@@ -227,12 +226,12 @@ class OvDetector(DetectionApi):
|
||||
|
||||
conf_mask = (image_pred[:, 4] * class_conf.squeeze() >= 0.3).squeeze()
|
||||
# Detections ordered as (x1, y1, x2, y2, obj_conf, class_conf, class_pred)
|
||||
detections = np.concatenate(
|
||||
predictions = np.concatenate(
|
||||
(image_pred[:, :5], class_conf, class_pred), axis=1
|
||||
)
|
||||
detections = detections[conf_mask]
|
||||
predictions = predictions[conf_mask]
|
||||
|
||||
ordered = detections[detections[:, 5].argsort()[::-1]][:20]
|
||||
ordered = predictions[predictions[:, 5].argsort()[::-1]][:20]
|
||||
|
||||
for i, object_detected in enumerate(ordered):
|
||||
detections[i] = self.process_yolo(
|
||||
|
||||
@@ -47,7 +47,6 @@ class RknnDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class Rknn(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, config: RknnDetectorConfig):
|
||||
super().__init__(config)
|
||||
|
||||
@@ -30,7 +30,6 @@ class TeflonDetectorConfig(BaseDetectorConfig):
|
||||
|
||||
class TeflonTfl(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def __init__(self, detector_config: TeflonDetectorConfig):
|
||||
# Location in Debian's mesa-teflon-delegate
|
||||
|
||||
@@ -82,7 +82,6 @@ class HostDeviceMem:
|
||||
|
||||
class TensorRtDetector(DetectionApi):
|
||||
type_key = DETECTOR_KEY
|
||||
supports_multiple_models = True
|
||||
|
||||
def _load_engine(self, model_path):
|
||||
try:
|
||||
|
||||
@@ -159,16 +159,7 @@ class EventProcessor(threading.Thread):
|
||||
if width is None or height is None:
|
||||
return
|
||||
|
||||
# find a detector instance running this camera's model so the
|
||||
# event records the model that produced it
|
||||
camera_detector = next(
|
||||
(
|
||||
detector
|
||||
for detector in self.config.detector_instances.values()
|
||||
if detector.model_key == camera_config.detect.model
|
||||
),
|
||||
list(self.config.detectors.values())[0],
|
||||
)
|
||||
first_detector = list(self.config.detectors.values())[0]
|
||||
|
||||
start_time = event_data["start_time"]
|
||||
end_time = (
|
||||
@@ -238,13 +229,13 @@ class EventProcessor(threading.Thread):
|
||||
Event.thumbnail: event_data.get("thumbnail"),
|
||||
Event.has_clip: event_data["has_clip"],
|
||||
Event.has_snapshot: event_data["has_snapshot"],
|
||||
Event.model_hash: camera_detector.model.model_hash
|
||||
if camera_detector.model
|
||||
Event.model_hash: first_detector.model.model_hash
|
||||
if first_detector.model
|
||||
else None,
|
||||
Event.model_type: camera_detector.model.model_type
|
||||
if camera_detector.model
|
||||
Event.model_type: first_detector.model.model_type
|
||||
if first_detector.model
|
||||
else None,
|
||||
Event.detector_type: camera_detector.type,
|
||||
Event.detector_type: first_detector.type,
|
||||
Event.data: {
|
||||
"box": box,
|
||||
"region": region,
|
||||
|
||||
@@ -23,6 +23,7 @@ from frigate.genai.prompts import (
|
||||
build_review_summary_prompt,
|
||||
)
|
||||
from frigate.models import Event
|
||||
from frigate.util.builtin import has_non_finite_number
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -164,6 +165,15 @@ class GenAIClient:
|
||||
except json.JSONDecodeError as je:
|
||||
logger.error("Failed to parse review description JSON: %s", je)
|
||||
return None
|
||||
|
||||
# model_construct skips validation, so non-finite numbers that
|
||||
# the validated path would have rejected have to be caught here
|
||||
if has_non_finite_number(raw):
|
||||
logger.error(
|
||||
"Discarding review description containing non-finite numbers."
|
||||
)
|
||||
return None
|
||||
|
||||
# observations and confidence are required on the model; fill an empty default
|
||||
# if the response omitted it so attribute access stays safe.
|
||||
raw.setdefault("observations", [])
|
||||
|
||||
+68
-120
@@ -262,6 +262,10 @@ def get_tool_definitions(
|
||||
`attribute` parameter is exposed for filtering by their labels. When the
|
||||
embeddings model only understands English (JinaV1), the `semantic_query`
|
||||
description instructs the model to write the query in English.
|
||||
|
||||
Descriptions here stay mechanical: which tool to reach for, and how the
|
||||
filters relate to each other, is stated once in the system prompt so the
|
||||
guidance is not paid for twice on every request.
|
||||
"""
|
||||
search_objects_properties: dict[str, Any] = {
|
||||
"camera": {
|
||||
@@ -270,26 +274,13 @@ def get_tool_definitions(
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": (
|
||||
"Generic object class to filter by — one of the tracked detector "
|
||||
"labels such as 'person', 'package', 'car', 'dog', 'bird'. Use "
|
||||
"this for broad queries like 'show me all cars today'. Combine "
|
||||
"with semantic_query when the user also describes appearance or "
|
||||
"behavior (e.g. label='person', semantic_query='riding a lawn "
|
||||
"mower')."
|
||||
),
|
||||
"description": "Tracked object class to filter by.",
|
||||
},
|
||||
"sub_label": {
|
||||
"type": "string",
|
||||
"description": (
|
||||
"Filter by a DISCRETE NAMED entity recognized in the detection. "
|
||||
"Use this for: a known person's name ('John'), a delivery "
|
||||
"company ('Amazon', 'UPS'), a recognized animal species or "
|
||||
"breed ('blue jay', 'cardinal', 'golden retriever'), or a "
|
||||
"license plate string. When filtering by a specific name, set "
|
||||
"only sub_label and leave label unset. Do NOT use sub_label "
|
||||
"for descriptions of appearance, clothing, or actions — those "
|
||||
"belong in semantic_query."
|
||||
"Name recognized in the detection: a person, delivery company, "
|
||||
"animal species or breed, or license plate."
|
||||
),
|
||||
},
|
||||
"after": {
|
||||
@@ -313,20 +304,11 @@ def get_tool_definitions(
|
||||
}
|
||||
|
||||
if attribute_classifications:
|
||||
model_outline = "; ".join(
|
||||
f"{m['name']} (applies to {', '.join(m['objects']) or 'any object'})"
|
||||
for m in attribute_classifications
|
||||
)
|
||||
search_objects_properties["attribute"] = {
|
||||
"type": "string",
|
||||
"description": (
|
||||
"Filter by a classification attribute label produced by a "
|
||||
"configured attribute classification model. Use this INSTEAD "
|
||||
"of semantic_query when the user's request matches one of "
|
||||
"these classifications. Configured models: "
|
||||
f"{model_outline}. "
|
||||
"Set the value to the attribute label that matches the user's "
|
||||
"phrasing (case-sensitive)."
|
||||
"Attribute label produced by a configured classification model "
|
||||
"(case-sensitive)."
|
||||
),
|
||||
}
|
||||
|
||||
@@ -334,29 +316,12 @@ def get_tool_definitions(
|
||||
search_objects_properties["semantic_query"] = {
|
||||
"type": "string",
|
||||
"description": (
|
||||
"Optional natural-language description of a PHYSICAL "
|
||||
"CHARACTERISTIC, APPEARANCE, or ACTIVITY the user mentioned, "
|
||||
"used to semantically narrow results. Only set this when the "
|
||||
"user describes something beyond what label and sub_label can "
|
||||
"express on their own.\n"
|
||||
"USE for descriptive phrases like: 'riding a lawn mower', "
|
||||
"'wearing a red jacket', 'carrying a package', 'walking a "
|
||||
"dog', 'on a bicycle', 'holding an umbrella'.\n"
|
||||
"DO NOT USE for:\n"
|
||||
"- specific named people, pets, or delivery companies → use sub_label\n"
|
||||
"- animal species or breed names like 'blue jay', 'cardinal', "
|
||||
"'golden retriever' → use sub_label\n"
|
||||
"- license plate strings → use sub_label\n"
|
||||
"- generic object queries like 'all cars today' or 'every "
|
||||
"person' → use label alone with no semantic_query\n"
|
||||
"When set, combine with label/time/camera/zone filters as "
|
||||
"usual (e.g. label='person', semantic_query='riding a lawn "
|
||||
"mower', after='2024-05-01T00:00:00Z')."
|
||||
"Description of an appearance or activity, used to semantically "
|
||||
"narrow results."
|
||||
+ (
|
||||
" The configured embeddings model only understands "
|
||||
"English, so always write semantic_query in English, "
|
||||
"translating the user's description if they phrased it "
|
||||
"in another language."
|
||||
" The configured embeddings model only understands English, so "
|
||||
"always write this in English, translating the user's "
|
||||
"description if they phrased it in another language."
|
||||
if embeddings_language == "english"
|
||||
else ""
|
||||
)
|
||||
@@ -364,26 +329,10 @@ def get_tool_definitions(
|
||||
}
|
||||
|
||||
search_objects_description = (
|
||||
"Search the historical record of detected objects in Frigate. "
|
||||
"Use this ONLY for questions about the PAST — e.g. 'did anyone come by today?', "
|
||||
"'when was the last car?', 'show me detections from yesterday'. "
|
||||
"Do NOT use this for monitoring or alerting requests about future events — "
|
||||
"use start_camera_watch instead for those. "
|
||||
"An 'object' in Frigate represents a tracked detection (e.g., a person, package, car).\n\n"
|
||||
"Choose filters based on what the user is asking for:\n"
|
||||
"- Generic class query ('show me all cars today'): set `label` only.\n"
|
||||
"- Specific NAMED entity (known person, delivery company, animal "
|
||||
"species/breed like 'blue jay' or 'golden retriever', license "
|
||||
"plate): set `sub_label` only and leave `label` unset.\n"
|
||||
"Search the historical record of tracked detections. Use this ONLY for "
|
||||
"questions about the PAST, e.g. 'did anyone come by today?', 'when was the "
|
||||
"last car?'. For alerting on future events use start_camera_watch instead."
|
||||
)
|
||||
if semantic_search_enabled:
|
||||
search_objects_description += (
|
||||
"- Physical CHARACTERISTIC, APPEARANCE, or ACTIVITY that is not a "
|
||||
"discrete name ('person riding a lawn mower', 'someone in a red "
|
||||
"jacket', 'person carrying a package'): set `semantic_query` with "
|
||||
"the descriptive phrase, optionally alongside `label` for the "
|
||||
"object class. Do NOT put descriptive phrases in sub_label."
|
||||
)
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -398,20 +347,34 @@ def get_tool_definitions(
|
||||
"required": [],
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "get_categorized_object_names",
|
||||
"description": (
|
||||
"Every name that can be attached as a sub_label, grouped by object "
|
||||
"type: recognized faces, named license plates, classification "
|
||||
"categories, and delivery logos."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"object_type": {
|
||||
"type": "string",
|
||||
"description": "Optional object label (e.g. 'person', 'car'). Omit for all.",
|
||||
},
|
||||
},
|
||||
"required": [],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "find_similar_objects",
|
||||
"description": (
|
||||
"Find tracked objects that are visually and semantically similar "
|
||||
"to a specific past event. Use this when the user references a "
|
||||
"particular object they have seen and wants to find other "
|
||||
"sightings of the same or similar one ('that green car', 'the "
|
||||
"person in the red jacket', 'the package that was delivered'). "
|
||||
"Prefer this over search_objects whenever the user's intent is "
|
||||
"'find more like this specific one.' Use search_objects first "
|
||||
"only if you need to locate the anchor event. Requires semantic "
|
||||
"search to be enabled."
|
||||
"Find tracked objects visually and semantically similar to a "
|
||||
"specific past event. Requires semantic search to be enabled."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -473,9 +436,8 @@ def get_tool_definitions(
|
||||
"function": {
|
||||
"name": "set_camera_state",
|
||||
"description": (
|
||||
"Change a camera's feature state (e.g., turn detection on/off, enable/disable recordings). "
|
||||
"Use camera='*' to apply to all cameras at once. "
|
||||
"Only call this tool when the user explicitly asks to change a camera setting. "
|
||||
"Change a camera's feature state, e.g. turn detection on or off. "
|
||||
"Only call this when the user explicitly asks to change a setting. "
|
||||
"Requires admin privileges."
|
||||
),
|
||||
"parameters": {
|
||||
@@ -517,7 +479,7 @@ def get_tool_definitions(
|
||||
},
|
||||
"value": {
|
||||
"type": "string",
|
||||
"description": "The value to set. ON or OFF for toggles, a number for thresholds, a profile name or 'none' for profile.",
|
||||
"description": "The value to set, as accepted by the chosen feature.",
|
||||
},
|
||||
},
|
||||
"required": ["camera", "feature", "value"],
|
||||
@@ -529,11 +491,9 @@ def get_tool_definitions(
|
||||
"function": {
|
||||
"name": "get_live_context",
|
||||
"description": (
|
||||
"Get the current live image and detection information for a single camera: objects being tracked, "
|
||||
"zones, timestamps. Use this to understand what is visible in the live view. "
|
||||
"Call this when answering questions about what is happening right now on a specific camera. "
|
||||
"Operates on one camera at a time; call the tool again for each additional camera. "
|
||||
"Wildcards and empty values are not accepted."
|
||||
"Current live image and detections (tracked objects, zones, "
|
||||
"timestamps) for one camera. Use this for questions about what is "
|
||||
"happening right now. Call it again for each additional camera."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -541,8 +501,8 @@ def get_tool_definitions(
|
||||
"camera": {
|
||||
"type": "string",
|
||||
"description": (
|
||||
"Exact name of a single camera to get live context for. "
|
||||
"Wildcards (e.g. '*', 'all') and empty strings are not accepted."
|
||||
"Exact name of a single camera. Wildcards (e.g. '*', "
|
||||
"'all') and empty strings are not accepted."
|
||||
),
|
||||
},
|
||||
},
|
||||
@@ -555,10 +515,9 @@ def get_tool_definitions(
|
||||
"function": {
|
||||
"name": "start_camera_watch",
|
||||
"description": (
|
||||
"Start a continuous VLM watch job that monitors a camera and sends a notification "
|
||||
"when a specified condition is met. Use this when the user wants to be alerted about "
|
||||
"a future event, e.g. 'tell me when guests arrive' or 'notify me when the package is picked up'. "
|
||||
"Only one watch job can run at a time. Returns a job ID."
|
||||
"Start a continuous watch job that monitors a camera and notifies "
|
||||
"the user when a condition is met, e.g. 'tell me when guests "
|
||||
"arrive'. Only one watch job can run at a time. Returns a job ID."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -598,10 +557,7 @@ def get_tool_definitions(
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "stop_camera_watch",
|
||||
"description": (
|
||||
"Cancel the currently running VLM watch job. Use this when the user wants to "
|
||||
"stop a previously started watch, e.g. 'stop watching the front door'."
|
||||
),
|
||||
"description": "Cancel the currently running watch job.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
@@ -614,11 +570,9 @@ def get_tool_definitions(
|
||||
"function": {
|
||||
"name": "get_profile_status",
|
||||
"description": (
|
||||
"Get the current profile status including the active profile and "
|
||||
"timestamps of when each profile was last activated. Use this to "
|
||||
"determine time periods for recap requests — e.g. when the user asks "
|
||||
"'what happened while I was away?', call this first to find the relevant "
|
||||
"time window based on profile activation history."
|
||||
"Get the active profile and when each profile was last activated. "
|
||||
"Call this before get_recap to derive the time window for requests "
|
||||
"like 'what happened while I was away?'."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -632,11 +586,9 @@ def get_tool_definitions(
|
||||
"function": {
|
||||
"name": "get_recap",
|
||||
"description": (
|
||||
"Get a recap of all activity (alerts and detections) for a given time period. "
|
||||
"Use this after calling get_profile_status to retrieve what happened during "
|
||||
"a specific window — e.g. 'what happened while I was away?'. Returns a "
|
||||
"chronological list of activity with camera, objects, zones, and GenAI-generated "
|
||||
"descriptions when available. Summarize the results for the user."
|
||||
"Get all activity (alerts and detections) for a time period, as a "
|
||||
"chronological list with camera, objects, zones, and descriptions "
|
||||
"when available. Summarize the results for the user."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -723,14 +675,13 @@ def build_chat_system_prompt(
|
||||
)
|
||||
speed_units_section = f"\n\nReport object speeds to the user in {speed_unit}."
|
||||
|
||||
semantic_search_section = ""
|
||||
filter_routing_section = (
|
||||
"\n\nWhen routing a search_objects call, pick filters by the shape of the user's request:\n"
|
||||
"- Generic class ('show me all cars today'): set `label` only.\n"
|
||||
"- Specific named entity — a known person ('John'), delivery company ('Amazon'), animal species/breed ('blue jay', 'golden retriever'), or license plate: set `sub_label` only and leave `label` unset. Call get_categorized_object_names first and use the exact spelling it returns; a guessed spelling matches nothing. If the name is absent, say it is not configured rather than searching for it."
|
||||
)
|
||||
if semantic_search_enabled:
|
||||
semantic_search_section = (
|
||||
"\n\nWhen routing a search_objects call, pick filters by the shape of the user's request:\n"
|
||||
"- Generic class ('show me all cars today'): set `label` only.\n"
|
||||
"- Specific named entity — a known person ('John'), delivery company ('Amazon'), animal species/breed ('blue jay', 'cardinal', 'golden retriever'), or license plate: set `sub_label` only and leave `label` unset.\n"
|
||||
"- Physical characteristic, appearance, or activity that is NOT a discrete name ('find me people riding a lawn mower', 'someone in a red jacket', 'a person carrying a package'): set `semantic_query` with the descriptive phrase, optionally combined with `label` for the object class. Never put descriptive phrases in `sub_label`."
|
||||
)
|
||||
filter_routing_section += "\n- Physical characteristic, appearance, or activity that is NOT a discrete name ('riding a lawn mower', 'someone in a red jacket'): set `semantic_query` with the descriptive phrase, optionally combined with `label`. Never put descriptive phrases in `sub_label`."
|
||||
|
||||
attribute_classification_section = ""
|
||||
if attribute_classifications:
|
||||
@@ -739,9 +690,9 @@ def build_chat_system_prompt(
|
||||
for m in attribute_classifications
|
||||
)
|
||||
attribute_classification_section = (
|
||||
"\n\nAttribute classification models are configured for the following object types:\n"
|
||||
"\n\nConfigured attribute classification models:\n"
|
||||
f"{model_lines}\n"
|
||||
"When the user's request matches one of these classifications, set the search_objects `attribute` field to the matching label rather than using `semantic_query`. Reserve `semantic_query` for descriptive phrases that fall outside the configured attribute labels."
|
||||
"When the user's request matches one of these classifications, set the search_objects `attribute` field to the matching label (case-sensitive) rather than using `semantic_query`. Reserve `semantic_query` for descriptive phrases outside the configured attribute labels."
|
||||
)
|
||||
|
||||
return f"""You are a helpful assistant for Frigate, a security camera NVR system. You help users answer questions about their cameras, detected objects, and events.
|
||||
@@ -750,9 +701,6 @@ Current server local date and time: {current_date_str} at {current_time_str}
|
||||
|
||||
Do not start your response with phrases like "I will check...", "Let me see...", or "Let me look...". Answer directly.
|
||||
|
||||
Always present times to the user in the server's local timezone. When tool results include start_time_local and end_time_local, use those exact strings when listing or describing detection times—do not convert or invent timestamps. Do not use UTC or ISO format with Z for the user-facing answer unless the tool result only provides Unix timestamps without local time fields.
|
||||
When users ask about "today", "yesterday", "this week", etc., use the current date above as reference.
|
||||
When searching for objects or events, use ISO 8601 format for dates (e.g., {current_date_str}T00:00:00Z for the start of today).
|
||||
Always be accurate with time calculations based on the current date provided.
|
||||
Always present times in the server's local timezone. When tool results include start_time_local and end_time_local, quote those strings exactly; never convert or invent timestamps, and fall back to UTC or ISO format only when a result has no local time fields. Resolve relative dates like "today" or "this week" against the current date above, and pass dates to tools in ISO 8601 (e.g. {current_date_str}T00:00:00Z for the start of today).
|
||||
|
||||
When a user refers to a specific object they have seen or describe with identifying details ("that green car", "the person in the red jacket", "a package left today"), prefer the find_similar_objects tool over search_objects. Use search_objects first only to locate the anchor event, then pass its id to find_similar_objects. For generic queries like "show me all cars today", keep using search_objects. If a user message begins with [attached_event:<id>], treat that event id as the anchor for any similarity or "tell me more" request in the same message and call find_similar_objects with that id.{semantic_search_section}{attribute_classification_section}{cameras_section}{speed_units_section}"""
|
||||
When the user refers to a specific object they have seen ("that green car", "the person in the red jacket", "a package left today"), prefer find_similar_objects over search_objects, using search_objects only to locate the anchor event and passing its id along. Keep search_objects for generic queries like "show me all cars today". If a user message begins with [attached_event:<id>], treat that id as the anchor for any similarity or "tell me more" request in the same message.{filter_routing_section}{attribute_classification_section}{cameras_section}{speed_units_section}"""
|
||||
|
||||
@@ -178,13 +178,10 @@ class OutputProcess(FrigateProcess):
|
||||
)
|
||||
|
||||
if update_topic is not None and birdseye_config is not None:
|
||||
previous_global_mode = self.config.birdseye.mode
|
||||
# only the global-only fields are applied here; the per-camera
|
||||
# enabled and mode arrive on config/cameras/<name>/birdseye,
|
||||
# already resolved against yaml by the config parse
|
||||
self.config.birdseye = birdseye_config
|
||||
|
||||
for camera_config in self.config.cameras.values():
|
||||
if camera_config.birdseye.mode == previous_global_mode:
|
||||
camera_config.birdseye.mode = birdseye_config.mode
|
||||
|
||||
logger.debug("Applied dynamic birdseye config update")
|
||||
|
||||
# check if there is an updated config
|
||||
|
||||
@@ -115,9 +115,11 @@ class PendingReviewSegment:
|
||||
if self._frame is not None:
|
||||
self.thumb_time = datetime.datetime.now().timestamp()
|
||||
self.has_frame = True
|
||||
cv2.imwrite(
|
||||
Path(self.frame_path).parent.mkdir(parents=True, exist_ok=True)
|
||||
if not cv2.imwrite(
|
||||
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
||||
)
|
||||
):
|
||||
logger.error("Failed to write review thumbnail to %s", self.frame_path)
|
||||
|
||||
def save_full_frame(self, camera_config: CameraConfig, frame: np.ndarray) -> None:
|
||||
color_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
|
||||
@@ -128,9 +130,11 @@ class PendingReviewSegment:
|
||||
|
||||
if self._frame is not None:
|
||||
self.has_frame = True
|
||||
cv2.imwrite(
|
||||
Path(self.frame_path).parent.mkdir(parents=True, exist_ok=True)
|
||||
if not cv2.imwrite(
|
||||
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
||||
)
|
||||
):
|
||||
logger.error("Failed to write review thumbnail to %s", self.frame_path)
|
||||
|
||||
def get_data(self, ended: bool) -> dict:
|
||||
end_time = None
|
||||
@@ -374,6 +378,16 @@ class ReviewSegmentMaintainer(threading.Thread):
|
||||
"""Forcibly end the pending segment for a camera."""
|
||||
segment = self.active_review_segments.get(camera)
|
||||
if segment:
|
||||
if self.indefinite_events.get(camera):
|
||||
self.indefinite_events[camera] = {}
|
||||
now = datetime.datetime.now().timestamp()
|
||||
|
||||
if segment.last_alert_time == sys.maxsize:
|
||||
segment.last_alert_time = now
|
||||
|
||||
if segment.last_detection_time == sys.maxsize:
|
||||
segment.last_detection_time = now
|
||||
|
||||
prev_data = segment.get_data(False)
|
||||
return self._publish_segment_end(segment, prev_data)
|
||||
return None
|
||||
@@ -436,10 +450,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
||||
|
||||
if not object["sub_label"]:
|
||||
segment.detections[object["id"]] = object["label"]
|
||||
elif (
|
||||
object["sub_label"][0]
|
||||
in self.config.model_for_camera(segment.camera).all_attributes
|
||||
):
|
||||
elif object["sub_label"][0] in self.config.model.all_attributes:
|
||||
segment.detections[object["id"]] = object["sub_label"][0]
|
||||
else:
|
||||
segment.detections[object["id"]] = f"{object['label']}-verified"
|
||||
@@ -577,10 +588,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
||||
for object in activity.get_all_objects():
|
||||
if not object["sub_label"]:
|
||||
detections[object["id"]] = object["label"]
|
||||
elif (
|
||||
object["sub_label"][0]
|
||||
in self.config.model_for_camera(camera).all_attributes
|
||||
):
|
||||
elif object["sub_label"][0] in self.config.model.all_attributes:
|
||||
detections[object["id"]] = object["sub_label"][0]
|
||||
else:
|
||||
detections[object["id"]] = f"{object['label']}-verified"
|
||||
|
||||
@@ -13,6 +13,7 @@ from frigate.config.camera.updater import (
|
||||
CameraConfigUpdatePublisher,
|
||||
CameraConfigUpdateTopic,
|
||||
)
|
||||
from frigate.config.holder import ConfigHolder
|
||||
from frigate.models import Event, Recordings, ReviewSegment
|
||||
from frigate.test.http_api.base_http_test import AuthTestClient, BaseTestHttp
|
||||
|
||||
@@ -373,6 +374,128 @@ class TestConfigSetWildcardPropagation(BaseTestHttp):
|
||||
finally:
|
||||
os.unlink(config_path)
|
||||
|
||||
@patch("frigate.api.app.find_config_file")
|
||||
def test_global_birdseye_save_fans_out_resolved_camera_configs(
|
||||
self, mock_find_config
|
||||
):
|
||||
"""A global birdseye save must also publish the per-camera values.
|
||||
|
||||
Global birdseye only seeds enabled and mode; the camera copies are what
|
||||
the output process actually reads. Sending just the global object makes
|
||||
a worker guess which cameras were inheriting, and the only available
|
||||
guess (mode still equals the previous global) wrongly claims a camera
|
||||
whose explicit yaml mode happens to match.
|
||||
"""
|
||||
self.minimal_config["birdseye"] = {"enabled": True, "mode": "motion"}
|
||||
# explicit override that matches the global value being replaced
|
||||
self.minimal_config["cameras"]["front_door"]["birdseye"] = {"mode": "motion"}
|
||||
|
||||
config_path = self._write_config_file()
|
||||
mock_find_config.return_value = config_path
|
||||
|
||||
try:
|
||||
app, mock_publisher = self._create_app_with_publisher()
|
||||
with AuthTestClient(app) as client:
|
||||
resp = client.put(
|
||||
"/config/set",
|
||||
json={
|
||||
"config_data": {"birdseye": {"mode": "continuous"}},
|
||||
"update_topic": "config/birdseye",
|
||||
"requires_restart": 0,
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
# the global object still goes out on its own topic
|
||||
mock_publisher.publisher.publish.assert_called_once()
|
||||
topic, settings = mock_publisher.publisher.publish.call_args[0]
|
||||
self.assertEqual(topic, "config/birdseye")
|
||||
self.assertEqual(settings.mode.value, "continuous")
|
||||
|
||||
published = {
|
||||
call[0][0].camera: call[0][1]
|
||||
for call in mock_publisher.publish_update.call_args_list
|
||||
}
|
||||
self.assertEqual(set(published), {"front_door", "back_yard"})
|
||||
|
||||
for call in mock_publisher.publish_update.call_args_list:
|
||||
self.assertEqual(
|
||||
call[0][0].update_type, CameraConfigUpdateEnum.birdseye
|
||||
)
|
||||
|
||||
# the override survives, the inheriting camera follows global
|
||||
self.assertEqual(published["front_door"].mode.value, "motion")
|
||||
self.assertEqual(published["back_yard"].mode.value, "continuous")
|
||||
finally:
|
||||
os.unlink(config_path)
|
||||
|
||||
@patch("frigate.api.app.find_config_file")
|
||||
def test_save_updates_the_config_holder(self, mock_find_config):
|
||||
"""A save must move the holder onto the freshly parsed config.
|
||||
|
||||
FrigateApp reads the holder when the watchdog rebuilds a crashed
|
||||
process; if the save leaves it on the boot config, that process comes
|
||||
back having lost every change made since Frigate started.
|
||||
"""
|
||||
from fastapi import Request
|
||||
|
||||
from frigate.api.auth import get_allowed_cameras_for_filter, get_current_user
|
||||
from frigate.api.fastapi_app import create_fastapi_app
|
||||
|
||||
config_path = self._write_config_file()
|
||||
mock_find_config.return_value = config_path
|
||||
|
||||
mock_publisher = Mock(spec=CameraConfigUpdatePublisher)
|
||||
mock_publisher.publisher = MagicMock()
|
||||
boot_config = FrigateConfig(**self.minimal_config)
|
||||
holder = ConfigHolder(boot_config)
|
||||
|
||||
try:
|
||||
app = create_fastapi_app(
|
||||
boot_config,
|
||||
self.db,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
mock_publisher,
|
||||
None,
|
||||
enforce_default_admin=False,
|
||||
config_holder=holder,
|
||||
)
|
||||
|
||||
async def mock_get_current_user(request: Request):
|
||||
return {"username": "admin", "role": "admin"}
|
||||
|
||||
async def mock_get_allowed_cameras_for_filter(request: Request):
|
||||
return list(self.minimal_config.get("cameras", {}).keys())
|
||||
|
||||
app.dependency_overrides[get_current_user] = mock_get_current_user
|
||||
app.dependency_overrides[get_allowed_cameras_for_filter] = (
|
||||
mock_get_allowed_cameras_for_filter
|
||||
)
|
||||
|
||||
with AuthTestClient(app) as client:
|
||||
resp = client.put(
|
||||
"/config/set",
|
||||
json={
|
||||
"config_data": {"birdseye": {"inactivity_threshold": 5}},
|
||||
"update_topic": "config/birdseye",
|
||||
"requires_restart": 0,
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
self.assertIsNot(holder.config, boot_config)
|
||||
self.assertIs(holder.config, app.frigate_config)
|
||||
self.assertEqual(holder.config.birdseye.inactivity_threshold, 5)
|
||||
finally:
|
||||
os.unlink(config_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -1,15 +1,73 @@
|
||||
"""Unit tests for recordings/media API endpoints."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytz
|
||||
from fastapi import Request
|
||||
|
||||
from frigate.api.auth import get_allowed_cameras_for_filter, get_current_user
|
||||
from frigate.const import MAX_SEGMENT_DURATION
|
||||
from frigate.models import Recordings
|
||||
from frigate.test.http_api.base_http_test import AuthTestClient, BaseTestHttp
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RangeCase:
|
||||
"""Expected behavior for one segment relative to the requested range.
|
||||
|
||||
Offsets are seconds from REQUEST_START; the request ends at +100 seconds.
|
||||
"""
|
||||
|
||||
name: str
|
||||
start_offset: float
|
||||
end_offset: float
|
||||
included_in_recordings: bool
|
||||
vod_clip_from_ms: int | None = None
|
||||
vod_duration_ms: int | None = None
|
||||
|
||||
|
||||
REQUEST_START = 1000
|
||||
REQUEST_END = 1100
|
||||
RANGE_CASES = (
|
||||
RangeCase("before", -MAX_SEGMENT_DURATION + 1, -1, False),
|
||||
RangeCase("meets_start", -10, 0, True),
|
||||
RangeCase(
|
||||
"overlaps_start",
|
||||
-MAX_SEGMENT_DURATION + 0.5,
|
||||
0.25,
|
||||
True,
|
||||
vod_clip_from_ms=599500,
|
||||
vod_duration_ms=250,
|
||||
),
|
||||
RangeCase("starts_at_start", 0, 10, True, vod_duration_ms=10000),
|
||||
RangeCase("inside", 20, 80, True, vod_duration_ms=60000),
|
||||
RangeCase("ends_at_end", 90, 100, True, vod_duration_ms=10000),
|
||||
RangeCase("matches_range", 0, 100, True, vod_duration_ms=100000),
|
||||
RangeCase("starts_with_range", 0, 110, True, vod_duration_ms=100000),
|
||||
RangeCase(
|
||||
"covers_range",
|
||||
-20,
|
||||
120,
|
||||
True,
|
||||
vod_clip_from_ms=20000,
|
||||
vod_duration_ms=100000,
|
||||
),
|
||||
RangeCase(
|
||||
"ends_with_range",
|
||||
-10,
|
||||
100,
|
||||
True,
|
||||
vod_clip_from_ms=10000,
|
||||
vod_duration_ms=100000,
|
||||
),
|
||||
RangeCase("overlaps_end", 95, 105, True, vod_duration_ms=5000),
|
||||
RangeCase("starts_at_end", 100, 110, True),
|
||||
RangeCase("after", 101, 110, False),
|
||||
)
|
||||
|
||||
|
||||
class TestHttpMedia(BaseTestHttp):
|
||||
"""Test media API endpoints, particularly recordings with DST handling."""
|
||||
|
||||
@@ -44,6 +102,26 @@ class TestHttpMedia(BaseTestHttp):
|
||||
self.app.dependency_overrides.clear()
|
||||
super().tearDown()
|
||||
|
||||
def _assert_vod_response(
|
||||
self,
|
||||
response,
|
||||
expected_clips: list[tuple[str, int | None, int]],
|
||||
) -> None:
|
||||
"""Assert VOD clip metadata and its derived duration fields."""
|
||||
assert response.status_code == 200
|
||||
vod = response.json()
|
||||
assert [
|
||||
(
|
||||
clip["path"],
|
||||
clip.get("clipFrom"),
|
||||
clip["keyFrameDurations"][0],
|
||||
)
|
||||
for clip in vod["sequences"][0]["clips"]
|
||||
] == expected_clips
|
||||
expected_durations = [clip[2] for clip in expected_clips]
|
||||
assert vod["durations"] == expected_durations
|
||||
assert vod["segment_duration"] == max(expected_durations)
|
||||
|
||||
def test_recordings_summary_across_dst_spring_forward(self):
|
||||
"""
|
||||
Test recordings summary across spring DST transition (spring forward).
|
||||
@@ -404,6 +482,102 @@ class TestHttpMedia(BaseTestHttp):
|
||||
assert "2024-03-10" in summary
|
||||
assert summary["2024-03-10"] is True
|
||||
|
||||
def test_recordings_handles_all_range_relations(self):
|
||||
"""Recordings return every interval relation that touches the range."""
|
||||
with AuthTestClient(self.app) as client:
|
||||
for case in RANGE_CASES:
|
||||
with self.subTest(case=case.name):
|
||||
Recordings.delete().execute()
|
||||
super().insert_mock_recording(
|
||||
case.name,
|
||||
REQUEST_START + case.start_offset,
|
||||
REQUEST_START + case.end_offset,
|
||||
)
|
||||
|
||||
response = client.get(
|
||||
"/front_door/recordings",
|
||||
params={"after": REQUEST_START, "before": REQUEST_END},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
expected_ids = [case.name] if case.included_in_recordings else []
|
||||
assert [
|
||||
recording["id"] for recording in response.json()
|
||||
] == expected_ids
|
||||
|
||||
def test_vod_handles_all_range_relations(self):
|
||||
"""VOD clips every interval relation with positive playback duration."""
|
||||
with (
|
||||
AuthTestClient(self.app) as client,
|
||||
patch(
|
||||
"frigate.api.media.get_keyframe_before",
|
||||
side_effect=lambda _path, offset: offset,
|
||||
),
|
||||
):
|
||||
for case in RANGE_CASES:
|
||||
with self.subTest(case=case.name):
|
||||
Recordings.delete().execute()
|
||||
super().insert_mock_recording(
|
||||
case.name,
|
||||
REQUEST_START + case.start_offset,
|
||||
REQUEST_START + case.end_offset,
|
||||
)
|
||||
|
||||
response = client.get(
|
||||
f"/vod/front_door/start/{REQUEST_START}/end/{REQUEST_END}"
|
||||
)
|
||||
|
||||
if case.vod_duration_ms is None:
|
||||
assert response.status_code == 404
|
||||
continue
|
||||
|
||||
self._assert_vod_response(
|
||||
response,
|
||||
[
|
||||
(
|
||||
case.name,
|
||||
case.vod_clip_from_ms,
|
||||
case.vod_duration_ms,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
def test_vod_handles_segment_ending_at_start_with_keyframe_fallbacks(self):
|
||||
"""VOD keeps a boundary segment when keyframe lookup extends it."""
|
||||
|
||||
def keyframe_before(path: str, offset: int) -> int | None:
|
||||
return offset - 1000 if path == "previous_keyframe" else None
|
||||
|
||||
with (
|
||||
AuthTestClient(self.app) as client,
|
||||
patch(
|
||||
"frigate.api.media.get_keyframe_before",
|
||||
side_effect=keyframe_before,
|
||||
),
|
||||
):
|
||||
super().insert_mock_recording(
|
||||
"previous_keyframe",
|
||||
REQUEST_START - 10,
|
||||
REQUEST_START,
|
||||
)
|
||||
super().insert_mock_recording(
|
||||
"missing_keyframe",
|
||||
REQUEST_START - 5,
|
||||
REQUEST_START,
|
||||
)
|
||||
|
||||
response = client.get(
|
||||
f"/vod/front_door/start/{REQUEST_START}/end/{REQUEST_END}"
|
||||
)
|
||||
|
||||
self._assert_vod_response(
|
||||
response,
|
||||
[
|
||||
("previous_keyframe", 9000, 1000),
|
||||
("missing_keyframe", None, 5000),
|
||||
],
|
||||
)
|
||||
|
||||
def test_recordings_unavailable_reports_gap_between_recordings(self):
|
||||
"""A gap between two recordings is reported as an unavailable segment."""
|
||||
with AuthTestClient(self.app) as client:
|
||||
|
||||
+9
-181
@@ -86,7 +86,7 @@ class TestConfig(unittest.TestCase):
|
||||
},
|
||||
},
|
||||
# needs to be a file that will exist, doesn't matter what
|
||||
"models": {"default": {"path": "/etc/hosts", "width": 512}},
|
||||
"model": {"path": "/etc/hosts", "width": 512},
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**(deep_merge(config, self.minimal)))
|
||||
@@ -103,7 +103,7 @@ class TestConfig(unittest.TestCase):
|
||||
assert frigate_config.detectors["edgetpu"].device is None
|
||||
assert frigate_config.detectors["openvino"].device is None
|
||||
|
||||
assert frigate_config.models["default"].path == "/etc/hosts"
|
||||
assert frigate_config.model.path == "/etc/hosts"
|
||||
assert frigate_config.detectors["cpu"].model.path == "/cpu_model.tflite"
|
||||
assert frigate_config.detectors["edgetpu"].model.path == "/edgetpu_model.tflite"
|
||||
assert frigate_config.detectors["openvino"].model.path == "/etc/hosts"
|
||||
@@ -956,7 +956,7 @@ class TestConfig(unittest.TestCase):
|
||||
def test_merge_labelmap(self):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"models": {"default": {"labelmap": {7: "truck"}}},
|
||||
"model": {"labelmap": {7: "truck"}},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
@@ -977,7 +977,7 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[7] == "truck"
|
||||
assert frigate_config.model.merged_labelmap[7] == "truck"
|
||||
|
||||
def test_default_labelmap_empty(self):
|
||||
config = {
|
||||
@@ -1002,12 +1002,12 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[0] == "person"
|
||||
assert frigate_config.model.merged_labelmap[0] == "person"
|
||||
|
||||
def test_default_labelmap(self):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"models": {"default": {"width": 320, "height": 320}},
|
||||
"model": {"width": 320, "height": 320},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
@@ -1028,7 +1028,7 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[0] == "person"
|
||||
assert frigate_config.model.merged_labelmap[0] == "person"
|
||||
|
||||
def test_plus_labelmap(self):
|
||||
with open(os.path.join(MODEL_CACHE_DIR, "test"), "w") as f:
|
||||
@@ -1039,7 +1039,7 @@ class TestConfig(unittest.TestCase):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"detectors": {"cpu": {"type": "cpu"}},
|
||||
"models": {"default": {"path": "plus://test"}},
|
||||
"model": {"path": "plus://test"},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
@@ -1060,7 +1060,7 @@ class TestConfig(unittest.TestCase):
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.models["default"].merged_labelmap[0] == "amazon"
|
||||
assert frigate_config.model.merged_labelmap[0] == "amazon"
|
||||
|
||||
def test_fails_on_invalid_role(self):
|
||||
config = {
|
||||
@@ -1765,177 +1765,5 @@ class TestAttributeFilterDefaults(unittest.TestCase):
|
||||
self.assertEqual(face_filter.min_score, 0.3)
|
||||
|
||||
|
||||
class TestMultiModelConfig(unittest.TestCase):
|
||||
"""Tests for named models and detector instance assignment."""
|
||||
|
||||
def setUp(self):
|
||||
self.base = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"models": {
|
||||
"indoor": {"width": 320, "height": 320},
|
||||
"outdoor": {"width": 640, "height": 640},
|
||||
},
|
||||
"cameras": {
|
||||
"living_room": self._camera("indoor"),
|
||||
"driveway": self._camera("outdoor"),
|
||||
},
|
||||
}
|
||||
|
||||
def _camera(self, model=None):
|
||||
camera = {
|
||||
"ffmpeg": {
|
||||
"inputs": [{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}]
|
||||
},
|
||||
"detect": {"height": 1080, "width": 1920, "fps": 5},
|
||||
}
|
||||
|
||||
if model:
|
||||
camera["detect"]["model"] = model
|
||||
|
||||
return camera
|
||||
|
||||
def test_single_model_resolves_implicitly(self):
|
||||
config = FrigateConfig(
|
||||
mqtt={"host": "mqtt"},
|
||||
models={"custom": {"width": 320, "height": 320}},
|
||||
cameras={"back": self._camera()},
|
||||
)
|
||||
assert config.cameras["back"].detect.model == "custom"
|
||||
|
||||
def test_multiple_models_resolve_to_default(self):
|
||||
config = FrigateConfig(
|
||||
mqtt={"host": "mqtt"},
|
||||
models={
|
||||
"default": {"width": 320, "height": 320},
|
||||
"outdoor": {"width": 640, "height": 640},
|
||||
},
|
||||
cameras={"back": self._camera()},
|
||||
)
|
||||
assert config.cameras["back"].detect.model == "default"
|
||||
|
||||
def test_multiple_models_without_default_requires_selection(self):
|
||||
config = self.base.copy()
|
||||
config["cameras"] = {"back": self._camera()}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_camera_references_missing_model(self):
|
||||
config = self.base.copy()
|
||||
config["cameras"] = {"back": self._camera("thermal")}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_global_detect_model_inherited_and_overridden(self):
|
||||
config = self.base.copy()
|
||||
config["detect"] = {"model": "indoor"}
|
||||
config["cameras"] = {
|
||||
"living_room": self._camera(),
|
||||
"driveway": self._camera("outdoor"),
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.cameras["living_room"].detect.model == "indoor"
|
||||
assert frigate_config.cameras["driveway"].detect.model == "outdoor"
|
||||
|
||||
def test_invalid_model_name(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {"bad name!": {"width": 320, "height": 320}}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_multi_model_detector_expands_instances(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"ov0": {"type": "openvino", "device": "GPU"},
|
||||
"ov1": {"type": "openvino", "device": "GPU.1"},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert sorted(frigate_config.detector_instances.keys()) == [
|
||||
"ov0_indoor",
|
||||
"ov0_outdoor",
|
||||
"ov1_indoor",
|
||||
"ov1_outdoor",
|
||||
]
|
||||
assert frigate_config.detector_instances["ov0_indoor"].model_key == "indoor"
|
||||
assert frigate_config.detector_instances["ov0_indoor"].model.width == 320
|
||||
assert frigate_config.detector_instances["ov0_outdoor"].model.width == 640
|
||||
|
||||
def test_multi_model_detector_single_model_keeps_name(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {"default": {"width": 320, "height": 320}}
|
||||
config["cameras"] = {"back": self._camera()}
|
||||
config["detectors"] = {"ov": {"type": "openvino", "device": "GPU"}}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert list(frigate_config.detector_instances.keys()) == ["ov"]
|
||||
assert frigate_config.detector_instances["ov"].model_key == "default"
|
||||
|
||||
def test_single_model_detectors_round_robin(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"coral0": {"type": "edgetpu", "device": "usb:0"},
|
||||
"coral1": {"type": "edgetpu", "device": "usb:1"},
|
||||
"coral2": {"type": "edgetpu", "device": "usb:2"},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assignments = {
|
||||
key: instance.model_key
|
||||
for key, instance in frigate_config.detector_instances.items()
|
||||
}
|
||||
assert assignments == {
|
||||
"coral0": "indoor",
|
||||
"coral1": "outdoor",
|
||||
"coral2": "indoor",
|
||||
}
|
||||
|
||||
def test_single_model_detectors_insufficient_coverage(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {"coral": {"type": "edgetpu", "device": "usb"}}
|
||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||
|
||||
def test_single_model_detector_with_multi_model_detector(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"coral": {"type": "edgetpu", "device": "usb"},
|
||||
"ov": {"type": "openvino", "device": "GPU"},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.detector_instances["coral"].model_key == "indoor"
|
||||
assert frigate_config.detector_instances["ov_indoor"].model_key == "indoor"
|
||||
assert frigate_config.detector_instances["ov_outdoor"].model_key == "outdoor"
|
||||
|
||||
def test_unused_model_gets_no_instances(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {
|
||||
**config["models"],
|
||||
"thermal": {"width": 320, "height": 320},
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
model_keys = {
|
||||
instance.model_key
|
||||
for instance in frigate_config.detector_instances.values()
|
||||
}
|
||||
assert "thermal" not in model_keys
|
||||
|
||||
def test_model_path_ignored_when_detector_runs_multiple_models(self):
|
||||
config = self.base.copy()
|
||||
config["detectors"] = {
|
||||
"cpu": {"type": "cpu", "model_path": "/custom_model.tflite"}
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert (
|
||||
frigate_config.detector_instances["cpu_indoor"].model.path
|
||||
== "/cpu_model.tflite"
|
||||
)
|
||||
|
||||
def test_model_path_applied_when_detector_runs_one_model(self):
|
||||
config = self.base.copy()
|
||||
config["models"] = {"default": {"width": 320, "height": 320}}
|
||||
config["cameras"] = {"back": self._camera()}
|
||||
config["detectors"] = {
|
||||
"cpu": {"type": "cpu", "model_path": "/custom_model.tflite"}
|
||||
}
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert (
|
||||
frigate_config.detector_instances["cpu"].model.path
|
||||
== "/custom_model.tflite"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
"""Tests for config file migration functions."""
|
||||
|
||||
import unittest
|
||||
|
||||
from frigate.util.config import migrate_019_0
|
||||
|
||||
|
||||
class TestMigrate019(unittest.TestCase):
|
||||
def test_migrates_model_to_named_models(self):
|
||||
config = {
|
||||
"version": "0.18-0",
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"model": {"path": "/config/model.tflite", "width": 320, "height": 320},
|
||||
}
|
||||
new_config = migrate_019_0(config)
|
||||
assert "model" not in new_config
|
||||
assert new_config["models"] == {
|
||||
"default": {"path": "/config/model.tflite", "width": 320, "height": 320}
|
||||
}
|
||||
assert new_config["version"] == "0.19-0"
|
||||
|
||||
def test_no_model_defined(self):
|
||||
config = {"version": "0.18-0", "mqtt": {"host": "mqtt"}}
|
||||
new_config = migrate_019_0(config)
|
||||
assert "model" not in new_config
|
||||
assert "models" not in new_config
|
||||
assert new_config["version"] == "0.19-0"
|
||||
|
||||
def test_existing_models_not_overwritten(self):
|
||||
config = {
|
||||
"version": "0.18-0",
|
||||
"model": {"width": 320},
|
||||
"models": {"custom": {"width": 640}},
|
||||
}
|
||||
new_config = migrate_019_0(config)
|
||||
assert "model" not in new_config
|
||||
assert new_config["models"] == {"custom": {"width": 640}}
|
||||
assert new_config["version"] == "0.19-0"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
@@ -4,6 +4,7 @@ import unittest
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from frigate.api.config_util import swap_runtime_config
|
||||
from frigate.config.holder import ConfigHolder
|
||||
|
||||
|
||||
class TestSwapRuntimeConfig(unittest.TestCase):
|
||||
@@ -12,6 +13,7 @@ class TestSwapRuntimeConfig(unittest.TestCase):
|
||||
def _make_app(self) -> MagicMock:
|
||||
app = MagicMock()
|
||||
app.dispatcher.comms = [MagicMock(), MagicMock()]
|
||||
app.config_holder = ConfigHolder(MagicMock(name="boot_config"))
|
||||
return app
|
||||
|
||||
def test_rebinds_all_references(self) -> None:
|
||||
@@ -37,11 +39,40 @@ class TestSwapRuntimeConfig(unittest.TestCase):
|
||||
# the swap rebuilds cameras from yaml, so overrides must be re-layered
|
||||
app.dispatcher.reapply_runtime_state_to_config.assert_called_once_with()
|
||||
|
||||
def test_updates_the_config_holder(self) -> None:
|
||||
app = self._make_app()
|
||||
holder = app.config_holder
|
||||
config = MagicMock(name="new_config")
|
||||
|
||||
swap_runtime_config(app, config)
|
||||
|
||||
self.assertIs(holder.config, config)
|
||||
|
||||
def test_deferred_factory_builds_from_the_swapped_config(self) -> None:
|
||||
"""A watchdog-style factory must not rebuild from the boot config.
|
||||
|
||||
The factories in FrigateApp are lambdas evaluated when a process is
|
||||
restarted, long after a user may have saved. Reading through the
|
||||
holder is what keeps a rebuilt process from reverting every change
|
||||
made since Frigate started.
|
||||
"""
|
||||
app = self._make_app()
|
||||
holder = app.config_holder
|
||||
boot_config = holder.config
|
||||
factory = lambda: holder.config # noqa: E731
|
||||
self.assertIs(factory(), boot_config)
|
||||
|
||||
config = MagicMock(name="new_config")
|
||||
swap_runtime_config(app, config)
|
||||
|
||||
self.assertIs(factory(), config)
|
||||
|
||||
def test_tolerates_missing_optional_collaborators(self) -> None:
|
||||
app = MagicMock()
|
||||
app.profile_manager = None
|
||||
app.stats_emitter = None
|
||||
app.dispatcher = None
|
||||
app.config_holder = None
|
||||
config = MagicMock(name="new_config")
|
||||
|
||||
# must not raise when the optional collaborators are absent
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import unittest
|
||||
from io import StringIO
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from frigate.util.services import get_amd_gpu_stats, get_intel_gpu_stats
|
||||
from frigate.util.services import (
|
||||
get_amd_gpu_stats,
|
||||
get_intel_gpu_stats,
|
||||
get_openvino_npu_stats,
|
||||
)
|
||||
|
||||
|
||||
class TestGpuStats(unittest.TestCase):
|
||||
@@ -17,6 +22,88 @@ class TestGpuStats(unittest.TestCase):
|
||||
amd_stats = get_amd_gpu_stats()
|
||||
assert amd_stats == {"gpu": "4.17%", "mem": "60.37%"}
|
||||
|
||||
@patch("frigate.util.services.time.sleep")
|
||||
@patch("frigate.util.services.time.time", side_effect=[0.0, 1.0])
|
||||
@patch(
|
||||
"frigate.util.services.os.readlink",
|
||||
return_value="/sys/bus/pci/drivers/intel_vpu",
|
||||
)
|
||||
@patch(
|
||||
"frigate.util.services.glob.glob",
|
||||
return_value=["/sys/class/accel/accel0"],
|
||||
)
|
||||
@patch(
|
||||
"builtins.open",
|
||||
side_effect=[StringIO("1000"), StringIO("1250")],
|
||||
)
|
||||
def test_openvino_npu_stats_discovers_accel0(
|
||||
self, open_file, glob, readlink, time, sleep
|
||||
):
|
||||
assert get_openvino_npu_stats() == {"npu": "25.0", "mem": "-%"}
|
||||
|
||||
open_file.assert_any_call(
|
||||
"/sys/class/accel/accel0/device/power/runtime_active_time"
|
||||
)
|
||||
|
||||
@patch("frigate.util.services.time.sleep")
|
||||
@patch("frigate.util.services.time.time", side_effect=[0.0, 1.0])
|
||||
@patch(
|
||||
"frigate.util.services.os.readlink",
|
||||
side_effect=[
|
||||
"/sys/bus/pci/drivers/other",
|
||||
"/sys/bus/pci/drivers/intel_vpu",
|
||||
],
|
||||
)
|
||||
@patch(
|
||||
"frigate.util.services.glob.glob",
|
||||
return_value=[
|
||||
"/sys/class/accel/accel0",
|
||||
"/sys/class/accel/accel1",
|
||||
],
|
||||
)
|
||||
@patch(
|
||||
"builtins.open",
|
||||
side_effect=[StringIO("1000"), StringIO("1250")],
|
||||
)
|
||||
def test_openvino_npu_stats_skips_non_intel_accelerator(
|
||||
self, open_file, glob, readlink, time, sleep
|
||||
):
|
||||
assert get_openvino_npu_stats() == {"npu": "25.0", "mem": "-%"}
|
||||
|
||||
open_file.assert_any_call(
|
||||
"/sys/class/accel/accel1/device/power/runtime_active_time"
|
||||
)
|
||||
|
||||
@patch(
|
||||
"frigate.util.services.os.readlink",
|
||||
return_value="/sys/bus/pci/drivers/other",
|
||||
)
|
||||
@patch(
|
||||
"frigate.util.services.glob.glob",
|
||||
return_value=["/sys/class/accel/accel0"],
|
||||
)
|
||||
@patch("builtins.open")
|
||||
def test_openvino_npu_stats_no_intel_accelerator(self, open_file, glob, readlink):
|
||||
assert get_openvino_npu_stats() is None
|
||||
open_file.assert_not_called()
|
||||
|
||||
@patch(
|
||||
"frigate.util.services.os.readlink",
|
||||
return_value="/sys/bus/pci/drivers/intel_vpu",
|
||||
)
|
||||
@patch(
|
||||
"frigate.util.services.glob.glob",
|
||||
return_value=["/sys/class/accel/accel0"],
|
||||
)
|
||||
@patch("builtins.open", side_effect=FileNotFoundError)
|
||||
def test_openvino_npu_stats_runtime_counter_unavailable(
|
||||
self, open_file, glob, readlink
|
||||
):
|
||||
assert get_openvino_npu_stats() is None
|
||||
open_file.assert_called_once_with(
|
||||
"/sys/class/accel/accel0/device/power/runtime_active_time"
|
||||
)
|
||||
|
||||
@patch("frigate.stats.intel_gpu_info.intel_gpu_name_resolver.get_names")
|
||||
@patch("frigate.util.services.time.sleep")
|
||||
@patch("frigate.util.services.time.monotonic")
|
||||
|
||||
@@ -209,10 +209,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
if obj.obj_data.get("sub_label"):
|
||||
sub_label = obj.obj_data["sub_label"][0]
|
||||
|
||||
if (
|
||||
sub_label
|
||||
in self.config.model_for_camera(camera).all_attribute_logos
|
||||
):
|
||||
if sub_label in self.config.model.all_attribute_logos:
|
||||
self.dispatcher.publish(
|
||||
f"{camera}/{sub_label}/snapshot",
|
||||
jpg_bytes,
|
||||
|
||||
@@ -472,6 +472,18 @@ def sanitize_float(value):
|
||||
return value
|
||||
|
||||
|
||||
def has_non_finite_number(value: Any) -> bool:
|
||||
"""Return True if any number in a parsed JSON value is NaN or infinite."""
|
||||
if isinstance(value, float):
|
||||
return not math.isfinite(value)
|
||||
if isinstance(value, dict):
|
||||
return any(has_non_finite_number(v) for v in value.values())
|
||||
if isinstance(value, list):
|
||||
return any(has_non_finite_number(v) for v in value)
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def cosine_similarity(a: np.ndarray, b: np.ndarray) -> float:
|
||||
return 1 - cosine_distance(a, b)
|
||||
|
||||
|
||||
+1
-29
@@ -20,7 +20,7 @@ from frigate.util.services import get_video_properties
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CURRENT_CONFIG_VERSION = "0.19-0"
|
||||
CURRENT_CONFIG_VERSION = "0.18-0"
|
||||
DEFAULT_CONFIG_FILE = os.path.join(CONFIG_DIR, "config.yml")
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_014(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.14"
|
||||
|
||||
logger.info("Migrating export file names...")
|
||||
@@ -118,7 +117,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_015_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.15-0"
|
||||
|
||||
if previous_version < "0.15-1":
|
||||
@@ -126,7 +124,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_015_1(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.15-1"
|
||||
|
||||
if previous_version < "0.16-0":
|
||||
@@ -134,7 +131,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_016_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.16-0"
|
||||
|
||||
if previous_version < "0.17-0":
|
||||
@@ -142,7 +138,6 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_017_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.17-0"
|
||||
|
||||
if previous_version < "0.18-0":
|
||||
@@ -150,17 +145,8 @@ def migrate_frigate_config(config_file: str):
|
||||
new_config = migrate_018_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.18-0"
|
||||
|
||||
if previous_version < "0.19-0":
|
||||
logger.info(f"Migrating frigate config from {previous_version} to 0.19-0...")
|
||||
new_config = migrate_019_0(config)
|
||||
with open(config_file, "w") as f:
|
||||
yaml.dump(new_config, f)
|
||||
config = new_config
|
||||
previous_version = "0.19-0"
|
||||
|
||||
logger.info("Finished frigate config migration...")
|
||||
|
||||
|
||||
@@ -672,20 +658,6 @@ def migrate_018_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]
|
||||
return new_config
|
||||
|
||||
|
||||
def migrate_019_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:
|
||||
"""Handle migrating frigate config to 0.19-0"""
|
||||
new_config = config.copy()
|
||||
|
||||
# Migrate the single model config to named models
|
||||
model = new_config.pop("model", None)
|
||||
|
||||
if model is not None and "models" not in new_config:
|
||||
new_config["models"] = {"default": model}
|
||||
|
||||
new_config["version"] = "0.19-0"
|
||||
return new_config
|
||||
|
||||
|
||||
def get_relative_coordinates(
|
||||
mask: str | list | None,
|
||||
frame_shape: tuple[int, int],
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
"""Aggregation of the known sub label names an object can be tagged with."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from pathvalidate import sanitize_filename
|
||||
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.config.classification import ObjectClassificationType
|
||||
from frigate.const import CLIPS_DIR, FACE_DIR, MODEL_CACHE_DIR
|
||||
from frigate.util.builtin import load_labels
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# subdirectory of FACE_DIR holding unassigned training images, not a face name
|
||||
FACE_TRAIN_DIR = "train"
|
||||
|
||||
# category used by classification models for "no match", never attached to an object
|
||||
CLASSIFICATION_NONE_CATEGORY = "none"
|
||||
|
||||
|
||||
def get_categorized_object_names(
|
||||
config: FrigateConfig,
|
||||
allowed_cameras: list[str],
|
||||
object_type: str | None = None,
|
||||
) -> dict[str, list[str]]:
|
||||
"""Collect every sub label name this install can attach, by object type.
|
||||
|
||||
Unlike the database-backed /sub_labels endpoint, this reads the config and
|
||||
model files, so it also covers names that are configured but have not been
|
||||
detected yet. Names come from the detector's logo attributes (limited to
|
||||
objects the allowed cameras actually track), LPR known plate names,
|
||||
registered face names, and custom object classification categories.
|
||||
|
||||
Structural attributes such as `face` and `license_plate` are excluded: they
|
||||
describe a part of an object rather than naming it, and are never attached
|
||||
as a sub label.
|
||||
|
||||
Args:
|
||||
config: The running Frigate config
|
||||
allowed_cameras: Cameras the requesting user may see
|
||||
object_type: Optional object label to restrict the result to
|
||||
|
||||
Returns:
|
||||
Mapping of object label to its known sub label names, sorted and
|
||||
deduplicated. Object types with no known names are omitted.
|
||||
"""
|
||||
tracked_objects = _get_tracked_objects(config, allowed_cameras)
|
||||
names: dict[str, set[str]] = {}
|
||||
logos = set(config.model.all_attribute_logos)
|
||||
|
||||
# 1. detector logo attributes, only for objects that are actually tracked
|
||||
for label, label_attributes in config.model.attributes_map.items():
|
||||
if label not in tracked_objects:
|
||||
continue
|
||||
|
||||
label_logos = logos.intersection(label_attributes)
|
||||
|
||||
if label_logos:
|
||||
names.setdefault(label, set()).update(label_logos)
|
||||
|
||||
# 2. LPR known plate names, for objects that can carry a plate
|
||||
if config.lpr.known_plates and _lpr_enabled(config, allowed_cameras):
|
||||
known_plates = set(config.lpr.known_plates)
|
||||
|
||||
for label in _objects_with_attribute(config, tracked_objects, "license_plate"):
|
||||
names.setdefault(label, set()).update(known_plates)
|
||||
|
||||
# 3. registered face names, for objects that can carry a face
|
||||
if _face_recognition_enabled(config, allowed_cameras):
|
||||
face_names = _get_face_names()
|
||||
|
||||
if face_names:
|
||||
for label in _objects_with_attribute(config, tracked_objects, "face"):
|
||||
names.setdefault(label, set()).update(face_names)
|
||||
|
||||
# 4. custom object classification categories
|
||||
for model_key, model_config in config.classification.custom.items():
|
||||
if not model_config.enabled or model_config.object_config is None:
|
||||
continue
|
||||
|
||||
if (
|
||||
model_config.object_config.classification_type
|
||||
!= ObjectClassificationType.sub_label
|
||||
):
|
||||
continue
|
||||
|
||||
categories = _get_classification_categories(model_key)
|
||||
|
||||
if not categories:
|
||||
continue
|
||||
|
||||
for label in model_config.object_config.objects:
|
||||
names.setdefault(label, set()).update(categories)
|
||||
|
||||
return {
|
||||
label: sorted(label_names)
|
||||
for label, label_names in sorted(names.items())
|
||||
if label_names and (object_type is None or label == object_type)
|
||||
}
|
||||
|
||||
|
||||
def _get_tracked_objects(config: FrigateConfig, allowed_cameras: list[str]) -> set[str]:
|
||||
"""Get the union of objects tracked by the cameras the user can see."""
|
||||
tracked: set[str] = set()
|
||||
|
||||
for camera_name in allowed_cameras:
|
||||
camera_config = config.cameras.get(camera_name)
|
||||
|
||||
if camera_config is None:
|
||||
continue
|
||||
|
||||
tracked.update(camera_config.objects.track)
|
||||
|
||||
return tracked
|
||||
|
||||
|
||||
def _objects_with_attribute(
|
||||
config: FrigateConfig, tracked_objects: set[str], attribute: str
|
||||
) -> set[str]:
|
||||
"""Get the tracked objects that a given attribute can be recognized on.
|
||||
|
||||
The attribute may also be tracked as an object in its own right, as
|
||||
`license_plate` is on a dedicated LPR camera, in which case the name is
|
||||
attached to that object directly.
|
||||
"""
|
||||
objects = {
|
||||
label
|
||||
for label, label_attributes in config.model.attributes_map.items()
|
||||
if attribute in label_attributes and label in tracked_objects
|
||||
}
|
||||
|
||||
if attribute in tracked_objects:
|
||||
objects.add(attribute)
|
||||
|
||||
return objects
|
||||
|
||||
|
||||
def _lpr_enabled(config: FrigateConfig, allowed_cameras: list[str]) -> bool:
|
||||
return any(
|
||||
config.cameras[camera_name].lpr.enabled
|
||||
for camera_name in allowed_cameras
|
||||
if camera_name in config.cameras
|
||||
)
|
||||
|
||||
|
||||
def _face_recognition_enabled(
|
||||
config: FrigateConfig, allowed_cameras: list[str]
|
||||
) -> bool:
|
||||
return any(
|
||||
config.cameras[camera_name].face_recognition.enabled
|
||||
for camera_name in allowed_cameras
|
||||
if camera_name in config.cameras
|
||||
)
|
||||
|
||||
|
||||
def _get_face_names() -> set[str]:
|
||||
"""Get the names of every registered face collection."""
|
||||
if not os.path.exists(FACE_DIR):
|
||||
return set()
|
||||
|
||||
try:
|
||||
entries = os.listdir(FACE_DIR)
|
||||
except OSError:
|
||||
logger.debug("Failed to read face directory %s", FACE_DIR)
|
||||
return set()
|
||||
|
||||
return {
|
||||
name
|
||||
for name in entries
|
||||
if name != FACE_TRAIN_DIR and os.path.isdir(os.path.join(FACE_DIR, name))
|
||||
}
|
||||
|
||||
|
||||
def _get_classification_categories(model_key: str) -> set[str]:
|
||||
"""Get the categories a custom classification model can output.
|
||||
|
||||
The trained labelmap is authoritative, but it only exists once the model
|
||||
has been trained, so fall back to the dataset directories that will become
|
||||
the labelmap on the next training run.
|
||||
"""
|
||||
safe_key = sanitize_filename(model_key)
|
||||
categories: set[str] = set()
|
||||
labelmap_path = os.path.join(MODEL_CACHE_DIR, safe_key, "labelmap.txt")
|
||||
|
||||
if os.path.exists(labelmap_path):
|
||||
try:
|
||||
labelmap = load_labels(labelmap_path, prefill=0, indexed=False)
|
||||
except OSError:
|
||||
logger.debug("Failed to read labelmap %s", labelmap_path)
|
||||
labelmap = {}
|
||||
|
||||
categories.update(label for label in labelmap.values() if label)
|
||||
|
||||
dataset_dir = os.path.join(CLIPS_DIR, safe_key, "dataset")
|
||||
|
||||
if os.path.exists(dataset_dir):
|
||||
try:
|
||||
entries = os.listdir(dataset_dir)
|
||||
except OSError:
|
||||
logger.debug("Failed to read dataset directory %s", dataset_dir)
|
||||
entries = []
|
||||
|
||||
categories.update(
|
||||
name for name in entries if os.path.isdir(os.path.join(dataset_dir, name))
|
||||
)
|
||||
|
||||
categories.discard(CLASSIFICATION_NONE_CATEGORY)
|
||||
return categories
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Utilities for services."""
|
||||
|
||||
import asyncio
|
||||
import glob
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -670,19 +671,33 @@ def get_intel_gpu_stats(
|
||||
|
||||
def get_openvino_npu_stats() -> dict[str, str] | None:
|
||||
"""Get NPU stats using openvino."""
|
||||
NPU_RUNTIME_PATH = "/sys/devices/pci0000:00/0000:00:0b.0/power/runtime_active_time"
|
||||
for accel_path in sorted(glob.glob("/sys/class/accel/accel*")):
|
||||
try:
|
||||
driver = os.path.basename(os.readlink(f"{accel_path}/device/driver"))
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
if driver != "intel_vpu":
|
||||
continue
|
||||
|
||||
try:
|
||||
runtime_path = f"{accel_path}/device/power/runtime_active_time"
|
||||
with open(runtime_path) as f:
|
||||
initial_runtime = float(f.read().strip())
|
||||
break
|
||||
except (FileNotFoundError, PermissionError, ValueError):
|
||||
continue
|
||||
else:
|
||||
return None
|
||||
|
||||
try:
|
||||
with open(NPU_RUNTIME_PATH) as f:
|
||||
initial_runtime = float(f.read().strip())
|
||||
|
||||
initial_time = time.time()
|
||||
|
||||
# Sleep for 1 second to get an accurate reading
|
||||
time.sleep(1.0)
|
||||
|
||||
# Read runtime value again
|
||||
with open(NPU_RUNTIME_PATH) as f:
|
||||
with open(runtime_path) as f:
|
||||
current_runtime = float(f.read().strip())
|
||||
|
||||
current_time = time.time()
|
||||
|
||||
@@ -36,8 +36,8 @@ from __future__ import annotations
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import dataclass
|
||||
from typing import Iterable
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
@@ -53,21 +53,31 @@ ARCFACE_INPUT_SIZE = 112
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _bgr_to_rgb(frame: np.ndarray) -> np.ndarray:
|
||||
"""Mirror BaseEmbedding._bgr_to_rgb."""
|
||||
if isinstance(frame, np.ndarray) and frame.ndim == 3:
|
||||
return np.ascontiguousarray(frame[:, :, ::-1])
|
||||
|
||||
return frame
|
||||
|
||||
|
||||
def _process_image_frigate(image: np.ndarray) -> Image.Image:
|
||||
"""Mirror BaseEmbedding._process_image for an ndarray input.
|
||||
|
||||
NOTE: Frigate passes the output of `cv2.imread` (BGR) directly in. PIL's
|
||||
`Image.fromarray` does NOT reorder channels, so the embedder effectively
|
||||
receives a BGR-ordered tensor. We replicate that faithfully here. (Tested
|
||||
— swapping to RGB produces near-identical embeddings; this model is
|
||||
robust to channel order.)
|
||||
`Image.fromarray` does not reorder channels, so whatever order it is
|
||||
handed is what reaches the model. Callers swap to RGB first, exactly as
|
||||
ArcfaceEmbedding._preprocess_inputs does.
|
||||
"""
|
||||
return Image.fromarray(image)
|
||||
|
||||
|
||||
def arcface_preprocess(image_bgr: np.ndarray) -> np.ndarray:
|
||||
"""Mirror ArcfaceEmbedding._preprocess_inputs."""
|
||||
pil = _process_image_frigate(image_bgr)
|
||||
"""Mirror ArcfaceEmbedding._preprocess_inputs.
|
||||
|
||||
Face crops arrive BGR from cv2 and #23712 added the swap to RGB before
|
||||
embedding, so this script has to do it too.
|
||||
"""
|
||||
pil = _process_image_frigate(_bgr_to_rgb(image_bgr))
|
||||
|
||||
width, height = pil.size
|
||||
if width != ARCFACE_INPUT_SIZE or height != ARCFACE_INPUT_SIZE:
|
||||
@@ -138,9 +148,7 @@ class LandmarkAligner:
|
||||
M[0, 2] += tX - eyesCenter[0]
|
||||
M[1, 2] += tY - eyesCenter[1]
|
||||
|
||||
aligned = cv2.warpAffine(
|
||||
image, M, (out_w, out_h), flags=cv2.INTER_CUBIC
|
||||
)
|
||||
aligned = cv2.warpAffine(image, M, (out_w, out_h), flags=cv2.INTER_CUBIC)
|
||||
info = dict(
|
||||
angle=float(angle),
|
||||
eye_dist_px=dist,
|
||||
@@ -433,9 +441,7 @@ def vector_outlier_test(
|
||||
if neg
|
||||
else np.array([])
|
||||
)
|
||||
baseline_conf_neg = np.array(
|
||||
[similarity_to_confidence(c) for c in baseline_neg]
|
||||
)
|
||||
baseline_conf_neg = np.array([similarity_to_confidence(c) for c in baseline_neg])
|
||||
|
||||
print(
|
||||
f"\nBaseline (trim_mean only, {len(pos)} images):"
|
||||
@@ -465,9 +471,7 @@ def vector_outlier_test(
|
||||
mean, keep = iterative_mean(all_embs, T)
|
||||
pos_sims = np.array([cosine(p.embedding, mean) for p in pos])
|
||||
neg_sims = (
|
||||
np.array([cosine(n.embedding, mean) for n in neg])
|
||||
if neg
|
||||
else np.array([])
|
||||
np.array([cosine(n.embedding, mean) for n in neg]) if neg else np.array([])
|
||||
)
|
||||
neg_conf = np.array([similarity_to_confidence(c) for c in neg_sims])
|
||||
margin = pos_sims.min() - (neg_sims.max() if len(neg_sims) else 0)
|
||||
@@ -483,9 +487,7 @@ def vector_outlier_test(
|
||||
# Show which images get dropped at the shipped threshold + neighbors
|
||||
for T_show in (0.25, 0.30, 0.33):
|
||||
_, keep = iterative_mean(all_embs, T_show)
|
||||
print(
|
||||
f"\nAt T={T_show}, the {int((~keep).sum())} dropped positives are:"
|
||||
)
|
||||
print(f"\nAt T={T_show}, the {int((~keep).sum())} dropped positives are:")
|
||||
final_mean = stats.trim_mean(all_embs[keep], base_trim, axis=0)
|
||||
m_n = final_mean / (np.linalg.norm(final_mean) + 1e-9)
|
||||
for i, (p, k) in enumerate(zip(pos, keep)):
|
||||
@@ -501,9 +503,7 @@ def vector_outlier_test(
|
||||
)
|
||||
|
||||
|
||||
def degenerate_embedding_test(
|
||||
pos: list[FaceSample], neg: list[FaceSample]
|
||||
) -> None:
|
||||
def degenerate_embedding_test(pos: list[FaceSample], neg: list[FaceSample]) -> None:
|
||||
"""Detect whether negatives and low-quality positives share a degenerate
|
||||
'tiny/noisy face' region of the embedding space.
|
||||
|
||||
@@ -533,8 +533,7 @@ def degenerate_embedding_test(
|
||||
f"(how tightly negatives cluster together)"
|
||||
)
|
||||
print(
|
||||
f" pos<->pos mean cos : {np.nanmean(pp):.3f} "
|
||||
f"(how tightly positives cluster)"
|
||||
f" pos<->pos mean cos : {np.nanmean(pp):.3f} (how tightly positives cluster)"
|
||||
)
|
||||
print(
|
||||
f" pos<->neg mean cos : {pn.mean():.3f} "
|
||||
@@ -558,11 +557,7 @@ def degenerate_embedding_test(
|
||||
neg_scores = np.array([cosine(n.embedding, clean_mean) for n in neg])
|
||||
neg_confs = np.array([similarity_to_confidence(c) for c in neg_scores])
|
||||
pos_scores = np.array(
|
||||
[
|
||||
cosine(pos[i].embedding, clean_mean)
|
||||
for i in range(len(pos))
|
||||
if keep[i]
|
||||
]
|
||||
[cosine(pos[i].embedding, clean_mean) for i in range(len(pos)) if keep[i]]
|
||||
)
|
||||
print(
|
||||
f"\n mean_intra >= {thresh}: keeping {int(keep.sum())}/{len(pos)} positives"
|
||||
@@ -585,9 +580,7 @@ def degenerate_embedding_test(
|
||||
)
|
||||
|
||||
|
||||
def contamination_analysis(
|
||||
pos: list[FaceSample], neg: list[FaceSample]
|
||||
) -> None:
|
||||
def contamination_analysis(pos: list[FaceSample], neg: list[FaceSample]) -> None:
|
||||
"""Check whether the positive collection contains a second identity.
|
||||
|
||||
Two signals:
|
||||
@@ -617,10 +610,7 @@ def contamination_analysis(
|
||||
"\nPositives closer to a negative than to their own class avg"
|
||||
"\n(these are candidates for mislabeled images):"
|
||||
)
|
||||
print(
|
||||
f"\n{'max_neg':>7} {'mean_neg':>8} {'mean_intra':>10} "
|
||||
f"{'delta':>6} name"
|
||||
)
|
||||
print(f"\n{'max_neg':>7} {'mean_neg':>8} {'mean_intra':>10} {'delta':>6} name")
|
||||
rows = list(zip(pos_names, max_to_neg, mean_to_neg, mean_intra))
|
||||
rows.sort(key=lambda r: -(r[1] - r[3]))
|
||||
for nm, mxn, mnn, mi in rows[:15]:
|
||||
@@ -704,7 +694,9 @@ def main() -> int:
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog=__doc__,
|
||||
)
|
||||
ap.add_argument("--positive", required=True, help="Training folder for one identity")
|
||||
ap.add_argument(
|
||||
"--positive", required=True, help="Training folder for one identity"
|
||||
)
|
||||
ap.add_argument(
|
||||
"--negative",
|
||||
default=None,
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"id": "case-001", "name": "Package Theft Investigation", "description": "Review of suspicious activity near the front porch", "created_at": 1784761296.1184616, "updated_at": 1784836896.1184616}]
|
||||
[{"id": "case-001", "name": "Package Theft Investigation", "description": "Review of suspicious activity near the front porch", "created_at": 1780597809.365581, "updated_at": 1780673409.365581}]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
[{"id": "event-person-001", "label": "person", "sub_label": null, "camera": "front_door", "start_time": 1784840496.1184616, "end_time": 1784840526.1184616, "false_positive": false, "zones": ["front_yard"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "abc123", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.92, "score": 0.92, "region": [0.1, 0.1, 0.5, 0.8], "box": [0.2, 0.15, 0.45, 0.75], "area": 0.18, "ratio": 0.6, "type": "object", "description": "A person walking toward the front door", "average_estimated_speed": 1.2, "velocity_angle": 45.0, "path_data": [[[0.2, 0.5], 0.0], [[0.3, 0.5], 1.0]]}}, {"id": "event-car-001", "label": "car", "sub_label": null, "camera": "backyard", "start_time": 1784836896.1184616, "end_time": 1784836941.1184616, "false_positive": false, "zones": ["driveway"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "def456", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.87, "score": 0.87, "region": [0.3, 0.2, 0.9, 0.7], "box": [0.35, 0.25, 0.85, 0.65], "area": 0.2, "ratio": 1.25, "type": "object", "description": "A car parked in the driveway", "average_estimated_speed": 0.0, "velocity_angle": 0.0, "path_data": []}}, {"id": "event-person-002", "label": "person", "sub_label": null, "camera": "garage", "start_time": 1784833296.1184616, "end_time": 1784833316.1184616, "false_positive": false, "zones": [], "thumbnail": null, "has_clip": false, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "ghi789", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.78, "score": 0.78, "region": [0.0, 0.0, 0.6, 0.9], "box": [0.1, 0.05, 0.5, 0.85], "area": 0.32, "ratio": 0.5, "type": "object", "description": null, "average_estimated_speed": 0.5, "velocity_angle": 90.0, "path_data": [[[0.1, 0.4], 0.0]]}}]
|
||||
[{"id": "event-person-001", "label": "person", "sub_label": null, "camera": "front_door", "start_time": 1780677009.365581, "end_time": 1780677039.365581, "false_positive": false, "zones": ["front_yard"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "abc123", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.92, "score": 0.92, "region": [0.1, 0.1, 0.5, 0.8], "box": [0.2, 0.15, 0.45, 0.75], "area": 0.18, "ratio": 0.6, "type": "object", "description": "A person walking toward the front door", "average_estimated_speed": 1.2, "velocity_angle": 45.0, "path_data": [[[0.2, 0.5], 0.0], [[0.3, 0.5], 1.0]]}}, {"id": "event-car-001", "label": "car", "sub_label": null, "camera": "backyard", "start_time": 1780673409.365581, "end_time": 1780673454.365581, "false_positive": false, "zones": ["driveway"], "thumbnail": null, "has_clip": true, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "def456", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.87, "score": 0.87, "region": [0.3, 0.2, 0.9, 0.7], "box": [0.35, 0.25, 0.85, 0.65], "area": 0.2, "ratio": 1.25, "type": "object", "description": "A car parked in the driveway", "average_estimated_speed": 0.0, "velocity_angle": 0.0, "path_data": []}}, {"id": "event-person-002", "label": "person", "sub_label": null, "camera": "garage", "start_time": 1780669809.365581, "end_time": 1780669829.365581, "false_positive": false, "zones": [], "thumbnail": null, "has_clip": false, "has_snapshot": true, "retain_indefinitely": false, "plus_id": null, "model_hash": "ghi789", "detector_type": "cpu", "model_type": "ssd", "data": {"top_score": 0.78, "score": 0.78, "region": [0.0, 0.0, 0.6, 0.9], "box": [0.1, 0.05, 0.5, 0.85], "area": 0.32, "ratio": 0.5, "type": "object", "description": null, "average_estimated_speed": 0.5, "velocity_angle": 90.0, "path_data": [[[0.1, 0.4], 0.0]]}}]
|
||||
@@ -1 +1 @@
|
||||
[{"id": "export-001", "camera": "front_door", "name": "Front Door - Person Alert", "date": 1784844096.1184616, "video_path": "/exports/export-001.mp4", "thumb_path": "/exports/export-001-thumb.jpg", "in_progress": false, "export_case_id": null}, {"id": "export-002", "camera": "backyard", "name": "Backyard - Car Detection", "date": 1784836896.1184616, "video_path": "/exports/export-002.mp4", "thumb_path": "/exports/export-002-thumb.jpg", "in_progress": false, "export_case_id": "case-001"}, {"id": "export-003", "camera": "garage", "name": "Garage - In Progress", "date": 1784845896.1184616, "video_path": "/exports/export-003.mp4", "thumb_path": "/exports/export-003-thumb.jpg", "in_progress": true, "export_case_id": null}]
|
||||
[{"id": "export-001", "camera": "front_door", "name": "Front Door - Person Alert", "date": 1780680609.365581, "video_path": "/exports/export-001.mp4", "thumb_path": "/exports/export-001-thumb.jpg", "in_progress": false, "export_case_id": null}, {"id": "export-002", "camera": "backyard", "name": "Backyard - Car Detection", "date": 1780673409.365581, "video_path": "/exports/export-002.mp4", "thumb_path": "/exports/export-002-thumb.jpg", "in_progress": false, "export_case_id": "case-001"}, {"id": "export-003", "camera": "garage", "name": "Garage - In Progress", "date": 1780682409.365581, "video_path": "/exports/export-003.mp4", "thumb_path": "/exports/export-003-thumb.jpg", "in_progress": true, "export_case_id": null}]
|
||||
@@ -102,17 +102,11 @@ def generate_config():
|
||||
snapshot = config.model_dump()
|
||||
|
||||
# Runtime-computed fields not in the Pydantic dump
|
||||
for model_dict in snapshot.get("models", {}).values():
|
||||
all_attrs = set()
|
||||
for attrs in model_dict.get("attributes_map", {}).values():
|
||||
all_attrs.update(attrs)
|
||||
model_dict["all_attributes"] = sorted(all_attrs)
|
||||
model_dict["colormap"] = {}
|
||||
|
||||
# legacy single-model block mirrors the default model, matching /api/config
|
||||
models = snapshot.get("models", {})
|
||||
default_key = "default" if "default" in models else next(iter(models))
|
||||
snapshot["model"] = models[default_key]
|
||||
all_attrs = set()
|
||||
for attrs in snapshot.get("model", {}).get("attributes_map", {}).values():
|
||||
all_attrs.update(attrs)
|
||||
snapshot["model"]["all_attributes"] = sorted(all_attrs)
|
||||
snapshot["model"]["colormap"] = {}
|
||||
|
||||
return snapshot
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"2026-07-23": {"day": "2026-07-23", "reviewed_alert": 1, "reviewed_detection": 0, "total_alert": 2, "total_detection": 2}, "2026-07-22": {"day": "2026-07-22", "reviewed_alert": 3, "reviewed_detection": 2, "total_alert": 3, "total_detection": 4}}
|
||||
{"2026-06-05": {"day": "2026-06-05", "reviewed_alert": 1, "reviewed_detection": 0, "total_alert": 2, "total_detection": 2}, "2026-06-04": {"day": "2026-06-04", "reviewed_alert": 3, "reviewed_detection": 2, "total_alert": 3, "total_detection": 4}}
|
||||
@@ -1 +1 @@
|
||||
[{"id": "review-alert-001", "camera": "front_door", "start_time": "2026-07-23T21:01:36.118462", "end_time": "2026-07-23T21:02:06.118462", "has_been_reviewed": false, "severity": "alert", "thumb_path": "/clips/front_door/review-alert-001-thumb.jpg", "data": {"audio": [], "detections": ["person-abc123"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}, {"id": "review-alert-002", "camera": "backyard", "start_time": "2026-07-23T20:01:36.118462", "end_time": "2026-07-23T20:02:21.118462", "has_been_reviewed": true, "severity": "alert", "thumb_path": "/clips/backyard/review-alert-002-thumb.jpg", "data": {"audio": [], "detections": ["car-def456"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["driveway"]}}, {"id": "review-detect-001", "camera": "garage", "start_time": "2026-07-23T19:01:36.118462", "end_time": "2026-07-23T19:01:56.118462", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/garage/review-detect-001-thumb.jpg", "data": {"audio": [], "detections": ["person-ghi789"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": []}}, {"id": "review-detect-002", "camera": "front_door", "start_time": "2026-07-23T18:01:36.118462", "end_time": "2026-07-23T18:01:51.118462", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/front_door/review-detect-002-thumb.jpg", "data": {"audio": [], "detections": ["car-jkl012"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}]
|
||||
[{"id": "review-alert-001", "camera": "front_door", "start_time": "2026-06-05T11:30:09.365581", "end_time": "2026-06-05T11:30:39.365581", "has_been_reviewed": false, "severity": "alert", "thumb_path": "/clips/front_door/review-alert-001-thumb.jpg", "data": {"audio": [], "detections": ["person-abc123"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}, {"id": "review-alert-002", "camera": "backyard", "start_time": "2026-06-05T10:30:09.365581", "end_time": "2026-06-05T10:30:54.365581", "has_been_reviewed": true, "severity": "alert", "thumb_path": "/clips/backyard/review-alert-002-thumb.jpg", "data": {"audio": [], "detections": ["car-def456"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["driveway"]}}, {"id": "review-detect-001", "camera": "garage", "start_time": "2026-06-05T09:30:09.365581", "end_time": "2026-06-05T09:30:29.365581", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/garage/review-detect-001-thumb.jpg", "data": {"audio": [], "detections": ["person-ghi789"], "objects": ["person"], "sub_labels": [], "significant_motion_areas": [], "zones": []}}, {"id": "review-detect-002", "camera": "front_door", "start_time": "2026-06-05T08:30:09.365581", "end_time": "2026-06-05T08:30:24.365581", "has_been_reviewed": false, "severity": "detection", "thumb_path": "/clips/front_door/review-detect-002-thumb.jpg", "data": {"audio": [], "detections": ["car-jkl012"], "objects": ["car"], "sub_labels": [], "significant_motion_areas": [], "zones": ["front_yard"]}}]
|
||||
Generated
+4
-4
@@ -73,7 +73,7 @@
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-router-dom": "^6.30.3",
|
||||
"react-swipeable": "^7.0.2",
|
||||
"react-zoom-pan-pinch": "^3.7.0",
|
||||
"react-zoom-pan-pinch": "3.4.4",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"scroll-into-view-if-needed": "^3.1.0",
|
||||
"sonner": "^2.0.7",
|
||||
@@ -12354,9 +12354,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-zoom-pan-pinch": {
|
||||
"version": "3.7.0",
|
||||
"resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.7.0.tgz",
|
||||
"integrity": "sha512-UmReVZ0TxlKzxSbYiAj+LeGRW8s8LraAFTXRAxzMYnNRgGPsxCudwZKVkjvGmjtx7SW/hZamt69NUmGf4xrkXA==",
|
||||
"version": "3.4.4",
|
||||
"resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.4.4.tgz",
|
||||
"integrity": "sha512-lGTu7D9lQpYEQ6sH+NSlLA7gicgKRW8j+D/4HO1AbSV2POvKRFzdWQ8eI0r3xmOsl4dYQcY+teV6MhULeg1xBw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8",
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-router-dom": "^6.30.3",
|
||||
"react-swipeable": "^7.0.2",
|
||||
"react-zoom-pan-pinch": "^3.7.0",
|
||||
"react-zoom-pan-pinch": "3.4.4",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"scroll-into-view-if-needed": "^3.1.0",
|
||||
"sonner": "^2.0.7",
|
||||
|
||||
@@ -61,7 +61,8 @@
|
||||
"error": {
|
||||
"endTimeMustAfterStartTime": "L'hora de finalització ha de ser posterior a l'hora d'inici",
|
||||
"noVaildTimeSelected": "No s'ha seleccionat un rang de temps vàlid",
|
||||
"failed": "No s'ha pogut inciar l'exportació: {{error}}"
|
||||
"failed": "No s'ha pogut inciar l'exportació: {{error}}",
|
||||
"noValidTimeSelected": "No s'ha seleccionat cap interval de temps vàlid"
|
||||
},
|
||||
"view": "Vista",
|
||||
"queued": "Exporta a la cua. Mostra el progrés a la pàgina d'exportacions.",
|
||||
|
||||
@@ -493,6 +493,9 @@
|
||||
"max_concurrent": {
|
||||
"label": "Màxim d'exportacions concurrents",
|
||||
"description": "Nombre màxim de treballs d'exportació a processar al mateix temps."
|
||||
},
|
||||
"chapters": {
|
||||
"label": "Metadades de capítol per incrustar en els enregistraments exportats"
|
||||
}
|
||||
},
|
||||
"preview": {
|
||||
|
||||
@@ -380,6 +380,9 @@
|
||||
"max_concurrent": {
|
||||
"label": "Màxim d'exportacions concurrents",
|
||||
"description": "Nombre màxim de treballs d'exportació a processar al mateix temps."
|
||||
},
|
||||
"chapters": {
|
||||
"label": "Metadades de capítol per incrustar en els enregistraments exportats"
|
||||
}
|
||||
},
|
||||
"preview": {
|
||||
@@ -1917,7 +1920,7 @@
|
||||
},
|
||||
"model_type": {
|
||||
"label": "Tipus de Model de detecció d'objecte",
|
||||
"description": "Tipus d'arquitectura del model de detector (ssd, yolox, yolonas) usat per l'optimització d'alguns detectors."
|
||||
"description": "Tipus d'arquitectura del model de detector (ssd, yolox, yolonas, yolo-generic, rfdetr, dfine) utilitzat per alguns detectors per a l'optimització"
|
||||
}
|
||||
},
|
||||
"model_path": {
|
||||
@@ -1966,7 +1969,7 @@
|
||||
},
|
||||
"model_type": {
|
||||
"label": "Tipus de model de detecció d'objectes",
|
||||
"description": "Tipus d'arquitectura del model de detector (ssd, yolox, yolonas) utilitzat per alguns detectors per a l'optimització."
|
||||
"description": "Tipus d'arquitectura del model de detector (ssd, yolox, yolonas, yolo-generic, rfdetr, dfine) utilitzat per alguns detectors per a l'optimització."
|
||||
}
|
||||
},
|
||||
"genai": {
|
||||
|
||||
@@ -192,7 +192,20 @@
|
||||
"title": "Edita el model de classificació",
|
||||
"descriptionState": "Edita les classes per a aquest model de classificació d'estats. Els canvis requeriran tornar a entrenar el model.",
|
||||
"descriptionObject": "Edita el tipus d'objecte i el tipus de classificació per a aquest model de classificació d'objectes.",
|
||||
"stateClassesInfo": "Nota: Canviar les classes d'estat requereix tornar a entrenar el model amb les classes actualitzades."
|
||||
"stateClassesInfo": "S'ha actualitzat el model. Restringeix el model perquè els canvis de classe tinguin efecte.",
|
||||
"enabled": "Habilitat",
|
||||
"enabledDesc": "Executa aquest model. Quan està desactivat, deixa d'executar-se i ja no classifica.",
|
||||
"saveAttempts": "Desa els intents",
|
||||
"saveAttemptsDesc": "Nombre d'imatges de classificació que s'intenten mantenir per a les classificacions recents UI.",
|
||||
"motion": "Executa en moviment",
|
||||
"motionDesc": "Executa la classificació quan es detecta el moviment dins de l'escapçat configurat.",
|
||||
"interval": "Interval",
|
||||
"intervalDesc": "Segons entre les classificacions periòdiques. Deixeu-ho buit per a executar-se només en moviment.",
|
||||
"intervalPlaceholder": "Sense interval",
|
||||
"errors": {
|
||||
"saveAttemptsInvalid": "Els intents de desar han de ser un nombre sencer de 0 o més",
|
||||
"intervalInvalid": "L'interval ha de ser un nombre sencer més gran que 0"
|
||||
}
|
||||
},
|
||||
"tooltip": {
|
||||
"trainingInProgress": "El model s'està entrenant actualment",
|
||||
@@ -202,5 +215,6 @@
|
||||
},
|
||||
"none": "Cap",
|
||||
"reclassifyImageAs": "Reclassifica la imatge com a:",
|
||||
"reclassifyImage": "Reclassifica la imatge"
|
||||
"reclassifyImage": "Reclassifica la imatge",
|
||||
"disabled": "Desactivat"
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
},
|
||||
"offset": {
|
||||
"label": "Òfset d'Anotació",
|
||||
"desc": "Aquestes dades provenen del flux de detecció de la càmera, però se superposen a les imatges del flux de gravació. És poc probable que els dos fluxos estiguin perfectament sincronitzats. Com a resultat, el quadre delimitador i les imatges no s'alinearan perfectament. Tanmateix, es pot utilitzar el camp <code>annotation_offset</code> per ajustar-ho.",
|
||||
"desc": "Aquestes dades provenen del canal de detecció de la càmera, però estan sobreposades a les imatges del canal de registre. És poc probable que els dos corrents estiguin perfectament sincronitzats. Com a resultat, la caixa contenidora i les imatges no s'alinearan perfectament. Podeu utilitzar aquest paràmetre per a compensar les anotacions cap endavant o cap enrere en el temps per a alinear-les millor amb el metratge gravat.",
|
||||
"millisecondsToOffset": "Millisegons per l'òfset de detecció d'anotacions per. <em>Per defecte: 0</em>",
|
||||
"tips": "Reduïu el valor si la reproducció del vídeo es troba per davant dels quadres i els punts de ruta, i augmenteu-lo si es troba per darrere. Aquest valor pot ser negatiu.",
|
||||
"toast": {
|
||||
|
||||
@@ -698,7 +698,7 @@
|
||||
"title": "Crear un nou usuari",
|
||||
"confirmPassword": "Siusplau, confirma la contrasenya",
|
||||
"usernameOnlyInclude": "El nom d'usuari només pot contenir lletres, números, . o _",
|
||||
"desc": "Afegeix un nou compte d'usuari i especifica un rol per accedir a àrees de la interfície de Frigate."
|
||||
"desc": "Afegeix un compte d'usuari nou i especifica un rol per a l'accés a les àrees de la interfície d'usuari de Frigate."
|
||||
}
|
||||
},
|
||||
"title": "Usuaris",
|
||||
@@ -1323,7 +1323,7 @@
|
||||
"details": {
|
||||
"edit": "Edita els detalls de la càmera",
|
||||
"title": "Edita els detalls de la càmera",
|
||||
"description": "Actualitza el nom de visualització, l'URL extern i la visibilitat utilitzada per a aquesta càmera a tota la interfície d'usuari de la Fragata.",
|
||||
"description": "Actualitza el nom de visualització, l'URL extern i la visibilitat utilitzada per a aquesta càmera a tota la interfície d'usuari de Frigate.",
|
||||
"friendlyNameLabel": "Nom a mostrar",
|
||||
"friendlyNameHelp": "Nom amistós que es mostra per a aquesta càmera a tota la interfície d'usuari de Frigate. Deixeu-ho en blanc per utilitzar l'ID de la càmera.",
|
||||
"webuiUrlLabel": "URL de la interfície web de la càmera",
|
||||
@@ -1484,7 +1484,7 @@
|
||||
"successMulti_other": "Configuració copiada a {{count}} càmeres",
|
||||
"successMultiWithRestart_one": "Configuració copiada a la càmera {{count}}. Reinicia Frigate per aplicar tots els canvis.",
|
||||
"successMultiWithRestart_many": "Configuració copiada a {{count}} càmeres. Reinicia Frigate per aplicar tots els canvis.",
|
||||
"successMultiWithRestart_other": "Configuració copiada a {{count}} càmeres. Reinicia la fragata per aplicar tots els canvis.",
|
||||
"successMultiWithRestart_other": "Configuració copiada a {{count}} càmeres. Reinicia Frigate per aplicar tots els canvis.",
|
||||
"partialFailure": "{{successCount}} seccions aplicades; «{{failedSection}}» ha fallat: {{errorMessage}}",
|
||||
"partialFailureMulti": "S'ha copiat a {{successCount}} càmera(es); ha fallat {{failed}}: {{errorMessage}}",
|
||||
"newCameraPartialFailure": "S'ha creat la càmera {{cameraName}} però no s'han pogut copiar alguns paràmetres: {{errorMessage}}",
|
||||
@@ -1641,7 +1641,14 @@
|
||||
"keyLabel": "Clau",
|
||||
"valueLabel": "Valor",
|
||||
"keyPlaceholder": "Nou valor",
|
||||
"remove": "Elimina"
|
||||
"remove": "Elimina",
|
||||
"providerNameLabel": "Nom del proveïdor",
|
||||
"providerNamePlaceholder": "p. ex., openai",
|
||||
"variableNameLabel": "Nom de la variable",
|
||||
"variableNamePlaceholder": ". ex., La_Meva_Variable",
|
||||
"loggerNameLabel": "Nom del registrador",
|
||||
"loggerNamePlaceholder": "p. ex., friagte.registre",
|
||||
"keyPatternError": "Utilitza només lletres, números, guions i guions baixos (sense espais)"
|
||||
},
|
||||
"timezone": {
|
||||
"defaultOption": "Utilitza la zona horària del navegador"
|
||||
@@ -2096,7 +2103,8 @@
|
||||
"autotrackingNoZones": "Autotraquejar requereix al menys una zona. Defineix una zona per aquesta cámera a Mascares/Zones, després usa'l com a requerit a la part inferior."
|
||||
},
|
||||
"ffmpeg": {
|
||||
"hwaccelManualNotRecommended": "No es recomanen arguments manuals d'acceleració de maquinari. Tret que existeixi un requisit específic, seleccioneu el predefinit que coincideixi amb el vostre maquinari."
|
||||
"hwaccelManualNotRecommended": "No es recomanen arguments manuals d'acceleració de maquinari. Tret que existeixi un requisit específic, seleccioneu el predefinit que coincideixi amb el vostre maquinari.",
|
||||
"inputsMissingGo2rtcStream": "Una entrada a sota apunta a un restream go2rtc que ja no existeix. Seleccioneu un restream existent o introduïu manualment l'URL de la càmera, en cas contrari aquesta càmera no es connectarà."
|
||||
},
|
||||
"model": {
|
||||
"optimizedFor320": "Frigate està optimitzada per a un model 320x320, que és la millor opció per a la majoria de configuracions. Un model 640x640 és més lent i només ajuda en escenaris específics.",
|
||||
|
||||
@@ -425,5 +425,23 @@
|
||||
"chop": "Sekání",
|
||||
"crack": "Prasknutí",
|
||||
"chink": "Cinknutí",
|
||||
"field_recording": "Nahrávka z terénu"
|
||||
"field_recording": "Nahrávka z terénu",
|
||||
"change_ringing": "Změnit vyzvánění",
|
||||
"liquid": "Tekutina",
|
||||
"splash": "Šplouchnutí",
|
||||
"squish": "Zmáčknout",
|
||||
"drip": "Kapat",
|
||||
"pour": "Lít",
|
||||
"trickle": "Stékat",
|
||||
"fill": "Naplnit",
|
||||
"stir": "Míchat",
|
||||
"boiling": "Vařící",
|
||||
"sonar": "Sonar",
|
||||
"arrow": "Šíp",
|
||||
"electronic_tuner": "Elektronický Ladič",
|
||||
"bang": "Rána",
|
||||
"slap": "Plácnout",
|
||||
"smash": "Rozmlátit",
|
||||
"bouncing": "Odrážející",
|
||||
"scratch": "Škrábat"
|
||||
}
|
||||
|
||||
@@ -86,10 +86,6 @@
|
||||
"label": "Enable object detection",
|
||||
"description": "Enable or disable object detection for this camera."
|
||||
},
|
||||
"model": {
|
||||
"label": "Detection model name",
|
||||
"description": "Name of the model (key under `models`) used by this camera. Defaults to the only defined model, or the model named 'default'."
|
||||
},
|
||||
"height": {
|
||||
"label": "Detect height",
|
||||
"description": "Height (pixels) of frames used for the detect stream; leave empty to use the native stream resolution."
|
||||
|
||||
@@ -329,10 +329,6 @@
|
||||
"label": "Detector specific model path",
|
||||
"description": "File path to the detector model binary if required by the chosen detector."
|
||||
},
|
||||
"model_key": {
|
||||
"label": "Assigned model name",
|
||||
"description": "Name of the model (key under `models`) this detector instance serves. Set automatically at runtime, users should not set this."
|
||||
},
|
||||
"axengine": {
|
||||
"label": "AXEngine NPU",
|
||||
"description": "AXERA AX650N/AX8850N NPU detector running compiled .axmodel files via the AXEngine runtime."
|
||||
@@ -458,9 +454,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models": {
|
||||
"label": "Detection models",
|
||||
"description": "Named object detection models. Cameras select a model with detect.model; detectors are assigned to models automatically.",
|
||||
"model": {
|
||||
"label": "Detection model",
|
||||
"description": "Settings to configure a custom object detection model and its input shape.",
|
||||
"path": {
|
||||
"label": "Custom object detector model path",
|
||||
"description": "Path to a custom detection model file (or plus://<model_id> for Frigate+ models)."
|
||||
@@ -629,10 +625,6 @@
|
||||
"label": "Enable object detection",
|
||||
"description": "Enable or disable object detection for all cameras; can be overridden per-camera."
|
||||
},
|
||||
"model": {
|
||||
"label": "Detection model name",
|
||||
"description": "Name of the model (key under `models`) used by this camera. Defaults to the only defined model, or the model named 'default'."
|
||||
},
|
||||
"height": {
|
||||
"label": "Detect height",
|
||||
"description": "Height (pixels) of frames used for the detect stream; leave empty to use the native stream resolution."
|
||||
|
||||
@@ -125,5 +125,7 @@
|
||||
"baby": "Baby",
|
||||
"baby_stroller": "Baby Stroller",
|
||||
"rickshaw": "Rickshaw",
|
||||
"rodent": "Rodent"
|
||||
"rodent": "Rodent",
|
||||
"possum": "Possum",
|
||||
"garbage_truck": "Garbage Truck"
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
"ask_a": "¿Es este objeto un <code>{{label}}</code>?",
|
||||
"ask_an": "¿Es este objeto un <code>{{label}}</code>?",
|
||||
"ask_full": "¿Es este objeto un <code>{{untranslatedLabel}}</code> ({{translatedLabel}})?"
|
||||
},
|
||||
"toast": {
|
||||
"error": "Error al enviarlo a Frigate+. Por favor, comprueba tu conexión a internet y prueba de nuevo."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -68,7 +71,8 @@
|
||||
"error": {
|
||||
"failed": "No se pudo iniciar la exportación: {{error}}",
|
||||
"noVaildTimeSelected": "No se seleccionó un rango de tiempo válido",
|
||||
"endTimeMustAfterStartTime": "La hora de finalización debe ser posterior a la hora de inicio"
|
||||
"endTimeMustAfterStartTime": "La hora de finalización debe ser posterior a la hora de inicio",
|
||||
"noValidTimeSelected": "Rango de tiempo seleccionado no valido"
|
||||
},
|
||||
"success": "Exportación iniciada con éxito. Ver el archivo en la página exportaciones.",
|
||||
"view": "Vista",
|
||||
|
||||
@@ -273,5 +273,69 @@
|
||||
"sailboat": "Purjekas",
|
||||
"soundtrack_music": "Filmimuusika",
|
||||
"jingle": "Kõlisemine/tilisemine",
|
||||
"theme_music": "Tunnusmuusika"
|
||||
"theme_music": "Tunnusmuusika",
|
||||
"steel_guitar": "Steel Kitarr",
|
||||
"tapping": "Koputamine",
|
||||
"strum": "Klimberdus",
|
||||
"drum_machine": "Trummimasin",
|
||||
"drum": "Trumm",
|
||||
"maraca": "Marakas",
|
||||
"bowed_string_instrument": "Poogenkeelpill",
|
||||
"singing_bowl": "Helikauss",
|
||||
"wind_noise": "Tuulemüra",
|
||||
"rustling_leaves": "Sahisevad lehed",
|
||||
"waves": "Lained",
|
||||
"steam": "Aur",
|
||||
"ship": "Laev",
|
||||
"motor_vehicle": "Mootorsõiduk",
|
||||
"rowboat": "Sõudepaat",
|
||||
"motorboat": "Mootorpaat",
|
||||
"waterfall": "Kosk",
|
||||
"ocean": "Ookean",
|
||||
"rain_on_surface": "Vihm pinnal",
|
||||
"stream": "Oja",
|
||||
"fire": "Tuli",
|
||||
"crackle": "Praksumine",
|
||||
"car_alarm": "Auto alarm",
|
||||
"truck": "Veoauto",
|
||||
"police_car": "Politseiauto",
|
||||
"ambulance": "Kiirabi",
|
||||
"fire_engine": "Tuletõrjeauto",
|
||||
"aircraft": "Lennuk",
|
||||
"aircraft_engine": "Lennukimootor",
|
||||
"jet_engine": "Reaktiivmootor",
|
||||
"propeller": "Propeller",
|
||||
"helicopter": "Helikopter",
|
||||
"fixed-wing_aircraft": "Fikseeritud tiivaga õhusõiduk",
|
||||
"train_horn": "Rongisignaal",
|
||||
"railroad_car": "Kaubavagun",
|
||||
"lawn_mower": "Muruniiduk",
|
||||
"chainsaw": "mootorsaag",
|
||||
"engine": "Mootor",
|
||||
"knock": "Koputus",
|
||||
"alarm": "Häire",
|
||||
"siren": "Sireen",
|
||||
"fire_alarm": "Tulekahjuhäire",
|
||||
"telephone": "Telefon",
|
||||
"telephone_bell_ringing": "Helisev telefon",
|
||||
"ringtone": "Telefonihelin",
|
||||
"smoke_detector": "Suitsuandur",
|
||||
"foghorn": "Udupasun",
|
||||
"whistle": "Vile",
|
||||
"printer": "Printer",
|
||||
"drill": "Puur",
|
||||
"explosion": "Plahvatus",
|
||||
"hammer": "Haamer",
|
||||
"air_conditioning": "Õhukonditsioneer",
|
||||
"gunshot": "Püssilask",
|
||||
"glass": "Klaas",
|
||||
"boom": "Pauk",
|
||||
"fireworks": "Ilutulestik",
|
||||
"static": "Staatiline",
|
||||
"white_noise": "Valge müra",
|
||||
"radio": "Raadio",
|
||||
"television": "Televiisor",
|
||||
"scream": "Karjumine",
|
||||
"pour": "Valamine",
|
||||
"drip": "Tilkumine"
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
"ask_an": "Kas see objekt on <code>{{label}}</code>?",
|
||||
"ask_full": "Kas see objekt on <code>{{untranslatedLabel}}</code> ({{translatedLabel}})?",
|
||||
"label": "Kinnita see silt Frigate+ teenuse jaoks"
|
||||
},
|
||||
"toast": {
|
||||
"error": "Frigate+ teenusesse saatmine ebaõnnestus. Palun kontrolli oma võrguühendust ja proovi uuesti."
|
||||
}
|
||||
},
|
||||
"submitToPlus": {
|
||||
@@ -70,18 +73,79 @@
|
||||
"success": "Eksportimise käivitamine õnnestus. Faili leiad eksportimise lehelt.",
|
||||
"view": "Vaata",
|
||||
"error": {
|
||||
"failed": "Eksportimise käivitamine ei õnnestunud: {{error}}",
|
||||
"failed": "Eksportimise järjekorda lisamine ei õnnestunud: {{error}}",
|
||||
"endTimeMustAfterStartTime": "Ajavahemiku lõpp peab olema peale algust",
|
||||
"noVaildTimeSelected": "Ühtegi kehtivat ajavahemikku pole valitud"
|
||||
}
|
||||
"noVaildTimeSelected": "Ühtegi kehtivat ajavahemikku pole valitud",
|
||||
"noValidTimeSelected": "Ühtegi korrektset ajavahemikku pole valitud"
|
||||
},
|
||||
"queued": "Eksport on järjekorda lisatud. Vaata progressi eksportide lehelt.",
|
||||
"batchSuccess_one": "Alustasin 1 ekspordiga. Avan juhtumi kohe.",
|
||||
"batchSuccess_other": "Alustasin {{count}} ekspordiga. Avan juhtumi kohe.",
|
||||
"batchPartial": "Alustasin {{successful}}/{{total}} ekspordiga. Ebaõnnestunud kaamerad: {{failedCameras}}",
|
||||
"batchFailed": "{{total}} eksporti ebaõnnestus algatada. Ebaõnnestunud kaamerad: {{failedCameras}}",
|
||||
"batchQueuedSuccess_one": "1 eksport järjekorda lisatud. Avan juhtumi kohe.",
|
||||
"batchQueuedSuccess_other": "{{count}} eksporti järjekorda lisatud. Avan juhtumi kohe.",
|
||||
"batchQueuedPartial": "{{successful}}/{{total}} ekspordist on järjekorda lisatud. Ebaõnnestunud kaamerad: {{failedCameras}}",
|
||||
"batchQueueFailed": "{{total}} eksporti ebaõnnestus järjekorda lisada. Ebaõnnestunud kaamerad: {{failedCameras}}"
|
||||
},
|
||||
"fromTimeline": {
|
||||
"saveExport": "Salvesta eksporditud sisu",
|
||||
"previewExport": "Eksporditud sisu eelvaade"
|
||||
"previewExport": "Eksporditud sisu eelvaade",
|
||||
"queueingExport": "Ekspordi järjekorda lisamine...",
|
||||
"useThisRange": "Kasuta seda vahemikku"
|
||||
},
|
||||
"case": {
|
||||
"label": "Juhtum",
|
||||
"placeholder": "Vali juhtum"
|
||||
"placeholder": "Vali juhtum",
|
||||
"newCaseOption": "Ava uus juhtum",
|
||||
"newCaseNamePlaceholder": "Uue juhtumi nimi",
|
||||
"newCaseDescriptionPlaceholder": "Juhtumi kirjeldus",
|
||||
"nonAdminHelp": "Uus juhtum avatakse järnevatele eksportidele."
|
||||
},
|
||||
"queueing": "Ekspordi järjekorda lisamine...",
|
||||
"tabs": {
|
||||
"export": "Üksik kaamera",
|
||||
"multiCamera": "Mitu kaamerat"
|
||||
},
|
||||
"multiCamera": {
|
||||
"timeRange": "Ajavahemik",
|
||||
"selectFromTimeline": "Vali ajajoonelt",
|
||||
"cameraSelection": "Kaamerad",
|
||||
"cameraSelectionHelp": "Selles ajavahemikus tuvastatud objektidega kaamerad on eelvalitud",
|
||||
"searchOrSelectGroup": "Otsi või vali kaamera grupp...",
|
||||
"selectAll": "Vali kõik kaamerad",
|
||||
"clearSelection": "Tühista valik",
|
||||
"selectWithActivity": "Jälgitud objektidega kaamerad",
|
||||
"selectGroup": "Vali grupp",
|
||||
"noMatchingCameras": "Ükski kaamera ei sobitunud otsinguga",
|
||||
"selectedCount": "{{selected}} / {{total}} valitud",
|
||||
"checkingActivity": "Kaamera aktiivsuse kontrollimine...",
|
||||
"noCameras": "Ühtegi kaamerat pole saadaval",
|
||||
"detectionCount_one": "1 jälgitav objekt",
|
||||
"detectionCount_other": "{{count}} jälgitavat objekti",
|
||||
"nameLabel": "Ekspordi nimi",
|
||||
"namePlaceholder": "Valikuline baasnimi nendele eksportidele",
|
||||
"queueingButton": "Ekspordi järjekorda lisamine...",
|
||||
"exportButton_one": "Ekspordi 1 kaamera",
|
||||
"exportButton_other": "Ekspordi {{count}} kaamerat"
|
||||
},
|
||||
"multi": {
|
||||
"title_one": "Ekspordi 1 ülevaade",
|
||||
"title_other": "Espordi {{count}} ülevaadet",
|
||||
"description": "Ekspordi valitud ülevaated. Kõik ekspordid on grupeeritud ühte juhtumisse.",
|
||||
"descriptionNoCase": "Ekspordi kõik valitud juhtumid.",
|
||||
"caseNamePlaceholder": "Ülevaate eksport - {{date}}",
|
||||
"exportButton_one": "Ekspordi 1 ülevaade",
|
||||
"exportButton_other": "Ekspordi {{count}} ülevaadet",
|
||||
"exportingButton": "Ekspordin...",
|
||||
"toast": {
|
||||
"started_one": "Alustasin 1 eksporti. Avan juhtumi kohe.",
|
||||
"started_other": "Alustasin {{count}} ekspordiga. Avan juhtumi kohe.",
|
||||
"startedNoCase_one": "Alustasin 1 ekspordiga.",
|
||||
"startedNoCase_other": "Alustasin {{count}} ekspordiga.",
|
||||
"partial": "Alustasin {{successful}}/{{total}} ekspordiga. Ebaõnnestusid: {{failedItems}}",
|
||||
"failed": "{{total}} ekspordi algatamine ebaõnnestus. Ebaõnnestunud: {{failedItems}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"streaming": {
|
||||
@@ -114,6 +178,14 @@
|
||||
"success": "Selle ülevaadatava objektiga seotud videosisu on kustutatud.",
|
||||
"error": "Kustutamine ei õnnestunud: {{error}}"
|
||||
}
|
||||
},
|
||||
"shareTimestamp": {
|
||||
"label": "Jaotise ajatempel",
|
||||
"title": "Jaotise ajatempel",
|
||||
"description": "Jaga praeguse esituskoha ajatempliga URL-i või vali kohandatud ajatempel. Arvesta, et see ei ole avalik jagamislink ja on kättesaadav ainult kasutajatele, kellel on ligipääs Frigate'ile ja sellele kaamerale.",
|
||||
"custom": "Kohandatud ajatempel",
|
||||
"button": "Jaga ajatempliga linki",
|
||||
"shareTitle": "Frigate ülevaate ajatempel: {{camera}}"
|
||||
}
|
||||
},
|
||||
"imagePicker": {
|
||||
|
||||
@@ -12,11 +12,20 @@
|
||||
"description": "Kasutusel"
|
||||
},
|
||||
"audio": {
|
||||
"label": "Helisündmused"
|
||||
"label": "Heli tuvastus",
|
||||
"min_volume": {
|
||||
"label": "Minimaalne helitase"
|
||||
},
|
||||
"filters": {
|
||||
"label": "Audio filtrid"
|
||||
}
|
||||
},
|
||||
"birdseye": {
|
||||
"mode": {
|
||||
"label": "Jälgimisrežiim"
|
||||
},
|
||||
"order": {
|
||||
"label": "Positsioon"
|
||||
}
|
||||
},
|
||||
"label": "Kaameraseadistus",
|
||||
@@ -25,7 +34,8 @@
|
||||
"threshold": {
|
||||
"description": "Minimaalne sarnasuse punktiskoor (0-1), mis on vajalik selle päästiku käivitamiseks."
|
||||
}
|
||||
}
|
||||
},
|
||||
"label": "Semantiline otsing"
|
||||
},
|
||||
"lpr": {
|
||||
"label": "Sõidukite numbrimärkide tuvastus",
|
||||
@@ -34,6 +44,171 @@
|
||||
"review": {
|
||||
"genai": {
|
||||
"description": "Kontrollib generatiivse tehisaru kasutamist kirjelduste ja kokkuvõtete koostamiseks ülevaatamisele kuuluvate objektide jaoks."
|
||||
},
|
||||
"alerts": {
|
||||
"enabled": {
|
||||
"label": "Luba häired"
|
||||
}
|
||||
}
|
||||
},
|
||||
"audio_transcription": {
|
||||
"label": "Audio transkriptsioon",
|
||||
"live_enabled": {
|
||||
"label": "Reaalajas transkriptsioon"
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Luba heli üleskirjutamine tekstina"
|
||||
}
|
||||
},
|
||||
"detect": {
|
||||
"label": "Objekti tuvastus",
|
||||
"enabled": {
|
||||
"label": "Luba objektituvastus"
|
||||
},
|
||||
"height": {
|
||||
"label": "Tuvastamise kõrgus"
|
||||
},
|
||||
"width": {
|
||||
"label": "Tuvastamise laius"
|
||||
},
|
||||
"fps": {
|
||||
"label": "Tuvastamise kaadrisagedus"
|
||||
},
|
||||
"stationary": {
|
||||
"label": "Püsivate objektide sätted"
|
||||
}
|
||||
},
|
||||
"face_recognition": {
|
||||
"label": "Näotuvastus"
|
||||
},
|
||||
"ffmpeg": {
|
||||
"path": {
|
||||
"label": "FFmpeg asukoht"
|
||||
},
|
||||
"gpu": {
|
||||
"label": "GPU indeks"
|
||||
},
|
||||
"inputs": {
|
||||
"global_args": {
|
||||
"label": "FFmpeg globaalsed argumendid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"live": {
|
||||
"label": "Reaalajas mahamängimine",
|
||||
"height": {
|
||||
"label": "Otseülekande kõrgus"
|
||||
},
|
||||
"quality": {
|
||||
"label": "Otseülekande kvaliteet"
|
||||
},
|
||||
"streams": {
|
||||
"label": "Otseülekande voo nimed"
|
||||
}
|
||||
},
|
||||
"motion": {
|
||||
"label": "Liikumistuvastus",
|
||||
"frame_height": {
|
||||
"label": "Kaadri kõrgus"
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Luba liikumistuvastus"
|
||||
}
|
||||
},
|
||||
"objects": {
|
||||
"label": "Objektid",
|
||||
"filters": {
|
||||
"min_area": {
|
||||
"label": "Minimaalne objekti ala"
|
||||
},
|
||||
"max_area": {
|
||||
"label": "Maksimaalne objekti ala"
|
||||
}
|
||||
},
|
||||
"genai": {
|
||||
"label": "GenAI objekti konfiguratsioon",
|
||||
"required_zones": {
|
||||
"label": "Nõutud tsoonid"
|
||||
},
|
||||
"debug_save_thumbnails": {
|
||||
"label": "Salvesta pisipildid"
|
||||
},
|
||||
"enabled": {
|
||||
"label": "Luba GenAI"
|
||||
},
|
||||
"use_snapshot": {
|
||||
"label": "Kasuta hetktõmmiseid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mqtt": {
|
||||
"label": "MQTT"
|
||||
},
|
||||
"notifications": {
|
||||
"enabled": {
|
||||
"label": "Luba teavitused"
|
||||
},
|
||||
"email": {
|
||||
"label": "Teavituste email"
|
||||
},
|
||||
"label": "Teavitused"
|
||||
},
|
||||
"ui": {
|
||||
"label": "Kaamera kasutajaliides"
|
||||
},
|
||||
"record": {
|
||||
"label": "Salvestus",
|
||||
"enabled": {
|
||||
"label": "Luba salvestamine"
|
||||
}
|
||||
},
|
||||
"snapshots": {
|
||||
"enabled": {
|
||||
"label": "Luba hetktõmmised"
|
||||
}
|
||||
},
|
||||
"timestamp_style": {
|
||||
"color": {
|
||||
"red": {
|
||||
"label": "Punane",
|
||||
"description": "Punase komponent (0–255) ajatempli värvi jaoks."
|
||||
},
|
||||
"green": {
|
||||
"label": "Roheline",
|
||||
"description": "Rohelise komponent (0–255) ajatempli värvi jaoks."
|
||||
},
|
||||
"blue": {
|
||||
"label": "Sinine",
|
||||
"description": "Sinise komponent (0–255) ajatempli värvi jaoks."
|
||||
},
|
||||
"label": "Ajatempli värv",
|
||||
"description": "Ajatempli teksti RGB värviväärtused (kõik väärtused 0–255)."
|
||||
},
|
||||
"thickness": {
|
||||
"label": "Ajatempli paksus",
|
||||
"description": "Ajatempli teksti joone paksus."
|
||||
},
|
||||
"effect": {
|
||||
"label": "Ajatempli efekt",
|
||||
"description": "Ajatempli teksti visuaalne efekt (puudub, ühtlane, vari)."
|
||||
}
|
||||
},
|
||||
"onvif": {
|
||||
"user": {
|
||||
"label": "ONVIF kasutajanimi"
|
||||
},
|
||||
"password": {
|
||||
"label": "ONVIF parool"
|
||||
},
|
||||
"port": {
|
||||
"label": "ONVIF port"
|
||||
},
|
||||
"label": "ONVIF",
|
||||
"host": {
|
||||
"label": "ONVIF host"
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"label": "Profiilid"
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user