Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
4"""Little W-Net for image segmentation
6The Little W-Net architecture contains roughly around 70k parameters and
7closely matches (or outperforms) other more complex techniques.
9Reference: [GALDRAN-2020]_
10"""
12from torch.optim import Adam
13from torch.optim.lr_scheduler import CosineAnnealingLR
15from bob.ip.binseg.models.losses import MultiWeightedBCELogitsLoss
16from bob.ip.binseg.models.lwnet import lwnet
18# config
19max_lr = 0.01 # start
20min_lr = 1e-08 # valley
21cycle = 50 # epochs for a complete scheduling cycle
23model = lwnet()
25criterion = MultiWeightedBCELogitsLoss()
27optimizer = Adam(
28 model.parameters(),
29 lr=max_lr,
30)
32scheduler = CosineAnnealingLR(
33 optimizer,
34 T_max=cycle,
35 eta_min=min_lr,
36)