Repository navigation
Apply EXIF orientation when loading pet images - #121
Merged
Merged
Conversation
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! |
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.
Users who point
COURSE_PET_IMAGESat 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_datasetconverted 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 withAssertionError: 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 -qran 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_IMAGESpath with a user-provided JPEG.