Skip to content

Commit

Permalink
handle exif data when loading images during training (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorfmanrobert authored Sep 3, 2024
1 parent 3b23870 commit c0888e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions darwin/dataset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np
from PIL import Image as PILImage
from PIL import ImageOps
from rich.live import Live
from rich.progress import ProgressBar, track

Expand Down Expand Up @@ -676,6 +677,7 @@ def load_pil_image(path: Path, to_rgb: Optional[bool] = True) -> PILImage.Image:
The loaded image.
"""
pic = PILImage.open(path)
pic = ImageOps.exif_transpose(pic)
if to_rgb:
pic = convert_to_rgb(pic)
return pic
Expand Down

0 comments on commit c0888e1

Please sign in to comment.