Skip to content

feat(crops): cut stable detection crops from the native crops - #750

Open
MateoLostanlen wants to merge 4 commits into
feat/detection-native-cropsfrom
feat/stabilized-sequence-crops
Open

MateoLostanlen wants to merge 4 commits into
feat/detection-native-cropsfrom
feat/stabilized-sequence-crops

Conversation

@MateoLostanlen

Copy link
Copy Markdown
Member

Stacked on #749.

  • Why: with native crops stored, the API can cut the 224x224 crop shown on the platform itself, with one box for the whole sequence, so the crops of a sequence show a still picture centered on the object.
  • What: once a sequence is validated, its crop box is the union of its bboxes plus a 20% margin (sequences.crop_box). Each detection sent with a native crop gets its crop cut with that box, from the native crop or from the frame when the box is larger. When a bbox leaves the box, the box grows and every crop of the sequence is cut again.
  • How: refreshes are queued in the DB and run by a worker loop, like the validation jobs, so none is lost on a restart. Pillow becomes a direct dependency.
  • Engine crops are ignored when native crops are sent. Detections without a native crop are unchanged.
  • Platform: replaced crops are deleted, so crop URLs must be fetched again when crop_box changes.

A validated sequence gets one crop box shared by all its detections.
Refreshes are queued in the DB (crops_due_at with a lease), like the
validation jobs, so none is lost on a restart.
Once a sequence is validated, a worker cuts the 224x224 crop of each
detection from its native crop, with the same box for the whole
sequence. When a bbox leaves the box, the box grows and every crop of
the sequence is cut again. Crops sent by the engine are ignored when
native crops are sent.
A refresh that outlives its lease is taken over by another worker: it
no longer publishes its older crops nor releases the other job. Its
cleanups keep the objects a detection still references, and deletions
of replaced crops no longer block the event loop.
…nce-crops

# Conflicts:
#	src/app/api/api_v1/endpoints/detections.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant