-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT: Remove best.jpg
endpoint in favor of latest.jpg
enpoint which uses snapshot from most recent event
#2833
FEAT: Remove best.jpg
endpoint in favor of latest.jpg
enpoint which uses snapshot from most recent event
#2833
Conversation
I have built locally and been testing this change on my main setup. It works great most of the time, but sometimes the @blakeblackshear is there any difference with how the cords of box from the event is calculated compared to the box of the old best type? |
Okay after some more looking, seems like after an event is ended the Just to reiterate, this only affects images that are using the |
Not sure if my fix is good enough to be mergeable, but I added self.thumbnail_data = {
"frame_time": obj_data["frame_time"],
"box": obj_data["box"],
"area": obj_data["area"],
"region": obj_data["region"],
"score": obj_data["score"],
}
self.obj_data["best_box"] = obj_data["box"]
thumb_update = True and made it so when the def to_dict(self, include_thumbnail: bool = False, end_frame: bool = False):
snapshot_time = (
self.thumbnail_data["frame_time"]
if not self.thumbnail_data is None
else 0.0
)
event = {
"id": self.obj_data["id"],
"camera": self.camera,
"frame_time": self.obj_data["frame_time"],
"snapshot_time": snapshot_time,
"label": self.obj_data["label"],
"top_score": self.top_score,
"false_positive": self.false_positive,
"start_time": self.obj_data["start_time"],
"end_time": self.obj_data.get("end_time", None),
"score": self.obj_data["score"],
"box": self.obj_data.get("best_box", self.obj_data["box"]) if end_frame else self.obj_data["box"],
"area": self.obj_data["area"],
"region": self.obj_data["region"],
"stationary": self.obj_data["motionless_count"]
> self.camera_config.detect.stationary.threshold,
"motionless_count": self.obj_data["motionless_count"],
"position_changes": self.obj_data["position_changes"],
"current_zones": self.current_zones.copy(),
"entered_zones": self.entered_zones.copy(),
"has_clip": self.has_clip,
"has_snapshot": self.has_snapshot,
}
if include_thumbnail:
event["thumbnail"] = base64.b64encode(self.get_thumbnail()).decode("utf-8")
return event |
…rigate into better-object-jpg
@blakeblackshear I think this PR is ready for review. I have been testing for 5 days now and it has been working great to retrieve the snapshots and the crop options works well too. I am not sure how you feel about the "best_box" change I made to get cropping working, I think it isn't super clean but it also isn't too bad and works well. I'm not sure if you had plans to also remove some code from the If you want to give this one more time I completely understand, just thought I would reach out to see what you are thinking on this. Thank you! 😃 |
…rigate into better-object-jpg
I think the best thing to do here is leverage the
I would recommend opening a new PR rather than updating this branch since there are some artifacts from all the back merging. |
Description
This PR is an implementation as described in #2799 to replace the
best.jpg
endpoint.The new endpoint is
GET /api/<camera_name>/<object_name>/latest.jpg
This endpoint has feature parity with the oldbest.jpg
endpoint and also includes the ability to passany
as theobject_name
and it will return the snapshot from the latest event of any type.Open Questions
best.jpg
was removed but the API was left in place. Unsure if this should stay that way (perhaps redirect to the new API?) for a release and it can be considered deprecated? I am not sure if many users utilize this endpoint other than frigate itself.latest.jpg
endpoints in the docs?