Coverage for /scratch/builds/bob/bob.med.tb/miniconda/conda-bld/bob.med.tb_1637571489937/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python3.8/site-packages/bob/med/tb/data/indian_RS/__init__.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

1#!/usr/bin/env python 

2# coding=utf-8 

3 

4"""Indian collection dataset for computer-aided diagnosis 

5(extended with DensenetRS predictions) 

6 

7The Indian collection database has been established to foster research 

8in computer-aided diagnosis of pulmonary diseases with a special 

9focus on pulmonary tuberculosis (TB). 

10 

11* Reference: [INDIAN-2013]_ 

12* Original resolution (height x width or width x height): more than 1024 x 1024 

13* Split reference: [INDIAN-2013]_ with 20% of train set for the validation set 

14 

15""" 

16 

17import os 

18import pkg_resources 

19 

20import bob.extension 

21 

22from ..dataset import JSONDataset 

23from ..loader import make_delayed 

24 

25_protocols = [ 

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

27 pkg_resources.resource_filename(__name__, "fold_0.json"), 

28 pkg_resources.resource_filename(__name__, "fold_1.json"), 

29 pkg_resources.resource_filename(__name__, "fold_2.json"), 

30 pkg_resources.resource_filename(__name__, "fold_3.json"), 

31 pkg_resources.resource_filename(__name__, "fold_4.json"), 

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

33 pkg_resources.resource_filename(__name__, "fold_6.json"), 

34 pkg_resources.resource_filename(__name__, "fold_7.json"), 

35 pkg_resources.resource_filename(__name__, "fold_8.json"), 

36 pkg_resources.resource_filename(__name__, "fold_9.json"), 

37] 

38 

39def _raw_data_loader(sample): 

40 return dict( 

41 data=sample["data"], 

42 label=sample["label"] 

43 ) 

44 

45 

46def _loader(context, sample): 

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

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

49 return make_delayed(sample, _raw_data_loader, key=sample["filename"]) 

50 

51 

52dataset = JSONDataset( 

53 protocols=_protocols, 

54 fieldnames=("filename", "label", "data"), 

55 loader=_loader, 

56) 

57"""Extended Indian dataset object"""