Coverage for src/deepdraw/configs/datasets/refuge/__init__.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2023-11-30 15:00 +0100

1# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5 

6def _maker(protocol): 

7 from ....data.refuge import dataset as raw 

8 from ....data.transforms import CenterCrop, Pad, Resize 

9 from .. import make_dataset as mk 

10 

11 # due to different sizes, we need to make the dataset twice 

12 train = mk(raw.subsets(protocol), [Resize(1539), Pad((21, 46, 22, 47))]) 

13 # we'll keep "dev" and "test" from the next one 

14 retval = mk(raw.subsets(protocol), [CenterCrop(1632)]) 

15 # and we keep the "train" set with the right transforms 

16 retval["train"] = train["train"] 

17 return retval 

18 

19 

20def _maker_square(protocol, size): 

21 from ....data.refuge import dataset as raw 

22 from ....data.transforms import CenterCrop, Pad, Resize 

23 from .. import make_dataset as mk 

24 

25 # due to different sizes, we need to make the dataset twice 

26 train = mk( 

27 raw.subsets(protocol), 

28 [Resize(1539), Pad((21, 46, 22, 47)), Resize((size, size))], 

29 ) 

30 # we'll keep "dev" and "test" from the next one 

31 retval = mk(raw.subsets(protocol), [CenterCrop(1632), Resize((size, size))]) 

32 # and we keep the "train" set with the right transforms 

33 retval["train"] = train["train"] 

34 return retval