The 0 or 1 is the index of the current text box being predicted, generally 0 is the top box and 1 is the bottom box, although many memes are more complex.The string is left padded with zeros so all IDs are the same length. This allows the model to differentiate between the 48 distinct memes we’re feeding it. The first 12 characters are the meme template ID.We are classifying the text strings on the left into one of ~70 different buckets where the buckets are characters. Like most things in machine learning, this is just a classification problem. ] # we'll need our feature text and labels as separate arrays later texts = for row in training_data] labels = for row in training_data]
DEEP FRIED MEME GENERATOR CODE
I’m omitting the code for reading from the database and performing initial cleaning because it’s very standard and could be done in multiple ways. If you try the finished model below, you’ll also see that char-level can be more fun!īelow is what the training data looks if the first meme caption is “make all the memes”. Also, character-level deep learning is a superset of word-level deep learning and can therefore achieve higher accuracy if you have enough data and your model design is sufficient to learn all the complexity. Character-level generation rather than word-level was chosen here because memes tend to use spelling and grammar… uh… creatively. However, since we are building a generational model there will be one training example for each character in the caption, totaling ~45,000,000 training examples. To speed up training and reduce complexity of the model, we only use the 48 most popular memes and exactly 20,000 captions per meme, totaling 960,000 captions as training data. The raw dataset we’ll draw from is ~100M public meme captions by users of the Imgflip Meme Generator. I’ll cover takeaways about data cleaning, training, model design, and prediction algorithms.
This will be a practical guide and while I suggest many best practices, I am not an expert in deep learning theory nor have I read every single relevant research paper.
DEEP FRIED MEME GENERATOR HOW TO
The goal of this post is to describe end-to-end how to build a deep conv net for text generation, but in greater depth than some of the existing articles I’ve read. Meme Text Generation with a Deep Convolutional Network in Keras & Tensorflow