Reputation: 89
I am trying to use caffe test in order to check out the accuracy of caffennet. Pretty simple, isn't it?
Really NOT. It doesn't work at all.
Below I describe the steps I am following (To my mind everythink is OK):
I have used the app "create_imagenet.sh" to create a LMDB database. Here I depict my "create_imagenet.sh" (I have modified some things since I only need validation database):
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=256
RESIZE_WIDTH=256
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi
if [ ! -d "$VAL_DATA_ROOT" ]; then
echo "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT"
echo "Set the VAL_DATA_ROOT variable in create_imagenet.sh to the path" \
"where the ImageNet validation data is stored."
exit 1
fi
echo "Creating train lmdb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
-resize_height=$RESIZE_HEIGHT \
-resize_width=$RESIZE_WIDTH \
--shuffle \
$VAL_DATA_ROOT \
$DATA/val.txt \
$EXAMPLE/ilsvrc12_val_leveldb
echo "Done."
in $VAL_DATA_ROOT I storage the path to the validation images, in $DATA the path tu val.txt file and finally example the path when I want to save my database. I can MAKE SURE that the paths are totally correct.
I have modified train_val.prototxt to link the database. Next I depict the first lines of the file. The rest does not change at all (respect to the original).
# mean pixel / channel-wise mean instead of mean image
# transform_param {
# crop_size: 227
# mean_value: 104
# mean_value: 117
# mean_value: 123
# mirror: true
# }
data_param {
source: "/home/paco/Caffe_Original/caffe/examples/imagenet/ilsvrc12_train_lmdb"
batch_size: 256
backend: LMDB
}
}
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
# transform_param {
# mirror: false
# crop_size: 227
# mean_file: "/home/paco/Caffe/caffe/data/ilsvrc12/imagenet_mean.binaryproto"
# }
# mean pixel / channel-wise mean instead of mean image
transform_param {
crop_size: 227
mean_value: 104
mean_value: 117
mean_value: 123
mirror: false
}
data_param {
source: "/home/paco/imagenet_noformat/ilsvrc12_val_lmdb"
batch_size: 50
backend: LMDB
}
}
I just execute caffe tool as follows:
caffe test -model=/home/paco/Caffe/caffe/models/bvlc_reference_caffenet/train_val.prototxt -weights=/home/paco/Caffe/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel -iterations=2000
As you all can see everything looks PERFECT and I don't obtain any error at all!!
However, it does not work since I obtain this on my shell!!:
**
I1016 16:43:32.526727 22178 net.cpp:255] Network initialization done.
I1016 16:43:32.675029 22178 upgrade_proto.cpp:46] Attempting to upgrade input file specified using deprecated transformation parameters: /home/paco/Caffe/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
I1016 16:43:32.675051 22178 upgrade_proto.cpp:49] Successfully upgraded file specified using deprecated data transformation parameters.
W1016 16:43:32.675071 22178 upgrade_proto.cpp:51] Note that future Caffe releases will only support transform_param messages for transformation fields.
I1016 16:43:32.675122 22178 upgrade_proto.cpp:55] Attempting to upgrade input file specified using deprecated V1LayerParameter: /home/paco/Caffe/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
I1016 16:43:32.882395 22178 upgrade_proto.cpp:63] Successfully upgraded file specified using deprecated V1LayerParameter
I1016 16:43:32.943102 22178 caffe.cpp:281] Running for 2000 iterations.
I1016 16:43:34.434036 22178 caffe.cpp:304] Batch 0, accuracy = 1
I1016 16:43:34.434161 22178 caffe.cpp:304] Batch 0, loss = -nan
I1016 16:43:35.862941 22178 caffe.cpp:304] Batch 1, accuracy = 1
I1016 16:43:35.862982 22178 caffe.cpp:304] Batch 1, loss = -nan
I1016 16:43:37.310729 22178 caffe.cpp:304] Batch 2, accuracy = 1
I1016 16:43:37.310768 22178 caffe.cpp:304] Batch 2, loss = -nan
I1016 16:43:38.719712 22178 caffe.cpp:304] Batch 3, accuracy = 1
I1016 16:43:38.719833 22178 caffe.cpp:304] Batch 3, loss = -nan
I1016 16:43:40.171242 22178 caffe.cpp:304] Batch 4, accuracy = 1
I1016 16:43:40.171273 22178 caffe.cpp:304] Batch 4, loss = -nan
I1016 16:43:41.674332 22178 caffe.cpp:304] Batch 5, accuracy = 1
I1016 16:43:41.674373 22178 caffe.cpp:304] Batch 5, loss = -nan
I1016 16:43:43.160789 22178 caffe.cpp:304] Batch 6, accuracy = 1
I1016 16:43:43.160826 22178 caffe.cpp:304] Batch 6, loss = -nan
**
This is even worse with alexnet and Squeezenet where following the same steps I ALWAYS obtain 0 of accuracy (really times to times I get 0.001 or something like that).
WHAT IS HAPPENENING? Maybe I have to preprocess the images before dump it into the database? ANYBODY CAN HELP ME? I WOULD REALLY APPRECIATE IT.
Thank you so much for your attention and help.
Upvotes: 0
Views: 37
Reputation: 89
The problem was MKL library. It was not working yet I was not given any information at all. I have fixed the problem by compiling caffe all over again using OpenBlas library.
Thank you to myself.
Upvotes: 0