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"""HRF dataset for Vessel Segmentation
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.
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``:
17 * Training samples: 15 (including labels)
18 * Test samples: 30 (including labels)
20"""
22import os
24import pkg_resources
26import bob.extension
28from ..dataset import JSONDataset
29from ..loader import load_pil_1, load_pil_rgb, make_delayed
31_protocols = [
32 pkg_resources.resource_filename(__name__, "default.json"),
33]
35_root_path = bob.extension.rc.get(
36 "bob.ip.binseg.hrf.datadir", os.path.realpath(os.curdir)
37)
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 )
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)
54dataset = JSONDataset(
55 protocols=_protocols,
56 fieldnames=("data", "label", "mask"),
57 loader=_loader,
58)
59"""HRF dataset object"""