-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecoder.py
More file actions
103 lines (88 loc) · 3.98 KB
/
Copy pathDecoder.py
File metadata and controls
103 lines (88 loc) · 3.98 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
import torch.nn as nn
class decoder_layer5(nn.Module):
def __init__(self, in_channels, out_channels):
super(decoder_layer5, self).__init__()
self.nn_modules = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
nn.Conv2d(out_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
nn.Conv2d(out_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
)
def forward(self, x):
return self.nn_modules(x)
class decoder_layer4(nn.Module):
def __init__(self, in_channels, out_channels):
super(decoder_layer4, self).__init__()
self.nn_modules = nn.Sequential(
nn.Conv2d(in_channels * 2, in_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(in_channels),
nn.Dropout(p=0.6),
nn.Conv2d(in_channels, in_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(in_channels),
nn.Dropout(p=0.6),
nn.Conv2d(in_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
)
def forward(self, x):
return self.nn_modules(x)
class decoder_layer3(nn.Module):
def __init__(self, in_channels, out_channels):
super(decoder_layer3, self).__init__()
self.nn_modules = nn.Sequential(
nn.Conv2d(in_channels * 2, in_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(in_channels),
nn.Dropout(p=0.6),
nn.Conv2d(in_channels, in_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(in_channels),
nn.Dropout(p=0.6),
nn.Conv2d(in_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
)
def forward(self, x):
return self.nn_modules(x)
class decoder_layer2(nn.Module):
def __init__(self, in_channels, out_channels):
super(decoder_layer2, self).__init__()
self.nn_modules = nn.Sequential(
nn.Conv2d(in_channels * 2, in_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(in_channels),
nn.Dropout(p=0.6),
nn.Conv2d(in_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
)
def forward(self, x):
return self.nn_modules(x)
class decoder_layer1(nn.Module):
def __init__(self, in_channels, out_channels):
super(decoder_layer1, self).__init__()
self.nn_modules = nn.Sequential(
nn.Conv2d(in_channels * 2, in_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(in_channels),
nn.Dropout(p=0.6),
nn.Conv2d(in_channels, out_channels, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
nn.ReLU(inplace=True),
nn.BatchNorm2d(out_channels),
nn.Dropout(p=0.6),
)
def forward(self, x):
return self.nn_modules(x)