Skip to content

Preserve training image orientation when EXIF rational metadata is malformed - #3417

Open
bghira wants to merge 1 commit into
mainfrom
fix/malformed-gps-exif
Open

bghira wants to merge 1 commit into
mainfrom
fix/malformed-gps-exif

Conversation

@bghira

@bghira bghira commented Nov 21, 2026

Copy link
Copy Markdown
Owner

An image with a valid EXIF orientation stopped a distributed training run after its pixels had decoded. Pillow applied the rotation, then raised a TypeError while serializing a nested EXIF field that contained text where it expected a rational number.

For this failure, TrainingSample.correct_image retains the orientation in a fresh EXIF block and retries the transform. The resulting training image has correctly oriented RGB pixels and no pending rotation. Images with valid metadata follow the existing Pillow path.

The regression fixture stores GPS latitude as ASCII. It reproduced the original exception before the fix. The test compares the corrected pixels for all seven non-identity EXIF orientations against a valid reference and checks that the orientation tag was removed. All 41 training sample tests passed.

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