Caffe:如何使用lmdb将每个图像的概率和类标签输出到文件?

时间:2016-03-17 15:17:06

标签: caffe

我有一个网络,我正在尝试使用caffe-但是我有很多测试图像,并希望使用lmdb blobs加速测试/实验过程(而不是在MatCaffe / PyCaffe中按图像进行测试) )。最后,我希望有一个输出类似的文件:

ImageXXXXX prob1 prob2 ... probk argmaxlabel1 argmaxlabel2 ... argmaxlabelk

对于每个1-k顶部猜测,其中该文件的每一行是被测试的图像。

我知道如何修改原型文件以获取概率,argmax和记录,但我似乎无法弄清楚如何以这种特定方式将其写入文件。

有人有什么想法吗?

修改

将此添加到我的原型文本底部:

layer {
  name: "hdf5out"
  type: "HDF5Output"
  bottom: "data"
  bottom: "prob"
  hdf5_output_param {
    file_name: "temp.h5"
  }
}

我生成以下错误:

I0317 13:27:35.451179 31624 hdf5_output_layer.cpp:32] Saving HDF5 file temp.h5
HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 140368229194176:
  #000: ../../../src/H5D.c line 170 in H5Dcreate2(): unable to create dataset
    major: Dataset
    minor: Unable to initialize object
  #001: ../../../src/H5Dint.c line 439 in H5D__create_named(): unable to create and link to dataset
    major: Dataset
    minor: Unable to initialize object
  #002: ../../../src/H5L.c line 1638 in H5L_link_object(): unable to create new link to object
    major: Links
    minor: Unable to initialize object
  #003: ../../../src/H5L.c line 1882 in H5L_create_real(): can't insert link
    major: Symbol table
    minor: Unable to insert object
  #004: ../../../src/H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal failed
    major: Symbol table
    minor: Object not found
  #005: ../../../src/H5Gtraverse.c line 641 in H5G_traverse_real(): traversal operator failed
    major: Symbol table
    minor: Callback failed
  #006: ../../../src/H5L.c line 1674 in H5L_link_cb(): name already exists
    major: Symbol table
    minor: Object already exists
F0317 13:27:35.451373 31624 hdf5.cpp:101] Check failed: status >= 0 (-1 vs. 0) Failed to make float dataset data
*** Check failure stack trace: ***

它似乎与此post相似,但是该解决方案的链接是不同版本的caffe(例如,在我的版本中,没有文件data_layers.hpp - 我只有data_layer.hpp )/

0 个答案:

没有答案