-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel.py
33 lines (29 loc) · 1.11 KB
/
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
import torch.nn as nn
from blocks import *
class uw_experiment(nn.Module):
def __init__(self):
super(uw_experiment, self).__init__()
self.input_channels = 3
self.output_channels = 3
self.encoder_inc = DoubleConvBlock(self.input_channels, 24)
self.encoder_down1 = DownBlock(24, 48)
self.encoder_down2 = DownBlock(48, 96)
self.encoder_down3 = DownBlock(96, 192)
self.encoder_bridge_down = BridgeDown(192, 384)
self.decoder_bridge_up = BridgeUP(384, 192)
self.decoder_up1 = UpBlock(192, 96)
self.decoder_up2 = UpBlock(96, 48)
self.decoder_up3 = UpBlock(48, 24)
self.decoder_out = OutputBlock(24, self.output_channels)
def forward(self, x):
x1 = self.encoder_inc(x)
x2 = self.encoder_down1(x1)
x3 = self.encoder_down2(x2)
x4 = self.encoder_down3(x3)
x5 = self.encoder_bridge_down(x4)
x = self.decoder_bridge_up(x5)
x = self.decoder_up1(x, x4)
x = self.decoder_up2(x, x3)
x = self.decoder_up3(x, x2)
out = self.decoder_out(x, x1)
return out