我有一个完全无条件的深度估算网络,如下所示:(为简单起见,只有上层和下层):
# input: image and depth_image
layer {
name: "train-data"
type: "Data"
top: "data"
top: "silence_1"
include {
phase: TRAIN
}
transform_param {
#mean_file: "mean_train.binaryproto"
scale: 0.00390625
}
data_param {
source: "/train_lmdb"
batch_size: 4
backend: LMDB
}
}
layer {
name: "train-depth"
type: "Data"
top: "depth"
top: "silence_2"
include {
phase: TRAIN
}
transform_param {
scale: 0.00390625
}
data_param {
source: "train_depth_lmdb"
batch_size: 4
backend: LMDB
}
}
layer {
name: "val-data"
type: "Data"
top: "data"
top: "silence_1"
include {
phase: TEST
}
transform_param {
#mean_file: "mean_val.binaryproto"
scale: 0.00390625
}
data_param {
source: "val_lmdb"
batch_size: 4
backend: LMDB
}
}
layer {
name: "val-depth"
type: "Data"
top: "depth"
top: "silence_2"
include {
phase: TEST
}
transform_param {
scale: 0.00390625
}
data_param {
source: "val_depth_lmdb"
batch_size: 4
backend: LMDB
}
}
################## Silence unused labels ##################
layer {
name: "silence_layer_1"
type: "Silence"
bottom: "silence_1"
}
layer {
name: "silence_layer_2"
type: "Silence"
bottom: "silence_2"
}
....
layer {
name: "conv"
type: "Convolution"
bottom: "concat"
top: "conv"
convolution_param {
num_output: 1
kernel_size: 5
pad: 2
stride: 1
engine: CUDNN
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu"
type: "ReLU"
bottom: "conv"
top: "result"
relu_param{
negative_slope: 0.01
engine: CUDNN
}
}
# Error
layer {
name: "accuracy"
type: "Accuracy"
bottom: "result"
bottom: "depth"
top: "accuracy"
include {
phase: TEST
}
}
layer {
name: "loss"
type: "EuclideanLoss"
bottom: "result"
bottom: "depth"
top: "loss"
}
现在我有3个问题:
当我训练网络时,准确度层总是1.我不明白为什么?
EuclideanLayer是否是为此目的的正确层?
在这种情况下需要平均值还是可以忽略平均值?
#Define image transformers
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_mean('data', mean_array)
transformer.set_transpose('data', (2,0,1))
image = "test.png"
img = caffe.io.load_image(image, False)
img = caffe.io.resize_image( img, (IMAGE_WIDTH, IMAGE_HEIGHT))
net.blobs['data'].data[...] = transformer.preprocess('data', img)
pred = net.forward()
output_blob = pred['result']
答案 0 :(得分:1)
"EuclideanLoss"
图层非常适合回归。