Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion vggt/utils/load_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

import torch
from PIL import Image
from PIL import Image, ImageOps
from torchvision import transforms as TF
import numpy as np

Expand Down Expand Up @@ -39,6 +39,7 @@ def load_and_preprocess_images_square(image_path_list, target_size=1024):
for image_path in image_path_list:
# Open image
img = Image.open(image_path)
img = ImageOps.exif_transpose(img)

# If there's an alpha channel, blend onto white background
if img.mode == "RGBA":
Expand Down Expand Up @@ -138,6 +139,7 @@ def load_and_preprocess_images(image_path_list, mode="crop"):
for image_path in image_path_list:
# Open image
img = Image.open(image_path)
img = ImageOps.exif_transpose(img)

# If there's an alpha channel, blend onto white background:
if img.mode == "RGBA":
Expand Down