How to generate the lmdb from VOC2012 data (raw image, path)?

199 views
Skip to first unread message

john1...@gmail.com

unread,
Jan 2, 2017, 3:35:14 AM1/2/17
to Caffe Users
Hello all, I am using ParseNet code. It used the LMDB file with two inputs: `VOC2012ext_train_aug_img_lmdb` and `VOC2012ext_train_aug_label_lmdb
`. However, my VOC2012 database has only the jpg image locate at  `/media/john/pascal/VOCdevkit/VOC2012` and txt files (train.txt and val.txt) at `/media/john/pascal/VOCdevkit/VOC2012_train_val_list`. Hence, I must modify the the script /caffe/examples/imagenet/create_imagenet.sh to generate these lmdb file as

set -e

EXAMPLE
=/home/john/caffe/examples/imagenet
DATA
=/media/john/pascal/VOCdevkit/VOC2012_train_val_list
TOOLS
=../../build/tools

TRAIN_DATA_ROOT
=/media/john/pascal/VOCdevkit/VOC2012
VAL_DATA_ROOT
=/media/john/pascal/VOCdevkit/VOC2012
# 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 $TOOLS/convert_imageset \
   
--resize_height=$RESIZE_HEIGHT \
   
--resize_width=$RESIZE_WIDTH \
   
--shuffle \
    $TRAIN_DATA_ROOT
\
    $DATA
/train.txt \
    $EXAMPLE
/ilsvrc12_train_lmdb
echo
"Done."

Finally,  I got two outputs as: `data.mdb` and `lock.mdb`.  My question is Is it correct steps to generate lmdb file from JPEG and its path? In my outputs, Which one corresponding is to VOC2012ext_train_aug_img_lmdb and which one is corresponding to VOC2012ext_train_aug_label_lmdb of prototxt (bellow)? Thank you 


name: "VGG_VOC2012ext"
layer
{
  name
: "data"
  type
: "Data"
  top
: "data"
  include
{
    phase
: TRAIN
 
}

  transform_param
{
    mean_value
: 104.00699
    mean_value
: 116.66877
    mean_value
: 122.67892
 
}

  data_param
{
    source
: "examples/VOC2012ext/VOC2012ext_train_aug_img_lmdb"
    batch_size
: 1
    backend
: LMDB
 
}
}
layer
{
  name
: "label"
  type
: "Data"
  top
: "label"
  include
{
    phase
: TRAIN
 
}

  data_param
{
    source
: "examples/VOC2012ext/VOC2012ext_train_aug_label_lmdb"
    batch_size
: 1
    backend
: LMDB
 
}

}



Reply all
Reply to author
Forward
0 new messages