This Meme Text Generator Uses AI To Create Memes That Don't Exist

AI meme generator

The internet is just full of memes. Humans made them, and this AI is trying to to that too.

Meme is literally an idea, behavior, or style that spreads by means of imitation from person to person within a culture and often carries symbolic meaning referring to a particular phenomenon or theme.

In other words, meme is simply an 'art' of imitating. And AI is already known to excel in imitating and automation, so in theory, the two should come along together pretty nicely.

Because of this, the developers at Imgflip created what they call a 'This Meme Does Not Exist' (imgflip.com/ai-meme).

Powered by AI, the tool is a meme generator with deep artificial network as its brain, capable of creating nonsensical nature of memes, but within the borderlines of human understanding, with results that can be bizarre and brilliant at the same time.

Its naming scheme follows the reference of others products, including 'This Person Does Not Exist', which also uses AI to create new images of faces that don't exist.

In a Medium blog post, Imgflip founder Dylan Wenzlau said that the AI was trained using ~100 million public meme captions by users of the Imgflip Meme Generator.

To speed up training and reduce complexity of the model, the team used only the top 48 most popular memes and 20,000 captions per meme, totaling to 960,000 captions for training data.

However, because Imgflip was trying to build a generational model, the AI can be trained with one training example per character in the caption. This made the number of training data jumped to around 45,000,000.

Using Keras and Tensorflow, the team restructured the text accordingly, with each of the training transformed into an array of integers by replacing each character with its corresponding index from the array of ~70 unique characters found in the data.

After randomizing the training data and splitting it into training and validation sets, the team uses a convolutional network because it's simpler and faster to train that when using Generative Adversarial Networks (GANs).

Having finished with the model design, the team started training the AI.

"This is where you just sit and watch the magic number go up over a period of many hours…," said Wenzlau.

Some of the memes generated by the AI-powered This Meme Does Not Exist
Some of the memes generated by the AI-powered This Meme Does Not Exist. (Credit: Imgflip)

The next time consuming part, is to make the model capable of outputting a full meme caption from scratch.

In theory, the way would be initiating a string to whichever meme the team wanted to generate the text for, and then calling the model to predict once for each character until the model outputs the end-of-box-text character.

After testing different approaches for choosing the next character given the model’s output of 70 probabilities, the team decided to give each character a probability of being chosen equal to the score the model gave it, but only if the score is above a certain threshold (≥ 10% of the highest score works well for this model).

What this means, multiple characters can be chosen, but bias is given to higher scored characters. This method succeeded in adding variety, but longer phrases sometimes lacked cohesion.

On the project's GitHub page, interested developers and enthusiasts can view all the code including utility functions and a sample training data file.

Imgflip is already known for its Meme Generator, where users can create pieces of art using popular templates.

With more than 100 million images made using the tool, Imgflip is sitting on a huge trove of data to work this this AI.

The AI here was trained solely using the public images generated by Meme Generator.

"Beware, no profanity filtering was done on the training data so you may encounter vulgarity," says This Meme Does Not Exist's website.

Published: 
30/04/2020