Public Member Functions | Public Attributes | List of all members
model.UnetInduction Class Reference
Inheritance diagram for model.UnetInduction:

Public Member Functions

def __init__ (self, in_channels=1, out_channels=1)
 
def forward (self, conv1)
 
def single_conv_in (self, in_channels, out_channels, kernel_size, padding=1)
 
def single_conv_out (self, in_channels, out_channels, kernel_size, padding=1)
 
def conv_block (self, in_channels, out_channels, kernel_size, padding=[(1, 1))
 
def down_conv (self, in_channels, out_channels, kernel_size, stride)
 
def up_conv (self, in_channels, out_channels, kernel_size, stride, output_padding=0)
 

Public Attributes

 conv_in
 
 convs1_L
 
 down_conv1
 
 convs2_L
 
 down_conv2
 
 convs3_L
 
 down_conv3
 
 convs4_L
 
 down_conv_bottom
 
 convs_bottom
 
 up_conv_bottom
 
 convs4_R
 
 up_conv1
 
 convs3_R
 
 up_conv2
 
 convs2_R
 
 up_conv3
 
 convs1_R
 
 conv_out
 

Detailed Description

Definition at line 13 of file model.py.

Constructor & Destructor Documentation

def model.UnetInduction.__init__ (   self,
  in_channels = 1,
  out_channels = 1 
)

Definition at line 14 of file model.py.

14  def __init__(self, in_channels=1, out_channels=1):
15  super(UnetInduction, self).__init__()
16 
17  self.conv_in = self.single_conv_in(1, 4, 3)
18  self.convs1_L = self.conv_block(4, 4 ,3)
19  self.down_conv1 = self.down_conv(4, 8, 3, 3)
20  self.convs2_L = self.conv_block(8, 8, 3)
21  self.down_conv2 = self.down_conv(8, 16, 3, 3)
22  self.convs3_L = self.conv_block(16, 16, 3, padding=[(0,0), (0,0)])
23  self.down_conv3 = self.down_conv(16, 32, 3, 3)
24  self.convs4_L = self.conv_block(32, 32, 3, padding=[(0,0),(0,0)])
25 
26  self.down_conv_bottom = self.down_conv(32, 64, 3, 3)
27  self.convs_bottom = self.conv_block(64, 64, 3, padding=[(1,1),(1,1)])
28  self.up_conv_bottom = self.up_conv(64, 32, 3, 3, output_padding=(0,0))
29 
30  self.convs4_R = self.conv_block(32*2, 32, 3, padding=[(2,2),(2,2)])
31  self.up_conv1 = self.up_conv(32, 16, 3, 3, output_padding=(2,0))
32  self.convs3_R = self.conv_block(16*2, 16, 3, padding=[(2,2),(2,2)])
33  self.up_conv2 = self.up_conv(16, 8, 3, 3, output_padding=(2,2))
34  self.convs2_R = self.conv_block(8*2, 8, 3)
35  self.up_conv3 = self.up_conv(8, 4, 3, 3, output_padding=(0,2))
36  self.convs1_R = self.conv_block(4*2, 4, 3)
37  self.conv_out = self.single_conv_out(4, 1, 3)
38 
def down_conv(self, in_channels, out_channels, kernel_size, stride)
Definition: model.py:89
def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1, 1))
Definition: model.py:78
def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0)
Definition: model.py:97
def __init__(self, in_channels=1, out_channels=1)
Definition: model.py:14
def single_conv_out(self, in_channels, out_channels, kernel_size, padding=1)
Definition: model.py:70
def single_conv_in(self, in_channels, out_channels, kernel_size, padding=1)
Definition: model.py:64

Member Function Documentation

