kohya-ss / kohya-ss/sd-scripts
warn or transpose images with exif rotation
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
https://github.com/kohya-ss/sd-scripts/blob/71e2c91330a9d866ec05cdd10584bbb962896a99/library/train_util.py#L2349
Minor issue, but would it be possible to warn users if exif rotational information for an image is found? I had some images in my training set which were rotated only by exif data, so when they were loaded in by Pillow, their rotation was ignored, making my captions inaccurate ("from side").
(I have exif rotated images because Windows' built-in image rotation function rotates by exif only for some file extensions, like .jpeg. I believe digital cameras and phone cameras also use exif rotation metadata).
Alternatively, could load_image() use the Pillow method to automatically rotate the image by exif orientation?
`PIL.ImageOps.exif_transpose(image, in_place=True)`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at library/train_util.py around line 2349 and inspect how load_image() handles Pillow images and EXIF orientation. Check Pillow's PIL.ImageOps.exif_transpose(image, in_place=True) behavior, then define completion as either warning when rotational EXIF data is present or applying the requested automatic transpose, with the chosen behavior verified on affected images.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100