Actually train object classification models automatically

This commit is contained in:
Nicolas Mowen 2025-12-17 15:31:23 -07:00
parent 08f0306fd0
commit bf07143553

View File

@ -186,15 +186,17 @@ export default function Step3ChooseExamples({
await Promise.all(emptyFolderPromises); await Promise.all(emptyFolderPromises);
// Step 3: Determine if we should train // Step 3: Determine if we should train
// For state models, we need ALL states to have examples // For state models, we need ALL states to have examples (at least 2 states)
// For object models, we need at least 2 classes with images // For object models, we need at least 1 class with images (the rest go to "none")
const allStatesHaveExamplesForTraining = const allStatesHaveExamplesForTraining =
step1Data.modelType !== "state" || step1Data.modelType !== "state" ||
step1Data.classes.every((className) => step1Data.classes.every((className) =>
classesWithImages.has(className), classesWithImages.has(className),
); );
const shouldTrain = const shouldTrain =
allStatesHaveExamplesForTraining && classesWithImages.size >= 2; step1Data.modelType === "object"
? classesWithImages.size >= 1
: allStatesHaveExamplesForTraining && classesWithImages.size >= 2;
// Step 4: Kick off training only if we have enough classes with images // Step 4: Kick off training only if we have enough classes with images
if (shouldTrain) { if (shouldTrain) {