-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_model.py
79 lines (74 loc) · 2.91 KB
/
create_model.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
from grpc import insecure_channel
import torch
from torch import nn
from models import resnet
def generate_model(opt, channel):
assert opt.model in [
'resnet'
]
if opt.model == 'resnet':
assert opt.model_depth in [10, 18, 34, 50, 101, 152, 200]
if opt.model_depth == 10:
model = resnet.resnet3d_10(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
elif opt.model_depth == 18:
model = resnet.resnet3d_18(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
elif opt.model_depth == 34:
model = resnet.resnet3d_34(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
elif opt.model_depth == 50:
model = resnet.resnet3d_50(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
elif opt.model_depth == 101:
model = resnet.resnet3d_101(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
elif opt.model_depth == 152:
model = resnet.resnet3d_152(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
elif opt.model_depth == 200:
model = resnet.resnet3d_200(
in_channel= channel,
sample_input_W=opt.crop_W,
sample_input_H=opt.crop_H,
sample_input_D=opt.crop_D,
shortcut_type=opt.resnet_shortcut,
no_cuda=opt.no_cuda,
num_seg_classes=opt.n_seg_classes)
return model