Coverage for src/deepdraw/configs/models/resunet.py: 100%
19 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-11-30 15:00 +0100
« prev ^ index » next coverage.py v7.3.1, created at 2023-11-30 15:00 +0100
1# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
5"""Residual U-Net for image segmentation.
7A semantic segmentation neural network which combines the strengths of residual
8learning and U-Net is proposed for road area extraction. The network is built
9with residual units and has similar architecture to that of U-Net. The benefits
10of this model is two-fold: first, residual units ease training of deep
11networks. Second, the rich skip connections within the network could facilitate
12information propagation, allowing us to design networks with fewer parameters
13however better performance.
15Reference: [ZHANG-2017]_
16"""
18from torch.optim.lr_scheduler import MultiStepLR
20from deepdraw.engine.adabound import AdaBound
21from deepdraw.models.losses import SoftJaccardBCELogitsLoss
22from deepdraw.models.resunet import resunet50
24# config
25lr = 0.001
26betas = (0.9, 0.999)
27eps = 1e-08
28weight_decay = 0
29final_lr = 0.1
30gamma = 1e-3
31eps = 1e-8
32amsbound = False
34scheduler_milestones = [900]
35scheduler_gamma = 0.1
37model = resunet50()
39# optimizer
40optimizer = AdaBound(
41 model.parameters(),
42 lr=lr,
43 betas=betas,
44 final_lr=final_lr,
45 gamma=gamma,
46 eps=eps,
47 weight_decay=weight_decay,
48 amsbound=amsbound,
49)
51# criterion
52criterion = SoftJaccardBCELogitsLoss(alpha=0.7)
54# scheduler
55scheduler = MultiStepLR(
56 optimizer, milestones=scheduler_milestones, gamma=scheduler_gamma
57)