mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-06 05:27:44 +03:00
Cleanup ui colors
This commit is contained in:
parent
02d797ba00
commit
f8d5c8420f
@ -229,7 +229,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
face_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
|
face_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
|
||||||
|
|
||||||
face_frame = face_frame[
|
face_frame = face_frame[
|
||||||
max(0, face_box[1]) : min(frame.shape[0], face_box[3]),F
|
max(0, face_box[1]) : min(frame.shape[0], face_box[3]),
|
||||||
max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
|
max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ import useKeyboardListener from "@/hooks/use-keyboard-listener";
|
|||||||
import useOptimisticState from "@/hooks/use-optimistic-state";
|
import useOptimisticState from "@/hooks/use-optimistic-state";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { FaceLibraryData, RecognizedFaceData } from "@/types/face";
|
import { FaceLibraryData, RecognizedFaceData } from "@/types/face";
|
||||||
import { FrigateConfig } from "@/types/frigateConfig";
|
import { FaceRecognitionConfig, FrigateConfig } from "@/types/frigateConfig";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { isDesktop, isMobile } from "react-device-detect";
|
import { isDesktop, isMobile } from "react-device-detect";
|
||||||
@ -451,7 +451,7 @@ function TrainingGrid({
|
|||||||
key={image}
|
key={image}
|
||||||
image={image}
|
image={image}
|
||||||
faceNames={faceNames}
|
faceNames={faceNames}
|
||||||
threshold={config.face_recognition.recognition_threshold}
|
recognitionConfig={config.face_recognition}
|
||||||
selected={selectedFaces.includes(image)}
|
selected={selectedFaces.includes(image)}
|
||||||
onClick={(data, meta) => {
|
onClick={(data, meta) => {
|
||||||
if (meta) {
|
if (meta) {
|
||||||
@ -471,7 +471,7 @@ function TrainingGrid({
|
|||||||
type FaceAttemptProps = {
|
type FaceAttemptProps = {
|
||||||
image: string;
|
image: string;
|
||||||
faceNames: string[];
|
faceNames: string[];
|
||||||
threshold: number;
|
recognitionConfig: FaceRecognitionConfig;
|
||||||
selected: boolean;
|
selected: boolean;
|
||||||
onClick: (data: RecognizedFaceData, meta: boolean) => void;
|
onClick: (data: RecognizedFaceData, meta: boolean) => void;
|
||||||
onRefresh: () => void;
|
onRefresh: () => void;
|
||||||
@ -479,7 +479,7 @@ type FaceAttemptProps = {
|
|||||||
function FaceAttempt({
|
function FaceAttempt({
|
||||||
image,
|
image,
|
||||||
faceNames,
|
faceNames,
|
||||||
threshold,
|
recognitionConfig,
|
||||||
selected,
|
selected,
|
||||||
onClick,
|
onClick,
|
||||||
onRefresh,
|
onRefresh,
|
||||||
@ -496,6 +496,16 @@ function FaceAttempt({
|
|||||||
};
|
};
|
||||||
}, [image]);
|
}, [image]);
|
||||||
|
|
||||||
|
const scoreStatus = useMemo(() => {
|
||||||
|
if (data.score >= recognitionConfig.recognition_threshold) {
|
||||||
|
return "match";
|
||||||
|
} else if (data.score >= recognitionConfig.unknown_score) {
|
||||||
|
return "potential";
|
||||||
|
} else {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
// interaction
|
// interaction
|
||||||
|
|
||||||
const imgRef = useRef<HTMLImageElement | null>(null);
|
const imgRef = useRef<HTMLImageElement | null>(null);
|
||||||
@ -579,10 +589,13 @@ function FaceAttempt({
|
|||||||
<div className="capitalize">{data.name}</div>
|
<div className="capitalize">{data.name}</div>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
data.score >= threshold ? "text-success" : "text-danger",
|
"",
|
||||||
|
scoreStatus == "match" && "text-success",
|
||||||
|
scoreStatus == "potential" && "text-orange-400",
|
||||||
|
scoreStatus == "unknown" && "text-danger",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{data.score * 100}%
|
{Math.round(data.score * 100)}%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row items-start justify-end gap-5 md:gap-4">
|
<div className="flex flex-row items-start justify-end gap-5 md:gap-4">
|
||||||
|
|||||||
@ -20,6 +20,14 @@ export interface BirdseyeConfig {
|
|||||||
width: number;
|
width: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FaceRecognitionConfig {
|
||||||
|
enabled: boolean;
|
||||||
|
model_size: SearchModelSize;
|
||||||
|
unknown_score: number;
|
||||||
|
detection_threshold: number;
|
||||||
|
recognition_threshold: number;
|
||||||
|
}
|
||||||
|
|
||||||
export type SearchModel = "jinav1" | "jinav2";
|
export type SearchModel = "jinav1" | "jinav2";
|
||||||
export type SearchModelSize = "small" | "large";
|
export type SearchModelSize = "small" | "large";
|
||||||
|
|
||||||
@ -331,12 +339,7 @@ export interface FrigateConfig {
|
|||||||
|
|
||||||
environment_vars: Record<string, unknown>;
|
environment_vars: Record<string, unknown>;
|
||||||
|
|
||||||
face_recognition: {
|
face_recognition: FaceRecognitionConfig;
|
||||||
enabled: boolean;
|
|
||||||
model_size: SearchModelSize;
|
|
||||||
detection_threshold: number;
|
|
||||||
recognition_threshold: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
ffmpeg: {
|
ffmpeg: {
|
||||||
global_args: string[];
|
global_args: string[];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user