Using AI to Combat AI: A CNN for Distinguishing Real Images of Faces From Those Created by GANs
Julia Grabovac
Eric Hamber Secondary
Floor Location : S 072 N

Artificial Intelligence research has been dominated in the last decade by recent advances in artificial neural networks, and specifically, deep neural networks. One of these types of networks known as Generative Adversarial Networks (GANs), are now capable of generating highly detailed and realistic images of human faces that, to untrained observers, are indistinguishable from photographs of real faces. Such technological developments open up the possibility for mistreatment and have implications for courts, news reporting, social media, and more broadly, may result in the erosion of public trust that a photo is of a real person. To help mitigate the potential negative effects of GAN-generated images, a Convolutional Neural Network (CNN) was developed to distinguish between generated and real images of human faces. This CNN classifier was built using a combination of the Python 3.6 programming language, PyTorch, and Fast.ai, using the Jupyter Notebooks development environment.The training data consisted of 40065 images, 20,001 images from the CelebA dataset of real images and 20,064 images generated by a state of the art GAN developed by researchers at NVIDIA. This data set was then divided into a training set with 20,033 images and a validation set containing 20,032 images. A pre-trained Resnet-34 architecture was used as the backbone of the CNN to take advantage of transfer learning effects, with a fully-connected layer with initially randomized weights added at the end. After 4 epochs of training with a batch size of 64 and learning rate of 0.003, an accuracy of 100% was achieved on the validation set. Training took 5 minutes and 42 seconds. A CNN of this kind can easily be incorporated into web browser extensions, social media apps, and other online tools in order to inform the user of the probability that a given image of a person is fake. Courts could use a similar system to verify the veracity of photo evidence. As GANs become more sophisticated, this kind of CNN can quickly be trained to allow it to continue accurately discerning between real and GAN-generated fake images.