mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
add label attrs to events and snapshots
This commit is contained in:
parent
b466a951e3
commit
0431eedf12
@ -62,7 +62,9 @@ Message published for each changed event. The first message is published when th
|
|||||||
"has_clip": false,
|
"has_clip": false,
|
||||||
"stationary": false, // whether or not the object is considered stationary
|
"stationary": false, // whether or not the object is considered stationary
|
||||||
"motionless_count": 0, // number of frames the object has been motionless
|
"motionless_count": 0, // number of frames the object has been motionless
|
||||||
"position_changes": 2 // number of times the object has moved from a stationary position
|
"position_changes": 2, // number of times the object has moved from a stationary position
|
||||||
|
"attributes": [], // set of unique attributes that have been identified on the object
|
||||||
|
"current_attributes": [] // detailed data about the current attributes in this frame
|
||||||
},
|
},
|
||||||
"after": {
|
"after": {
|
||||||
"id": "1607123955.475377-mxklsc",
|
"id": "1607123955.475377-mxklsc",
|
||||||
@ -87,7 +89,16 @@ Message published for each changed event. The first message is published when th
|
|||||||
"has_clip": false,
|
"has_clip": false,
|
||||||
"stationary": false, // whether or not the object is considered stationary
|
"stationary": false, // whether or not the object is considered stationary
|
||||||
"motionless_count": 0, // number of frames the object has been motionless
|
"motionless_count": 0, // number of frames the object has been motionless
|
||||||
"position_changes": 2 // number of times the object has changed position
|
"position_changes": 2, // number of times the object has changed position
|
||||||
|
"attributes": ["face"], // set of unique attributes that have been identified on the object
|
||||||
|
"current_attributes": [
|
||||||
|
// detailed data about the current attributes in this frame
|
||||||
|
{
|
||||||
|
"label": "face",
|
||||||
|
"box": [442, 506, 534, 524],
|
||||||
|
"score": 0.64
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -163,9 +174,9 @@ Topic with current motion contour area for a camera. Published value is an integ
|
|||||||
|
|
||||||
Topic to send PTZ commands to camera.
|
Topic to send PTZ commands to camera.
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| ---------------------- | --------------------------------------------------------------------------------------- |
|
| ---------------------- | ----------------------------------------------------------------------------------------- |
|
||||||
| `preset-<preset_name>` | send command to move to preset with name `<preset_name>` |
|
| `preset-<preset_name>` | send command to move to preset with name `<preset_name>` |
|
||||||
| `MOVE_<dir>` | send command to continuously move in `<dir>`, possible values are [UP, DOWN, LEFT, RIGHT] |
|
| `MOVE_<dir>` | send command to continuously move in `<dir>`, possible values are [UP, DOWN, LEFT, RIGHT] |
|
||||||
| `ZOOM_<dir>` | send command to continuously zoom `<dir>`, possible values are [IN, OUT] |
|
| `ZOOM_<dir>` | send command to continuously zoom `<dir>`, possible values are [IN, OUT] |
|
||||||
| `STOP` | send command to stop moving |
|
| `STOP` | send command to stop moving |
|
||||||
|
|||||||
@ -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
|
# keep these from being set back to false because the event
|
||||||
# may have started while recordings and snapshots were enabled
|
# may have started while recordings and snapshots were enabled
|
||||||
# this would be an issue for long running events
|
# this would be an issue for long running events
|
||||||
@ -173,6 +190,7 @@ class EventProcessor(threading.Thread):
|
|||||||
"region": region,
|
"region": region,
|
||||||
"score": score,
|
"score": score,
|
||||||
"top_score": event_data["top_score"],
|
"top_score": event_data["top_score"],
|
||||||
|
"attributes": attributes,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,7 @@ class TrackedObject:
|
|||||||
self.zone_presence = {}
|
self.zone_presence = {}
|
||||||
self.current_zones = []
|
self.current_zones = []
|
||||||
self.entered_zones = []
|
self.entered_zones = []
|
||||||
|
self.attributes = set()
|
||||||
self.false_positive = True
|
self.false_positive = True
|
||||||
self.has_clip = False
|
self.has_clip = False
|
||||||
self.has_snapshot = False
|
self.has_snapshot = False
|
||||||
@ -133,6 +134,7 @@ class TrackedObject:
|
|||||||
"area": obj_data["area"],
|
"area": obj_data["area"],
|
||||||
"region": obj_data["region"],
|
"region": obj_data["region"],
|
||||||
"score": obj_data["score"],
|
"score": obj_data["score"],
|
||||||
|
"attributes": obj_data["attributes"],
|
||||||
}
|
}
|
||||||
thumb_update = True
|
thumb_update = True
|
||||||
|
|
||||||
@ -184,6 +186,9 @@ class TrackedObject:
|
|||||||
if self.obj_data["frame_time"] - self.previous["frame_time"] > 60:
|
if self.obj_data["frame_time"] - self.previous["frame_time"] > 60:
|
||||||
significant_change = True
|
significant_change = True
|
||||||
|
|
||||||
|
for attr in obj_data["attributes"]:
|
||||||
|
self.attributes.add(attr["label"])
|
||||||
|
|
||||||
self.obj_data.update(obj_data)
|
self.obj_data.update(obj_data)
|
||||||
self.current_zones = current_zones
|
self.current_zones = current_zones
|
||||||
return (thumb_update, significant_change)
|
return (thumb_update, significant_change)
|
||||||
@ -214,7 +219,8 @@ class TrackedObject:
|
|||||||
"entered_zones": self.entered_zones.copy(),
|
"entered_zones": self.entered_zones.copy(),
|
||||||
"has_clip": self.has_clip,
|
"has_clip": self.has_clip,
|
||||||
"has_snapshot": self.has_snapshot,
|
"has_snapshot": self.has_snapshot,
|
||||||
"attributes": self.obj_data["attributes"],
|
"attributes": list(self.attributes),
|
||||||
|
"current_attributes": self.obj_data["attributes"],
|
||||||
}
|
}
|
||||||
|
|
||||||
if include_thumbnail:
|
if include_thumbnail:
|
||||||
@ -295,6 +301,21 @@ class TrackedObject:
|
|||||||
color=color,
|
color=color,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# draw any attributes
|
||||||
|
for attribute in self.thumbnail_data["attributes"]:
|
||||||
|
box = attribute["box"]
|
||||||
|
draw_box_with_label(
|
||||||
|
best_frame,
|
||||||
|
box[0],
|
||||||
|
box[1],
|
||||||
|
box[2],
|
||||||
|
box[3],
|
||||||
|
attribute["label"],
|
||||||
|
f"{attribute['score']:.0%}",
|
||||||
|
thickness=thickness,
|
||||||
|
color=color,
|
||||||
|
)
|
||||||
|
|
||||||
if crop:
|
if crop:
|
||||||
box = self.thumbnail_data["box"]
|
box = self.thumbnail_data["box"]
|
||||||
box_size = 300
|
box_size = 300
|
||||||
@ -423,7 +444,7 @@ class CameraState:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# draw any attributes
|
# draw any attributes
|
||||||
for attribute in obj["attributes"]:
|
for attribute in obj["current_attributes"]:
|
||||||
box = attribute["box"]
|
box = attribute["box"]
|
||||||
draw_box_with_label(
|
draw_box_with_label(
|
||||||
frame_copy,
|
frame_copy,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user