diff --git a/utils/datasets.py b/utils/datasets.py index a6e3d3f56b9f..d87952c9b61d 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -445,7 +445,8 @@ def cache_labels(self, path=Path('./labels.cache'), prefix=''): 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):