Skip to content

Apply EXIF orientation when loading pet images - #121

Merged
yyong119 merged 1 commit into
MLEveryday:masterfrom
Arthur031221:fix-exif-pet-images-s16
Oct 2, 2026
Merged

yyong119 merged 1 commit into
MLEveryday:masterfrom
Arthur031221:fix-exif-pet-images-s16

Conversation

@Arthur031221

Copy link
Copy Markdown
Contributor

Users who point COURSE_PET_IMAGES at cat and dog JPEGs with EXIF rotation get sideways pixels in the Day 40 preview and Day 41/42 models. The data guide documents this option for an existing image folder.

pet_dataset converted images to RGB without applying the orientation tag. Apply the EXIF transpose before resizing. The regression creates a fixed red and blue JPEG with orientation 6 and checks the colors at the top and bottom of the decoded image. On the parent commit, its bottom-blue assertion failed with AssertionError: np.float32(0.0) not greater than 0.9.

Tested on Linux with Python 3.12.3: .venv/bin/python -m unittest discover -s tests -q ran 17 tests successfully. The lesson checks passed for 15 scripts and 15 notebooks, and the deep checks passed for 4 scripts and 4 notebooks.

The repository does not include the PetImages files, so I have not measured whether the linked Microsoft dataset contains EXIF rotation tags. The regression covers the documented COURSE_PET_IMAGES path with a user-provided JPEG.

@yyong119

yyong119 commented Oct 2, 2026

Copy link
Copy Markdown
Member

@Arthur031221 Thank you for contributing this fix and the focused regression test! Applying EXIF orientation before RGB conversion and resizing ensures that user-provided pet photos are displayed and processed in their intended orientation. We verified the regression against the previous implementation, checked all eight EXIF orientations plus images without an orientation tag, and confirmed that the original image files remain unchanged. All 17 local tests and the CI checks passed. This is ready to merge — thanks for making the course more reliable for learners!

@yyong119
yyong119 merged commit d430ac5 into MLEveryday:master Oct 2, 2026
3 checks passed
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.

2 participants