Coverage for src/deepdraw/configs/models/driu_bn.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"""DRIU Network for Vessel Segmentation with Batch Normalization.
7Deep Retinal Image Understanding (DRIU), a unified framework of retinal image
8analysis that provides both retinal vessel and optic disc segmentation using
9deep Convolutional Neural Networks (CNNs). This implementation includes batch
10normalization as a regularization mechanism.
12Reference: [MANINIS-2016]_
13"""
15from torch.optim.lr_scheduler import MultiStepLR
17from deepdraw.engine.adabound import AdaBound
18from deepdraw.models.driu_bn import driu_bn
19from deepdraw.models.losses import SoftJaccardBCELogitsLoss
21# config
22lr = 0.001
23betas = (0.9, 0.999)
24eps = 1e-08
25weight_decay = 0
26final_lr = 0.1
27gamma = 1e-3
28eps = 1e-8
29amsbound = False
31scheduler_milestones = [900]
32scheduler_gamma = 0.1
34model = driu_bn()
36# optimizer
37optimizer = AdaBound(
38 model.parameters(),
39 lr=lr,
40 betas=betas,
41 final_lr=final_lr,
42 gamma=gamma,
43 eps=eps,
44 weight_decay=weight_decay,
45 amsbound=amsbound,
46)
47# criterion
48criterion = SoftJaccardBCELogitsLoss(alpha=0.7)
50# scheduler
51scheduler = MultiStepLR(
52 optimizer, milestones=scheduler_milestones, gamma=scheduler_gamma
53)