-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_FCN.py
64 lines (55 loc) · 1.82 KB
/
model_FCN.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
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
# self.x = x
self.block0 = nn.Sequential(
# input image 96x96
nn.ReLU(),
nn.Conv2d(3, 128, (11, 11), (1, 1), (5, 5)),
nn.LeakyReLU(0.1),
nn.BatchNorm2d(128),
nn.Conv2d(128, 128, (5, 5), (1, 1), (2, 2)),
nn.LeakyReLU(0.1),
nn.Conv2d(128, 128, (5, 5), (1, 1), (2, 2)),
nn.LeakyReLU(0.1),
nn.BatchNorm2d(128),
nn.Conv2d(128, 256, (3, 3), (1, 1), (1, 1)),
nn.LeakyReLU(0.1),
nn.BatchNorm2d(256),
nn.Conv2d(256, 256, (3, 3), (1, 1), (1, 1)),
nn.LeakyReLU(0.1),
nn.Conv2d(256, 256, (3, 3), (1, 1), (1, 1)),
nn.LeakyReLU(0.1),
nn.Conv2d(256, 256, (3, 3), (1, 1), (1, 1)),
nn.LeakyReLU(0.1),
nn.BatchNorm2d(256),
nn.Conv2d(256, 512, (7, 7), (1, 1), (3, 3)),
nn.LeakyReLU(0.1),
nn.BatchNorm2d(512),
nn.Conv2d(512, 512, (1, 1), (1, 1)),
nn.LeakyReLU(0.1),
nn.Conv2d(512, 1, (1, 1), (1, 1)),
nn.LeakyReLU(0.1),
nn.BatchNorm2d(1),
# image 96x96
)
# self.block1 = nn.Sequential(
# # image 96x96
# nn.PixelShuffle(2)
# # image 192x192
# )
self.fc = nn.Sequential(
# nn.PixelShuffle(96/89)
nn.Sigmoid()
)
def forward(self, x):
x=x.float()
out = self.block0(x)
out = self.fc(out)
return out
def _initialize_weights(self):
pass