def model.UnetInduction.conv_block (   self,
  in_channels,
  out_channels,
  kernel_size,
  padding = [(1,1) 
)

Definition at line 78 of file model.py.

78  def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1,1),(1,1)]):
79  conv_block = nn.Sequential(
80  nn.BatchNorm2d(in_channels),
81  nn.ReLU(),
82  nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding[0]),
83  nn.BatchNorm2d(out_channels),
84  nn.ReLU(),
85  nn.Conv2d(out_channels, out_channels, kernel_size, padding=padding[1]))
86 
87  return conv_block
88 
def conv_block(self, in_channels, out_channels, kernel_size, padding=[(1, 1))
Definition: model.py:78
def model.UnetInduction.down_conv (   self,
  in_channels,
  out_channels,
  kernel_size,
  stride 
)

Definition at line 89 of file model.py.

89  def down_conv(self, in_channels, out_channels, kernel_size, stride):
90  down_conv = nn.Sequential(
91  nn.BatchNorm2d(in_channels),
92  nn.ReLU(),
93  nn.Conv2d(in_channels, out_channels, kernel_size, stride))
94 
95  return down_conv
96 
def down_conv(self, in_channels, out_channels, kernel_size, stride)
Definition: model.py:89
def model.UnetInduction.forward (   self,
  conv1 
)

Definition at line 39 of file model.py.

39  def forward(self, conv1):
40  conv1 = self.conv_in(conv1)
41  conv1 = self.convs1_L(conv1)
42  conv2 = self.down_conv1(conv1)
43  conv2 = self.convs2_L(conv2)
44  conv3 = self.down_conv2(conv2)
45  conv3 = self.convs3_L(conv3)
46  conv4 = self.down_conv3(conv3)
47  conv4 = self.convs4_L(conv4)
48 
49  conv_bottom = self.down_conv_bottom(conv4)
50  conv_bottom = self.convs_bottom(conv_bottom)
51  conv_bottom = self.up_conv_bottom(conv_bottom)
52 
53  conv4 = self.convs4_R(torch.cat([conv_bottom, conv4], 1))
54  conv4 = self.up_conv1(conv4)
55  conv3 = self.convs3_R(torch.cat([conv4, conv3], 1))
56  conv3 = self.up_conv2(conv3)
57  conv2 = self.convs2_R(torch.cat([conv3, conv2], 1))
58  conv2 = self.up_conv3(conv2)
59  conv1 = self.convs1_R(torch.cat([conv2, conv1], 1))
60  conv1 = self.conv_out(conv1)
61 
62  return conv1
63 
def forward(self, conv1)
Definition: model.py:39
def model.UnetInduction.single_conv_in (   self,
  in_channels,
  out_channels,
  kernel_size,
  padding = 1 
)

Definition at line 64 of file model.py.

64  def single_conv_in(self, in_channels, out_channels, kernel_size, padding=1):
65  conv = nn.Sequential(
66  nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding))
67 
68  return conv
69 
def single_conv_in(self, in_channels, out_channels, kernel_size, padding=1)
Definition: model.py:64
def model.UnetInduction.single_conv_out (   self,
  in_channels,
  out_channels,
  kernel_size,
  padding = 1 
)

Definition at line 70 of file model.py.

70  def single_conv_out(self, in_channels, out_channels, kernel_size, padding=1):
71  conv = nn.Sequential(
72  nn.BatchNorm2d(in_channels),
73  nn.ReLU(),
74  nn.Conv2d(in_channels, out_channels, kernel_size, padding=padding))
75 
76  return conv
77 
def single_conv_out(self, in_channels, out_channels, kernel_size, padding=1)
Definition: model.py:70
def model.UnetInduction.up_conv (   self,
  in_channels,
  out_channels,
  kernel_size,
  stride,
  output_padding = 0 
)

Definition at line 97 of file model.py.

97  def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0):
98  up_conv = nn.Sequential(
99  nn.BatchNorm2d(in_channels),
100  nn.ReLU(),
101  nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride, output_padding=output_padding))
102 
103  return up_conv
104 
105 
def up_conv(self, in_channels, out_channels, kernel_size, stride, output_padding=0)
Definition: model.py:97

Member Data Documentation

model.UnetInduction.conv_in

Definition at line 17 of file model.py.

model.UnetInduction.conv_out

Definition at line 37 of file model.py.

model.UnetInduction.convs1_L

Definition at line 18 of file model.py.

model.UnetInduction.convs1_R

Definition at line 36 of file model.py.

model.UnetInduction.convs2_L

Definition at line 20 of file model.py.

model.UnetInduction.convs2_R

Definition at line 34 of file model.py.

model.UnetInduction.convs3_L

Definition at line 22 of file model.py.

model.UnetInduction.convs3_R

Definition at line 32 of file model.py.

model.UnetInduction.convs4_L

Definition at line 24 of file model.py.

model.UnetInduction.convs4_R

Definition at line 30 of file model.py.

model.UnetInduction.convs_bottom

Definition at line 27 of file model.py.

model.UnetInduction.down_conv1

Definition at line 19 of file model.py.

model.UnetInduction.down_conv2

Definition at line 21 of file model.py.

model.UnetInduction.down_conv3

Definition at line 23 of file model.py.

model.UnetInduction.down_conv_bottom

Definition at line 26 of file model.py.

model.UnetInduction.up_conv1

Definition at line 31 of file model.py.

model.UnetInduction.up_conv2

Definition at line 33 of file model.py.

model.UnetInduction.up_conv3

Definition at line 35 of file model.py.

model.UnetInduction.up_conv_bottom

Definition at line 28 of file model.py.


The documentation for this class was generated from the following file: