fix(workers/people): apply EXIF orientation before face detection and backfill #942

Merged
chris merged 2 commits from fix/face-exif-orientation into main 2026-09-28 16:32:36 +02:00
Owner

Summary

  • Face detection bboxes were computed against the EXIF-unrotated original image, while previews, face crops and frontend overlays render EXIF-oriented pixels. On portrait photos (EXIF orientation 6/8) face markers were shifted/wrong.
  • Apply ImageOps.exif_transpose before detection in face_model.py and before bbox cropping in the embedding backfill path (main.py), mirroring the existing workers/ml pattern.
  • After deploy, existing stored bboxes still need a re-detection pass to be rewritten to the oriented frame (backfill/detect job).

Tests

  • New tests/test_exif_orientation.py: 4 regression tests (content-driven detection mock; EXIF-tagged vs physically pre-rotated inputs must yield identical normalized boxes / identical crops).
  • Verified: tests fail without the fix, pass with it. Full suite: 107 passed.
  • Ref: ISSUE-023 (people worker part)
## Summary - Face detection bboxes were computed against the EXIF-unrotated original image, while previews, face crops and frontend overlays render EXIF-oriented pixels. On portrait photos (EXIF orientation 6/8) face markers were shifted/wrong. - Apply `ImageOps.exif_transpose` before detection in `face_model.py` and before bbox cropping in the embedding backfill path (`main.py`), mirroring the existing `workers/ml` pattern. - After deploy, existing stored bboxes still need a re-detection pass to be rewritten to the oriented frame (backfill/detect job). ## Tests - New `tests/test_exif_orientation.py`: 4 regression tests (content-driven detection mock; EXIF-tagged vs physically pre-rotated inputs must yield identical normalized boxes / identical crops). - Verified: tests fail without the fix, pass with it. Full suite: 107 passed. - Ref: ISSUE-023 (people worker part)
fix(workers/people): apply EXIF orientation before face detection and backfill
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 4s
Build and Deploy / Run scoped PR tests (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
7b3802a188
Face bboxes were computed against the EXIF-unrotated original while previews,
crops and frontend overlays render EXIF-oriented pixels, shifting face markers
on portrait photos with EXIF orientation 6/8. Run detection and embedding
backfill crops on ImageOps.exif_transpose-ed pixels so normalized bboxes live
in the display frame (same approach as workers/ml jobs.py). A re-detection
pass after deploy rewrites existing faces to the oriented frame.

Tests use a content-driven detection mock (decodes its own input tensor) plus
synthetic orientation-6 PNGs; all four regressions fail without the fix.
chore: version bump 1.21.54
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 4s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 1m43s
4ace9770b4
chris merged commit c06b00f866 into main 2026-09-28 16:32:36 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!942
No description provided.