pythonmachine-learningcomputer-visioncaffepycaffe

caffe: Check failed: cv_img.data Could not load


I use python to train a caffe net but meet an error:

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)

here is the data layer of my net:

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 is about the same to this file)

/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

I have checked that the file path is correct.All files are edited under ubuntu14.04. THEN I modified the 80th line of io.cpp,try to print the wrong filename like this:

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;
  }

the error comes to:

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 

I can not figure out why the error comes out. thank you very much if you know the reason.


Solution

  • Did you make files executable ? my problem solved after i did that.

    you can use chmod +x *.jpg or chmod +x *.png inside images folder for making files executable.