Plus Settings: add base model and name (#17738)

* Plus Settings: add base model and name

* I18n change user model to fine-tuned model

* Move fields in drop-down for mobile

* Missed commit

* remove unused i18n key

* Add base/FTM to model Type, reorder Model Information fields

* fix missing availableModels for now

* shorten Fine-Tuned Model to Fine-Tuned

* isBaseModel is already available in config, use that

* Change Base Model to Default

* minor tweaks

* Revert "Change Base Model to Default"

This reverts commit 0191aa34f6.
This commit is contained in:
leccelecce 2025-04-17 15:48:56 +01:00 committed by GitHub
parent 84c1ad59a2
commit 1abd3c68ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 72 additions and 26 deletions

View File

@ -571,8 +571,11 @@
"modelType": "Model Type", "modelType": "Model Type",
"trainDate": "Train Date", "trainDate": "Train Date",
"baseModel": "Base Model", "baseModel": "Base Model",
"plusModelType": {
"baseModel": "Base Model",
"userModel": "Fine-Tuned"
},
"supportedDetectors": "Supported Detectors", "supportedDetectors": "Supported Detectors",
"dimensions": "Dimensions",
"cameras": "Cameras", "cameras": "Cameras",
"loading": "Loading model information...", "loading": "Loading model information...",
"error": "Failed to load model information", "error": "Failed to load model information",

View File

@ -408,6 +408,7 @@ export interface FrigateConfig {
id: string; id: string;
trainDate: string; trainDate: string;
baseModel: string; baseModel: string;
isBaseModel: boolean;
supportedDetectors: string[]; supportedDetectors: string[];
width: number; width: number;
height: number; height: number;

View File

@ -26,6 +26,8 @@ import {
type FrigatePlusModel = { type FrigatePlusModel = {
id: string; id: string;
type: string; type: string;
name: string;
isBaseModel: boolean;
supportedDetectors: string[]; supportedDetectors: string[];
trainDate: string; trainDate: string;
baseModel: string; baseModel: string;
@ -273,13 +275,17 @@ export default function FrigatePlusSettingsView({
<div className="grid grid-cols-2 gap-4"> <div className="grid grid-cols-2 gap-4">
<div> <div>
<Label className="text-muted-foreground"> <Label className="text-muted-foreground">
{t("frigatePlus.modelInfo.modelType")} {t("frigatePlus.modelInfo.baseModel")}
</Label> </Label>
<p> <p>
{config.model.plus.name} ( {config.model.plus.baseModel} (
{config.model.plus.width + {config.model.plus.isBaseModel
"x" + ? t(
config.model.plus.height} "frigatePlus.modelInfo.plusModelType.baseModel",
)
: t(
"frigatePlus.modelInfo.plusModelType.userModel",
)}
) )
</p> </p>
</div> </div>
@ -295,9 +301,15 @@ export default function FrigatePlusSettingsView({
</div> </div>
<div> <div>
<Label className="text-muted-foreground"> <Label className="text-muted-foreground">
{t("frigatePlus.modelInfo.baseModel")} {t("frigatePlus.modelInfo.modelType")}
</Label> </Label>
<p>{config.model.plus.baseModel}</p> <p>
{config.model.plus.name} (
{config.model.plus.width +
"x" +
config.model.plus.height}
)
</p>
</div> </div>
<div> <div>
<Label className="text-muted-foreground"> <Label className="text-muted-foreground">
@ -328,25 +340,45 @@ export default function FrigatePlusSettingsView({
}) })
} }
> >
<SelectTrigger> {frigatePlusSettings.model.id &&
{frigatePlusSettings.model.id && availableModels?.[frigatePlusSettings.model.id] ? (
availableModels?.[frigatePlusSettings.model.id] <SelectTrigger>
? new Date( {new Date(
availableModels[ availableModels[
frigatePlusSettings.model.id frigatePlusSettings.model.id
].trainDate, ].trainDate,
).toLocaleString() + ).toLocaleString() +
" " +
availableModels[frigatePlusSettings.model.id]
.baseModel +
" (" +
(availableModels[frigatePlusSettings.model.id]
.isBaseModel
? t(
"frigatePlus.modelInfo.plusModelType.baseModel",
)
: t(
"frigatePlus.modelInfo.plusModelType.userModel",
)) +
") " +
availableModels[frigatePlusSettings.model.id]
.name +
" (" + " (" +
availableModels[frigatePlusSettings.model.id] availableModels[frigatePlusSettings.model.id]
.width + .width +
"x" + "x" +
availableModels[frigatePlusSettings.model.id] availableModels[frigatePlusSettings.model.id]
.height + .height +
")" ")"}
: t( </SelectTrigger>
"frigatePlus.modelInfo.loadingAvailableModels", ) : (
)} <SelectTrigger>
</SelectTrigger> {t(
"frigatePlus.modelInfo.loadingAvailableModels",
)}
</SelectTrigger>
)}
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
{Object.entries(availableModels || {}).map( {Object.entries(availableModels || {}).map(
@ -366,17 +398,27 @@ export default function FrigatePlusSettingsView({
{new Date( {new Date(
model.trainDate, model.trainDate,
).toLocaleString()}{" "} ).toLocaleString()}{" "}
({model.baseModel}) <div>
{model.baseModel} {" ("}
{model.isBaseModel
? t(
"frigatePlus.modelInfo.plusModelType.baseModel",
)
: t(
"frigatePlus.modelInfo.plusModelType.userModel",
)}
{")"}
</div>
<div>
{model.name} (
{model.width + "x" + model.height})
</div>
<div> <div>
{t( {t(
"frigatePlus.modelInfo.supportedDetectors", "frigatePlus.modelInfo.supportedDetectors",
)} )}
: {model.supportedDetectors.join(", ")} : {model.supportedDetectors.join(", ")}
</div> </div>
<div>
{t("frigatePlus.modelInfo.dimensions")}:{" "}
{model.width + "x" + model.height}
</div>
<div className="text-xs text-muted-foreground"> <div className="text-xs text-muted-foreground">
{id} {id}
</div> </div>