-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker_test.py
More file actions
235 lines (222 loc) · 7.63 KB
/
Copy pathdocker_test.py
File metadata and controls
235 lines (222 loc) · 7.63 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
"""
"""
import traceback
if __name__ == "__main__":
try:
try:
# in cfg_models.py
from torch_ecg.torch_ecg.model_configs import ( # noqa: F401
# cnn bankbone
vgg_block_basic,
vgg_block_mish,
vgg_block_swish,
vgg16,
vgg16_leadwise,
resnet_block_basic,
resnet_bottle_neck_B,
resnet_bottle_neck_D,
resnet_block_basic_se,
resnet_block_basic_gc,
resnet_bottle_neck_se,
resnet_bottle_neck_gc,
resnet_nature_comm,
resnet_nature_comm_se,
resnet_nature_comm_gc,
resnet_nature_comm_bottle_neck,
resnet_nature_comm_bottle_neck_se,
resnetN,
resnetNB,
resnetNS,
resnetNBS,
tresnetF,
tresnetP,
tresnetN,
tresnetS,
tresnetM,
multi_scopic_block,
multi_scopic,
multi_scopic_leadwise,
densenet_leadwise,
xception_leadwise,
# lstm
lstm,
attention,
# mlp
linear,
# attn
non_local,
squeeze_excitation,
global_context,
# the whole model config
ECG_CRNN_CONFIG,
)
# in model.py
from torch_ecg.torch_ecg.models.ecg_crnn import ECG_CRNN # noqa: F401
# in train.py
from torch_ecg.torch_ecg.models.loss import ( # noqa: F401
BCEWithLogitsWithClassWeightLoss,
AsymmetricLoss,
)
from torch_ecg.torch_ecg.utils.utils_nn import ( # noqa: F401
default_collate_fn as collate_fn,
)
from torch_ecg.torch_ecg.utils.misc import ( # noqa: F401
init_logger,
get_date_str,
dict_to_str,
str2bool,
)
from torch_ecg.torch_ecg._preprocessors import PreprocManager # noqa: F401
from torch_ecg.torch_ecg.augmenters import AugmenterManager # noqa: F401
from torch_ecg.torch_ecg.utils.trainer import BaseTrainer # noqa: F401
except Exception:
print("import torch_ecg directly")
# in cfg_models.py
from torch_ecg.model_configs import ( # noqa: F401
# cnn bankbone
vgg_block_basic,
vgg_block_mish,
vgg_block_swish,
vgg16,
vgg16_leadwise,
resnet_block_basic,
resnet_bottle_neck_B,
resnet_bottle_neck_D,
resnet_block_basic_se,
resnet_block_basic_gc,
resnet_bottle_neck_se,
resnet_bottle_neck_gc,
resnet_nature_comm,
resnet_nature_comm_se,
resnet_nature_comm_gc,
resnet_nature_comm_bottle_neck,
resnet_nature_comm_bottle_neck_se,
resnetN,
resnetNB,
resnetNS,
resnetNBS,
tresnetF,
tresnetP,
tresnetN,
tresnetS,
tresnetM,
multi_scopic_block,
multi_scopic,
multi_scopic_leadwise,
densenet_leadwise,
xception_leadwise,
# lstm
lstm,
attention,
# mlp
linear,
# attn
non_local,
squeeze_excitation,
global_context,
# the whole model config
ECG_CRNN_CONFIG,
)
# in model.py
from torch_ecg.models.ecg_crnn import ECG_CRNN # noqa: F401
# in train.py
from torch_ecg.models.loss import ( # noqa: F401
BCEWithLogitsWithClassWeightLoss,
AsymmetricLoss,
)
from torch_ecg.utils.utils_nn import (
default_collate_fn as collate_fn,
) # noqa: F401
from torch_ecg.utils.misc import ( # noqa: F401
init_logger,
get_date_str,
dict_to_str,
str2bool,
)
from torch_ecg._preprocessors import PreprocManager # noqa: F401
from torch_ecg.augmenters import AugmenterManager # noqa: F401
from torch_ecg.utils.trainer import BaseTrainer # noqa: F401
print("successfully import torch_ecg from the submodule!")
except Exception as e:
print("failed to import torch_ecg from the submodule!")
traceback.print_exc()
try:
# in cfg.py
from torch_ecg_bak.torch_ecg.model_configs import ( # noqa: F401, F811
# cnn bankbone
vgg_block_basic,
vgg_block_mish,
vgg_block_swish,
vgg16,
vgg16_leadwise,
resnet_block_basic,
resnet_bottle_neck_B,
resnet_bottle_neck_D,
resnet_block_basic_se,
resnet_block_basic_gc,
resnet_bottle_neck_se,
resnet_bottle_neck_gc,
resnet_nature_comm,
resnet_nature_comm_se,
resnet_nature_comm_gc,
resnet_nature_comm_bottle_neck,
resnet_nature_comm_bottle_neck_se,
resnetN,
resnetNB,
resnetNS,
resnetNBS,
tresnetF,
tresnetP,
tresnetN,
tresnetS,
tresnetM,
multi_scopic_block,
multi_scopic,
multi_scopic_leadwise,
densenet_leadwise,
xception_leadwise,
# lstm
lstm,
attention,
# mlp
linear,
# attn
non_local,
squeeze_excitation,
global_context,
# the whole model config
ECG_CRNN_CONFIG,
)
# in model.py
from torch_ecg_bak.torch_ecg.models.ecg_crnn import ECG_CRNN # noqa: F401, F811
# in train.py
from torch_ecg_bak.torch_ecg.models.loss import ( # noqa: F401, F811
BCEWithLogitsWithClassWeightLoss,
AsymmetricLoss,
)
from torch_ecg_bak.torch_ecg.utils.utils_nn import ( # noqa: F401, F811
default_collate_fn as collate_fn,
)
from torch_ecg_bak.torch_ecg.utils.misc import ( # noqa: F401, F811
init_logger,
get_date_str,
dict_to_str,
str2bool,
)
from torch_ecg_bak.torch_ecg._preprocessors import ( # noqa: F401, F811
PreprocManager,
) # noqa: F401, F811
from torch_ecg_bak.torch_ecg.augmenters import ( # noqa: F401, F811
AugmenterManager,
) # noqa: F401, F811
from torch_ecg_bak.torch_ecg.utils.trainer import ( # noqa: F401, F811
BaseTrainer,
) # noqa: F401, F811
print("successfully import torch_ecg from the backup folder!")
except Exception as e:
print("failed to import torch_ecg from the backup folder!")
traceback.print_exc()
import torch
cuda_is_available = " " if torch.cuda.is_available() else " not "
print(f"torch version == {torch.__version__}")
print(f"cuda is{cuda_is_available}available")