1. 程式人生 > >caffe生成lmdb資料集的指令碼

caffe生成lmdb資料集的指令碼

caffe生成lmdb資料集的指令碼

#!/usr/bin/env sh
set -e

EXAMPLE=/home/hadoop/桌面/caffe_study/more_eyes
DATA=/home/hadoop/桌面/caffe_study/more_eyes
TOOLS=/home/hadoop/caffe/build/tools

TRAIN_DATA_ROOT=/home/hadoop/桌面/caffe_study/more_eyes/train/
VAL_DATA_ROOT=/home/hadoop/桌面/caffe_study/more_eyes/test/


RESIZE=true
if $RESIZE; then
  RESIZE_HEIGHT=32
  RESIZE_WIDTH=32
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/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/test.txt \
    $EXAMPLE/test_lmdb

echo "Done."

有問題歡迎評論,我們共同解決

喜歡請關注,轉載請註明出處,謝謝配合