-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
executable file
·57 lines (50 loc) · 2.07 KB
/
test.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
#!/bin/bash
IMAGENET_PATH=${IMAGENET_PATH:-""}
# ---- cifar10 ----
# vgg16
model=vgg16_masked_bn
for ckpt in ./ckpt/vgg/vgg-0.3/ckpt.t7 ./ckpt/vgg/vgg-0.05/ckpt.t7; do
echo -n "Testing $ckpt ..."
acc=$(python test.py --model $model --resume $ckpt | grep 'Test:' | awk '{print $(NF-1)}')
echo ": $acc %"
done
# res18
model=resnet18_masked_plan1_bn
for ckpt in ./ckpt/res18/res18-0.25/ckpt.t7 ./ckpt/res18/res18-0.17/ckpt.t7 ./ckpt/res18/res18-0.07/ckpt.t7; do
echo -n "Testing $ckpt ..."
acc=$(python test.py --model $model --resume $ckpt | grep 'Test:' | awk '{print $(NF-1)}')
echo ": $acc %"
done
# res20
model=cifar10_resnet20_dsconv_masked_plan1_bn
for ckpt in ./ckpt/res20/res20-0.75/ckpt.t7 ./ckpt/res20/res20-0.5/ckpt.t7 ./ckpt/res20/res20-0.5_pretrained/ckpt.t7 ./ckpt/res20/res20-0.33/ckpt.t7; do
echo -n "Testing $ckpt ..."
acc=$(python test.py --model $model --resume $ckpt --gpu 0 | grep 'Test:' | awk '{print $(NF-1)}')
echo ": $acc %"
done
# res56
model=cifar10_resnet56_dsconv_masked_plan1_bn
for ckpt in ./ckpt/res56/res56-0.75/ckpt.t7 ./ckpt/res56/res56-0.5/ckpt.t7 ./ckpt/res56/res56-0.33/ckpt.t7; do
echo -n "Testing $ckpt ..."
acc=$(python test.py --model $model --resume $ckpt --gpu 0 | grep 'Test:' | awk '{print $(NF-1)}')
echo ": $acc %"
done
if [[ -n "${IMAGENET_PATH}" ]]; then
## ---- imagenet ----
# res18
model=resnet18_masked_plan1_imgnet
for ckpt in ./ckpt/res18/imgnet-res18-0.6/ckpt.t7; do
echo -n "Testing $ckpt ..."
python test.py --path $IMAGENET_PATH --dataset imagenet --model $model --resume $ckpt --gpu 0 | tee /tmp/tmp_test.log
acc=$(grep 'Test:' /tmp/tmp_test.log | awk '{print $(NF-1)}')
echo ": $acc %"
done
# res50
model=resnet50_masked_plan1_bn_imgnet
for ckpt in ./ckpt/res50/imgnet-res50-0.6/ckpt.t7 ./ckpt/res50/imgnet-res50-0.5/ckpt.t7; do
echo -n "Testing $ckpt ..."
python test.py --path $IMAGENET_PATH --dataset imagenet --model $model --resume $ckpt --gpu 0 | tee /tmp/tmp_test.log
acc=$(grep 'Test:' /tmp/tmp_test.log | awk '{print $(NF-1)}')
echo ": $acc %"
done
fi