【发布时间】:2023-04-01 20:50:02
【问题描述】:
我正在尝试将 LeNet 网络用作二元分类器(是,否)。 用于测试的配置文件的第一层和最后几层如下:
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
scale: 0.00390625
}
image_data_param {
source: "examples/my_example/test_images_labels.txt"
batch_size: 1
new_height: 128
new_width: 128
}
}
...
layer {
name: "ip2"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip2"
bottom: "label"
top: "loss"
}
为了测试,我设置了 batch_size=1,因此我使用以下命令运行测试:
./build/tools/caffe test -model examples/my_example/lenet_test.prototxt -weights=examples/my_example/lenet_iter_528.caffemodel -iterations 200
我的目的是能够分别分析每个测试图像的结果。 目前,每次迭代我都会得到以下信息:
I0310 18:30:21.889688 5952 caffe.cpp:264] Batch 41, accuracy = 1 I0310 18:30:21.889739 5952 caffe.cpp:264] Batch 41, loss = 0.578524
但是,由于我的网络中有两个输出,因此在测试时,我希望看到每个输出的两个单独值:一个用于“0”类(“否”),一个用于“1”类(“是”) )。应该是这样的:
Batch 41, class 0 output: 0.755 Batch 41, class 1 output: 0.201
我应该如何修改测试配置文件来实现它?
【问题讨论】:
-
请不要编辑问题来提出新问题。发布一个新问题。如果您认为它们相关,您可以添加上下文链接。
-
另外,如果“上述问题已经解决”,为什么不点击旁边的“v”图标“接受”答案?
-
为什么你声称“有时它是由其他方式制造的(首先是 1 类,然后是 0 类)”?这似乎是一个错误。你确定吗?你能重现它吗?如果是这样,您可能需要在 BVLC/caffe github 页面中报告此错误。
标签: machine-learning computer-vision neural-network deep-learning caffe