Replace print() with logging.info() in trainloader (#3103)
Browse filesMight indirectly help #3095 by providing better visibility on source of corruption.
- utils/datasets.py +2 -2
utils/datasets.py
CHANGED
@@ -490,14 +490,14 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|
490 |
x[im_file] = [l, shape, segments]
|
491 |
except Exception as e:
|
492 |
nc += 1
|
493 |
-
|
494 |
|
495 |
pbar.desc = f"{prefix}Scanning '{path.parent / path.stem}' images and labels... " \
|
496 |
f"{nf} found, {nm} missing, {ne} empty, {nc} corrupted"
|
497 |
pbar.close()
|
498 |
|
499 |
if nf == 0:
|
500 |
-
|
501 |
|
502 |
x['hash'] = get_hash(self.label_files + self.img_files)
|
503 |
x['results'] = nf, nm, ne, nc, i + 1
|
|
|
490 |
x[im_file] = [l, shape, segments]
|
491 |
except Exception as e:
|
492 |
nc += 1
|
493 |
+
logging.info(f'{prefix}WARNING: Ignoring corrupted image and/or label {im_file}: {e}')
|
494 |
|
495 |
pbar.desc = f"{prefix}Scanning '{path.parent / path.stem}' images and labels... " \
|
496 |
f"{nf} found, {nm} missing, {ne} empty, {nc} corrupted"
|
497 |
pbar.close()
|
498 |
|
499 |
if nf == 0:
|
500 |
+
logging.info(f'{prefix}WARNING: No labels found in {path}. See {help_url}')
|
501 |
|
502 |
x['hash'] = get_hash(self.label_files + self.img_files)
|
503 |
x['results'] = nf, nm, ne, nc, i + 1
|