caffe - 如何在训练阶段获得 PyCaffe 的 Top-k 准确率?
问题描述
我想知道在训练阶段是否有办法在 PyCaffe 上获得 top-k 错误。
我知道 .prototxt 文件有 top_k 参数,但是有什么方法可以在 PyCaffe 上使用它吗?
layer {
name: "accuracy"
type: "Accuracy"
bottom: "..."
bottom: "label"
top: "accuracy"
accuracy_param {
top_k: 5
}
include {
phase: TEST
}
}
解决方案
对于任何想知道我只是发现您需要放置具有不同 top-k 数字的多个精度层的人。这是前 3 位准确度的示例。
layer {
name: "accuracy1"
type: "Accuracy"
bottom: "score"
bottom: "label"
top: "accuracy1"
include {
phase: TEST
}
}
layer {
name: "accuracy2"
type: "Accuracy"
bottom: "score"
bottom: "label"
top: "accuracy2"
accuracy_param {
top_k: 2
}
include {
phase: TEST
}
}
layer {
name: "accuracy3"
type: "Accuracy"
bottom: "score"
bottom: "label"
top: "accuracy3"
accuracy_param {
top_k: 3
}
include {
phase: TEST
}
}
推荐阅读
- python - 使用 for 循环更改列表中所有元素的值
- php - php脚本在添加3个图像的情况下执行,即使只有一个文件,我也需要让它将数据插入数据库
- javascript - Three.js - CanvasRenderer 不使用多种材质渲染网格
- google-chrome - 防止 chrome 自动建议列表
- java - java按等级,名称排序等级
- methods - 为什么 Vec::len 是方法而不是公共属性?
- javascript - 为传单风图格式化json
- arrays - 如何强制从 Observable 返回的对象类型到 Angular 中的对象数组?
- java - java - 如何使用包含数组的参数调用图形方法?
- flask - 在 Flask-Admin 的内置模板中添加填充其他字段的按钮