forked from microsoft/seismic-deeplearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_all.sh
executable file
·201 lines (173 loc) · 7.74 KB
/
test_all.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/bin/bash
# specify absolute locations to your models, data and storage
MODEL_ROOT="/your/model/root"
DATA_ROOT="/your/data/root"
STORAGE_ROOT="/your/storage/root"
# specify pretrained HRNet backbone
PRETRAINED_HRNET="${MODEL_ROOT}/hrnetv2_w48_imagenet_pretrained.pth"
DATA_F3="${DATA_ROOT}/dutchf3/data"
DATA_PENOBSCOT="${DATA_ROOT}/penobscot"
# name of your git branch which you ran the training code from
BRANCH="your/git/branch/with/slashes/if/they/exist/in/branch/name"
# name of directory where results are kept
OUTPUT_DIR="output"
# directory where to copy pre-trained models to
OUTPUT_PRETRAINED="${STORAGE_ROOT}/pretrained_models/"
if [ -d ${OUTPUT_PRETRAINED} ]; then
echo "erasing pre-trained models in ${OUTPUT_PRETRAINED}"
rm -rf "${OUTPUT_PRETRAINED}"
fi
mkdir -p "${OUTPUT_PRETRAINED}"
echo "Pre-trained models will be copied to ${OUTPUT_PRETRAINED}"
# bug to fix conda not launching from a bash shell
source /data/anaconda/etc/profile.d/conda.sh
conda activate seismic-interpretation
cd experiments/interpretation/penobscot/local
# Penobscot seresnet unet with section depth
export CUDA_VISIBLE_DEVICES=0
CONFIG_NAME='seresnet_unet'
# master
# model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/resnet_unet/*/section_depth/*.pth | head -1)
# new staging structure
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/section_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/penobscot_seresnetunet_patch_section_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_PENOBSCOT}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1
# Penobscot hrnet with section depth
export CUDA_VISIBLE_DEVICES=1
CONFIG_NAME='hrnet'
# master
# model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/seg_hrnet/*/section_depth/*.pth | head -1)
# new staging structure
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/section_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/penobscot_hrnet_patch_section_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_PENOBSCOT}" 'TEST.MODEL_PATH' "${model}" \
'MODEL.PRETRAINED' "${PRETRAINED_HRNET}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1
cd ../../dutchf3_patch/local
# patch based without skip connections
export CUDA_VISIBLE_DEVICES=2
CONFIG_NAME='patch_deconvnet'
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/no_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_deconvnet_patch_no_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1
# patch based with skip connections
export CUDA_VISIBLE_DEVICES=3
CONFIG_NAME='patch_deconvnet_skip'
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/no_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_deconvnetskip_patch_no_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1
# squeeze excitation resnet unet + section depth
export CUDA_VISIBLE_DEVICES=4
CONFIG_NAME='seresnet_unet'
# master
# model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/resnet_unet/*/section_depth/*.pth | head -1)
# staging
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/section_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_seresnetunet_patch_section_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1
# HRNet + patch depth
export CUDA_VISIBLE_DEVICES=5
CONFIG_NAME='hrnet'
# master
# model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/seg_hrnet/*/patch_depth/*.pth | head -1)
# staging
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/$CONFIG_NAME/patch_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_hrnet_patch_patch_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
'MODEL.PRETRAINED' "${PRETRAINED_HRNET}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_patch_test.log 2>&1 &
sleep 1
# HRNet + section depth
export CUDA_VISIBLE_DEVICES=6
CONFIG_NAME='hrnet'
# master
# model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/seg_hrnet/*/section_depth/*.pth | head -1)
# staging
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/section_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_hrnet_patch_section_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
'MODEL.PRETRAINED' "${PRETRAINED_HRNET}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_section_test.log 2>&1 &
sleep 1
cd ../../dutchf3_section/local
# and finally do a section-based model for comparison
# (deconv with skip connections and no depth)
export CUDA_VISIBLE_DEVICES=7
CONFIG_NAME='section_deconvnet_skip'
model=$(ls -td ${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/no_depth/*/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_deconvnetskip_section_no_depth.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1
echo "Waiting for all local runs to finish"
wait
# scoring scripts are in the local folder
# models are in the distributed folder
cd ../../dutchf3_patch/local
# patch based without skip connections
export CUDA_VISIBLE_DEVICES=2
CONFIG_NAME='patch_deconvnet'
model=$(ls -td ../distributed/${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/*/no_depth/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_deconvnet_patch_no_depth_distributed.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_distributed_test.log 2>&1 &
sleep 1
# patch based with skip connections
export CUDA_VISIBLE_DEVICES=3
CONFIG_NAME='patch_deconvnet_skip'
model=$(ls -td ../distributed/${OUTPUT_DIR}/${BRANCH}/*/${CONFIG_NAME}/*/no_depth/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_deconvnetskip_patch_no_depth_distributed.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_distributed_test.log 2>&1 &
sleep 1
# squeeze excitation resnet unet + section depth
export CUDA_VISIBLE_DEVICES=4
CONFIG_NAME='seresnet_unet'
model=$(ls -td ../distributed/${OUTPUT_DIR}/${BRANCH}/*/resnet_unet/*/section_depth/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_seresnetunet_patch_section_depth_distributed.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_distributed_test.log 2>&1 &
sleep 1
# HRNet + patch depth
export CUDA_VISIBLE_DEVICES=5
CONFIG_NAME='hrnet'
model=$(ls -td ../distributed/${OUTPUT_DIR}/${BRANCH}/*/seg_hrnet/*/patch_depth/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_hrnet_patch_patch_depth_distributed.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
'MODEL.PRETRAINED' "${PRETRAINED_HRNET}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_distributed_test.log 2>&1 &
sleep 1
# HRNet + section depth
export CUDA_VISIBLE_DEVICES=6
CONFIG_NAME='hrnet'
model=$(ls -td ../distributed/${OUTPUT_DIR}/${BRANCH}/*/seg_hrnet/*/section_depth/*.pth | head -1)
cp $model ${OUTPUT_PRETRAINED}/dutchf3_hrnet_patch_section_depth_distributed.pth
nohup time python test.py \
'DATASET.ROOT' "${DATA_F3}" 'TEST.MODEL_PATH' "${model}" \
'MODEL.PRETRAINED' "${PRETRAINED_HRNET}" \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_distributed_test.log 2>&1 &
sleep 1
echo "Waiting for all distributed runs to finish"
wait
echo "TADA"