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",
"trainDate": "Train Date",
"baseModel": "Base Model",
"plusModelType": {
"baseModel": "Base Model",
"userModel": "Fine-Tuned"
},
"supportedDetectors": "Supported Detectors",
"dimensions": "Dimensions",
"cameras": "Cameras",
"loading": "Loading model information...",
"error": "Failed to load model information",

View File

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

View File

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