0
$\begingroup$

I have been having trouble trying to get a working (non-variational) autoencoder to reproduce images from the MNIST dataset. The two biggest issues is an averaging of the samples to yield a single image regardless of the input (see examples below from fully connected network with 8 layers), or blurry images lacking full reproducibility. I am using my own code and not an ML library. I am hoping someone on here may know the issue I am experiencing or can potentially tell me what portion of my program is not computing properly.

I made 4 different networks, two being fully connected linear networks, and the other two being part convolutional part linear. I did this to show the range of the problems I am having and if anything looks familiar from this range. The four network architectures are listed below, with the numbers corresponding to the number of outputs per layer with corresponding loss curves for ~2 epochs:

  1. 4 layer linear network Flatten Input(2352) -> Linear(150) -> Relu -> Linear(10) -> ReLu -> Linear(150) -> Relu -> Linear(2352) -> Sigmoid -> Output Img enter image description here

2)8 Layer linear network Flatten Input(2352) -> Linear(400) -> Relu -> Linear(200) -> ReLu -> Linear(50) -> Relu -> Linear(10) -> Relu -> Linear(50) -> Linear(200) -> Relu -> Linear(400) -> Linear(2352) -> Sigmoid -> Output Img enter image description here

3)6 Layer Convolutional Network Input(2352) -> Convolutional(Input_Channels=3, Output_Channels=1, kernal_Size = 4) -> Relu -> Flatten -> Linear(100) -> Relu -> Linear(10) ->Relu -> Linear(100) -> Relu -> Linear(625) -> Relu -> reshape(1, 25, 25) -> Transposed_Convolutional(Input_Channels=1, Output_Channels=3, kernal+_Size = 4) -> Output Img enter image description here

4)8 Layer Convolutional Network Input(2352) -> Convolutional(Input_Channels=3, Output_Channels=32, kernal_Size = 4) -> Relu -> Convolutional(Input_Channels=32, Output_Channels=10, kernal_Size = 6) -> Relu -> Convolutional(Input_Channels=10, Output_Channels=1, kernal_Size = 6) -> Relu -> Flatten -> Linear(10) -> Relu -> Linear(225) -> Relu -> reshape(1, 15, 15) -> Transposed_Convolutional(Input_Channels=1, Output_Channels=10, kernal+_Size = 6) -> Relu Transposed_Convolutional(Input_Channels=10, Output_Channels=32, kernal+_Size = 6) -> Relu Transposed_Convolutional(Input_Channels=32, Output_Channels=3, kernal+_Size = 4) -> Sigmoid -> Output Img enter image description here

Main properties about all the networks is that they use relu activations except for the output which uses a sigmoid activation. Additionally each autoencoder has a latent vector size of 10 at the middle point of the network. I regularize my images from 0 to 1 and compare this with my "sigmoidtized" output via a standard error loss function. log loss (BCE) was yielding even worse results. Below are some of the output examples with their corresponding inputs enter image description here

Since this is a home built code here are some things to note:

  • I am using RMSprop which updates its values per each batch gradient not per each sample in the batch
  • My convolutions are just valid and full cross correlations for down and up sampling respectively
  • This is just a autoencoder and is NOT a variational autoencoder
  • Batch size is 16
  • I am using png MNIST images which have been compressed into 3 dimensional RGB images
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.