-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.py
72 lines (67 loc) · 3.69 KB
/
config.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
# This file is used to configure the training or testing parameters for each task
class Config_BCIHM:
# This dataset is for intracranial hemorrhage segmentation
data_path = "./data/to/BCIHM/"
save_path = "./checkpoints/to/BCIHM/"
tensorboard_path = "./tensorboard/BCIHM/"
load_path = ''
save_path_code = "_"
workers = 2 # data loading workers (default: 8)
epochs = 200 # total training epochs (default: 400)
batch_size = 2 # batch size (default: 4)
learning_rate = 1e-4 # initial learning rate (default: 0.001)
momentum = 0.9 # momentum
classes = 2 # the number of classes (background + foreground)
img_size = 512 # the input size of model
train_split = "train" # the file name of training set
val_split = "val" # the file name of testing set
test_split = "test" # the file name of testing set
crop = None # the cropped image size
eval_freq = 1 # the frequency of evaluate the model
save_freq = 2000 # the frequency of saving the model
device = "cuda" # training device, cpu or cuda
cuda = "on" # switch on/off cuda option (default: off)
gray = "yes" # the type of input image
img_channel = 1 # the channel of input image
eval_mode = "mask_slice" # the mode when evaluate the model, slice level or patient level
pre_trained = False
mode = "test"
visual = False
modelname = "SAMIHS"
class Config_Intance:
# This dataset is for intracranial hemorrhage segmentation
data_path = "./data/to/Instance/"
save_path = "./checkpoints/to/Instance/"
tensorboard_path = "./tensorboard/Instance/"
load_path = ''
save_path_code = "_"
workers = 2 # data loading workers (default: 8)
epochs = 200 # total epochs to run (default: 400)
batch_size = 2 # batch size (default: 4)
learning_rate = 1e-4 # initial learning rate (default: 0.001)
momentum = 0.9 # momentum
classes = 2 # the number of classes (background + foreground)
img_size = 512 # the input size of model
train_split = "train" # the file name of training set
val_split = "val" # the file name of testing set
test_split = "test" # the file name of testing set
crop = None # the cropped image size
eval_freq = 1 # the frequency of evaluate the model
save_freq = 2000 # the frequency of saving the model
device = "cuda" # training device, cpu or cuda
cuda = "on" # switch on/off cuda option (default: off)
gray = "yes" # the type of input image
img_channel = 1 # the channel of input image
eval_mode = "mask_slice" # the mode when evaluate the model, slice level or patient level
pre_trained = False
mode = "test"
visual = False
modelname = "SAMIHS"
# ==================================================================================================
def get_config(task="BCIHM"):
if task == "BCIHM":
return Config_BCIHM()
elif task == "Instance":
return Config_Intance()
else:
assert("We do not have the related dataset, please choose another task.")