Refactor detector and model management (#23995)

* Refactor detector and model management

* Fix model resolution field
This commit is contained in:
Nicolas Mowen
2026-08-27 20:30:35 -05:00
committed by Josh Hawkins
parent 378fbec416
commit 2dd700aa5a
63 changed files with 2052 additions and 1152 deletions
@@ -19,23 +19,16 @@ function collectLabelmapLabels(labelmap: unknown, labels: Set<string>) {
});
}
// Read labelmap labels from the global model and detector models.
// Read labelmap labels from every configured detection model.
function getLabelmapLabels(context: FormContext): string[] {
const labels = new Set<string>();
const fullConfig = context.fullConfig as FrigateConfig | undefined;
if (fullConfig?.model) {
collectLabelmapLabels(fullConfig.model.labelmap, labels);
}
if (fullConfig?.detectors) {
// detectors is a map of detector configs; each may include a model labelmap.
Object.values(fullConfig.detectors).forEach((detector) => {
if (detector?.model?.labelmap) {
collectLabelmapLabels(detector.model.labelmap, labels);
}
});
}
fullConfig?.models?.forEach((model) => {
if (model?.labelmap) {
collectLabelmapLabels(model.labelmap, labels);
}
});
return [...labels];
}