Changed from deconv to bilinear for upsampling

This commit is contained in:
milesial 2017-08-17 15:33:47 +02:00
parent a4937ca931
commit 8332f891c3
3 changed files with 7 additions and 5 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.pyc *.pyc
data/ data/
__pycache__/ __pycache__/
*.pth

View file

@ -11,10 +11,10 @@ class UNet(nn.Module):
self.down1 = down(64, 128) self.down1 = down(64, 128)
self.down2 = down(128, 256) self.down2 = down(128, 256)
self.down3 = down(256, 512) self.down3 = down(256, 512)
self.down4 = down(512, 1024) self.down4 = down(512, 512)
self.up1 = up(1024, 512) self.up1 = up(1024, 256)
self.up2 = up(512, 256) self.up2 = up(512, 128)
self.up3 = up(256, 128) self.up3 = up(256, 64)
self.up4 = up(128, 64) self.up4 = up(128, 64)
self.outc = outconv(64, n_classes) self.outc = outconv(64, n_classes)

View file

@ -41,7 +41,8 @@ class down(nn.Module):
class up(nn.Module): class up(nn.Module):
def __init__(self, in_ch, out_ch): def __init__(self, in_ch, out_ch):
super(up, self).__init__() super(up, self).__init__()
self.up = nn.ConvTranspose2d(in_ch, out_ch, 2, stride=2) self.up = nn.UpsamplingBilinear2d(scale_factor=2)
#self.up = nn.ConvTranspose2d(in_ch, out_ch, 2, stride=2)
self.conv = double_conv(in_ch, out_ch) self.conv = double_conv(in_ch, out_ch)
def forward(self, x1, x2): def forward(self, x1, x2):