-
Notifications
You must be signed in to change notification settings - Fork 0
/
decoder_block.m
35 lines (35 loc) · 1.56 KB
/
decoder_block.m
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
function layers=decoder_block(numF,tag)
if (tag=='d0')
layers=[
batchNormalizationLayer('Name',[tag,'_BN1'])
reluLayer('Name',[tag,'_relu1'])
convolution2dLayer(3,numF*2,'Padding','same','Stride',1,'Name',[tag,'_conv1'])
batchNormalizationLayer('Name',[tag,'_BN2'])
reluLayer('Name',[tag,'_relu2'])
convolution2dLayer(3,numF*2,'Padding','same','Stride',1,'Name',[tag,'_conv2'])];
elseif (tag=='d1')
layers=[
batchNormalizationLayer('Name',[tag,'_BN1'])
reluLayer('Name',[tag,'_relu1'])
convolution2dLayer(3,numF,'Padding','same','Stride',1,'Name',[tag,'_conv1'])
batchNormalizationLayer('Name',[tag,'_BN2'])
reluLayer('Name',[tag,'_relu2'])
convolution2dLayer(3,numF,'Padding','same','Stride',1,'Name',[tag,'_conv2'])
batchNormalizationLayer('Name',[tag,'_upconv_BN'])
reluLayer('Name',[tag,'_upconv_relu'])
transposedConv2dLayer(2,numF,'Stride',2,'Name',[tag,'_upconv'])
depthConcatenationLayer(2,'Name',[tag,'_contac'])];
else
layers=[
batchNormalizationLayer('Name',[tag,'_BN1'])
reluLayer('Name',[tag,'_relu1'])
convolution2dLayer(3,numF,'Padding','same','Stride',1,'Name',[tag,'_conv1'])
batchNormalizationLayer('Name',[tag,'_BN2'])
reluLayer('Name',[tag,'_relu2'])
convolution2dLayer(3,numF,'Padding','same','Stride',1,'Name',[tag,'_conv2'])
batchNormalizationLayer('Name',[tag,'_upconv_BN'])
reluLayer('Name',[tag,'_upconv_relu'])
transposedConv2dLayer(2,numF/2,'Stride',2,'Name',[tag,'_upconv'])
depthConcatenationLayer(2,'Name',[tag,'_contac'])];
end
end