深度学习中的排名准确率与网络微调技术
1. 排名准确率(Ranked Accuracy)
排名准确率是评估模型性能的重要指标,主要包括排名 1 准确率(rank-1 accuracy)和排名 5 准确率(rank-5 accuracy)。
1.1 排名准确率的概念
- 排名 1 准确率 :指的是真实标签与模型预测概率最大的类别标签相等的次数占比。
- 排名 5 准确率 :是指真实标签出现在模型预测概率最大的前 5 个类别标签中的次数占比。
1.2 计算排名准确率的代码实现
以下是计算排名 1 和排名 5 准确率的 Python 代码:
# initialize the rank-1 and rank-5 accuracies
rank1 = 0
rank5 = 0
# loop over the predictions and ground-truth labels
for (p, gt) in zip(preds, labels):
# sort the probabilities by their index in descending
# order so that the more confident guesses are at the
# front of the list
p = np.argsort(p)[::-1]
# check if the ground-truth l
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



