跟楼上的一样,参考caffe-master\examples\imagenet\create_imagenet.sh#!/usr/bin/env sh
# Create the imagenet leveldb inputs
# N.B. set the path to the imagenet train + val data dirs
RESIZE=TRUE
if $RESIZE; then
RESIZE_HEIGHT=128
RESIZE_WIDTH=128
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
3 个回复
tracycw
赞同来自: xinmiao
# Create the imagenet leveldb inputs
# N.B. set the path to the imagenet train + val data dirs
DATA=F:/caffe-master/data/model91/make_data
TOOLS=F:/caffe-master/bin
TRAIN_DATA_ROOT=F:/data/original_data/old_new2/
VAL_DATA_ROOT=F:/data/original_data/old_new2/
RESIZE=TRUE
if $RESIZE; then
RESIZE_HEIGHT=128
RESIZE_WIDTH=128
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
echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--backend=leveldb \
--shuffle \
--gray=true \
$TRAIN_DATA_ROOT \
$DATA/train.txt \
car_train_gray_leveldb
echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--backend=leveldb \
--shuffle \
--gray=true \
$VAL_DATA_ROOT \
$DATA/val.txt \
car_val_gray_leveldb
echo "Done."
read -p "Press any key to continue." var
不过windows下不能运行.sh文件,需要安装git才能够运行,或者参考caffe/tools/convert_imageset.cpp写个bat文件,传入相应的参数
Banggui02 - 深度炼丹
赞同来自:
swearos91
赞同来自:
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--shuffle \
$TRAIN_DATA_ROOT \
$DATA/train.txt \
$EXAMPLE/ilsvrc12_train_lmdb