In April 2020, Akvelon released AI ArtDive, an application that allows you to edit photos by applying AI-powered filters and effects. AI ArtDive is accessible via theses apps: web, iOS, and Android applications:
The AI ArtDive application launched with Akvelon’s custom trained Gender Swap GAN filter that transforms the face of a subject in a photo to look like the opposite gender by altering their features to look more masculine or feminine. Here, we are going to describe the methodology and approach that we used to develop this filter.
We tried a few novel techniques to train a Gender Swap GAN filter. In general, we tried to use generative adversarial networks in order to generate images of people with opposing genders.
Generative adversarial network or GAN is a type of neural network that is composed of two different parts — generator and discriminator. During the training procedure, both of these components take part in the learning procedure by “competing” with each other. The generator’s task is to create an image that will suit our given parameters and the discriminator’s task is to decide if the image is generated by the network or not. The discriminator is rewarded for correctly determining if a photo was synthetically generated or not and the generator is rewarded for successfully “fooling” the discriminator.
Our first task was to prepare a large dataset that contained numerous photos of people’s faces. Although there are plenty of prepared photo datasets on the internet, they are not always suitable for a particular task like this or they may have poor image quality.
For quality control of target images, we used the RetinaFace neural net that allowed us to crop faces from high-quality images of human subjects for further editing. We also shared this data with the InsightFace gender detection model to verify the target subject’s gender. This was necessary for us to ensure that the neural net will correctly distinguish the style of the target’s gender.
With all of our data prepared, the question arose: which particular GAN architecture should we use for a successful solution to this task?
We tried two different approaches to the training process: supervised and unsupervised.
Ilya Polishchuk is a Lead Software Developer at Akvelon’s Ivanovo office. Special thanks to Gleb Vasyagin and Anton Nesterenko for their help writing this article.