forked from yjh0410/RT-ODLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train.sh
98 lines (96 loc) · 2.54 KB
/
train.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Args parameters
MODEL=$1
DATASET=$2
DATASET_ROOT=$3
BATCH_SIZE=$4
WORLD_SIZE=$5
MASTER_PORT=$6
RESUME=$7
# MODEL setting
IMAGE_SIZE=640
FIND_UNUSED_PARAMS=False
if [[ $MODEL == *"yolov8"* ]]; then
# Epoch setting
MAX_EPOCH=500
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=20
elif [[ $MODEL == *"yolox"* ]]; then
# Epoch setting
MAX_EPOCH=300
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=20
elif [[ $MODEL == *"yolov7"* ]]; then
# Epoch setting
MAX_EPOCH=300
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=20
elif [[ $MODEL == *"yolov5"* ]]; then
# Epoch setting
MAX_EPOCH=300
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=20
elif [[ $MODEL == *"yolov4"* ]]; then
# Epoch setting
MAX_EPOCH=300
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=20
elif [[ $MODEL == *"yolov3"* ]]; then
# Epoch setting
MAX_EPOCH=300
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=20
else
# Epoch setting
MAX_EPOCH=150
WP_EPOCH=3
EVAL_EPOCH=10
NO_AUG_EPOCH=10
fi
# -------------------------- Train Pipeline --------------------------
if [ $WORLD_SIZE == 1 ]; then
python train.py \
--cuda \
--dataset ${DATASET} \
--root ${DATASET_ROOT} \
--model ${MODEL} \
--batch_size ${BATCH_SIZE} \
--img_size ${IMAGE_SIZE} \
--wp_epoch ${WP_EPOCH} \
--max_epoch ${MAX_EPOCH} \
--eval_epoch ${EVAL_EPOCH} \
--no_aug_epoch ${NO_AUG_EPOCH} \
--resume ${RESUME} \
--ema \
--fp16 \
--find_unused_parameters ${FIND_UNUSED_PARAMS} \
--multi_scale
elif [[ $WORLD_SIZE -gt 1 && $WORLD_SIZE -le 8 ]]; then
python -m torch.distributed.run --nproc_per_node=${WORLD_SIZE} --master_port ${MASTER_PORT} train.py \
--cuda \
-dist \
--dataset ${DATASET} \
--root ${DATASET_ROOT} \
--model ${MODEL} \
--batch_size ${BATCH_SIZE} \
--img_size ${IMAGE_SIZE} \
--wp_epoch ${WP_EPOCH} \
--max_epoch ${MAX_EPOCH} \
--eval_epoch ${EVAL_EPOCH} \
--no_aug_epoch ${NO_AUG_EPOCH} \
--resume ${RESUME} \
--ema \
--fp16 \
--find_unused_parameters ${FIND_UNUSED_PARAMS} \
--multi_scale \
--sybn
else
echo "The WORLD_SIZE is set to a value greater than 8, indicating the use of multi-machine \
multi-card training mode, which is currently unsupported."
exit 1
fi