I am trying to get started training a network for image classification using Caffe. I would like a solver to train a model using data of my own. I am using an "ImageData"
layer and I prepared a 'file_lists.txt'
file.
But I get these error messages.
E0211 10:43:12.274907 60653568 io.cpp:80] Could not open or find file /my/path/img/myfirstimage.jpg 123 F0211 10:49:29.643215 146333696 image_data_layer.cpp:148] Check failed: cv_img.data Could not load /my/path/img/myfirstimage.jpg 123
'myfirstimage.jpg'
is the first image in 'file_lists.txt'
and 123
is the label. I checked that the file is in the path '/my/path/img/myfirstimage.jpg'
.
It seems to be trying to load the image using a string that includes the label for the path. From looking at the documentation and examples this shouldn't happen unless I've goofed, but I'm not seeing anything. Can anyone help?
The beginning of mynet.prototxt:
name: "mynet"
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
image_data_param {
source: "/my/path/file_list.txt"
batch_size: 50
new_height: 256
new_width: 256
}
include {
phase: TRAIN
}
}
...
Here is mynet_solver.prototxt
:
net: "/my/path/mynet.prototxt"
test_iter: 10
test_interval: 500
base_lr: 0.01
momentum: 0.9
weight_decay: 0.0000
lr_policy: "inv"
gamma: 0.0001
power: 0.75
display: 100
max_iter: 50000
snapshot: 5000
snapshot_prefix: "/my/path"
solver_mode: CPU
The command I used:
caffe train -solver ./mynet_solver.prototxt
You are correct in your diagnose: it seems like caffe is trying to read the file "/my/path/img/myfirstimage.jpg 123"
, that is the path and the label.
Make sure your '/my/path/file_list.txt'
has this exact format:
That is: there is only one space (not tab or any other character) between the path and the label. There are no other white space characters after the label other than new line char indicating end of line.
Caffe is using c++ code to parse '/my/path/file_list.txt'
therefore the parsing is not very flexible.