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"""HRF dataset for Vessel Segmentation 

5 

6The database includes 15 images of each healthy, diabetic retinopathy (DR), and 

7glaucomatous eyes. It contains a total of 45 eye fundus images with a 

8resolution of 3304 x 2336. One set of ground-truth vessel annotations is 

9available. 

10 

11* Reference: [HRF-2013]_ 

12* Original resolution (height x width): 2336 x 3504 

13* Configuration resolution: 1168 x 1648 (after specific cropping and rescaling) 

14* Split reference: [ORLANDO-2017]_ 

15* Protocol ``default``: 

16 

17 * Training samples: 15 (including labels) 

18 * Test samples: 30 (including labels) 

19 

20""" 

21 

22import os 

23 

24import pkg_resources 

25 

26import bob.extension 

27 

28from ..dataset import JSONDataset 

29from ..loader import load_pil_1, load_pil_rgb, make_delayed 

30 

31_protocols = [ 

32 pkg_resources.resource_filename(__name__, "default.json"), 

33] 

34 

35_root_path = bob.extension.rc.get( 

36 "bob.ip.binseg.hrf.datadir", os.path.realpath(os.curdir) 

37) 

38 

39 

40def _raw_data_loader(sample): 

41 return dict( 

42 data=load_pil_rgb(os.path.join(_root_path, sample["data"])), 

43 label=load_pil_1(os.path.join(_root_path, sample["label"])), 

44 mask=load_pil_1(os.path.join(_root_path, sample["mask"])), 

45 ) 

46 

47 

48def _loader(context, sample): 

49 # "context" is ignored in this case - database is homogeneous 

50 # we returned delayed samples to avoid loading all images at once 

51 return make_delayed(sample, _raw_data_loader) 

52 

53 

54dataset = JSONDataset( 

55 protocols=_protocols, 

56 fieldnames=("data", "label", "mask"), 

57 loader=_loader, 

58) 

59"""HRF dataset object"""