Skip to content

Commit

Permalink
Add val.py no label warning (ultralytics#8782)
Browse files Browse the repository at this point in the history
Help resolve confusion around zero-metrics val.py results when no labels are found in ultralytics#8753
  • Loading branch information
glenn-jocher authored Jul 29, 2022
1 parent 567397d commit e309a85
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions val.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ def run(
# Print results
pf = '%20s' + '%11i' * 2 + '%11.3g' * 4 # print format
LOGGER.info(pf % ('all', seen, nt.sum(), mp, mr, map50, map))
if nt.sum() == 0:
LOGGER.warning(emojis(f'WARNING: no labels found in {task} set, can not compute metrics without labels ⚠️'))

# Print results per class
if (verbose or (nc < 50 and not training)) and nc > 1 and len(stats):
Expand Down

0 comments on commit e309a85

Please sign in to comment.