Add val.py no label warning (#8782)

Help resolve confusion around zero-metrics val.py results when no labels are found in https://github.com/ultralytics/yolov5/issues/8753
This commit is contained in:
Glenn Jocher authored and GitHub committed 2022-07-29 14:45:29 +02:00
1 parent 567397d67a
commit e309a85586
1 file changed
+2
+2
View File
@@ -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):