caffe+win10+git使用sh文件

时间:2023-03-09 06:53:28
caffe+win10+git使用sh文件

在windows下是否可以执行sh文件呢,搜了一下,可以安装了git就可以执行,当然这不是唯一答案。

然后联想到caffe下有一些.sh文件可以尝试,就用create_mnist.sh尝试把。

create_mnist.sh原文件内容为:

 #!/usr/bin/env sh
# This script converts the mnist data into lmdb/leveldb format,
# depending on the value assigned to $BACKEND. EXAMPLE=examples/mnist
DATA=data/mnist
BUILD=build/examples/mnist BACKEND="lmdb" echo "Creating ${BACKEND}..." rm -rf $EXAMPLE/mnist_train_${BACKEND}
rm -rf $EXAMPLE/mnist_test_${BACKEND} $BUILD/convert_mnist_data.bin $DATA/train-images-idx3-ubyte \
$DATA/train-labels-idx1-ubyte $EXAMPLE/mnist_train_${BACKEND} --backend=${BACKEND}
$BUILD/convert_mnist_data.bin $DATA/t10k-images-idx3-ubyte \
$DATA/t10k-labels-idx1-ubyte $EXAMPLE/mnist_test_${BACKEND} --backend=${BACKEND} echo "Done."

修改内容,将:

BUILD=build/examples/mnist
convert_mnist_data.bin

改为:

BUILD=build/examples/mnist/Release
convert_mnist_data.exe

改完后内容为:

#!/usr/bin/env sh
# This script converts the mnist data into lmdb/leveldb format,
# depending on the value assigned to $BACKEND. EXAMPLE=examples/mnist
DATA=data/mnist
BUILD=build/examples/mnist/Release BACKEND="lmdb" echo "Creating ${BACKEND}..." rm -rf $EXAMPLE/mnist_train_${BACKEND}
rm -rf $EXAMPLE/mnist_test_${BACKEND} $BUILD/convert_mnist_data.exe $DATA/train-images-idx3-ubyte \
$DATA/train-labels-idx1-ubyte $EXAMPLE/mnist_train_${BACKEND} --backend=${BACKEND}
$BUILD/convert_mnist_data.exe $DATA/t10k-images-idx3-ubyte \
$DATA/t10k-labels-idx1-ubyte $EXAMPLE/mnist_test_${BACKEND} --backend=${BACKEND} echo "Done."

看懂上面的命令是关键,从命令看,

git应该从caffe根目录执行,

mnist数据放在:data/mnist目录下;

data/mnist目录下的文件名为:train-labels-idx1-ubyte、train-labels-idx1-ubyte、t10k-labels-idx1-ubyte、t10k-labels-idx1-ubyte

生成文件到目录:examples/mnist/mnist_train_lmdb、examples/mnist/mnist_test_lmdb。

下图是git执行结果。

caffe+win10+git使用sh文件