I implemented a VAE in Pure C for Minecraft Items

Tutorials 280 points 34 comments 2 days ago

I wanted to share this project I recently made. Let me know what you guys think. I implemented a Convolutional Variational Autoencoder in C, no dependencies. I made this to learn how a more or less complex architecture is implemented from the lowest algorithmic level. The project implements everything from matmuls, to Adam and Xavier init, to CNN layers and the VAE training pipeline. I used OpenMP to parallelize the code on CPU. The code is, in my opinion, very readable and simple to understand. I prioritized simplicity over doing any complex optimizations. I used the Minecraft items dataset because the images are very low resolution (rgb 16x16) and I thought I could make some nice latent arithmetic. After the VAE was trained, I tested it by doing latent arithmetic. For example, I encoded the item iron\_chestplate into its latent representation, I got a latent representation for the concepts "diamond" and "iron" via averaging out the latents of all diamond and iron items, and finally decoded the latent "iron\_chestplate - iron + diamond", which generated an image of a diamond chestplate. Link: https://github.com/pmarinroig/c-vae

More from r/learnmachinelearning