Creating imagenet lmdb inputs

385 views
Skip to first unread message

Ali

unread,
May 18, 2016, 6:37:29 AM5/18/16
to Caffe Users
Hi,

I am trying to create an lmdb input for ImageNet validation data using create_imagenet.sh:

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

EXAMPLE=/run/media/boroujerdi/TOURO/caffe-master/examples/imagenet
DATA=/run/media/boroujerdi/TOURO/caffe-master/data/ilsvrc12
TOOLS=/usr/local/caffe-master/build/tools

VAL_DATA_ROOT=/run/media/boroujerdi/TOURO/DataSets/ImageNet/2012/Validation\ Images/ILSVRC2012_img_val/

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
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 val 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_lmdb

echo "Done."
 
All the paths are tested, but after running the script I got these error:

Creating val lmdb...
I0518 12:27:29.910037 19192 convert_imageset.cpp:83] Shuffling data
I0518 12:27:30.171171 19192 convert_imageset.cpp:86] A total of 0 images.
F0518 12:27:30.171519 19192 db_lmdb.cpp:13] Check failed: mkdir(source.c_str(), 0744) == 0 (-1 vs. 0) mkdir /run/media/boroujerdi/TOURO/caffe-master/data/ilsvrc12/val.txtfailed
*** Check failure stack trace: ***
    @     0x7f4020ba7edd  (unknown)
    @     0x7f4020ba9c50  (unknown)
    @     0x7f4020ba7ad3  (unknown)
    @     0x7f4020baa61e  (unknown)
    @     0x7f4026340400  caffe::db::LMDB::Open()
    @           0x403ad7  main
    @     0x7f401c99f580  __libc_start_main
    @           0x404b59  _start
create_imagenet_val.sh: line 37: 19192 Aborted                 (core dumped) GLOG_logtostderr=1 $TOOLS/convert_imageset --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $VAL_DATA_ROOT $DATA/val.txt $EXAMPLE/ilsvrc12_val_lmdb
Done.


Any suggestion? 
Eagerly awaiting replies. Thanks in advance.

Ali

unread,
May 18, 2016, 10:38:40 AM5/18/16
to Caffe Users
The answer is that:

DO NOT use space character in your path name:

The folder name was: Validation Images and I changed it into Validation_Images!

VAL_DATA_ROOT=/run/media/boroujerdi/TOURO/DataSets/ImageNet/2012/Validation\ Images/ILSVRC2012_img_val/
Reply all
Reply to author
Forward
0 new messages