I’m trying to code a simple convolution autoencoder for the digit MNIST dataset. My plan is to use it as a denoising autoencoder.
I’m trying to replicate an architecture proposed in a paper. The network architecture looks like this:




Network
Layer
Activation




Encoder
Convolution
Relu


Encoder
Max Pooling
-


Encoder
Convolution
Relu


Encoder
Max Pooling
-


----
----
----


Decoder
Convolution
Relu


Decoder
Upsampling
-


Decoder
Convolution
Relu


Decoder
Upsampling
-


Decoder
Convolution
Sigmoid



Here is the code I have so far, I never performed “deconvolution” so I’m a bit lost.
# Conv network
self.convEncoder = nn.Sequential(
	# Output size of each convolutional layer = [(in_channel + 2 * padding - kernel_size) / stride] + 1
	# In this case output = [(28 + 2 * 1 - 5) / 1] + 1 = 26
	nn.Conv2d(in_channels=1, out_channels=10, kernel_size=5, padding=1, stride=1),
	nn.ReLU(),
	nn.MaxPool2d(kernel_size=2),    # End up with 12 channels of size 13 x 13

	# In this case output = [(13 + 2 * 1 - 5) / 1] + 1 = 11
	nn.Conv2d(in_channels=10, out_channels=24, kernel_size=5, padding=1, stride=1),
	nn.ReLU(),
	nn.MaxPool2d(kernel_size=2),  # End up with 24 channels of size 5 x 5
)

# Not sure what to do here
self.convDecoder = nn.Sequential(
	# ???? 
	nn.ConvTranspose2d(??, ??, ??),	# 24, 10, 5 ???
	nn.ReLU(),
	nn.Upsample(scale_factor=??)	# ???

	nn.ConvTranspose2d(??, ??, ??),	# 10, 1, 5 ???
	nn.ReLU(),
	nn.Upsample(scale_factor=??)	# ???

	nn.ConvTranspose2d(??, ??, ??),	# ???
	nn.Sigmoid()
)

@ptrblck did you ever face this situation?