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/__init__.py: 92%

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 

6The Indian collection database has been established to foster research 

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

8focus on pulmonary tuberculosis (TB). 

9 

10* Reference: [INDIAN-2013]_ 

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

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

13 

14""" 

15 

16import os 

17import pkg_resources 

18 

19import bob.extension 

20 

21from ..dataset import JSONDataset 

22from ..loader import load_pil_baw, make_delayed 

23 

24_protocols = [ 

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

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

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

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

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

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

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

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

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

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

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

36] 

37 

38def _raw_data_loader(sample): 

39 return dict( 

40 data=load_pil_baw(os.path.join(bob.extension.rc.get( 

41 "bob.med.tb.indian.datadir", os.path.realpath(os.curdir) 

42 ), sample["data"])), 

43 label=sample["label"], 

44 ) 

45 

46 

47def _loader(context, sample): 

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

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

50 return make_delayed(sample, _raw_data_loader) 

51 

52 

53dataset = JSONDataset( 

54 protocols=_protocols, 

55 fieldnames=("data", "label"), 

56 loader=_loader, 

57) 

58"""Indian dataset object"""