我正在尝试通过做一个xor示例来学习caffe。
我在咖啡馆的网站上关注这个link,但他们在做CNN。
我正在尝试按照教程进行操作,但在编译模型时遇到了困难。
我制作了一个描述模型架构的prototxt文件,我试图制作一个两层的xor网络。我的代码如下:
name: "xor_test"
layer {
name: "data"
type: "Data"
transform_param {
scale: 1
}
data_param {
source: "0 0 0
1 0 1
0 1 1
1 1 0"
backend: LMDB
batch_size: 1
}
top: "data"
top: "data"
}
layer {
name: "ip1"
type: "InnerProduct"
param { lr_mult: 1 }
param { lr_mult: 2 }
inner_product_param {
num_output: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
bottom: "data"
top: "ip1"
}
layer {
name: "tanh1"
type: "Tanh"
bottom: "ip1"
top: "ip1"
}
layer {
name: "ip2"
type: "InnerProduct"
param { lr_mult: 1 }
param { lr_mult: 2 }
inner_product_param {
num_output: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
bottom: "ip1"
top: "ip2"
}
layer {
name: "tanh2"
type: "Tanh"
bottom: "ip2"
top: "ip2"
}我不知道这个模型是否正确,我找不到其他的例子来参考。
在此之后,本教程将创建一个引用先前创建的文件的求解器prototxt文件。
net: "test.prototxt"
test_iter: 2
test_interval: 5
base_lr: 0.01
momentum: 0.9
weight_decay: 0.0005
lr_policy: "inv"
gamma: 0.0001
power: 0.75
display: 5
# The maximum number of iterations
max_iter: 10
# solver mode: CPU or GPU
solver_mode: CPU我不确定如何训练或测试模型,因为我的输入不是图像。
发布于 2019-06-04 13:47:07
您的输入层不正确。由于您不使用图像作为输入,而是使用简单的二进制向量,因此可以考虑使用HDF5Data层作为输入。
关于如何构造和使用这个输入数据层,有一个很好的示例here。
https://stackoverflow.com/questions/56436796
复制相似问题