A card-counting, blackjack-playing AI that uses deep learning to identify playing cards

RAIN MAN 2.0 counts playing cards using deep learning.

RAIN MAN 2.0 is a card counting AI designed to be the ultimate blackjack player. Created using machine learning and Python, it easily counts its way through a deck of playing cards.

To identify cards, RAIN MAN 2.0 uses a YOLO v3 detection model trained on 50,000 synthetically generated images. The images were generated from short videos of playing cards using a Python script that extracts the cards and imposes them on random backgrounds. A detailed and entertaining explanation video showing how RAIN MAN 2.0 works can be found on our YouTube Channel.

At its current stage of development, it can robustly detect playing cards (even when they’re overlapping or against a busy background) and display which cards are remaining in the deck through a graphical interface. The end goal for RAIN MAN 2.0 is to create a program that can identify cards on the blackjack table and make a hit-or-stand decision based on the player’s cards, dealer’s cards, and the running count of the deck.

RAIN MAN 2.0 is a passion project that allows us to explore techniques for improving object detection model accuracy and integrating a deep learning based vision pipeline into a full-fledged Python application.

As we’ve developed RAIN MAN 2.0, we’ve learned more about:

  • Achieving high detection accuracy using synthetic image generation
  • Adjusting model training hyperparameters to improve overall performance
  • Tracking and filtering detected objects to control other program processes

The skills we’ve honed on this project have been directly applicable to other professional projects we’ve worked on for clients.