0

以下是我的微调模型的输入层:

layer {
  type: "HDF5Data"
  name: "data"
  top: "Meta" 
  hdf5_data_param {
    source: "/path/to/train.txt"
    batch_size: 50
  }
  include { phase: TRAIN }
}
layer {
  name: "data"
  type: "ImageData"
  top: "X"
  top: "Labels"
  include {
    phase: TRAIN
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
  }
  image_data_param {
    source: "/path/to/train.txt"
    batch_size: 50
    new_height: 256
    new_width: 256
  }
}
layer {
  type: "HDF5Data"
  name: "data"
  top: "Meta" 
  hdf5_data_param {
    source: "/path/to/val.txt"
    batch_size: 50
  }
  include { phase: TEST }
}
layer {
  name: "data"
  type: "ImageData"
  top: "X"
  top: "Labels"
  include {
    phase: TEST
  }
  transform_param {
    mirror: false
    crop_size: 227
    mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
  }
  image_data_param {
    source: "/path/to/val.txt"
    batch_size: 50
    new_height: 256
    new_width: 256
  }
}

如您所见,它有一个 imagedata 输入层和 1 个 hdf5 输入层,如果只有一种类型的层,比如 imagedata,我可以这样做:

input_data = {prepare_images(im)}; # dimension 227*227*3*10

然后 scores = caffe('forward',input_data); 但是在这里我必须给出两种类型的输入数据,我该怎么做呢?请帮忙!

4

1 回答 1

0

我必须检查 matcaffe.cpp(并使用 make matcaffe 重新编译)并打印我失败的“无效输入大小”条件的检查变量,以获得转置 input_data 的想法。

input_data = {prepare_images(im),prepare_other_data()};
scores = caffe('forward', input_data');

因此,转置对我有用。

于 2016-03-01T11:57:08.593 回答