#!/usr/bin/env sh
# Create the imagenet lmdb inputs
# N.B. set the path to the imagenet train + val data dirs
EXAMPLE=.
TOOLS=/data2/zxli/CODE/caffe_multilabel/build/tools
DATA=.
TRAIN_DATA_ROOT=/.
VAL_DATA_ROOT=/.
# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=24
RESIZE_WIDTH=24
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_multilabel \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
$TRAIN_DATA_ROOT \
$DATA/train_list.txt \
$EXAMPLE/mtcnn_train_20190121_lmdb
echo "Creating val lmdb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset_multilabel \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
$VAL_DATA_ROOT \
$DATA/val_list.txt \
$EXAMPLE/mtcnn_val_20190121_lmdb
echo "Done."
用于生成lmdb以便后续训练使用
2 对一下shell语言的理解
(1) $在脚本语言中代表一个变量,例如$var 即可以调用var变量,也可以用来输出变量的值
(2)使用if-then语句和test命令
(2.1)基本结构化命令if-then语句格式:
if command
then
command
fi
(2.2)test命令
if[condition]
then command
fi
(2.2.1)判断整数:整数1 -eq 整数2 判断整数1与2是否相等;整数1 -ge 整数2 判断整数1是否大于等于整数2;
整数1 -gt 整数2 判断整数1大于整数2;整数1 -le整数2 判断整数1是否小于等于整数2
(2.2.2)判断字符串: -n str1 判断str1的长度为非0;-z str2 判断str2的长度为0;
(2.2.3)判断文件:-d FIle文件存在且是目录;-e File 文件存在
参考博客:https://blog.csdn.net/weixin_36586564/article/details/78843172
3 ubuntu下常用命令
(1)按照时间升序排序文件夹 ls -lrt (l表示以长列表方式显示,t按修改时间排序,r reverse order whilt sorting)
(2)按照时间降序排序文件夹 ls -lt