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 Vessel Segmentation using SSL 

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). This version of our model includes 

9a loss that is suitable for Semi-Supervised Learning (SSL). 

10 

11Reference: [MANINIS-2016]_ 

12""" 

13 

14from torch.optim.lr_scheduler import MultiStepLR 

15 

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

17from bob.ip.binseg.models.driu import driu 

18from bob.ip.binseg.models.losses import MixJacLoss 

19 

20# config 

21lr = 0.001 

22betas = (0.9, 0.999) 

23eps = 1e-08 

24weight_decay = 0 

25final_lr = 0.1 

26gamma = 1e-3 

27eps = 1e-8 

28amsbound = False 

29 

30scheduler_milestones = [900] 

31scheduler_gamma = 0.1 

32 

33model = driu() 

34 

35# optimizer 

36optimizer = AdaBound( 

37 model.parameters(), 

38 lr=lr, 

39 betas=betas, 

40 final_lr=final_lr, 

41 gamma=gamma, 

42 eps=eps, 

43 weight_decay=weight_decay, 

44 amsbound=amsbound, 

45) 

46 

47# criterion 

48criterion = MixJacLoss(lambda_u=0.05, jacalpha=0.7) 

49ssl = True 

50 

51# scheduler 

52scheduler = MultiStepLR( 

53 optimizer, milestones=scheduler_milestones, gamma=scheduler_gamma 

54)