-
Notifications
You must be signed in to change notification settings - Fork 378
/
run_ssd300_vgg16_voc_det.sh
48 lines (39 loc) · 2.01 KB
/
run_ssd300_vgg16_voc_det.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# check the enviroment info
nvidia-smi
PYTHON="python"
WORK_DIR=$(cd $(dirname $0)/../../../;pwd)
export PYTHONPATH=${WORK_DIR}:${PYTHONPATH}
cd ${WORK_DIR}
DATA_DIR="/home/donny/DataSet/VOC07+12_DET"
MODEL_NAME="vgg16_ssd300"
LOSS_TYPE="multibox_loss"
CHECKPOINTS_NAME="ssd300_vgg16_voc_det"$2
PRETRAINED_MODEL="./pretrained_models/ssd_vgg16_caffe_pretrained.pth"
CONFIG_FILE='configs/det/voc/ssd300_vgg16_voc_det.conf'
LOG_DIR="./log/det/voc/"
LOG_FILE="${LOG_DIR}${CHECKPOINTS_NAME}.log"
if [[ ! -d ${LOG_DIR} ]]; then
echo ${LOG_DIR}" not exists!!!"
mkdir -p ${LOG_DIR}
fi
if [[ "$1"x == "train"x ]]; then
${PYTHON} -u main.py --config_file ${CONFIG_FILE} --phase train --gpu 0 --workers 3 \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --model_name ${MODEL_NAME} \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} 2>&1 | tee ${LOG_FILE}
elif [[ "$1"x == "resume"x ]]; then
${PYTHON} -u main.py --config_file ${CONFIG_FILE} --phase train --gpu 0 \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --model_name ${MODEL_NAME} \
--resume_continue y --resume ./checkpoints/det/voc/${CHECKPOINTS_NAME}_latest.pth \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} 2>&1 | tee -a ${LOG_FILE}
elif [[ "$1"x == "val"x ]]; then
${PYTHON} -u main.py --config_file ${CONFIG_FILE} --phase test --model_name ${MODEL_NAME} \
--phase test --gpu 0 --resume ./checkpoints/det/voc/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/val/image --out_dir val 2>&1 | tee -a ${LOG_FILE}
cd metrics/det/
${PYTHON} -u voc_evaluator.py --config_file "../../../"${CONFIG_FILE} \
--json_dir ../../../out/results/voc/test_dir/${CHECKPOINTS_NAME}/val/json \
--gt_dir ${DATA_DIR}/val/label 2>&1 | tee -a "../../"${LOG_FILE}
else
echo "$1"x" is invalid..."
fi