File experiment_meow_main.py changed (mode: 100644) (index 9beb6c8..049432d) |
... |
... |
from torch import nn |
13 |
13 |
from models.meow_experiment.kitten_meow_1 import M1, M2, M3, M4 |
from models.meow_experiment.kitten_meow_1 import M1, M2, M3, M4 |
14 |
14 |
from models.meow_experiment.ccnn_tail import BigTailM1, BigTailM2, BigTail3 |
from models.meow_experiment.ccnn_tail import BigTailM1, BigTailM2, BigTail3 |
15 |
15 |
from models.meow_experiment.ccnn_head import H1, H2 |
from models.meow_experiment.ccnn_head import H1, H2 |
|
16 |
|
from models.meow_experiment.kitten_meow_1 import H1_Bigtail3 |
16 |
17 |
from models import CustomCNNv2 |
from models import CustomCNNv2 |
17 |
18 |
import os |
import os |
18 |
19 |
from model_util import get_lr |
from model_util import get_lr |
|
... |
... |
if __name__ == "__main__": |
82 |
83 |
elif model_name == "H1": |
elif model_name == "H1": |
83 |
84 |
model = H1() |
model = H1() |
84 |
85 |
elif model_name == "H2": |
elif model_name == "H2": |
85 |
|
model = H1() |
|
|
86 |
|
model = H2() |
|
87 |
|
elif model_name == "H1_Bigtail3": |
|
88 |
|
model = H1_Bigtail3() |
|
89 |
|
|
86 |
90 |
else: |
else: |
87 |
91 |
print("error: you didn't pick a model") |
print("error: you didn't pick a model") |
88 |
92 |
exit(-1) |
exit(-1) |
File models/meow_experiment/ccnn_head.py changed (mode: 100644) (index a7d6359..2b34f59) |
... |
... |
class H1(nn.Module): |
31 |
31 |
|
|
32 |
32 |
self.c1 = nn.Conv2d(40, 60, 3, padding=1) |
self.c1 = nn.Conv2d(40, 60, 3, padding=1) |
33 |
33 |
|
|
34 |
|
# ideal from CSRNet |
|
35 |
34 |
self.c2 = nn.Conv2d(60, 40, 3, padding=1) |
self.c2 = nn.Conv2d(60, 40, 3, padding=1) |
36 |
35 |
self.c3 = nn.Conv2d(40, 20, 3, padding=1) |
self.c3 = nn.Conv2d(40, 20, 3, padding=1) |
37 |
36 |
self.c4 = nn.Conv2d(20, 10, 3, padding=1) |
self.c4 = nn.Conv2d(20, 10, 3, padding=1) |
File models/meow_experiment/kitten_meow_1.py changed (mode: 100644) (index 2daba3f..11453a6) |
... |
... |
class M4(nn.Module): |
256 |
256 |
x = F.relu(self.c5(x), inplace=True) |
x = F.relu(self.c5(x), inplace=True) |
257 |
257 |
|
|
258 |
258 |
x = self.output(x) |
x = self.output(x) |
259 |
|
return x |
|
|
259 |
|
return x |
|
260 |
|
|
|
261 |
|
|
|
262 |
|
class H1_Bigtail3(nn.Module): |
|
263 |
|
""" |
|
264 |
|
A REAL-TIME DEEP NETWORK FOR CROWD COUNTING |
|
265 |
|
https://arxiv.org/pdf/2002.06515.pdf |
|
266 |
|
the improve version |
|
267 |
|
|
|
268 |
|
we change 5x5 7x7 9x9 with 3x3 |
|
269 |
|
Keep the tail |
|
270 |
|
""" |
|
271 |
|
def __init__(self, load_weights=False): |
|
272 |
|
super(H1_Bigtail3, self).__init__() |
|
273 |
|
self.model_note = "headh1, all 20, with bigtail3 dilated" |
|
274 |
|
|
|
275 |
|
# ideal from crowd counting using DMCNN |
|
276 |
|
self.front_cnn_1 = nn.Conv2d(3, 10, 3, padding=1) |
|
277 |
|
self.front_cnn_2 = nn.Conv2d(10, 20, 3, padding=1) |
|
278 |
|
self.front_cnn_3 = nn.Conv2d(20, 20, 3, padding=1) |
|
279 |
|
self.front_cnn_4 = nn.Conv2d(20, 20, 3, padding=1) |
|
280 |
|
|
|
281 |
|
self.max_pooling = nn.MaxPool2d(kernel_size=2, stride=2) |
|
282 |
|
|
|
283 |
|
self.c0 = nn.Conv2d(40, 60, 3, padding=2, dilation=2) |
|
284 |
|
self.c1 = nn.Conv2d(60, 60, 3, padding=2, dilation=2) |
|
285 |
|
self.c2 = nn.Conv2d(60, 60, 3, padding=2, dilation=2) |
|
286 |
|
self.c3 = nn.Conv2d(60, 30, 3, padding=2, dilation=2) |
|
287 |
|
self.c4 = nn.Conv2d(30, 15, 3, padding=2, dilation=2) |
|
288 |
|
self.c5 = nn.Conv2d(15, 10, 3, padding=2, dilation=2) |
|
289 |
|
|
|
290 |
|
self.output = nn.Conv2d(10, 1, 1) |
|
291 |
|
|
|
292 |
|
def forward(self, x): |
|
293 |
|
x_red = F.relu(self.front_cnn_1(x), inplace=True) |
|
294 |
|
x_red = F.relu(self.front_cnn_2(x_red), inplace=True) |
|
295 |
|
x_red = F.relu(self.front_cnn_3(x_red), inplace=True) |
|
296 |
|
x_red = F.relu(self.front_cnn_4(x_red), inplace=True) |
|
297 |
|
x_red = self.max_pooling(x_red) |
|
298 |
|
|
|
299 |
|
x_green = F.relu(self.front_cnn_1(x), inplace=True) |
|
300 |
|
x_green = F.relu(self.front_cnn_2(x_green), inplace=True) |
|
301 |
|
x_green = F.relu(self.front_cnn_3(x_green), inplace=True) |
|
302 |
|
x_green = self.max_pooling(x_green) |
|
303 |
|
|
|
304 |
|
x_blue = F.relu(self.front_cnn_1(x), inplace=True) |
|
305 |
|
x_blue = F.relu(self.front_cnn_2(x_blue), inplace=True) |
|
306 |
|
x_blue = self.max_pooling(x_blue) |
|
307 |
|
|
|
308 |
|
# x = self.max_pooling(x) |
|
309 |
|
x = torch.cat((x_red, x_green, x_blue), 1) |
|
310 |
|
x = F.relu(self.c0(x), inplace=True) |
|
311 |
|
|
|
312 |
|
x = F.relu(self.c1(x), inplace=True) |
|
313 |
|
|
|
314 |
|
x = F.relu(self.c2(x), inplace=True) |
|
315 |
|
x = self.max_pooling(x) |
|
316 |
|
|
|
317 |
|
x = F.relu(self.c3(x), inplace=True) |
|
318 |
|
x = self.max_pooling(x) |
|
319 |
|
|
|
320 |
|
x = F.relu(self.c4(x), inplace=True) |
|
321 |
|
x = F.relu(self.c5(x), inplace=True) |
|
322 |
|
|
|
323 |
|
x = self.output(x) |
|
324 |
|
return x |
File train_script/combine/h1_bigtail_t1_shb_fixed.sh copied from file train_script/meow_one/big_tail/bigtail3_t4_shb_fixed.sh (similarity 66%) (mode: 100644) (index 1de7d38..7d5aba9) |
1 |
|
task="bigtail3_t4_shb_fixed" |
|
|
1 |
|
task="h1_bigtail_t1_shb_fixed" |
2 |
2 |
|
|
3 |
|
CUDA_VISIBLE_DEVICES=2 OMP_NUM_THREADS=5 HTTPS_PROXY="http://10.60.28.99:86" nohup python experiment_meow_main.py \ |
|
|
3 |
|
CUDA_VISIBLE_DEVICES=3 OMP_NUM_THREADS=4 HTTPS_PROXY="http://10.60.28.99:86" nohup python experiment_meow_main.py \ |
4 |
4 |
--task_id $task \ |
--task_id $task \ |
5 |
5 |
--note "bigtail3 L1" \ |
--note "bigtail3 L1" \ |
6 |
|
--model "BigTail3" \ |
|
|
6 |
|
--model "H1_Bigtail3" \ |
7 |
7 |
--input /data/rnd/thient/thient_data/shanghaitech_with_people_density_map/ShanghaiTech_fixed_sigma/part_B \ |
--input /data/rnd/thient/thient_data/shanghaitech_with_people_density_map/ShanghaiTech_fixed_sigma/part_B \ |
8 |
8 |
--lr 1e-4 \ |
--lr 1e-4 \ |
9 |
9 |
--decay 1e-4 \ |
--decay 1e-4 \ |
10 |
|
--batch_size 8 \ |
|
11 |
10 |
--loss_fn "L1" \ |
--loss_fn "L1" \ |
12 |
11 |
--datasetname shanghaitech_rnd \ |
--datasetname shanghaitech_rnd \ |
13 |
|
--epochs 601 > logs/$task.log & |
|
|
12 |
|
--epochs 1201 > logs/$task.log & |
14 |
13 |
|
|
15 |
14 |
echo logs/$task.log # for convenience |
echo logs/$task.log # for convenience |
File train_script/combine/h1_bigtail_t2_shb_fixed.sh copied from file train_script/meow_one/big_tail/bigtail3_t4_shb_fixed.sh (similarity 62%) (mode: 100644) (index 1de7d38..7586edf) |
1 |
|
task="bigtail3_t4_shb_fixed" |
|
|
1 |
|
task="h1_bigtail_t2_shb_fixed" |
2 |
2 |
|
|
3 |
|
CUDA_VISIBLE_DEVICES=2 OMP_NUM_THREADS=5 HTTPS_PROXY="http://10.60.28.99:86" nohup python experiment_meow_main.py \ |
|
|
3 |
|
CUDA_VISIBLE_DEVICES=4 OMP_NUM_THREADS=4 HTTPS_PROXY="http://10.60.28.99:86" nohup python experiment_meow_main.py \ |
4 |
4 |
--task_id $task \ |
--task_id $task \ |
5 |
5 |
--note "bigtail3 L1" \ |
--note "bigtail3 L1" \ |
6 |
|
--model "BigTail3" \ |
|
|
6 |
|
--model "H1_Bigtail3" \ |
7 |
7 |
--input /data/rnd/thient/thient_data/shanghaitech_with_people_density_map/ShanghaiTech_fixed_sigma/part_B \ |
--input /data/rnd/thient/thient_data/shanghaitech_with_people_density_map/ShanghaiTech_fixed_sigma/part_B \ |
8 |
8 |
--lr 1e-4 \ |
--lr 1e-4 \ |
9 |
9 |
--decay 1e-4 \ |
--decay 1e-4 \ |
10 |
|
--batch_size 8 \ |
|
11 |
|
--loss_fn "L1" \ |
|
|
10 |
|
--loss_fn "MSE" \ |
12 |
11 |
--datasetname shanghaitech_rnd \ |
--datasetname shanghaitech_rnd \ |
13 |
|
--epochs 601 > logs/$task.log & |
|
|
12 |
|
--epochs 1201 > logs/$task.log & |
14 |
13 |
|
|
15 |
14 |
echo logs/$task.log # for convenience |
echo logs/$task.log # for convenience |