-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathmodel2_symskip_nngraph2_deeper.lua
128 lines (115 loc) · 2.75 KB
/
model2_symskip_nngraph2_deeper.lua
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
require 'nn'
-- require 'cunn'
require 'nngraph'
local Convolution = nn.SpatialConvolution
local UpConvolution = nn.SpatialFullConvolution
local SBatchNorm = nn.SpatialBatchNormalization
local Max = nn.SpatialMaxPooling
local Avg = nn.SpatialAveragePooling
local ReLU = nn.ReLU
function create_model()
input = - nn.Identity()
ref = input
- nn.Narrow(2, 7, 3)
F0 = input
- Convolution(15,64,5,5,1,1,2,2)
- SBatchNorm(64,1e-3)
- ReLU(true)
D1 = F0
- Convolution(64,64,3,3,2,2,1,1)
- SBatchNorm(64,1e-3)
- ReLU(true)
F1 = D1
- Convolution(64,128,3,3,1,1,1,1)
- SBatchNorm(128,1e-3)
- ReLU(true)
F2 = F1
- Convolution(128,128,3,3,1,1,1,1)
- SBatchNorm(128,1e-3)
- ReLU(true)
D2 = F2
- Convolution(128,256,3,3,2,2,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
F3 = D2
- Convolution(256,256,3,3,1,1,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
F4 = F3
- Convolution(256,256,3,3,1,1,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
F5 = F4
- Convolution(256,256,3,3,1,1,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
D3 = F5
- Convolution(256,512,3,3,2,2,1,1)
- SBatchNorm(512,1e-3)
- ReLU(true)
F6 = D3
- Convolution(512,512,3,3,1,1,1,1)
- SBatchNorm(512,1e-3)
- ReLU(true)
F7 = F6
- Convolution(512,512,3,3,1,1,1,1)
- SBatchNorm(512,1e-3)
- ReLU(true)
F8 = F7
- Convolution(512,512,3,3,1,1,1,1)
- SBatchNorm(512,1e-3)
- ReLU(true)
U1 = F8
- UpConvolution(512,256,4,4,2,2,1,1)
- SBatchNorm(256,1e-3)
S1 = {F5,U1}
- nn.CAddTable()
- ReLU(true)
F9 = S1
- Convolution(256,256,3,3,1,1,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
F10 = F9
- Convolution(256,256,3,3,1,1,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
F11 = F10
- Convolution(256,256,3,3,1,1,1,1)
- SBatchNorm(256,1e-3)
- ReLU(true)
U2 = F11
- UpConvolution(256,128,4,4,2,2,1,1)
- SBatchNorm(128,1e-3)
S2 = {F2,U2}
- nn.CAddTable()
- ReLU(true)
F12 = S2
- Convolution(128,128,3,3,1,1,1,1)
- SBatchNorm(128,1e-3)
- ReLU(true)
F13 = F12
- Convolution(128,64,3,3,1,1,1,1)
- SBatchNorm(64,1e-3)
- ReLU(true)
U3 = F13
- UpConvolution(64,64,4,4,2,2,1,1)
- SBatchNorm(64,1e-3)
S3 = {F0,U3}
- nn.CAddTable()
- ReLU(true)
F14 = S3
- Convolution(64,15,3,3,1,1,1,1)
- SBatchNorm(15,1e-3)
- ReLU(true)
F15 = F14
- Convolution(15,3,3,3,1,1,1,1)
- SBatchNorm(3,1e-3)
S4 = {ref,F15}
- nn.CAddTable()
- nn.Sigmoid()
g = nn.gModule({input},{S4})
-- indata = torch.rand(4,15,64,64)
-- g:forward(indata)
-- graph.dot(g.fg, 'model2_symskip_deeper', 'model2_symskip_deeper')
return g
end