您的位置:首页 > 大数据 > 人工智能

20161114---手写图片转为lmdb

2017-01-01 20:16 344 查看
1.PS制图片;

2.将create_imagenet.sh复制到myself下并重命名为create_lmdb.sh;

  3.将数据集的train.txt和val.txt(或者是test.txt)拷贝到myself下







4.修改create_lmdb.sh

 #!/usr/bin/env sh

# Create the imagenet lmdb inputs

# N.B. set the path to the imagenet train + val data dirs

set -e
EXAMPLE=examples/imagenet/myself

DATA=examples/imagenet/myself

TOOLS=build/tools
TRAIN_DATA_ROOT=examples/imagenet/myself/

VAL_DATA_ROOT=examples/imagenet/myself/
# 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=28

  RESIZE_WIDTH=28

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/myself_train_lmdb
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/myself_test_lmdb
echo "Done."

 

 5../examples/imagenet/myself/create_lmdb.sh 

6.





内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息