我想在我自己的1-dim數據上訓練一個神經網絡(NN),我將這些數據存儲在hdf5數據庫中用於caffe。根據文件,這應該起作用。只要我使用「完全連接層」,「Relu」和「Dropout」,它也適用於我。但是,當我嘗試在NN體系結構中使用「卷積」和「最大池」層時,出現錯誤。該錯誤會抱怨數據的輸入維度。如何使用1-dim向量作爲咖啡的輸入?
I0622 16:44:20.456007 9513 net.cpp:84] Creating Layer conv1
I0622 16:44:20.456015 9513 net.cpp:380] conv1 <- data
I0622 16:44:20.456048 9513 net.cpp:338] conv1 -> conv1
I0622 16:44:20.456061 9513 net.cpp:113] Setting up conv1
F0622 16:44:20.456487 9513 blob.cpp:28] Check failed: shape[i] >= 0 (-9 vs. 0)
這是錯誤,當我只想用一個「池」層後面的「內積」層:
I0622 16:52:44.328660 9585 net.cpp:338] pool1 -> pool1
I0622 16:52:44.328666 9585 net.cpp:113] Setting up pool1
F0622 16:52:44.328680 9585 pooling_layer.cpp:84] Check failed: 4 == bottom[0]->num_axes() (4 vs. 2) Input must have 4 axes, corresponding to (num, channels, height, width)
但是我不知道如何改變輸入的尺寸使得有用。 這是我prototxt文件中指定的網絡架構的開頭:
name: "LeNet"
layer {
name: "myNet"
type: "HDF5Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
hdf5_data_param {
source: "/path/to/my/data/train.txt"
batch_size: 200
}
}
layer {
name: "myNet"
type: "HDF5Data"
top: "data"
top: "label"
include {
phase: TEST
}
hdf5_data_param {
source: "/path/to/my/data/test.txt"
batch_size: 200
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1
kernel_h: 11
kernel_w: 1
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_h: 3
kernel_w: 1
stride: 2
}
}
這是怎麼使用Matlabs h5write功能I輸出我的4D數據庫(有兩個單維):
h5create('train.h5','/data',[dimFeats 1 1 numSamplesTrain]);
h5write('train.h5','/data', traindata);
可能重複[\ [caffe \]:check failed:Check failed:hdf \ _blobs \ _ \ [i]] - > shape(0)== num(200 vs. 6000)](http:// stackoverflow.com/questions/34418027/caffe-check-fails-check-failed-hdf-blobs-i-shape0-num-200-vs-6000) – Shai