I'm doing an image segmentation with UNet-like CNN architecture by Pytorch 0.4.0.It mark foreground as 1 and background as 0 in the final segmentation result.I use a pre-trained VGG's feature extractor as my encoder, so I need to upsampling the encoder output many times.But the result shows a weird lattice parttern in the result like this:
kernel_size=3,stride=2,padding=1,output_padding=1
(the output_padding is used to fit the skip connection feature size, for instance, with a input size 40*30,I want it size enlarge twice in one deconvolutional layer,under my calculation with the formula:out=s(in-1)+k-2p,I must use padding 1 and output-padding 1 to keep size,or there might be other better choice I don’t know.)I'm wondering the reason that generate the black lattice.They looks like a grid or square parttern.And how to solve it.Besides,I need to adjust all deconv layer hyperparamater to one uniform or modify them separately?
environment:Ubuntu 16.04,Pytorch 0.4.0,GTX 1080Ti, the architecture of upsampling is three deconv layer,they are one after another.
Update
after I modified the deconv hyperparameter,(inspired by noise in image segmentation result use
kernel_size=4,stride=2,padding=1
thus to avoid output-padding and satisfy the size.But after 100 epoch I met similiar problem.
after another 30 epoch training, it seems like this,
self.conv1=Basic(1024,512,kernel_size=3,stride=1,padding=1)
self.conv2=Basic(512,512,kernel_size=3,stride=1,padding=1)
self.deconv1=Basic(512,256,kernel_size=4,stride=2,conv=False,padding=1)
self.deconv2=Basic(256,128,kernel_size=4,stride=2,conv=False,padding=1)
self.deconv3=Basic(128,64,kernel_size=4,stride=2,conv=False,padding=1)
#output 480*640 segmap
self.conv4=Basic(64,2,kernel_size=1,stride=1)
# self.avgpool=nn.AvgPool2d(kernel_size=2,stride=2)
def forward(self, input):
input=self.conv1(input)
input=self.conv2(input)
input=self.deconv1(input)
input=self.deconv2(input)
input=self.deconv3(input)
input=self.conv4(input)
# print(input.shape)
#a channel-wise probability map
raw=input
return raw`