【发布时间】:2016-03-18 00:06:33
【问题描述】:
我有一个有 4 个布尔输出的网络。这不是一个分类问题,它们中的每一个都是有意义的。我希望他们每个人都得到一个零或一个。现在我用的是欧几里得损失函数。
有 1000000 个样本。在输入文件中,它们每个都有 144 个特征,因此输入的大小为 1000000*144。 我使用了 50 的批量大小,否则处理时间太多了。 输出文件的大小为 1000000*4,即每个输入有四个输出。
当我使用精度层时,它抱怨输出的维度。它只需要一个布尔输出,而不是四个。我认为这是因为它将问题视为分类问题。 我有两个问题。 首先,考虑到准确率层的误差,欧几里得损失函数是否适合这个任务?以及如何获得网络的准确性? 其次,我将获得四个变量中每一个的预测输出的确切值。我的意思是我需要每个测试记录的准确预测值。现在,我只有每批的损失值。 请指导我解决这些问题。
谢谢, 阿夫辛
火车网络是:
{ state {
phase: TRAIN
}
layer {
name: "abbas"
type: "HDF5Data"
top: "data"
top: "label"
hdf5_data_param {
source: "/home/afo214/Research/hdf5/simulation/Train-1000-11- 1/Train-Sc-B-1000-11-1.txt"
batch_size: 50
}
}
layer {
name: "ip1"
type: "InnerProduct"
bottom: "data"
top: "ip1"
inner_product_param {
num_output: 350
weight_filler {
type: "xavier"
}
}
}
layer {
name: "sig1"
bottom: "ip1"
top: "sig1"
type: "Sigmoid"
}
layer {
name: "ip2"
type: "InnerProduct"
bottom: "sig1"
top: "ip2"
inner_product_param {
num_output: 150
weight_filler {
type: "xavier"
}
}
}
测试网络也是:
state {
phase: TEST
}
layer {
name: "abbas"
type: "HDF5Data"
top: "data"
top: "label"
hdf5_data_param {
source: "/home/afo214/Research/hdf5/simulation/Train-1000-11- 1/Train-Sc-B-1000-11-1.txt"
batch_size: 50
}
}
layer {
name: "ip1"
type: "InnerProduct"
bottom: "data"
top: "ip1"
inner_product_param {
num_output: 350
weight_filler {
type: "xavier"
}
}
}
layer {
name: "sig1"
bottom: "ip1"
top: "sig1"
type: "Sigmoid"
}
layer {
name: "ip2"
type: "InnerProduct"
bottom: "sig1"
top: "ip2"
inner_product_param {
num_output: 150
weight_filler {
type: "xavier"
}
}
}
layer {
name: "sig2"
bottom: "ip2"
top: "sig2"
type: "Sigmoid"
}
layer {
name: "ip4"
type: "InnerProduct"
bottom: "sig2"
top: "ip4"
inner_product_param {
num_output: 4
weight_filler {
type: "xavier"
}
}
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip4"
bottom: "label"
top: "accuracy"
}
layer {
name: "loss"
type: "EuclideanLoss"
bottom: "ip4"
bottom: "label"
top: "loss"
}
我得到这个错误:
accuracy_layer.cpp:34] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (50 vs. 200) Number of labels must match number of predictions; e.g., if label axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be N*H*W, with integer values in {0, 1, ..., C-1}.
不使用准确度层 caffe 给了我损失值。
【问题讨论】:
-
你能把你目前使用的预测层、损失层和准确率层贴出来吗?
-
@Shai 我在这里添加了我的训练层。
-
我对顶层更感兴趣:预测层、损失层和准确度层。顺便说一句,您输入
"label"的shape是什么? -
@Shai 输入标签是一个大小为 N*200 的表格,但预测标签的大小为 N*50。请注意,50 是我的批量大小,对于每个批次我有 4 个输出,但是 caffe 只给出一个预测。
-
你很不清楚。请发布您的 prototxt 并解释什么是
N以及为什么您将批量尺寸与标签尺寸混合在一起(而不是 N*50*4 您有 N*200)??
标签: machine-learning neural-network deep-learning caffe