mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-28 23:06:13 +02:00
Miscellaneous Fixes (0.17 beta) (#21336)
* fix coral docs * add note about sub label object classification with person * Catch OSError for deleting classification image * add docs for dummy camera debugging * add to sidebar * fix formatting * fix * avx instructions are required for classification * break text on classification card to prevent button overflow * Ensure there is no NameError when processing * Don't use region for state classification models * fix spelling * Handle attribute based models * Catch case of non-trained model that doesn't add infinite number of classification images * Actually train object classification models automatically --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
@@ -62,6 +62,7 @@ import useApiFilter from "@/hooks/use-api-filter";
|
||||
import {
|
||||
ClassificationDatasetResponse,
|
||||
ClassificationItemData,
|
||||
ClassifiedEvent,
|
||||
TrainFilter,
|
||||
} from "@/types/classification";
|
||||
import {
|
||||
@@ -1033,6 +1034,45 @@ function ObjectTrainGrid({
|
||||
};
|
||||
}, [model]);
|
||||
|
||||
// Helper function to create ClassifiedEvent from Event
|
||||
const createClassifiedEvent = useCallback(
|
||||
(event: Event | undefined): ClassifiedEvent | undefined => {
|
||||
if (!event || !model.object_config) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const classificationType = model.object_config.classification_type;
|
||||
|
||||
if (classificationType === "attribute") {
|
||||
// For attribute type, look at event.data[model.name]
|
||||
const attributeValue = event.data[model.name] as string | undefined;
|
||||
const attributeScore = event.data[`${model.name}_score`] as
|
||||
| number
|
||||
| undefined;
|
||||
|
||||
if (attributeValue && attributeValue !== "none") {
|
||||
return {
|
||||
id: event.id,
|
||||
label: attributeValue,
|
||||
score: attributeScore,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// For sub_label type, use event.sub_label
|
||||
if (event.sub_label && event.sub_label !== "none") {
|
||||
return {
|
||||
id: event.id,
|
||||
label: event.sub_label,
|
||||
score: event.data?.sub_label_score,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
[model],
|
||||
);
|
||||
|
||||
// selection
|
||||
|
||||
const [selectedEvent, setSelectedEvent] = useState<Event>();
|
||||
@@ -1095,11 +1135,13 @@ function ObjectTrainGrid({
|
||||
>
|
||||
{Object.entries(groups).map(([key, group]) => {
|
||||
const event = events?.find((ev) => ev.id == key);
|
||||
const classifiedEvent = createClassifiedEvent(event);
|
||||
|
||||
return (
|
||||
<div key={key} className="aspect-square w-full">
|
||||
<GroupedClassificationCard
|
||||
group={group}
|
||||
event={event}
|
||||
classifiedEvent={classifiedEvent}
|
||||
threshold={threshold}
|
||||
selectedItems={selectedImages}
|
||||
i18nLibrary="views/classificationModel"
|
||||
|
||||
Reference in New Issue
Block a user