What’s out there? In this vast, infinite and inconceivable universe… Stars, planets, nebulae and celestial bodies are colliding, orbiting, being born and dying since the dawn of time.
Humans have always looked up to the sky with fascination, imagining fantastic worlds and unreachable galaxies, and this has prompted mankind to use science to better understand the universe.
Thanks to modern telescopes, we can now look up at the stars and discover a lot about the universe and ourselves looking at how it really looks.
Space has also always been a source of inspiration for artists of the whole world who have even created a specific genre dedicated to astronomy, namely the ‘Space Art’, to show wonders of the universe. Over the centuries, numerous artistic productions have been produced from the comet in the sky in Giotto’s “The Adoration of the Magi” back in 1301 to modern works of art showing distant, fascinating and imaginary galaxies.
So over the centuries, we have seen how the universe was discovered by scientists and how it was imagined and abstracted by artists, but what would an artificial intelligence think? How would it imagine the universe?
We are now able to answer these questions, thanks to Generative Adversarial Networks (GANs), neural networks capable of looking at a series of images and generating new and credible ones!
GANs are composed of two distinct networks, a generator and a discriminator, which are in contrast to each other. The generator, looking at the input data, tries to generate new credible images in an attempt to deceive the discriminator. On the other side, the discriminator tries to understand if the given image is a generated or an original one. When the generator has become good enough at generating images to the point of fooling the discriminator it can be used to create other credible examples in addition to those present in the input data.
If this in-depth educational content is useful for you, subscribe to our AI research mailing list to be alerted when we release new material.
I then created a small dataset containing 600 examples of real space scenery including planets, nebulae, galaxies and stars, as well as fictional space-themed paintings and artworks. These images will be the input of our GAN and will serve as a knowledge base for it to understand what space is.
With this data, I first trained a small GAN capable of generating 128×128 pixels images and then a lightweight StyleGAN, one of the most powerful GANs available today.
Let’s take a look at some of the most wonderful generated images by the small GAN!
In this fantastic network-generated universe, planets, suns and galaxies can be clearly distinguished with their brilliant colours illuminating the darkness of space and this has been obtained with a quite small network and a few sample images.
But how did the network achieve these results? It all starts with simple noise, images generated in a practically random way that the generator network gradually learns to evolve to fool the discriminator network.
Let’s take a look at how GAN generates images as the eras pass:
These were the results obtained by the small GAN, now let’s look at what a lightweight version of StyleGAN was able to generate!
Amazing and very realistic images! The following animation gives an idea of the process conducted by the GAN to reach this wonderful result:
But we want something more. Why settle for generating single celestial bodies? We want to achieve an entire universe!
Well, maybe asking a GAN to generate a portion of the universe on its own is a bit too much. However, we can take inspiration from the Hubble telescope which was able to assemble a wide view of the universe by combining observations of various parts of it together. Couldn’t we do something like that?
Lucky for us we don’t need to build an enormous telescope to obtain our observations since a competition was started on Kaggle seven years ago to train a classifier that could distinguish between different types of galaxies. A huge dataset containing hundreds of thousands of real images of galaxies of all sizes, shapes and colours, captured by telescopes, was then built and made public.
With so much data, not trying to exploit our GANs to generate new galaxies would be a waste, don’t you think? I’ve done it and these are the images generated by the model:
Excellent! With these results, we can combine the images together to generate a wide view of the universe! To do this, the images generated by our GAN will be combined with other squares and neutral images to give that feeling of empty space in various random areas of space.
All these images will be randomly mixed, resized, rotated and finally combined into one big image!
Ladies and gentlemen, here it is, the GAN Universe!
We have reached the end of this journey. We let ourselves be enchanted by these fantastic worlds and lost our minds in the endless universe. Certainly, there are infinite galaxies and planets out there, fascinating and distant, and many more we can imagine and draw, and today even automatically generate, but one thing is certain and should be clear to all of us:
In an infinite universe, there is only one Earth.
This awareness in combination with the terrifying disastrous phenomena we are witnessing in recent years should make us think on how important it is to preserve the health of our planet. Scientists at the Intergovernmental Panel on Climate Change (IPCC) have recently sounded the alarm, calling humanity a red code. Human activities have caused a dramatic increase in temperatures, changes in rainfall patterns, rising sea levels and a marked increase in the number of wildfires worldwide.
Adopting good habits in everyday life is certainly a good way to counteract this phenomenon, but the greatest impact can certainly be made by governments with immediate and effective regulation. Otherwise simply saying that someone else should take the lead is not a constructive attitude, and since many of the readers of this article are interested in the world of Machine Learning, I have put together a number of possible starting points to make a concrete difference.
Look at the stars but protect your Earth.
Code to perform similar experiments is now available on Github!
References and Insights
[1] “Davide Coccomini”. “Should Machine Learning Experts respond to Climate Change call to action?”
[2] “Joseph Rocca”, “Understanding Generative Adversarial Networks (GANs)”
[3] “Rohan Jagtap”, “A Comprehensive Guide to Generative Adversarial Networks (GANs)”
[4] “Ian J. Goodfellow et al.”, “Generative Adversarial Networks”
[5] “D. Harvey et al.”, “Galaxy Zoo — The Galaxy Challenge”
[6] “Lucidrains”, “StyleGAN2 Pytorch implementation”
[7] “Lucidrains”, “Lightweight StyleGAN Pytorch implementation”
[8] “NASA”, “Hubble Astronomers Assemble Wide View of the Evolving Universe”
[9] “Wikipedia”, “What is the space Art or Astronomical Art?”
[10] “IPCC”, “Climate change widespread, rapid, and intensifying”
This article was originally published on Towards Data Science and re-published to TOPBOTS with permission from the author.
Enjoy this article? Sign up for more AI updates.
We’ll let you know when we release more technical education.
Tif says
Thanks for telling me. I will definitely try something like this, it’s really valuable.