feat(ai): Auto-Rotate & Face Alignment Correction (#2083) - #2084
Open
Dev1822 wants to merge 1 commit into
Open
Conversation
Add pre-processing step that detects face tilt via eye landmarks and auto-rotates the image so the face is level before cropping. - New face_align.py service using OpenCV Haar cascades for eye detection and PCA-based roll angle estimation as fallback - Integrated as auto pre-processing step in the /remove-bg pipeline - New standalone POST /auto-rotate endpoint for direct use - Added 'auto-rotate' as a new auto-correct issue type in the compliance endpoint (alongside the existing 'tilt' type which now also uses the new face_align module) - Roll angles beyond ±25° are clamped (not corrected) to avoid incorrect rotations on non-frontal photos - 11 unit tests covering detection, rotation, edge cases, and data structures
|
@Dev1822 is attempting to deploy a commit to the souma9830's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
Implements pre-processing step that detects face tilt via eye landmarks and auto-rotates the image so the face is perfectly level before cropping. Closes #2083.
Changes
New: python-ai-service/app/services/face_align.py
Modified: python-ai-service/app/routes/process_routes.py
Modified: python-ai-service/app/routes/compliance_routes.py
New: python-ai-service/app/services/test_face_align.py
Testing
All 11 tests pass.
API Usage
Standalone auto-rotate
curl -X POST http://localhost:8000/auto-rotate -F "image=@selfie.jpg"Returns corrected PNG with metadata headers.
Part of processing pipeline
Auto-rotation is now applied automatically in POST /remove-bg before background removal - no additional parameters needed.
Via compliance auto-correct