Fun visualization of the 2D latent space of an autoencoder trained on Fashion-MNIST. Inspired by and credits to n8python for the js code
Interactive JS implementation available on my github page
Local replication instructions :
-
All the training code is available in
trainingdir -
Once your model are trained, convert them to TensorflowJS using
tensorflowjs_converter --input_format=keras /saved_models/best_model.h5 /tf_js/...(if you trained it using Keras Functional API, you may need to change themodelTopology.model_config.class_nameattribute ofmodel.jsonfromFunctionaltoModel) -
You also need to generate the map using the encoder by executing the
GenerateMapnotebook -
Then you can visualize the latent space of the AE by executing the
mapSpace.pyscript (Tkinter GUI)
Discussion : below are two screenshots of the train / test distribution of the current online implementation. Despite having a custom loss acting as a penalty to the density, there are still some "blind spots" in the latent space. I think it's possible to do better but requires some fine-tuning
Developing the same approach on more complex datasets such as CIFAR-10 could also be fun, but compressing it to 2D may be a bit too "extreme", thus the results may not be as visually interesting