-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconfig.py
144 lines (136 loc) · 7.48 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# This file is used to configure the training parameters for each task
class Config_US30K:
# This dataset contain all the collected ultrasound dataset
data_path = "../../dataset/SAMUS/"
save_path = "./checkpoints/SAMUS/"
result_path = "./result/SAMUS/"
tensorboard_path = "./tensorboard/SAMUS/"
load_path = save_path + "/xxx.pth"
save_path_code = "_"
workers = 1 # number of data loading workers (default: 8)
epochs = 200 # number of total epochs to run (default: 400)
batch_size = 8 # batch size (default: 4)
learning_rate = 5e-4 # iniial learning rate (default: 0.001)
momentum = 0.9 # momntum
classes = 2 # thenumber of classes (background + foreground)
img_size = 256 # theinput 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 = "train"
visual = False
modelname = "SAM"
# -------------------------------------------------------------------------------------------------
class Config_TN3K:
data_path = "../../dataset/SAMUS/"
data_subpath = "../../dataset/SAMUS/ThyroidNodule-TN3K/"
save_path = "./checkpoints/TN3K/"
result_path = "./result/TN3K/"
tensorboard_path = "./tensorboard/TN3K/"
load_path = save_path + "/xxx.pth"
save_path_code = "_"
workers = 1 # number of data loading workers (default: 8)
epochs = 400 # number of total epochs to run (default: 400)
batch_size = 8 # 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 = 256 # the input size of model
train_split = "train-ThyroidNodule-TN3K" # the file name of training set
val_split = "val-ThyroidNodule-TN3K" # the file name of testing set
test_split = "test-ThyroidNodule-TN3K" # 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 = "train"
visual = False
modelname = "SAM"
class Config_BUSI:
# This dataset is for breast cancer segmentation
data_path = "../../dataset/SAMUS/"
data_subpath = "../../dataset/SAMUS/Breast-BUSI/"
save_path = "./checkpoints/BUSI/"
result_path = "./result/BUSI/"
tensorboard_path = "./tensorboard/BUSI/"
load_path = save_path + "/xxx.pth"
save_path_code = "_"
workers = 1 # number of data loading workers (default: 8)
epochs = 400 # number of total epochs to run (default: 400)
batch_size = 8 # batch size (default: 4)
learning_rate = 1e-4 # iniial learning rate (default: 0.001)
momentum = 0.9 # momntum
classes = 2 # thenumber of classes (background + foreground)
img_size = 256 # theinput size of model
train_split = "train-Breast-BUSI" # the file name of training set
val_split = "val-Breast-BUSI" # the file name of testing set
test_split = "test-Breast-BUSI" # 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 = "train"
visual = False
modelname = "SAM"
class Config_CAMUS:
# This dataset is for breast cancer segmentation
data_path = "../../dataset/SAMUS/" #
data_subpath = "../../dataset/SAMUS/Echocardiography-CAMUS/"
save_path = "./checkpoints/CAMUS/"
result_path = "./result/CAMUS/"
tensorboard_path = "./tensorboard/CAMUS/"
load_path = save_path + "/xxx.pth"
save_path_code = "_"
workers = 1 # number of data loading workers (default: 8)
epochs = 400 # number of total epochs to run (default: 400)
batch_size = 8 # batch size (default: 4)
learning_rate = 1e-4 # iniial learning rate (default: 0.001)
momentum = 0.9 # momntum
classes = 4 # thenumber of classes (background + foreground)
img_size = 256 # theinput size of model
train_split = "train-EchocardiographyLA-CAMUS" # the file name of training set
val_split = "val-EchocardiographyLA-CAMUS" # the file name of testing set
test_split = "test-Echocardiography-CAMUS" # the file name of testing set # HMCQU
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 = "camusmulti" # the mode when evaluate the model, slice level or patient level
pre_trained = False
mode = "train"
visual = False
modelname = "SAM"
# ==================================================================================================
def get_config(task="US30K"):
if task == "US30K":
return Config_US30K()
elif task == "TN3K":
return Config_TN3K()
elif task == "BUSI":
return Config_BUSI()
elif task == "CAMUS":
return Config_CAMUS()
else:
assert("We do not have the related dataset, please choose another task.")