Caffe的卷积问题

时间:2015-01-22 16:24:27

标签: machine-learning deep-learning caffe

我有96x96像素的灰度格式图像存储在HDF5文件中。我正在尝试使用caffe进行多输出回归,但卷积不起作用。究竟是什么问题?为什么卷积不起作用?

I0122 17:18:39.474860  5074 net.cpp:67] Creating Layer fkp
I0122 17:18:39.474889  5074 net.cpp:356] fkp -> data
I0122 17:18:39.474930  5074 net.cpp:356] fkp -> label
I0122 17:18:39.474967  5074 net.cpp:96] Setting up fkp
I0122 17:18:39.474987  5074 hdf5_data_layer.cpp:57] Loading filename from train.txt
I0122 17:18:39.475103  5074 hdf5_data_layer.cpp:69] Number of files: 1
I0122 17:18:39.475131  5074 hdf5_data_layer.cpp:29] Loading HDF5 filefacialkp-train.hd5
I0122 17:18:40.337786  5074 hdf5_data_layer.cpp:49] Successully loaded 4934 rows
I0122 17:18:40.337862  5074 hdf5_data_layer.cpp:81] output data size: 100,9216,1,1
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)
I0122 17:18:40.337971  5074 net.cpp:67] Creating Layer conv1
I0122 17:18:40.338001  5074 net.cpp:394] conv1 <- data
I0122 17:18:40.338069  5074 net.cpp:356] conv1 -> conv1
I0122 17:18:40.338109  5074 net.cpp:96] Setting up conv1
F0122 17:18:40.599761  5074 blob.cpp:13] Check failed: height >= 0 (-3 vs. 0) 

我的原型文件图层文件就像这样

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
}

1 个答案:

答案 0 :(得分:3)

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批96x96灰度图像的输入,形状应为:100 1 96 96。 试着改变这个。 (我的猜测是形状:N C H W,其中N个批次,c个通道,h高度,w重量)