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"""DRIVE dataset for Vessel Segmentation
6The DRIVE database has been established to enable comparative studies on
7segmentation of blood vessels in retinal images.
9* Reference: [DRIVE-2004]_
10* Original resolution (height x width): 584 x 565
11* Split reference: [DRIVE-2004]_
12* Protocol ``default``:
14 * Training samples: 20 (including labels and masks)
15 * Test samples: 20 (including labels from annotator 1 and masks)
17* Protocol ``second-annotator``:
19 * Test samples: 20 (including labels from annotator 2 and masks)
21"""
23import os
25import pkg_resources
27import bob.extension
29from ..dataset import JSONDataset
30from ..loader import load_pil_1, load_pil_rgb, make_delayed
32_protocols = [
33 pkg_resources.resource_filename(__name__, "default.json"),
34 pkg_resources.resource_filename(__name__, "second-annotator.json"),
35]
37_root_path = bob.extension.rc.get(
38 "bob.ip.binseg.drive.datadir", os.path.realpath(os.curdir)
39)
42def _raw_data_loader(sample):
43 return dict(
44 data=load_pil_rgb(os.path.join(_root_path, sample["data"])),
45 label=load_pil_1(os.path.join(_root_path, sample["label"])),
46 mask=load_pil_1(os.path.join(_root_path, sample["mask"])),
47 )
50def _loader(context, sample):
51 # "context" is ignored in this case - database is homogeneous
52 # we returned delayed samples to avoid loading all images at once
53 return make_delayed(sample, _raw_data_loader)
56dataset = JSONDataset(
57 protocols=_protocols,
58 fieldnames=("data", "label", "mask"),
59 loader=_loader,
60)
61"""DRIVE dataset object"""