Created
August 12, 2017 11:27
-
-
Save jinyu121/15388c9691a78c7c5f95120d60f4ef2b to your computer and use it in GitHub Desktop.
Caffe Auto Train and test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE_DIR="examples/jinyu121-alexnet" | |
BACK_DIR="${BASE_DIR}/backups" | |
PRE="alexnet" | |
GPU_NUM=1 | |
LOG="/tmp/haoyu_log.log" | |
cd ../../ | |
build/tools/caffe time -gpu ${GPU_NUM} -phase TEST -model ${BASE_DIR}/train_val.prototxt >${LOG} 2>&1 | |
echo $(tail ${LOG} -n5 | head -n3 | cut -d "]" -f2 | cut -d ":" -f2) | |
for ith in 1 2 3 | |
do | |
for iter in 200 400 600 800 1000 1200 | |
do | |
build/tools/caffe test \ | |
-gpu ${GPU_NUM} \ | |
-model ${BASE_DIR}/train_val.prototxt \ | |
-weights ${BACK_DIR}_${ith}/${PRE}_iter_${iter}.caffemodel \ | |
-iterations 5000 \ | |
>${LOG} 2>&1 | |
echo Train ${ith} Iter ${iter} $(tail ${LOG} -n2 | head -n1 | cut -d "]" -f2) | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE_DIR="examples/jinyu121-alexnet" | |
BACK_DIR="${BASE_DIR}/backups" | |
GPU_NUM=1 | |
cd ../../ | |
for ith in 1 2 3 | |
do | |
echo Begin ${ith} at $(date) | |
LOG_FILE="${BACK_DIR}/train.log" | |
mkdir -p ${BACK_DIR} | |
# ========== | |
echo Training... | |
date >${LOG_FILE} | |
build/tools/caffe train -solver ${BASE_DIR}/solver.prototxt -gpu ${GPU_NUM} -weights ${BASE_DIR}/bvlc_alexnet.caffemodel>>${LOG_FILE} 2>&1 | |
date >>${LOG_FILE} | |
TIME_TRAIN_START=$(cat ${LOG_FILE} | grep " Starting Optimization" | head -n1 | cut -d " " -f2) | |
TIME_TRAIN_END=$(cat ${LOG_FILE} | grep " Optimization Done." | head -n1 | cut -d " " -f2) | |
echo "\t Begin ${TIME_TRAIN_START} End ${TIME_TRAIN_END}" | |
# ========== | |
#echo Testing... | |
#for iter in 400 800 1200 1600 2000 2400 | |
#do | |
# build/tools/caffe test \ | |
# -gpu ${GPU_NUM} \ | |
# -model ${BASE_DIR}/train_val.prototxt \ | |
# -weights ${BACK_DIR}/${PRE}_iter_${iter}.caffemodel \ | |
# -iterations 5000 \ | |
# >${LOG} 2>&1 | |
# echo Train ${ith} Iter ${iter} $(tail ${LOG} -n2 | head -n1) | |
#done | |
# ========== | |
mv ${BACK_DIR} ${BASE_DIR}/backups_${ith} | |
mkdir -p ${BASE_DIR}/backups | |
echo Finish ${ith} at $(date) | |
done | |
cd ${BASE_DIR} | |
./run_test.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment