Bernie Sanders Detector Using YOLO

ai ai in computer vision computer vision yolo Apr 12, 2021


I am going to show you multiple ways to train models to detect Bernie Sanders on both static images as well as in real time.

We will be demonstrating the building, annotating, and augmenting the dataset, then I we will use Google Colab to initiate the training of YOLOv4/YOLOv5.

Finally if you stay till the end of the video, I will show you how to also run your model on Android ;)

Step 1: What You Will Need

What you’ll need, you’ll only need YOLO v4 or v5:


Step 2: Gathering Data

We will be using the (Chrome) Download All Images extension to search for images and automatically download them.

Search for Bernie Sanders Memes, you can remove irrelevant images manually or wait until the next step.

Step 3: Using Roboflow to Create Datasets

You can bypass this step and use our pre-made dataset!

You’ll need a free Roboflow account to start.

  1. The first thing you’ll want to do is create a dataset.
  2. Upload all images.
  3. Search and remove irrelevant images.
  4. We will be using default settings for splitting.

You will now be presented with the annotation workflow.

Using the drag and drop, select Bernie Sanders then create a class called Bernie. You’ll need to do this for each image.

Make sure to check for un-annotated images before continuing.

See our video for settings used when augmenting the output before exporting data.

When finished, save your download code for the next step.

Step 4: Training Scaled YOLOv4 and YOLOv5


Starting we will need to know about a timeout issue when using 3000+ epochs without pro versions of Google Colab. If the pro version isn’t available to you, try using Colab Alive Chrome Extension.

Once you have imported your dataset to Google Colab by pasting the download code from the previous step, we can begin.

For Scaled YOLOv4 you’ll need at least 3000 epochs, once you’ve set this simply make sure you are using a GPU hardware accelerator and select Run All.


We recommend 300 Epochs if using Google Colab.

Using Roboflow Train:

Alternatively you can use Roboflow Train and start from check point. You will need to wait up to 24 hours and recieve an email when it is done.

Step 5: Testing

For Web App Testing: Select example Web App. Find an unused image of Bernie and choose a minimum confidence level then increase Stroke Width to 10px.

Click Run Inference.

You should see that it has outlined Bernie with a line if all is working correctly

For Camera Based Testing: Try with webcam on your computer, or do the same with your Smart Phone.

To Learn more Computer Vision, Raspberry Pi, OpenCV tutorials, please visit:

Stay connected with news and updates!

Join our mailing list to receive the latest news and updates from our team.
Don't worry, your information will not be shared.

We hate SPAM. We will never sell your information, for any reason.