mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-05-01 03:31:35 +00:00
Make data loader resiliant to bad headers in meta
This commit is contained in:
@@ -244,7 +244,12 @@ class ImageProcessingDTOMixin:
|
|||||||
transform: Union[None, transforms.Compose]
|
transform: Union[None, transforms.Compose]
|
||||||
):
|
):
|
||||||
# todo make sure this matches
|
# todo make sure this matches
|
||||||
img = exif_transpose(Image.open(self.path)).convert('RGB')
|
img = Image.open(self.path).convert('RGB')
|
||||||
|
try:
|
||||||
|
img = exif_transpose(img)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
print(f"Error loading image: {self.path}")
|
||||||
w, h = img.size
|
w, h = img.size
|
||||||
if w > h and self.scale_to_width < self.scale_to_height:
|
if w > h and self.scale_to_width < self.scale_to_height:
|
||||||
# throw error, they should match
|
# throw error, they should match
|
||||||
|
|||||||
Reference in New Issue
Block a user