First Attempt: Convolutional Neural Network

After finally getting this blog up, I will be detailing my experiences for the IFT6266 project.

Special thanks to Philip Paquette, whose comments on the student forum were invaluable to get started on Hades, and to Philip Lacaille, whose repo helped me organize my own code.

Without further ado, let’s proceed to the first experiment.

I used a convolutional neural network to predict the missing region directly from the visible pixels on the border. This is the naive approach and will serve as a baseline to compare the other models to.

The network architecture was inspired from VGGNet utilizing mainly 3×3 convolutions followed by pooling layers. I also added a locally connected layer as the output for the model to have more flexibility and used batch-norm on every layer except the last. The full architecture is as follows:

 - Input (3x64x64)
 - 3x3 Conv (32 filters)
 - 3x3 Conv (32)
 - 2x2 MaxPool
 - 3x3 Conv (64)
 - 3x3 Conv (64)
 - 2x2 MaxPool
 - 3x3 Conv (64)
 - 3x3 Conv (64)
 - FC (3072 units)
 - Reshape into 3x32x32
 - 3x3 Conv (64)
 - 3x3 Conv (64)
 - 1x1 Locally-connected (Output 3x32x32)

I also tried another architecture resembling a classic autoencoder. Also, instead of using max pooling, it utilizes convolution layers with stride 2 to be able to learn the downsampling as recommended for GANs. Upsampling is done using nearest neighbor followed by convolutions. This one is as follows:

 - Input (3x64x64)
 - 3x3 Conv (64 filters)
 - 3x3 Conv (64)
 - 3x3 ConvStride2 (64)
 - 3x3 Conv (64)
 - 3x3 Conv (64)
 - 3x3 ConvStride2 (128)
 - 3x3 Conv (128)
 - 3x3 Conv (128)
 - 3x3 ConvStride2 (128)
 - 3x3 Conv (128)
 - 3x3 Conv (128)
 - 3x3 ConvStride2 (256)
 - 3x3 Conv (256)
 - 3x3 Conv (256)
 - FC (3072 units)
 - Reshape into 192x4x4
 - 3x3 Locally-Connected
 - 3x3 Conv (256)
 - 3x3 Conv (256)
 - NN-Upsample (double size)
 - 3x3 Conv (256)
 - 3x3 Conv (256)
 - NN-Upsample (double size)
 - 3x3 Conv (128)
 - 3x3 Conv (128)
 - NN-Upsample (double size) 
 - 3x3 Conv (96)
 - 3x3 Conv (96)
 - NN-Upsample (double size)
 - 3x3 Conv (64)
 - 3x3 Conv (64)
 - 1x1 Locally-Connected (Output 3x32x32)

Some sample images from the validation set:

As expected, the results aren’t great but they do show that model has been able to learn something. The blurriness of both models is probably due to the pixel-wise reconstruction loss as discussed in class.

Interestingly, the output for the CNN method is grainier but also seems to be more detailed than the Autoencoder. I would guess that this happens due to the tighter bottleneck of the autoencoder and the fact that there is no upsampling. (There are a lot less weights in the Autoencoder-style model since the fully connected layer is much smaller with (256*4*4) * 3072 = 4096*3072 weights, as opposed to the CNN model which has (64*16*16)*3072 = 16384*3072 weights in the FC layer. Also, the size of the file for the saved weights is about 6 times larger for the CNN compared to the autoencoder).

Next Steps

I stumbled on an interesting paper which tackles the inpainting task. It utilizes a combination of the regular reconstruction loss and an adversarial loss to train a model to fill in missing regions. I will try to reimplement their model. But first, as a step towards that, I will turn to GANs next.

 

Leave a Reply

Your email address will not be published. Required fields are marked *