Using a Neural Network for sending memes to my girlfriend

Mutt0-ds | May 20, 2021 min read

Well, my GF’s tastes in memes are simple: she loves wholesome memes and, most importantly, she loves animals.

That’s why I created a fun little project that:

  1. Surfs the subreddit r/wholesomemes using the reddit API
  2. Downloads a few of the hottest memes in the contents folder
  3. Initializes a ResNet50 model that recognizes images containing any animal
  4. Sends them via mail to my GF (positively welcomed)

Final email (3 memes by default)

finalmail

Reddit

I’m using the praw library for downloading the memes, it requires a Reddit Bot enabled. Use this guide for creating one, it’s a quick process.

ResNet50

ResNet50 (more info here) is an Image Recognition model that outputs a probability score (which I’m ignoring at the moment) and one of the 1000 labels available. The labels are mapped in the imagenet_class_index, and the first 397 are about animals (mostly cats and dogs). So, if the model’s predicted label is in that sublist, we can classify the meme as “containing animals”.

Email

I’m using smtplib for sending the email, so it just requires the email and password of the sender and the email of the receiver.

Code

Source code here