caffe:检查失败:cv_img.data 无法加载
caffe: Check failed: cv_img.data Could not load
我使用python训练caffe net但是遇到错误:
I0717 11:05:32.177762 8677 solver.cpp:218] Iteration 0 (0 iter/s, 0.178244s/20 iters), loss = 363409
I0717 11:05:32.177825 8677 solver.cpp:237] Train net output #0: loss = 363409 (* 1 = 363409 loss)
I0717 11:05:32.177922 8677 solver.cpp:237] Train net output #1: tmpl = 0
I0717 11:05:32.178000 8677 solver.cpp:237] Train net output #2: tmpo = 0
I0717 11:05:32.178014 8677 sgd_solver.cpp:105] Iteration 0, lr = 1e-10
E0717 11:05:32.186724 8703 io.cpp:80] Could not open or find file
F0717 11:05:32.186736 8703 image_data_layer.cpp:129] Check failed: cv_img.data Could not load
*** Check failure stack trace: ***
Aborted (core dumped)
这是我的网络的数据层:
layer {
name: "data"
type: "ImageData"
top: "data"
top: "tmpo"
image_data_param {
is_color: false
source: "/home/muses/fcn-master/mo/train_o.txt"
batch_size: 1
shuffle: false
}
}
layer {
name: "label"
type: "ImageData"
top: "label"
top: "tmpl"
image_data_param {
is_color: false
source: "/home/muses/fcn-master/mo/train_l.txt"
batch_size: 1
shuffle: false
}
}
train_l.txt:
(train_o.txt与本文件大致相同)
/home/muses/fcn-master/data/vessel/train/label/01.png 0
/home/muses/fcn-master/data/vessel/train/label/02.png 0
/home/muses/fcn-master/data/vessel/train/label/03.png 0
/home/muses/fcn-master/data/vessel/train/label/04.png 0
/home/muses/fcn-master/data/vessel/train/label/05.png 0
/home/muses/fcn-master/data/vessel/train/label/06.png 0
/home/muses/fcn-master/data/vessel/train/label/07.png 0
/home/muses/fcn-master/data/vessel/train/label/08.png 0
/home/muses/fcn-master/data/vessel/train/label/09.png 0
/home/muses/fcn-master/data/vessel/train/label/10.png 0
/home/muses/fcn-master/data/vessel/train/label/11.png 0
/home/muses/fcn-master/data/vessel/train/label/12.png 0
/home/muses/fcn-master/data/vessel/train/label/13.png 0
我检查过文件路径是correct.All文件是在ubuntu14.04下编辑的。
然后我修改了io.cpp的第80行,尝试像这样打印错误的文件名:
if (!cv_img_origin.data) {
LOG(INFO) << "FILENAME: " << filename;
LOG(INFO) << "cv_read_flag: " << cv_read_flag;
LOG(ERROR) << "Could not open or find file " << filename;
return cv_img_origin;
}
错误来了:
I0718 10:17:13.220021 18611 io.cpp:80] FILENAME:
I0718 10:17:13.220058 18611 io.cpp:81] cv_read_flag: 0
E0718 10:17:13.220062 18611 io.cpp:82] Could not open or find file
F0718 10:17:13.220067 18611 image_data_layer.cpp:129] Check failed: cv_img.data Could not load
我不明白为什么会出现错误。
知道原因的,万分感谢
您是否使文件可执行?我这样做之后我的问题就解决了。
您可以在图像文件夹中使用 chmod +x *.jpg
或 chmod +x *.png
来使文件可执行。
我有同样的问题 - 因为在 "Could not open or find file" 之后没有显示文件名,这意味着你在火车或测试 .txt 中有一个 空行 你当时正在打电话(我的是文件的最后一行)。
我使用python训练caffe net但是遇到错误:
I0717 11:05:32.177762 8677 solver.cpp:218] Iteration 0 (0 iter/s, 0.178244s/20 iters), loss = 363409
I0717 11:05:32.177825 8677 solver.cpp:237] Train net output #0: loss = 363409 (* 1 = 363409 loss)
I0717 11:05:32.177922 8677 solver.cpp:237] Train net output #1: tmpl = 0
I0717 11:05:32.178000 8677 solver.cpp:237] Train net output #2: tmpo = 0
I0717 11:05:32.178014 8677 sgd_solver.cpp:105] Iteration 0, lr = 1e-10
E0717 11:05:32.186724 8703 io.cpp:80] Could not open or find file
F0717 11:05:32.186736 8703 image_data_layer.cpp:129] Check failed: cv_img.data Could not load
*** Check failure stack trace: ***
Aborted (core dumped)
这是我的网络的数据层:
layer {
name: "data"
type: "ImageData"
top: "data"
top: "tmpo"
image_data_param {
is_color: false
source: "/home/muses/fcn-master/mo/train_o.txt"
batch_size: 1
shuffle: false
}
}
layer {
name: "label"
type: "ImageData"
top: "label"
top: "tmpl"
image_data_param {
is_color: false
source: "/home/muses/fcn-master/mo/train_l.txt"
batch_size: 1
shuffle: false
}
}
train_l.txt: (train_o.txt与本文件大致相同)
/home/muses/fcn-master/data/vessel/train/label/01.png 0
/home/muses/fcn-master/data/vessel/train/label/02.png 0
/home/muses/fcn-master/data/vessel/train/label/03.png 0
/home/muses/fcn-master/data/vessel/train/label/04.png 0
/home/muses/fcn-master/data/vessel/train/label/05.png 0
/home/muses/fcn-master/data/vessel/train/label/06.png 0
/home/muses/fcn-master/data/vessel/train/label/07.png 0
/home/muses/fcn-master/data/vessel/train/label/08.png 0
/home/muses/fcn-master/data/vessel/train/label/09.png 0
/home/muses/fcn-master/data/vessel/train/label/10.png 0
/home/muses/fcn-master/data/vessel/train/label/11.png 0
/home/muses/fcn-master/data/vessel/train/label/12.png 0
/home/muses/fcn-master/data/vessel/train/label/13.png 0
我检查过文件路径是correct.All文件是在ubuntu14.04下编辑的。 然后我修改了io.cpp的第80行,尝试像这样打印错误的文件名:
if (!cv_img_origin.data) {
LOG(INFO) << "FILENAME: " << filename;
LOG(INFO) << "cv_read_flag: " << cv_read_flag;
LOG(ERROR) << "Could not open or find file " << filename;
return cv_img_origin;
}
错误来了:
I0718 10:17:13.220021 18611 io.cpp:80] FILENAME:
I0718 10:17:13.220058 18611 io.cpp:81] cv_read_flag: 0
E0718 10:17:13.220062 18611 io.cpp:82] Could not open or find file
F0718 10:17:13.220067 18611 image_data_layer.cpp:129] Check failed: cv_img.data Could not load
我不明白为什么会出现错误。 知道原因的,万分感谢
您是否使文件可执行?我这样做之后我的问题就解决了。
您可以在图像文件夹中使用 chmod +x *.jpg
或 chmod +x *.png
来使文件可执行。
我有同样的问题 - 因为在 "Could not open or find file" 之后没有显示文件名,这意味着你在火车或测试 .txt 中有一个 空行 你当时正在打电话(我的是文件的最后一行)。