forked from bnu-wangxun/Deep_Metric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_train_00.sh
73 lines (62 loc) · 1.55 KB
/
run_train_00.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
DATA=cub
DATA_ROOT=/opt/data/users/xunwang/DataSet
Gallery_eq_Query=True
LOSS=WeightLoss
CHECKPOINTS=/opt/data/users/xunwang/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
SAVE_DIR=${CHECKPOINTS}/${LOSS}/${DATA}/${NET}-DIM-${DIM}-lr${LR}-ratio-${RATIO}-BatchSize-${BatchSize}
if_exist_mkdir ${SAVE_DIR}
if [ ! -n "$1" ] ;then
echo "Begin Training!"
CUDA_VISIBLE_DEVICES=0 python train.py --net ${NET} \
--data $DATA \
--data_root ${DATA_ROOT} \
--init random \
--lr $LR \
--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 50 50 400`
for i in $Model_LIST; do
CUDA_VISIBLE_DEVICES=0 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