Make data loader resiliant to bad headers in meta

This commit is contained in:
Jaret Burkett committed 2023-08-29 18:56:06 -06:00
1 parent 836fee47a6
commit d401348c2e
1 file changed
+6 -1
+6 -1
View File
@@ -244,7 +244,12 @@ class ImageProcessingDTOMixin:
transform: Union[None, transforms.Compose]
):
# 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
if w > h and self.scale_to_width < self.scale_to_height:
# throw error, they should match