1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
- #!usr/bin/env python
- # -*- coding: utf-8 -*-
- import argparse
- from GANDLF.cli import preprocess_and_save, copyrightMessage
- # main function
- if __name__ == "__main__":
- parser = argparse.ArgumentParser(
- prog="GANDLF_Preprocess",
- formatter_class=argparse.RawTextHelpFormatter,
- description="Generate training/inference data which are preprocessed to reduce resource footprint during computation.\n\n"
- + copyrightMessage,
- )
- parser.add_argument(
- "-c",
- "--config",
- metavar="",
- type=str,
- help="The configuration file (contains all the information related to the training/inference session), this is read from 'output' during inference",
- required=True,
- )
- parser.add_argument(
- "-i",
- "--inputdata",
- metavar="",
- type=str,
- help="Data csv file that is used for training/inference",
- required=True,
- )
- parser.add_argument(
- "-o",
- "--output",
- metavar="",
- type=str,
- help="Output directory to save intermediate files and model weights",
- required=True,
- )
- parser.add_argument(
- "-l",
- "--labelPad",
- metavar="",
- type=str,
- default="constant",
- help="This specifies the padding strategy for the label when 'patch_sampler' is 'label'. Defaults to 'constant' [full list: https://numpy.org/doc/stable/reference/generated/numpy.pad.html]",
- required=False,
- )
- parser.add_argument(
- "-a",
- "--applyaugs",
- metavar="",
- type=bool,
- default=False,
- help="This specifies the whether to apply data augmentation during output creation. Defaults to False",
- required=False,
- )
- parser.add_argument(
- "-a",
- "--cropzero",
- metavar="",
- type=bool,
- default=False,
- help="This specifies the whether to apply zero cropping during output creation. Defaults to False",
- required=False,
- )
- args = parser.parse_args()
- preprocess_and_save(
- args.inputdata,
- args.config,
- args.output,
- args.labelPad,
- args.applyaugs,
- args.cropzero,
- )
- print("Finished.")
|