From 2e0b155db91db0178bfa4a14fc24f6e5206ffb88 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 16 Jun 2021 11:12:15 +0200 Subject: [PATCH] Update `verify_image_label()` (#3635) --- utils/datasets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index 0bb657f30414..20109e739c02 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -1046,20 +1046,20 @@ def autosplit(path='../coco128', weights=(0.9, 0.1, 0.0), annotated_only=False): f.write(str(img) + '\n') # add image to txt file -def verify_image_label(params): +def verify_image_label(args): # Verify one image-label pair - im_file, lb_file, prefix = params + im_file, lb_file, prefix = args nm, nf, ne, nc = 0, 0, 0, 0 # number missing, found, empty, corrupt try: # verify images im = Image.open(im_file) im.verify() # PIL verify shape = exif_size(im) # image size - segments = [] # instance segments 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 + segments = [] # instance segments if os.path.isfile(lb_file): nf = 1 # label found with open(lb_file, 'r') as f: @@ -1084,7 +1084,7 @@ def verify_image_label(params): except Exception as e: nc = 1 logging.info(f'{prefix}WARNING: Ignoring corrupted image and/or label {im_file}: {e}') - return [None] * 4 + [nm, nf, ne, nc] + return [None, None, None, None, nm, nf, ne, nc] def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False):