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/8753pull/8747/head^2
parent
567397d67a
commit
e309a85586
2
val.py
2
val.py
|
@ -275,6 +275,8 @@ def run(
|
||||||
# Print results
|
# Print results
|
||||||
pf = '%20s' + '%11i' * 2 + '%11.3g' * 4 # print format
|
pf = '%20s' + '%11i' * 2 + '%11.3g' * 4 # print format
|
||||||
LOGGER.info(pf % ('all', seen, nt.sum(), mp, mr, map50, map))
|
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
|
# Print results per class
|
||||||
if (verbose or (nc < 50 and not training)) and nc > 1 and len(stats):
|
if (verbose or (nc < 50 and not training)) and nc > 1 and len(stats):
|
||||||
|
|
Loading…
Reference in New Issue