Check im.format during dataset caching (#2042)

* Check im.format during dataset caching

* Update datasets.py
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-01-25 20:55:35 -08:00
1 parent a41d910c5d
commit 8fcbe43423
1 file changed
+2 -1
+2 -1
View File
@@ -445,7 +445,8 @@ class LoadImagesAndLabels(Dataset): # for training/testing
im = Image.open(im_file)
im.verify() # PIL verify
shape = exif_size(im) # image size
assert (shape[0] > 9) & (shape[1] > 9), 'image size <10 pixels'
assert (shape[0] > 9) & (shape[1] > 9), f'image size {shape} <10 pixels'
assert im.format.lower() in img_formats, f'invalid image format {im.format}'
# verify labels
if os.path.isfile(lb_file):