マルチターゲット回帰に対処するために、Caffe に単純なネットを実装しようとしていました。
入力の次元は 5 です。出力の次元は 3 です。
私はマットファイルにこのデータを持っています。
とファイルの両方を作成するためにh5create
とを使用しました。h5write
train.h5
test.h5
load('train_data.mat')
h5create('train_data.h5','/data',[5 10000]);
h5write('train_data.h5', '/data', x');
load('train_label.mat')
h5create('train_label.h5','/label',[3 10000]);
h5write('train_label.h5', '/label', Y');
load('test_data.mat')
h5create('test_data.h5','/data',[5 2500]);
h5write('test_data.h5', '/data', x');
load('test_label.mat')
h5create('test_label.h5','/label',[3 2500]);
h5write('test_label.h5', '/label', Y');
次のように Caffe でネットワークを設計しました。
name: "RegressionNet"
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "data"
include {
phase: TRAIN
}
hdf5_data_param {
source: "examples/my_second_cnn_example/data/train_data.txt"
batch_size: 10
}
}
layer {
name: "data"
type: "HDF5Data"
top: "label"
top: "label"
include {
phase: TRAIN
}
hdf5_data_param {
source: "examples/my_second_cnn_example/data/train_label.txt"
batch_size: 10
}
}
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "data"
include {
phase: TEST
}
hdf5_data_param {
source: "examples/my_second_cnn_example/data/test_data.txt"
batch_size: 10
}
}
layer {
name: "data"
type: "HDF5Data"
top: "label"
top: "label"
include {
phase: TEST
}
hdf5_data_param {
source: "examples/my_first_cnn_example/data/test_label.txt"
batch_size: 10
}
}
layer {
name: "fc1"
type: "InnerProduct"
bottom: "data"
top: "fc1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "loss"
type: "EuclideanLoss"
bottom: "fc1"
bottom: "label"
top: "loss"
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "fc1"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
残念ながら、うまくいきません!次のエラーが発生しました
Check failed: outer_num_ * inner_num_ == bottom[1]->count() (10 vs. 30) 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}.
問題はデータの整理方法にあると思います。また、精度レイヤーの使用においても。
しかし、それを解決する方法について何か考えはありますか?