mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-17 13:48:21 +03:00
Merge b13fa77edd into c08ec9652f
This commit is contained in:
commit
0793325ba9
@ -1052,6 +1052,12 @@ ui:
|
||||
# Optional: Set the unit system to either "imperial" or "metric" (default: metric)
|
||||
# Used in the UI and in MQTT topics
|
||||
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
|
||||
telemetry:
|
||||
|
||||
@ -5,7 +5,13 @@ from pydantic import Field
|
||||
|
||||
from .base import FrigateBaseModel
|
||||
|
||||
__all__ = ["TimeFormatEnum", "DateTimeStyleEnum", "UnitSystemEnum", "UIConfig"]
|
||||
__all__ = [
|
||||
"TimeFormatEnum",
|
||||
"DateTimeStyleEnum",
|
||||
"UnitSystemEnum",
|
||||
"InferenceThresholdConfig",
|
||||
"UIConfig",
|
||||
]
|
||||
|
||||
|
||||
class TimeFormatEnum(str, Enum):
|
||||
@ -26,6 +32,19 @@ class UnitSystemEnum(str, Enum):
|
||||
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):
|
||||
timezone: Optional[str] = Field(
|
||||
default=None,
|
||||
@ -52,3 +71,8 @@ class UIConfig(FrigateBaseModel):
|
||||
title="Unit system",
|
||||
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
|
||||
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]) => {
|
||||
if (det["inference_speed"] > InferenceThreshold.error) {
|
||||
if (det["inference_speed"] > inferenceThreshold.error) {
|
||||
problems.push({
|
||||
text: t("stats.detectIsVerySlow", {
|
||||
detect: capitalizeFirstLetter(key),
|
||||
@ -60,7 +66,7 @@ export default function useStats(stats: FrigateStats | undefined) {
|
||||
color: "text-danger",
|
||||
relevantLink: "/system#general",
|
||||
});
|
||||
} else if (det["inference_speed"] > InferenceThreshold.warning) {
|
||||
} else if (det["inference_speed"] > inferenceThreshold.warning) {
|
||||
problems.push({
|
||||
text: t("stats.detectIsSlow", {
|
||||
detect: capitalizeFirstLetter(key),
|
||||
|
||||
@ -9,6 +9,10 @@ export interface UiConfig {
|
||||
dashboard: boolean;
|
||||
order: number;
|
||||
unit_system?: "metric" | "imperial";
|
||||
inference_threshold?: {
|
||||
warning: number;
|
||||
error: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface BirdseyeConfig {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import useSWR from "swr";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
import { FrigateStats, GpuInfo } from "@/types/stats";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useFrigateStats } from "@/api/ws";
|
||||
@ -34,6 +35,12 @@ export default function GeneralMetrics({
|
||||
// extra info
|
||||
const { t } = useTranslation(["views/system"]);
|
||||
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
|
||||
|
||||
@ -626,7 +633,7 @@ export default function GeneralMetrics({
|
||||
graphId={`${series.name}-inference`}
|
||||
name={series.name}
|
||||
unit="ms"
|
||||
threshold={InferenceThreshold}
|
||||
threshold={inferenceThreshold}
|
||||
updateTimes={updateTimes}
|
||||
data={[series]}
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user