Label attributes (#6829)

* pass attribute labels as attributes

* add label attrs to events and snapshots

* incorporate area of license_plate and face into snapshot selection

* populate sublabels for cars with logos
This commit is contained in:
Blake Blackshear
2023-06-17 09:56:22 -05:00
committed by GitHub
parent 2be2050d57
commit 793fe251b9
5 changed files with 177 additions and 9 deletions

View File

@@ -147,6 +147,23 @@ class EventProcessor(threading.Thread):
)
)
attributes = [
(
None
if event_data["snapshot"] is None
else {
"box": to_relative_box(
width,
height,
a["box"],
),
"label": a["label"],
"score": a["score"],
}
)
for a in event_data["snapshot"]["attributes"]
]
# keep these from being set back to false because the event
# may have started while recordings and snapshots were enabled
# this would be an issue for long running events
@@ -173,9 +190,14 @@ class EventProcessor(threading.Thread):
"region": region,
"score": score,
"top_score": event_data["top_score"],
"attributes": attributes,
},
}
# only overwrite the sub_label in the database if it's set
if event_data.get("sub_label") is not None:
event[Event.sub_label] = event_data["sub_label"]
(
Event.insert(event)
.on_conflict(