Skip to content

Commit

Permalink
Replace print() with logging.info() in trainloader (ultralytics#3103)
Browse files Browse the repository at this point in the history
Might indirectly help ultralytics#3095 by providing better visibility on source of corruption.
  • Loading branch information
glenn-jocher authored May 10, 2021
1 parent 2464044 commit 1ed4075
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ed4075

Please sign in to comment.