caffe icon indicating copy to clipboard operation
caffe copied to clipboard

how could I define the exact source path in the IMAGE_DATA layer

Open helxsz opened this issue 11 years ago • 2 comments

currently I am using the txt file to define the image path and corresponding label, and these data path and label are passed to the IMAGE_DATA layer.

Here is my files structure

-CAFFE_ROOT
  -examples
     -ocr
          - alpha_solver.prototxt
          - alpha_train_test.prototxt
          - training_index.txt   (data list with path and label for each image)
          - training_images  (data folder to put the images)

And here is my IMAGE_DATA layer defined in alpha_train_test.prototxt

layers {
  name: "alpha"
  type: IMAGE_DATA
  top: "data"
  top: "label"
  image_data_param {
    source: "examples/ocr/training_index.txt"
    batch_size: 500
  }
  transform_param {
    scale: 0.00390625
  }
  include: { phase: TRAIN }
}

When I run ./build/tools/caffe train --solver=examples/ocr/alpha_solver.prototxt -gpu 0, caffe successfully parsed the net defined alpha_train_test.prototxt, but can't get the image path defined in the training_index.txt.

I0226 03:54:24.330605  7059 image_data_layer.cpp:48] A total of 6300 images.
E0226 03:54:24.330628  7059 io.cpp:77] Could not open or find file training_images/G/TimesNewRoman-7-4.png
F0226 03:54:24.330772  7059 image_data_layer.cpp:64] Check failed: ReadImageToDatum(lines_[lines_id_].first, lines_[lines_id_].second, new_height, new_width, &datum) 
*** Check failure stack trace: ***
    @     0x7f74de03cdaa  (unknown)
    @     0x7f74de03cce4  (unknown)
    @     0x7f74de03c6e6  (unknown)
    @     0x7f74de03f687  (unknown)
    @           0x4c5bc7  caffe::ImageDataLayer<>::DataLayerSetUp()
    @           0x4e5a1f  caffe::BaseDataLayer<>::LayerSetUp()
    @           0x4e5fe9  caffe::BasePrefetchingDataLayer<>::LayerSetUp()
    @           0x47f0b1  caffe::Net<>::Init()
    @           0x4809be  caffe::Net<>::Net()
    @           0x48bb30  caffe::Solver<>::InitTrainNet()
    @           0x48cde6  caffe::Solver<>::Init()
    @           0x48cf46  caffe::Solver<>::Solver()
    @           0x419cb0  caffe::GetSolver<>()
    @           0x4160d4  train()
    @           0x410ac1  main
    @     0x7f74d9c3cec5  (unknown)
    @           0x414c27  (unknown)
    @              (nil)  (unknown)
Aborted (core dumped)

I think right now the problem is because of the invalid path, so my question is how to define the source path in the IMAGE_DATA layer

helxsz avatar Feb 26 '15 11:02 helxsz

You can look up the imagedataparameter definition, or just use absolute path in your txt.

lugiavn avatar Feb 27 '15 05:02 lugiavn

Please ask usage questions on the caffe-users list. Thanks!

longjon avatar May 08 '15 04:05 longjon