From 158746bf2b40c9b9eff072e78004ed990ad25242 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 10 May 2021 17:02:31 +0200 Subject: [PATCH] Replace print() with logging.info() in trainloader Might indirectly help #3095 by providing better visibility on source of corruption. --- utils/datasets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index 43e4e5973a25..f380b20b97d4 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -490,14 +490,14 @@ def cache_labels(self, path=Path('./labels.cache'), prefix=''): x[im_file] = [l, shape, segments] except Exception as e: nc += 1 - print(f'{prefix}WARNING: Ignoring corrupted image and/or label {im_file}: {e}') + logging.info(f'{prefix}WARNING: Ignoring corrupted image and/or label {im_file}: {e}') pbar.desc = f"{prefix}Scanning '{path.parent / path.stem}' images and labels... " \ f"{nf} found, {nm} missing, {ne} empty, {nc} corrupted" pbar.close() if nf == 0: - print(f'{prefix}WARNING: No labels found in {path}. See {help_url}') + logging.info(f'{prefix}WARNING: No labels found in {path}. See {help_url}') x['hash'] = get_hash(self.label_files + self.img_files) x['results'] = nf, nm, ne, nc, i + 1