forked from hyungwonchoi/Deep_metric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_train_car.sh.example
executable file
·77 lines (66 loc) · 1.59 KB
/
run_train_car.sh.example
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
#DATA=cub
DATA=car
DATA_ROOT=/data/local/metricDB
Gallery_eq_Query=True
#LOSS=WeightLoss
LOSS=Weight
CHECKPOINTS=./checkpoints
R=.pth.tar
if_exist_mkdir ()
{
dirname=$1
if [ ! -d "$dirname" ]; then
mkdir $dirname
fi
}
if_exist_mkdir ${CHECKPOINTS}
if_exist_mkdir ${CHECKPOINTS}/${LOSS}
if_exist_mkdir ${CHECKPOINTS}/${LOSS}/${DATA}
if_exist_mkdir result
if_exist_mkdir result/${LOSS}
if_exist_mkdir result/${LOSS}/${DATA}
NET=BN-Inception
DIM=512
ALPHA=40
LR=1e-5
BatchSize=80
RATIO=0.16
OPTIM=sgd
SAVE_DIR=${CHECKPOINTS}/${LOSS}/${DATA}/${NET}-DIM-${DIM}-lr${LR}-ratio-${RATIO}-BatchSize-${BatchSize}-OPTIM-${OPTIM}
if_exist_mkdir ${SAVE_DIR}
if [ ! -n "$1" ] ;then
echo "Begin Training!"
CUDA_VISIBLE_DEVICES=3 python train.py --net ${NET} \
--data $DATA \
--data_root ${DATA_ROOT} \
--init random \
--lr $LR \
--optim ${OPTIM} \
--dim $DIM \
--alpha $ALPHA \
--num_instances 5 \
--batch_size ${BatchSize} \
--epoch 400 \
--loss $LOSS \
--save_dir ${SAVE_DIR} \
--save_step 50 \
--ratio ${RATIO}
fi
if [ ! -n "$1" ] ;then
echo "Begin Testing!"
# POOL_FEATURE=True # if False, just comment this line !
echo ${POOL_FEATURE}
Model_LIST=`seq 100 20 400`
for i in $Model_LIST; do
CUDA_VISIBLE_DEVICES=3 python test.py --net ${NET} \
--data $DATA \
--data_root ${DATA_ROOT} \
--batch_size 100 \
-g_eq_q ${Gallery_eq_Query} \
--width 224 \
-r ${SAVE_DIR}/ckp_ep$i$R \
--pool_feature ${POOL_FEATURE:-'False'} \
| tee -a result/$LOSS/$DATA/${NET}-DIM-$DIM-Batchsize-${BatchSize}-ratio-${RATIO}-lr-$LR${POOL_FEATURE:+'-pool_feature'}.txt
done
fi