mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-21 15:48:22 +03:00
expose thresholds in ms for detectors to warn or error
This commit is contained in:
parent
324953d3a5
commit
b13fa77edd
@ -1052,6 +1052,12 @@ ui:
|
|||||||
# Optional: Set the unit system to either "imperial" or "metric" (default: metric)
|
# Optional: Set the unit system to either "imperial" or "metric" (default: metric)
|
||||||
# Used in the UI and in MQTT topics
|
# Used in the UI and in MQTT topics
|
||||||
unit_system: metric
|
unit_system: metric
|
||||||
|
# Optional: Thresholds in ms for detector inference speed warnings in the UI
|
||||||
|
inference_threshold:
|
||||||
|
# Optional: Inference speed in ms above which a warning is shown (default: shown below)
|
||||||
|
warning: 50
|
||||||
|
# Optional: Inference speed in ms above which an error is shown (default: shown below)
|
||||||
|
error: 100
|
||||||
|
|
||||||
# Optional: Telemetry configuration
|
# Optional: Telemetry configuration
|
||||||
telemetry:
|
telemetry:
|
||||||
|
|||||||
@ -5,7 +5,13 @@ from pydantic import Field
|
|||||||
|
|
||||||
from .base import FrigateBaseModel
|
from .base import FrigateBaseModel
|
||||||
|
|
||||||
__all__ = ["TimeFormatEnum", "DateTimeStyleEnum", "UnitSystemEnum", "UIConfig"]
|
__all__ = [
|
||||||
|
"TimeFormatEnum",
|
||||||
|
"DateTimeStyleEnum",
|
||||||
|
"UnitSystemEnum",
|
||||||
|
"InferenceThresholdConfig",
|
||||||
|
"UIConfig",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class TimeFormatEnum(str, Enum):
|
class TimeFormatEnum(str, Enum):
|
||||||
@ -26,6 +32,19 @@ class UnitSystemEnum(str, Enum):
|
|||||||
metric = "metric"
|
metric = "metric"
|
||||||
|
|
||||||
|
|
||||||
|
class InferenceThresholdConfig(FrigateBaseModel):
|
||||||
|
warning: int = Field(
|
||||||
|
default=50,
|
||||||
|
title="Warning threshold (ms)",
|
||||||
|
description="Inference speed in ms above which a warning is shown in the UI.",
|
||||||
|
)
|
||||||
|
error: int = Field(
|
||||||
|
default=100,
|
||||||
|
title="Error threshold (ms)",
|
||||||
|
description="Inference speed in ms above which an error is shown in the UI.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class UIConfig(FrigateBaseModel):
|
class UIConfig(FrigateBaseModel):
|
||||||
timezone: Optional[str] = Field(
|
timezone: Optional[str] = Field(
|
||||||
default=None,
|
default=None,
|
||||||
@ -52,3 +71,8 @@ class UIConfig(FrigateBaseModel):
|
|||||||
title="Unit system",
|
title="Unit system",
|
||||||
description="Unit system for display (metric or imperial) used in the UI and MQTT.",
|
description="Unit system for display (metric or imperial) used in the UI and MQTT.",
|
||||||
)
|
)
|
||||||
|
inference_threshold: InferenceThresholdConfig = Field(
|
||||||
|
default_factory=InferenceThresholdConfig,
|
||||||
|
title="Inference threshold",
|
||||||
|
description="Thresholds for detector inference speed warnings in the UI.",
|
||||||
|
)
|
||||||
|
|||||||
@ -50,8 +50,14 @@ export default function useStats(stats: FrigateStats | undefined) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check detectors for high inference speeds
|
// check detectors for high inference speeds
|
||||||
|
const inferenceThreshold = {
|
||||||
|
warning:
|
||||||
|
config?.ui?.inference_threshold?.warning ?? InferenceThreshold.warning,
|
||||||
|
error:
|
||||||
|
config?.ui?.inference_threshold?.error ?? InferenceThreshold.error,
|
||||||
|
};
|
||||||
Object.entries(memoizedStats["detectors"]).forEach(([key, det]) => {
|
Object.entries(memoizedStats["detectors"]).forEach(([key, det]) => {
|
||||||
if (det["inference_speed"] > InferenceThreshold.error) {
|
if (det["inference_speed"] > inferenceThreshold.error) {
|
||||||
problems.push({
|
problems.push({
|
||||||
text: t("stats.detectIsVerySlow", {
|
text: t("stats.detectIsVerySlow", {
|
||||||
detect: capitalizeFirstLetter(key),
|
detect: capitalizeFirstLetter(key),
|
||||||
@ -60,7 +66,7 @@ export default function useStats(stats: FrigateStats | undefined) {
|
|||||||
color: "text-danger",
|
color: "text-danger",
|
||||||
relevantLink: "/system#general",
|
relevantLink: "/system#general",
|
||||||
});
|
});
|
||||||
} else if (det["inference_speed"] > InferenceThreshold.warning) {
|
} else if (det["inference_speed"] > inferenceThreshold.warning) {
|
||||||
problems.push({
|
problems.push({
|
||||||
text: t("stats.detectIsSlow", {
|
text: t("stats.detectIsSlow", {
|
||||||
detect: capitalizeFirstLetter(key),
|
detect: capitalizeFirstLetter(key),
|
||||||
|
|||||||
@ -9,6 +9,10 @@ export interface UiConfig {
|
|||||||
dashboard: boolean;
|
dashboard: boolean;
|
||||||
order: number;
|
order: number;
|
||||||
unit_system?: "metric" | "imperial";
|
unit_system?: "metric" | "imperial";
|
||||||
|
inference_threshold?: {
|
||||||
|
warning: number;
|
||||||
|
error: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BirdseyeConfig {
|
export interface BirdseyeConfig {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
import { FrigateConfig } from "@/types/frigateConfig";
|
||||||
import { FrigateStats, GpuInfo } from "@/types/stats";
|
import { FrigateStats, GpuInfo } from "@/types/stats";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { useFrigateStats } from "@/api/ws";
|
import { useFrigateStats } from "@/api/ws";
|
||||||
@ -34,6 +35,12 @@ export default function GeneralMetrics({
|
|||||||
// extra info
|
// extra info
|
||||||
const { t } = useTranslation(["views/system"]);
|
const { t } = useTranslation(["views/system"]);
|
||||||
const [showVainfo, setShowVainfo] = useState(false);
|
const [showVainfo, setShowVainfo] = useState(false);
|
||||||
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
|
const inferenceThreshold = {
|
||||||
|
warning:
|
||||||
|
config?.ui?.inference_threshold?.warning ?? InferenceThreshold.warning,
|
||||||
|
error: config?.ui?.inference_threshold?.error ?? InferenceThreshold.error,
|
||||||
|
};
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
|
|
||||||
@ -626,7 +633,7 @@ export default function GeneralMetrics({
|
|||||||
graphId={`${series.name}-inference`}
|
graphId={`${series.name}-inference`}
|
||||||
name={series.name}
|
name={series.name}
|
||||||
unit="ms"
|
unit="ms"
|
||||||
threshold={InferenceThreshold}
|
threshold={inferenceThreshold}
|
||||||
updateTimes={updateTimes}
|
updateTimes={updateTimes}
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user