python - 在caffe中使用HDF5数据训练模型时出错

标签 python hdf5 deep-learning caffe

我正在使用 caffe,我一直在尝试使用 HDF5 数据训练 caffenet 模型,我使用 ~/../caffe/examples/hdf5_classification 中的 prototxt 文件。但我收到以下错误

I0219 19:06:43.038563 5773 caffe.cpp:103] Use CPU.
I0219 19:06:43.052496 5773 caffe.cpp:107] Starting Optimization
I0219 19:06:43.052989 5773 solver.cpp:32] Initializing solver from parameters:
test_iter: 10
test_interval: 10
base_lr: 0.01
display: 10
max_iter: 20
lr_policy: "step"
gamma: 0.1
momentum: 0.9
weight_decay: 0.0005
stepsize: 5
snapshot: 10
snapshot_prefix: "examples/hdf5_classification/train"
solver_mode: CPU
net: "examples/hdf5_classification/train_val2.prototxt"
I0219 19:06:43.055266 5773 solver.cpp:67] Creating training net from net file: examples/hdf5_classification/train_val2.prototxt
I0219 19:06:43.056095 5773 net.cpp:275] The NetState phase (0) differed from the phase (1) specified by a rule in layer data
I0219 19:06:43.056354 5773 net.cpp:275] The NetState phase (0) differed from the phase (1) specified by a rule in layer accuracy
I0219 19:06:43.056669 5773 net.cpp:39] Initializing net from parameters:
name: "LogisticRegressionNet"
layers {
top: "data"
top: "label"
name: "data"
type: HDF5_DATA
hdf5_data_param {
source: "examples/hdf5_classification/data/tr.txt"
batch_size: 1
}
include {
phase: TRAIN
}
}
layers {
bottom: "data"
top: "fc1"
name: "fc1"
type: INNER_PRODUCT
blobs_lr: 1
blobs_lr: 2
weight_decay: 1
weight_decay: 0
inner_product_param {
num_output: 40
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layers {
bottom: "fc1"
top: "fc1"
name: "relu1"
type: RELU
}
layers {
bottom: "fc1"
top: "fc2"
name: "fc2"
type: INNER_PRODUCT
blobs_lr: 1
blobs_lr: 2
weight_decay: 1
weight_decay: 0
inner_product_param {
num_output: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layers {
bottom: "fc2"
bottom: "label"
top: "loss"
name: "loss"
type: SOFTMAX_LOSS
}
state {
phase: TRAIN
}
I0219 19:06:43.061589 5773 net.cpp:67] Creating Layer data
I0219 19:06:43.061820 5773 net.cpp:356] data -> data
I0219 19:06:43.062067 5773 net.cpp:356] data -> label
I0219 19:06:43.062321 5773 net.cpp:96] Setting up data
I0219 19:06:43.062525 5773 hdf5_data_layer.cpp:57] Loading filename from examples/hdf5_classification/data/tr.txt
I0219 19:06:43.062893 5773 hdf5_data_layer.cpp:69] Number of files: 1
I0219 19:06:43.063103 5773 hdf5_data_layer.cpp:29] Loading HDF5 file/home/sohail/caffe/examples/hdf5_classification/data/new.hd5
HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 3008321728:
#000: ../../../src/H5D.c line 334 in H5Dopen2(): not found
major: Dataset
minor: Object not found
#1: ../../../src/H5Gloc.c line 430 in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
#2: ../../../src/H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#3: ../../../src/H5Gtraverse.c line 641 in H5G_traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
#4: ../../../src/H5Gloc.c line 385 in H5G_loc_find_cb(): object 'label' doesn't exist
major: Symbol table
minor: Object not found
F0219 19:06:43.255592 5773 io.cpp:131] Check failed: status >= 0 (-1 vs. 0) Failed to get dataset ndims for label
*** Check failure stack trace: ***
Aborted (core dumped)

P.S:我是Python编程新手

有人可以帮我解决这个问题吗...... 干杯

最佳答案

我没有在hdf文件中包含标签添加标签数据结构,问题就解决了

关于python - 在caffe中使用HDF5数据训练模型时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28608114/

相关文章:

python - MXNet 打印中间符号值

python - 如何在 train_on_batch nan 更新后将 keras 模型恢复到之前的历元权重

python - 终止剩余的线程

python - 在 asyncio.gather 中内联链 asyncio 协程

python - Pandas 无法正确将 csv 转换为 hdf5?

r - 保存在 hdf5save 中会创建一个不可读的文件

python重新查找可能包含括号的字符串

python - Matplotlib 极坐标图未绘制在应有的位置

python - PyTables:索引大型数组的多个维度

python - 运行Caffe时出现两个错误