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/configs/datasets/hivtb/__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

9 statements  

1#!/usr/bin/env python 

2# coding=utf-8 

3 

4def _maker(protocol, resize_size=512, cc_size=512, RGB=False): 

5 

6 from ....data.transforms import RemoveBlackBorders, ElasticDeformation 

7 from torchvision import transforms 

8 from ....data.hivtb import dataset as raw 

9 from .. import make_dataset as mk 

10 

11 post_transforms = [] 

12 if RGB: 

13 post_transforms = [transforms.Lambda(lambda x: x.convert("RGB")), 

14 transforms.ToTensor()] 

15 

16 return mk( 

17 [raw.subsets(protocol)], 

18 [ 

19 RemoveBlackBorders(), 

20 transforms.Resize(resize_size), 

21 transforms.CenterCrop(cc_size) 

22 ], 

23 [ElasticDeformation(p=0.8)], 

24 post_transforms 

25 )