Stuck at "Loading mean file from: ...imagenet_mean.binaryproto"

1,260 views
Skip to first unread message

Andrew Hu

unread,
Feb 16, 2016, 1:06:57 AM2/16/16
to Caffe Users
I successfully ran ./make_imagenet_mean.sh

After when I try to run
./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver.prototxt

Everything seems to be ok until it gets to the Loading mean file from: data/ilsvrc12/imagenet_mean.binaryproto stage. It just gets there and gets stuck with no error message.

If it helps the size of the imagenet_mean.binaryproto is 786.4 kB when I ran make_imagenet_mean.sh from a database made from 400 images.

Andrew Hu

unread,
Feb 16, 2016, 1:09:38 AM2/16/16
to Caffe Users
My create_imagenet.sh looks like this:

#!/usr/bin/env sh
# Create the imagenet lmdb inputs
# N.B. set the path to the imagenet train + val data dirs

EXAMPLE=examples/imagenet
DATA=data/ilsvrc12
TOOLS=build/tools

TRAIN_DATA_ROOT=/home/andrew/caffe/DB_train
VAL_DATA_ROOT=/home/andrew/caffe/DB_verify

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=false
if $RESIZE; then
  RESIZE_HEIGHT=256
  RESIZE_WIDTH=256
else
  RESIZE_HEIGHT=0
  RESIZE_WIDTH=0
fi

if [ ! -d "$TRAIN_DATA_ROOT" ]; then
  echo "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT"
  echo "Set the TRAIN_DATA_ROOT variable in create_imagenet.sh to the path" \
       "where the ImageNet training data is stored."
  exit 1
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 /home/andrew/caffe/$TOOLS/convert_imageset \
    --resize_height=$RESIZE_HEIGHT \
    --resize_width=$RESIZE_WIDTH \
    --shuffle \
    $TRAIN_DATA_ROOT \
    $DATA/train.txt \
    $EXAMPLE/ilsvrc12_train_lmdb

echo "Creating val lmdb..."

GLOG_logtostderr=1 /home/andrew/caffe/$TOOLS/convert_imageset \
    --resize_height=$RESIZE_HEIGHT \
    --resize_width=$RESIZE_WIDTH \
    --shuffle \
    $VAL_DATA_ROOT \
    $DATA/val.txt \
    $EXAMPLE/ilsvrc12_val_lmdb

echo "Done."

Andrew Hu

unread,
Feb 16, 2016, 1:22:12 AM2/16/16
to Caffe Users
Nevermind, i found the error. In my train_val.prototxt, the source for the TRAIN and TEST phases pointed to the exact same LMBD files. By pointing the TRAIN LMBD to a separate TRAIN DB I made, it worked.
Message has been deleted

sout...@gmail.com

unread,
May 18, 2016, 7:22:02 AM5/18/16
to Caffe Users
Hello Monjoy Saha,

If you have 3 classifications such as "dog", "cat" and "tiger", and you have 001.jpg, an image of a cat, and 002.jpg , an image of a tiger, then your train.txt or val.txt can be like this:
001.jpg 2
002.jpg 3

So this format is:
Filename No.1 The classification number of file No.1
Filename No.2 The classification number of file No.2
...
 

在 2016年3月16日星期三 UTC+8下午8:10:48,monjoy saha写道:
Can you kindly explain how did you prepare train.txt and val.txt file. If possible can you upload one sample image and corresponding .txt file.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages