3
votes

I am trying o use caffe's implementation of GoogleNet. I want to train the deep network according to a list of files and labels in a text file, but the problem is that, when I train the deep network, it can't read the files.

Here is the train_val.prototxt definitions, where I use ImageData instead of using big LMDB files with 'Data' type

name: "GoogleNet"
layer 
  {
  name: "data"
  type: "ImageData"
  top: "data"
  top: "label"
  include {
  phase: TRAIN
 }
 transform_param 
 {
 mirror: true
 crop_size: 224
 mean_value: 104
 mean_value: 117
 mean_value: 123
 }
 data_param 
 {
  source: "path_to_file/file_paths_and_labels.txt"
  batch_size: 32
 }
}  

Here I used ImageData type for the googlenet rather than type Data as suggested here: LMDB files and how they are used for caffe deep learning network

So, I have the text file (file_paths_and_labels.txt) where each line contain the following:

path_to_image label

where path to image is the image's address and label is the label of the image (there are 10 different labels).

I want to know exactly where I am wrong because when I run the deep network training command

./build/tools/caffe train --solver=/my_home/dl-caffe/models/bvlc_googlenet/solver.prototxt 

I have the following error:

I0624 10:36:11.524896 15246 layer_factory.hpp:74] Creating layer data
I0624 10:36:11.524960 15246 net.cpp:84] Creating Layer data
I0624 10:36:11.524988 15246 net.cpp:338] data -> data
I0624 10:36:11.525046 15246 net.cpp:338] data -> label
I0624 10:36:11.525084 15246 net.cpp:113] Setting up data
I0624 10:36:11.525106 15246 image_data_layer.cpp:36] Opening file 
I0624 10:36:11.525146 15246 image_data_layer.cpp:51] A total of 0 images.
*** Aborted at 1435152971 (unix time) try "date -d @1435152971" if you   are using GNU date ***
PC: @     0x7f7060b70ee0 (unknown)
*** SIGSEGV (@0x0) received by PID 15246 (TID 0x7f706188aa40) from PID   0; stack trace: ***
@     0x7f7060511d40 (unknown)
@     0x7f7060b70ee0 (unknown)
@     0x7f706118587c std::operator+<>()
@     0x7f70611861e5 caffe::ImageDataLayer<>::DataLayerSetUp()
@     0x7f7061144ac6 caffe::BaseDataLayer<>::LayerSetUp()
@     0x7f7061144bc9 caffe::BasePrefetchingDataLayer<>::LayerSetUp()
@     0x7f70611d8ff2 caffe::Net<>::Init()
@     0x7f70611daab2 caffe::Net<>::Net()
@     0x7f70611e6c10 caffe::Solver<>::InitTrainNet()
@     0x7f70611e7d23 caffe::Solver<>::Init()
@     0x7f70611e7ef6 caffe::Solver<>::Solver()
@           0x40c4a0 caffe::GetSolver<>()
@           0x406471 train()
@           0x404a11 main
@     0x7f70604fcec5 (unknown)
@           0x404fbd (unknown)
Segmentation fault (core dumped)

I think GoogleNet is not finding data in my textfile. What is the problem? the syntax of my train_val.prototxt file?

2
have you tried this with other nets (e.g., AlexNet)? is it possible that the "end-of-line" char in the text file is not compatible with your OS (that is, using windows line termination in unix system and vice versa)?Shai

2 Answers

8
votes

You're specifying the source using the wrong parameter. For IMAGE_DATA you need to use image_data_param instead of data_param. Because you specify your source in data_param, and ImageDataLayer looks at image_data_param, the value of source is the empty string. You can see that in the log here:

I0624 10:36:11.525106 15246 image_data_layer.cpp:36] Opening file 

The format of this line should be:

Opening file <filename>

while in your log there's an empty space following "Opening file".

0
votes

That my be helpful for people who will land here in future.
I had kind of the same problem, but I was loading images from leveldb file.
And this error appeared when I copied leveldb files, generated on machine A, to another machine B and tried to run caffe on B. The problem was solved by regenerating leveldb files once again on the machine B.

BTW. may be anybody knows why does the machine on which was leveldb generated matter?