-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
87 lines (72 loc) · 2.34 KB
/
main.py
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
80
81
82
83
84
85
86
87
"""This is the main module in the project which gets users prefernces."""
from optparse import OptionParser
from utils.config import config
import warnings
warnings.filterwarnings("ignore")
def main():
parser = OptionParser()
parser.add_option(
"-p",
"--path",
dest="dir_to_dataset",
help="Path to the desired dataset.",
default=config.dir_to_dataset,
)
parser.add_option(
"-d",
"--device",
dest="availabe_device",
help="Choose the device you want to start training on.['cuda','cpu']",
default=config.device,
)
parser.add_option(
"-g",
"--gpu",
dest="GPU_under_control",
help="True if you don't want to put a lot of pressure on your gpu card. It will keep your GPU's temperature in the safe zone.",
default=config.gpu_under_control,
)
parser.add_option(
"-m",
"--model",
dest="backbone_model_name",
help="The possible backbone models are as follows: efficientnet-b[0-7] -> efficientnet-b4 ",
default=config.backbone_model_name,
)
parser.add_option(
"-l",
"--load",
dest="dir_to_pretrained_model",
help="The directory to a pretrained model checkpoint.",
default=config.dir_to_pretrained_model,
)
parser.add_option(
"-w",
"--workers",
dest="num_workers",
help="The directory to a pretrained model checkpoint.",
default=config.num_workers,
)
parser.add_option(
"-t",
"--train",
dest="train",
help="If you want to start training your model based on your dataset, set this arg True. Otherwise, it just monitor the performance of your pretrained model.",
default=True,
)
(options, args) = parser.parse_args()
config.dir_to_dataset = options.dir_to_dataset
config.device = options.availabe_device
config.gpu_under_control = options.GPU_under_control
config.dir_to_pretrained_model = options.dir_to_pretrained_model
config.backbone_model_name = options.backbone_model_name
config.num_workers = int(options.num_workers)
return options.train
if __name__ == "__main__":
train_mode = main()
if train_mode:
from trainer import lunch
lunch()
else:
from monitor import lunch
lunch()