feat(detections): accept empty bboxes and keep sequence frames continuous#624
Open
MateoLostanlen wants to merge 5 commits into
Open
feat(detections): accept empty bboxes and keep sequence frames continuous#624MateoLostanlen wants to merge 5 commits into
MateoLostanlen wants to merge 5 commits into
Conversation
…uous A frame with no detection had to carry a fake placeholder bbox, which created phantom sequences (placeholders overlap each other and seed a sequence after a few frames). bboxes="[]" is now valid: the frame is attached with an empty bbox to every recently-seen sequence of the pose (SEQUENCE_CONTINUITY_SECONDS) not already covered by a real bbox of the same request, and stored nowhere otherwise (204). Continuity rows never refresh last_seen_at nor max_conf, but re-enqueue temporal validation; spatial matching compares against the last non-empty bbox so it survives them. This also keeps a frame in a sequence whose object faded while another object on the same frame is still detected.
Continuity rows carry a frame, not a detection: notification channels now use the sequence's latest non-empty detection, and per-sequence detection counts skip empty bboxes.
…tection Detections of the same upload (multi-bbox siblings, continuity rows) share one S3 frame object; deleting a single detection removed the image out from under the others.
Devices report a frame with no detection by sending an empty list instead of a placeholder bbox; the API attaches it to recently-seen sequences (201) or stores nothing (204).
| response = await async_client.post( | ||
| "/detections", data=payload, files={"file": ("logo.png", mock_img, "image/png")}, headers=auth | ||
| ) | ||
| assert response.status_code == 204, print(response.__dict__) |
| response = await async_client.post( | ||
| "/detections", data=payload, files={"file": ("logo.png", mock_img, "image/png")}, headers=auth | ||
| ) | ||
| assert response.status_code == 201, print(response.__dict__) |
| files={"file": ("logo.png", mock_img, "image/png")}, | ||
| headers=auth, | ||
| ) | ||
| assert response.status_code == 201, print(response.__dict__) |
| response = await async_client.post( | ||
| "/detections", data=payload, files={"file": ("logo.png", mock_img, "image/png")}, headers=auth | ||
| ) | ||
| assert response.status_code == 201, print(response.__dict__) |
| files={"file": ("logo.png", mock_img + bytes([idx]), "image/png")}, | ||
| headers=auth, | ||
| ) | ||
| assert response.status_code == 201, print(response.__dict__) |
| files={"file": ("logo.png", mock_img + b"-final-frame", "image/png")}, | ||
| headers=auth, | ||
| ) | ||
| assert response.status_code == 201, print(response.__dict__) |
| COMPILED_BOXES_PATTERN = re.compile(BOXES_PATTERN) | ||
|
|
||
| # Stored bbox of a continuity detection: a frame attached to a sequence with no detection on it. | ||
| EMPTY_BBOXES = "[]" |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #624 +/- ##
==========================================
+ Coverage 90.97% 93.25% +2.27%
==========================================
Files 3 58 +55
Lines 133 2980 +2847
==========================================
+ Hits 121 2779 +2658
- Misses 12 201 +189 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Devices had to send a fake placeholder bbox
(0.0,0.0,0.0001,0.0001,0.0)for frames with no detection, which created phantom sequences (placeholders overlap each other and seed a sequence after 3 frames).bboxes="[]"is now valid onPOST /detections: the frame is attached with an empty bbox ("continuity detection") to every sequence of the pose seen withinSEQUENCE_CONTINUITY_SECONDS(default 120s) that no real bbox of the request matched; with no active sequence, nothing is stored (204). This also keeps a frame in a sequence whose smoke faded while another object on the same frame is still detected (multi-bbox case).last_seen_at/max_confand never seed sequences, but re-enqueue temporal validation; spatial matching, notifications and per-sequence counts use the last non-empty bbox only.pyroclient.create_detectionaccepts an empty bbox list.