-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_imagenet_entropy.sh
51 lines (43 loc) · 1.52 KB
/
run_imagenet_entropy.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
#!/usr/bin/bash
#
# Copyright (c) 2023-present, Royal Bank of Canada.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
mkdir -p ./log
ARCH=resnet34
LOSS=sat_entropy
DATASET=imagenet
PRETRAIN=0
MOM=0.99
seed=42
epochs=150
batch_size=256
entropy=0.001
# Parsing arguments
while getopts ":s:e:a:" flag; do
case "${flag}" in
s) seed=${OPTARG};;
e) entropy=${OPTARG};;
a) ARCH=${OPTARG};;
:) # If expected argument omitted:
echo "Error: -${OPTARG} requires an argument."
exit_abnormal;; # Exit abnormally.
*) # If unknown (any other) option:
exit_abnormal;; # Exit abnormally.
esac
done
SAVE_DIR='./log/'
### train
python -u train.py --arch ${ARCH} --pretrain ${PRETRAIN} --sat-momentum ${MOM} \
--loss ${LOSS} --manualSeed ${seed} --entropy ${entropy}\
--dataset ${DATASET} --save ${SAVE_DIR} --epochs ${epochs} --train-batch ${batch_size}\
--schedule 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 \
2>&1 | tee -a ${SAVE_DIR}.log
### eval
python -u train.py --arch ${ARCH} --manualSeed ${seed}\
--loss ${LOSS} --dataset ${DATASET} --entropy ${entropy}\
--save ${SAVE_DIR} --evaluate --epochs ${epochs} --train-batch ${batch_size}\
--schedule 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 \
2>&1 | tee -a ${SAVE_DIR}.log