caffe检查失败:kernel_size指定2次; 0空间暗淡

时间:2018-04-15 13:56:03

标签: neural-network deep-learning caffe conv-neural-network pycaffe

我有一个caffe“检查失败”错误:

...
I0415 15:35:30.497133 39410 net.cpp:129] Top shape: 1 4096 (4096)
I0415 15:35:30.497135 39410 net.cpp:137] Memory required for data: 2898304
I0415 15:35:30.497138 39410 layer_factory.hpp:77] Creating layer conv1
I0415 15:35:30.497155 39410 net.cpp:84] Creating Layer conv1
I0415 15:35:30.497169 39410 net.cpp:406] conv1 <- ReLU0
I0415 15:35:30.497174 39410 net.cpp:380] conv1 -> conv1
F0415 15:35:30.497185 39410 base_conv_layer.cpp:35] Check failed: num_kernel_dims == 1 || num_kernel_dims == num_spatial_axes_ kernel_size must be specified once, or once per spatial dimension (kernel_size specified 2 times; 0 spatial dims).

这是proto.txt文件的一小部分:

...
layer {
  name: "loss0"
  type: "EuclideanLoss"
  bottom: "ampl0"
  bottom: "label_b4_noise"
  top: "loss0"
}
layer {
  name: "ReLU0"
  type: "ReLU"
  bottom: "ampl0"
  top: "ReLU0"
  relu_param {
    negative_slope: 0
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "ReLU0"
  top: "conv1"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  convolution_param {
    num_output: 16
    bias_term: false
    pad: 0
    pad: 0
    kernel_size: 1
    kernel_size: 5
    group: 1
    stride: 1
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
      value: 0.0
    }
    axis: 1
  }
}
...
你可以告诉我为什么“检查失败”?

什么“kernel_size指定2次; 0空间变暗”是指?

num_spatial_axes_ kernel_size在这里? 抱歉,如果我的问题很简单。

1 个答案:

答案 0 :(得分:1)

查看图层的输入("ReLU0"):

I0415 15:35:30.497133 39410 net.cpp:129] Top shape: 1 4096 (4096)

它的尺寸是1x4096,它有1个批次,4096个通道,没有宽度和没有高度(也就是说,宽度和高度是通常的单个尺寸忽略)。
现在您要应用"conv1" 1x5内核。你想如何在没有空间维度的blob上应用卷积?!

这是你从caffe得到的错误:你为conv内核指定了2个空间维度(你指定了kernel_size两次),但你的输入blob根本没有空间维度,即num_spatial_axes_==0