None of these cats exist. All are GAN-generated images obtained from https://thiscatdoesnotexist.com . Can we come up with a way to detect GAN-generated cat pics? #CaturdayShenaniGANs

(GAN = "generative adversarial network", the AI technique used to create the images)

cc: @ZellaQuixote
For this project, we used the following datasets (all images 512x512):

• 2000 GAN-generated cats from https://thiscatdoesnotexist.com 
• 1195 real cat faces, cropped from images at https://www.kaggle.com/crawford/cat-dataset
• a test set of 1000 GAN-generated and 1000 real cats (same sources as above)
Unlike the GAN-generated human face pics provided by https://thispersondoesnotexist.com  etc, the placement of the major facial features on the GAN-generated cat pics from https://thiscatdoesnotexist.com  varies from image to image. There are other anomalies in the fake cat pics, however. . .
We blended 2000 GAN-generated cat pics and altered the color scheme so that each pixel's brightness corresponds to how different that pixel's color is from the average color of the image. This reveals various horizontal and vertical bands in the GAN-generated cat images.
We can emphasize this banding further by blending all the pixels in the same row or column of the image and calculating the difference between adjacent values. This results in a distinctive pattern of peaks every other pixel and slightly less visible peaks every 8 pixels.
The same pattern shows up (albeit less visibly) when we apply the same process to a single GAN-generated cat image. Notably, this pattern is largely absent from real cat face pics, both single and blended.
We used these results to train a simple neural network to classify cat face images as "real" or "GAN-generated". Results are encouraging - within a few hours of training we ended up with a model that achieved 94.2% accuracy on 2000 images it hadn't been trained on.
Here's the code we used for both training and classification. It is presently hardcoded to use 512x512 pixel images (the size generated by https://thiscatdoesnotexist.com ) and will likely require tweaking for other image sizes. https://pastebin.com/hqPtD5CD 
A couple of disclaimers:

• This method is unlikely to produce useful results on images that aren't of cat faces.
• If using it on Twitter profile pics, you will want to obtain the full-resolution version of the pics for best results (more detail here: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/user-profile-images-and-banners).
You can follow @conspirator0.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: