mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 22:05:44 +03:00
remove face training
This commit is contained in:
parent
c419136dcf
commit
7871a0c77c
@ -13,7 +13,6 @@ import {
|
|||||||
DropdownMenuPortal,
|
DropdownMenuPortal,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { HiDotsHorizontal } from "react-icons/hi";
|
import { HiDotsHorizontal } from "react-icons/hi";
|
||||||
import FaceSelectionDialog from "../FaceSelectionDialog";
|
|
||||||
import { SearchResult } from "@/types/search";
|
import { SearchResult } from "@/types/search";
|
||||||
import { FrigateConfig } from "@/types/frigateConfig";
|
import { FrigateConfig } from "@/types/frigateConfig";
|
||||||
|
|
||||||
@ -32,9 +31,6 @@ export default function DetailActionsMenu({
|
|||||||
config,
|
config,
|
||||||
setSearch,
|
setSearch,
|
||||||
setSimilarity,
|
setSimilarity,
|
||||||
faceNames = [],
|
|
||||||
onTrainFace,
|
|
||||||
hasFace = false,
|
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const { t } = useTranslation(["views/explore", "views/faceLibrary"]);
|
const { t } = useTranslation(["views/explore", "views/faceLibrary"]);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -115,19 +111,6 @@ export default function DetailActionsMenu({
|
|||||||
</div>
|
</div>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasFace && onTrainFace && (
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<FaceSelectionDialog
|
|
||||||
faceNames={faceNames}
|
|
||||||
onTrainAttempt={onTrainFace}
|
|
||||||
>
|
|
||||||
<div className="flex cursor-pointer items-center gap-2">
|
|
||||||
<span>{t("trainFace", { ns: "views/faceLibrary" })}</span>
|
|
||||||
</div>
|
|
||||||
</FaceSelectionDialog>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
)}
|
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenuPortal>
|
</DropdownMenuPortal>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|||||||
@ -46,7 +46,6 @@ import {
|
|||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { REVIEW_PADDING } from "@/types/review";
|
import { REVIEW_PADDING } from "@/types/review";
|
||||||
// Chip removed from VideoTab - kept import commented out previously
|
|
||||||
import { capitalizeAll } from "@/utils/stringUtil";
|
import { capitalizeAll } from "@/utils/stringUtil";
|
||||||
import useGlobalMutation from "@/hooks/use-global-mutate";
|
import useGlobalMutation from "@/hooks/use-global-mutate";
|
||||||
import DetailActionsMenu from "./DetailActionsMenu";
|
import DetailActionsMenu from "./DetailActionsMenu";
|
||||||
@ -71,7 +70,6 @@ import { FaPencilAlt } from "react-icons/fa";
|
|||||||
import TextEntryDialog from "@/components/overlay/dialog/TextEntryDialog";
|
import TextEntryDialog from "@/components/overlay/dialog/TextEntryDialog";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import { useIsAdmin } from "@/hooks/use-is-admin";
|
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||||
// FaceSelectionDialog moved into DetailActionsMenu
|
|
||||||
import { getTranslatedLabel } from "@/utils/i18n";
|
import { getTranslatedLabel } from "@/utils/i18n";
|
||||||
import { CameraNameLabel } from "@/components/camera/CameraNameLabel";
|
import { CameraNameLabel } from "@/components/camera/CameraNameLabel";
|
||||||
import Heading from "@/components/ui/heading";
|
import Heading from "@/components/ui/heading";
|
||||||
@ -589,8 +587,6 @@ function ObjectDetailsTab({
|
|||||||
}
|
}
|
||||||
}, [search]);
|
}, [search]);
|
||||||
|
|
||||||
// clipTimeRange is calculated inside the shared DetailActionsMenu
|
|
||||||
|
|
||||||
const updateDescription = useCallback(() => {
|
const updateDescription = useCallback(() => {
|
||||||
if (!search) {
|
if (!search) {
|
||||||
return;
|
return;
|
||||||
@ -843,57 +839,6 @@ function ObjectDetailsTab({
|
|||||||
[search, apiHost, mutate, setSearch, t],
|
[search, apiHost, mutate, setSearch, t],
|
||||||
);
|
);
|
||||||
|
|
||||||
// face training
|
|
||||||
|
|
||||||
const hasFace = useMemo(() => {
|
|
||||||
if (!config?.face_recognition.enabled || !search) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return search.data.attributes?.find((attr) => attr.label == "face");
|
|
||||||
}, [config, search]);
|
|
||||||
|
|
||||||
const { data: faceData } = useSWR(hasFace ? "faces" : null);
|
|
||||||
|
|
||||||
const faceNames = useMemo<string[]>(
|
|
||||||
() =>
|
|
||||||
faceData ? Object.keys(faceData).filter((face) => face != "train") : [],
|
|
||||||
[faceData],
|
|
||||||
);
|
|
||||||
|
|
||||||
const onTrainFace = useCallback(
|
|
||||||
(trainName: string) => {
|
|
||||||
axios
|
|
||||||
.post(`/faces/train/${trainName}/classify`, { event_id: search.id })
|
|
||||||
.then((resp) => {
|
|
||||||
if (resp.status == 200) {
|
|
||||||
toast.success(
|
|
||||||
t("toast.success.trainedFace", { ns: "views/faceLibrary" }),
|
|
||||||
{
|
|
||||||
position: "top-center",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
const errorMessage =
|
|
||||||
error.response?.data?.message ||
|
|
||||||
error.response?.data?.detail ||
|
|
||||||
"Unknown error";
|
|
||||||
toast.error(
|
|
||||||
t("toast.error.trainFailed", {
|
|
||||||
ns: "views/faceLibrary",
|
|
||||||
errorMessage,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
position: "top-center",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
[search, t],
|
|
||||||
);
|
|
||||||
|
|
||||||
// speech transcription
|
// speech transcription
|
||||||
|
|
||||||
const onTranscribe = useCallback(() => {
|
const onTranscribe = useCallback(() => {
|
||||||
@ -967,9 +912,6 @@ function ObjectDetailsTab({
|
|||||||
config={config}
|
config={config}
|
||||||
setSearch={setSearch}
|
setSearch={setSearch}
|
||||||
setSimilarity={setSimilarity}
|
setSimilarity={setSimilarity}
|
||||||
faceNames={faceNames}
|
|
||||||
onTrainFace={onTrainFace}
|
|
||||||
hasFace={!!hasFace}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user