给变量赋值
savedir=dirpath/
列出文件夹中的所有文件
for file in $(ls dir/)
do
echo $file
done
新建文件夹(注意:中括前后必须有空格)
if [ ! -d newdir/ ];then
mkdir newdir/
else
echo dir exist
fi
截取字符串
${model%.*} #截取$model字符串.前的字符
调用python
python test.py --arg1 x1 --arg2 x2
综合应用
#!/bin/bash
for model in $(ls weights/)
do
echo $model
savedir=result/${model%.*}_nocrop/
echo $savedir
if [ ! -d $savedir ];then
mkdir $savedir
else
echo dir exist
fi
for dir in $(ls testpic/)
do
echo $dir
if [ ! -d $savedir/$dir ];then
mkdir $savedir/$dir
else
echo dir exist
fi
# echo weights/$model
python eval.py --trained_model=weights/$model --score_threshold=0.5 --top_k=15 --images=testpic/$dir:$savedir/$dir
done
done
网友评论