mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
populate sublabels for cars with logos
This commit is contained in:
parent
5c60c511d1
commit
8584234b7d
@ -194,6 +194,10 @@ class EventProcessor(threading.Thread):
|
||||
},
|
||||
}
|
||||
|
||||
# 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(
|
||||
|
||||
@ -204,6 +204,19 @@ class TrackedObject:
|
||||
if 0 < zone_score < zone.inertia:
|
||||
self.zone_presence[name] = zone_score - 1
|
||||
|
||||
# maintain attributes
|
||||
for attr in obj_data["attributes"]:
|
||||
self.attributes.add(attr["label"])
|
||||
|
||||
# populate the sub_label for car with first logo if it exists
|
||||
if self.obj_data["label"] == "car" and "sub_label" not in self.obj_data:
|
||||
recognized_logos = self.attributes.intersection(
|
||||
set(["ups", "fedex", "amazon"])
|
||||
)
|
||||
if len(recognized_logos) > 0:
|
||||
self.obj_data["sub_label"] = recognized_logos.pop()
|
||||
|
||||
# check for significant change
|
||||
if not self.false_positive:
|
||||
# if the zones changed, signal an update
|
||||
if set(self.current_zones) != set(current_zones):
|
||||
@ -224,9 +237,6 @@ class TrackedObject:
|
||||
if self.obj_data["frame_time"] - self.previous["frame_time"] > 60:
|
||||
significant_change = True
|
||||
|
||||
for attr in obj_data["attributes"]:
|
||||
self.attributes.add(attr["label"])
|
||||
|
||||
self.obj_data.update(obj_data)
|
||||
self.current_zones = current_zones
|
||||
return (thumb_update, significant_change)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user