Hide keyboard shortcuts

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 -*- 

3 

4"""DRIU Network for Optic Disc Segmentation 

5 

6Deep Retinal Image Understanding (DRIU), a unified framework of retinal image 

7analysis that provides both retinal vessel and optic disc segmentation using 

8deep Convolutional Neural Networks (CNNs). 

9 

10Reference: [MANINIS-2016]_ 

11""" 

12 

13from torch.optim.lr_scheduler import MultiStepLR 

14 

15from bob.ip.binseg.engine.adabound import AdaBound 

16from bob.ip.binseg.models.driu_od import driu_od 

17from bob.ip.binseg.models.losses import SoftJaccardBCELogitsLoss 

18 

19# config 

20lr = 0.001 

21betas = (0.9, 0.999) 

22eps = 1e-08 

23weight_decay = 0 

24final_lr = 0.1 

25gamma = 1e-3 

26eps = 1e-8 

27amsbound = False 

28 

29scheduler_milestones = [900] 

30scheduler_gamma = 0.1 

31 

32model = driu_od() 

33 

34# optimizer 

35optimizer = AdaBound( 

36 model.parameters(), 

37 lr=lr, 

38 betas=betas, 

39 final_lr=final_lr, 

40 gamma=gamma, 

41 eps=eps, 

42 weight_decay=weight_decay, 

43 amsbound=amsbound, 

44) 

45# criterion 

46criterion = SoftJaccardBCELogitsLoss(alpha=0.7) 

47 

48# scheduler 

49scheduler = MultiStepLR( 

50 optimizer, milestones=scheduler_milestones, gamma=scheduler_gamma 

51)