Refactor model scene definitions (#24508)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s

* Refactor model scene definitions

* Cleanup

* Validate model paths in the UI

* Handle form validation
This commit is contained in:
Nicolas Mowen
2026-09-30 06:02:14 -06:00
committed by GitHub
parent 5e87d101da
commit 1bb61eb808
30 changed files with 862 additions and 227 deletions
@@ -1,5 +1,12 @@
import type { HiddenFieldContext } from "@/types/configForm";
import { DEFAULT_SCENE, getSceneChoices } from "@/utils/modelUtil";
import type { SectionConfigOverrides } from "./types";
// picking a scene only means something when there is more than one choice,
// which includes a saved scene that no model uses
const hideSceneWithoutChoice = (ctx: HiddenFieldContext): string[] =>
getSceneChoices(ctx).length > 1 ? [] : ["scene"];
const detect: SectionConfigOverrides = {
base: {
sectionDocs: "/configuration/camera_specific",
@@ -123,7 +130,7 @@ const detect: SectionConfigOverrides = {
docLink: "/configuration/object_detectors#running-more-than-one-model",
condition: (ctx) => {
const scene = ctx.formData?.scene as string | undefined;
if (!scene || scene === "all") return false;
if (!scene || scene === DEFAULT_SCENE) return false;
const models = ctx.fullConfig?.models;
if (!models) return false;
return !models.some((model) => model.scene === scene);
@@ -194,6 +201,7 @@ const detect: SectionConfigOverrides = {
scene: {
"ui:options": {
enumI18nPrefix: "detectionModels.scenes",
enumI18nOptional: true,
},
},
annotation_offset: {
@@ -202,7 +210,7 @@ const detect: SectionConfigOverrides = {
},
},
},
hiddenFields: ["enabled_in_config"],
hiddenFields: ["enabled_in_config", hideSceneWithoutChoice],
advancedFields: [
"min_initialized",
"max_disappeared",