-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_cars.sh
executable file
·47 lines (39 loc) · 1.29 KB
/
run_cars.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
#!/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
DATASET=cars
PRETRAIN=60
MOM=0.9
seed=42
epochs=300
batch_size=128
# Parsing arguments
while getopts ":s:a:" flag; do
case "${flag}" in
s) seed=${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}\
--dataset ${DATASET} --save ${SAVE_DIR} --epochs ${epochs} --train-batch ${batch_size}\
2>&1 | tee -a ${SAVE_DIR}.log
### eval
python -u train.py --arch ${ARCH} --manualSeed ${seed}\
--loss ${LOSS} --dataset ${DATASET} \
--save ${SAVE_DIR} --evaluate --epochs ${epochs} --train-batch ${batch_size}\
2>&1 | tee -a ${SAVE_DIR}.log