浏览代码

Adjust legend labels for classes without instances (#5174)

* legend-labels Adjust legend labels for classes without instances.

* #5158 Re-indexed series names: only classes containing data.

* #5158 Re-indexed series names: only classes containing data.

* Cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
modifyDataloader
NauchtanRobotics GitHub 3 年前
父节点
当前提交
0be58f16f0
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. +2
    -0
      utils/metrics.py

+ 2
- 0
utils/metrics.py 查看文件

@@ -71,6 +71,8 @@ def ap_per_class(tp, conf, pred_cls, target_cls, plot=False, save_dir='.', names

# Compute F1 (harmonic mean of precision and recall)
f1 = 2 * p * r / (p + r + 1e-16)
names = [v for k, v in names.items() if k in unique_classes] # list: only classes that have data
names = {i: v for i, v in enumerate(names)} # to dict
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')

正在加载...
取消
保存