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"""Shenzhen No.3 People’s Hospital dataset for Lung Segmentation
6The database includes 336 cases with manifestation of tuberculosis, and 326
7normal cases. It contains a total of 662 images. Image size varies for each
8X-ray. It is approximately 3K x 3K. One set of ground-truth lung annotations is
9available for 566 of the 662 images.
11* Reference: [SHENZHEN-2014]_
12* Original resolution (height x width): Approximately 3K x 3K (varies)
13* Configuration resolution: 512 x 512 (after rescaling)
14* Split reference: [GAAL-2020]_
15* Protocol ``default``:
17 * Training samples: 396 (including labels)
18 * Validation samples: 56 (including labels)
19 * Test samples: 114 (including labels)
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]
36_root_path = bob.extension.rc.get(
37 "bob.ip.binseg.shenzhen.datadir", os.path.realpath(os.curdir)
38)
41def _raw_data_loader(sample):
42 return dict(
43 data=load_pil_rgb(os.path.join(_root_path, sample["data"])),
44 label=load_pil_1(os.path.join(_root_path, sample["label"])),
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, fieldnames=("data", "label"), loader=_loader
56)
58"""Shenzhen CXR dataset object"""