Improve score handling

This commit is contained in:
Nicolas Mowen 2025-06-27 07:51:18 -06:00
parent 44c85d3136
commit 79ab6f00df
2 changed files with 17 additions and 4 deletions

View File

@ -152,7 +152,7 @@ class CustomStateClassificationProcessor(RealTimeProcessorApi):
score,
)
if score >= camera_config.threshold:
if score >= self.model_config.threshold:
self.requestor.send_data(
f"{camera}/classification/{self.model_config.name}",
self.labelmap[best_id],
@ -271,6 +271,10 @@ class CustomObjectClassificationProcessor(RealTimeProcessorApi):
score,
)
if score < self.model_config.threshold:
logger.debug(f"Score {score} is less than threshold.")
return
if score <= previous_score:
logger.debug(f"Score {score} is worse than previous score {previous_score}")
return

View File

@ -640,15 +640,17 @@ function TrainGrid({
trainImages
.map((raw) => {
const parts = raw.replaceAll(".webp", "").split("-");
const rawScore = Number.parseFloat(parts[2]);
return {
raw,
timestamp: parts[0],
label: parts[1],
score: Number.parseFloat(parts[2]) * 100,
score: rawScore * 100,
truePositive: rawScore >= model.threshold,
};
})
.sort((a, b) => b.timestamp.localeCompare(a.timestamp)),
[trainImages],
[model, trainImages],
);
return (
@ -684,7 +686,14 @@ function TrainGrid({
<div className="smart-capitalize">
{data.label.replaceAll("_", " ")}
</div>
<div>{data.score}%</div>
<div
className={cn(
"",
data.truePositive ? "text-success" : "text-danger",
)}
>
{data.score}%
</div>
</div>
<div className="flex flex-row items-start justify-end gap-5 md:gap-4">
<ClassificationSelectionDialog