显示YOLOv5训练过程中单个类的AP
YOLOv5训练状况下默认只显示mAP_0.5和mAP_0.5:0.95,想要查看最终每个类别的AP只能在训练结束后的PR曲线中查看。
如果想在训练过程中打印,需要在val.py中270行附近修改
if (verbose or (nc < 50 and not training)) and nc > 1 and len(stats):
for i, c in enumerate(ap_class):
LOGGER.info(pf % (names[c], seen, nt[c], p[i], r[i], ap50[i], ap[i]))
将第一行注释掉,并第二行第三行向前缩进:
#if (verbose or (nc < 50 and not training)) and nc > 1 and len(stats):
for i, c in enumerate(ap_class):
LOGGER.info(pf % (names[c], seen, nt[c], p[i], r[i], ap50[i], ap[i]))
此时训练过程中每一轮都将显示每一个类别的AP。