From 885d6776fdea31f50c2237448851cfee2b6e0af0 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 17 Sep 2026 16:55:39 -0500 Subject: [PATCH] fix train image filtering for a class with a dash The backend writes a class with a `-` as `_` in train file names, since it splits those names on `-`, while a dataset folder keeps the dash. Filtering the Train grid by `half-open` compared it with `half_open` and hid every attempt. Both sides are normalized the same way now. --- web/src/views/classification/ModelTrainingView.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/src/views/classification/ModelTrainingView.tsx b/web/src/views/classification/ModelTrainingView.tsx index d70a8b2abd..d53820fe9d 100644 --- a/web/src/views/classification/ModelTrainingView.tsx +++ b/web/src/views/classification/ModelTrainingView.tsx @@ -899,6 +899,14 @@ type TrainGridProps = { onRefresh: () => void; onDelete: (ids: string[]) => void; }; + +// the backend writes a class with a "-" as "_" in train file names, since it +// splits those names on "-", so a dataset class may still carry the dash +function matchesTrainClass(classes: string[], name: string): boolean { + const target = name.replaceAll("-", "_"); + return classes.some((item) => item.replaceAll("-", "_") === target); +} + function TrainGrid({ model, contentRef, @@ -936,7 +944,10 @@ function TrainGrid({ return true; } - if (trainFilter.classes && !trainFilter.classes.includes(data.name)) { + if ( + trainFilter.classes && + !matchesTrainClass(trainFilter.classes, data.name) + ) { return false; }