mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-16 18:16:44 +03:00
Clean up decision logic
This commit is contained in:
parent
6d662151de
commit
7c0a97520a
@ -197,18 +197,24 @@ export function GroupedClassificationCard({
|
|||||||
let best: undefined | ClassificationItemData = undefined;
|
let best: undefined | ClassificationItemData = undefined;
|
||||||
|
|
||||||
group.forEach((item) => {
|
group.forEach((item) => {
|
||||||
if (best?.score == undefined || (item.score && best.score < item.score)) {
|
if (item?.name != undefined && item.name != "none") {
|
||||||
best = item;
|
if (
|
||||||
|
best?.score == undefined ||
|
||||||
|
(item.score && best.score < item.score)
|
||||||
|
) {
|
||||||
|
best = item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!best) {
|
if (!best) {
|
||||||
return undefined;
|
return group[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const bestTyped: ClassificationItemData = best;
|
const bestTyped: ClassificationItemData = best;
|
||||||
return {
|
return {
|
||||||
...bestTyped,
|
...bestTyped,
|
||||||
|
name: event?.sub_label || bestTyped.name,
|
||||||
score: event?.data?.sub_label_score || bestTyped.score,
|
score: event?.data?.sub_label_score || bestTyped.score,
|
||||||
};
|
};
|
||||||
}, [group, event]);
|
}, [group, event]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user