问题遇到的现象和发生背景
看了YOLOv5视频,能跑出结果,效果非常好!多谢炮哥的视频,非常详细了
但跑完train.py后所得性能参数的曲线图和混淆矩阵等图是从哪部分程序而来呢?
论文上要求尽量中文做图标,必须修改一下才能用
看了YOLOv5视频,能跑出结果,效果非常好!多谢炮哥的视频,非常详细了
但跑完train.py后所得性能参数的曲线图和混淆矩阵等图是从哪部分程序而来呢?
论文上要求尽量中文做图标,必须修改一下才能用
可以修改在源代码的utils中的metric.py文件实现
其中第71行
if plot:
plot_pr_curve(px, py, ap, Path(save_dir) / 'PR_curve.png', names)
plot_mc_curve(px, f1, Path(save_dir) / 'F1_curve.png', names, ylabel='F1分数')
plot_mc_curve(px, p, Path(save_dir) / 'P_curve.png', names, ylabel='精确度')
plot_mc_curve(px, r, Path(save_dir) / 'R_curve.png', names, ylabel='召回率')
第186行
```python
def plot_pr_curve(px, py, ap, save_dir='pr_curve.png', names=()):
# Precision-recall curve
fig, ax = plt.subplots(1, 1, figsize=(9, 6), tight_layout=True)
py = np.stack(py, axis=1)
if 0 < len(names) < 21: # display per-class legend if < 21 classes
for i, y in enumerate(py.T):
ax.plot(px, y, linewidth=1, label=f'{names[i]} {ap[i, 0]:.3f}') # plot(recall, precision)
else:
ax.plot(px, py, linewidth=1, color='grey') # plot(recall, precision)
ax.plot(px, py.mean(1), linewidth=3, color='blue', label='all classes %.3f mAP@0.5' % ap[:, 0].mean())
# ax.set_xlabel('Recall')
ax.set_xlabel('召回率')
# ax.set_ylabel('Precision')
ax.set_ylabel('精确度')
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
fig.savefig(Path(save_dir), dpi=250)
第208行
```python
def plot_mc_curve(px, py, save_dir='mc_curve.png', names=(), xlabel='置信度', ylabel='方法'):
# Metric-confidence curve
fig, ax = plt.subplots(1, 1, figsize=(9, 6), tight_layout=True)