我有存储在HDF5文件中的96×96像素的灰度图像。我试图使用Caffe进行多输出回归,但是卷积操作无法正常工作。这里到底是什么问题?为什么卷积不工作?
I0122 17:18:39.474860 5074 net.cpp:67] Creating Layer fkpI0122 17:18:39.474889 5074 net.cpp:356] fkp -> dataI0122 17:18:39.474930 5074 net.cpp:356] fkp -> labelI0122 17:18:39.474967 5074 net.cpp:96] Setting up fkpI0122 17:18:39.474987 5074 hdf5_data_layer.cpp:57] Loading filename from train.txtI0122 17:18:39.475103 5074 hdf5_data_layer.cpp:69] Number of files: 1I0122 17:18:39.475131 5074 hdf5_data_layer.cpp:29] Loading HDF5 filefacialkp-train.hd5I0122 17:18:40.337786 5074 hdf5_data_layer.cpp:49] Successully loaded 4934 rowsI0122 17:18:40.337862 5074 hdf5_data_layer.cpp:81] output data size: 100,9216,1,1I0122 17:18:40.337906 5074 net.cpp:103] Top shape: 100 9216 1 1 (921600)I0122 17:18:40.337929 5074 net.cpp:103] Top shape: 100 30 1 1 (3000)I0122 17:18:40.337971 5074 net.cpp:67] Creating Layer conv1I0122 17:18:40.338001 5074 net.cpp:394] conv1 <- dataI0122 17:18:40.338069 5074 net.cpp:356] conv1 -> conv1I0122 17:18:40.338109 5074 net.cpp:96] Setting up conv1F0122 17:18:40.599761 5074 blob.cpp:13] Check failed: height >= 0 (-3 vs. 0)
我的prototxt层文件如下
name: "LogReg"layers { top: "data" top: "label" name: "fkp" type: HDF5_DATA hdf5_data_param { source: "train.txt" batch_size: 100 } include { phase: TRAIN }}layers { bottom: "data" top: "conv1" name: "conv1" type: CONVOLUTION blobs_lr: 1 blobs_lr: 2 convolution_param { num_output: 64 kernel_size: 5 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}layers { bottom: "conv1" top: "pool1" name: "pool1" type: POOLING pooling_param { pool: MAX kernel_size: 2 stride: 2 }}layers { bottom: "pool1" top: "conv2" name: "conv2" type: CONVOLUTION blobs_lr: 1 blobs_lr: 2 convolution_param { num_output: 256 kernel_size: 5 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}layers { bottom: "conv2" top: "pool2" name: "pool2" type: POOLING pooling_param { pool: MAX kernel_size: 2 stride: 2 }}layers { bottom: "pool2" top: "ip1" name: "ip1" type: INNER_PRODUCT blobs_lr: 1 blobs_lr: 2 inner_product_param { num_output: 500 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}layers { bottom: "ip1" top: "ip1" name: "relu1" type: RELU}layers { bottom: "ip1" top: "ip2" name: "ip2" type: INNER_PRODUCT blobs_lr: 1 blobs_lr: 2 inner_product_param { num_output: 30 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}layers { bottom: "ip2" bottom: "label" top: "loss" name: "loss" type: EUCLIDEAN_LOSS}
回答:
这些行
I0122 17:18:40.337906 5074 net.cpp:103] Top shape: 100 9216 1 1 (921600)I0122 17:18:40.337929 5074 net.cpp:103] Top shape: 100 30 1 1 (3000)
表明你的输入数据形状不正确。对于100批次的96×96灰度图像,形状应该是:100 1 96 96。尝试更改这一点。(我的猜测是,对于形状:N C H W,其中N是批次数量,C是通道数,H是高度,W是宽度)