Personal project · Edge AI

Poker decision assistant with embedded vision

A camera films the table, a YOLOv8 Nano model recognises each card, and a Python engine works out the odds of winning to advise the player: fold, call or raise. Everything runs on a BeagleBone board, with no computer.

  • Computer vision
  • Edge AI
  • Python
A camera recognises the cards, an embedded board computes and suggests the best decision

Overview

  • 52cards to recognise, one class per rank and suit
  • ~3Mparameters for YOLOv8 Nano, the smallest version of the model
  • 7cards to combine per player in Texas Hold'em: 2 in hand, 5 on the table
  • 100%embedded: no computation sent to a computer or the cloud

Context

The idea

In poker, the right decision can be calculated: it depends on the odds of winning with the visible cards and on what it costs to stay in the hand. That is hard to work out in your head in a few seconds. The goal: a device that looks at the table and tells the player the mathematically soundest decision.

The setting

A personal project carried out in 2025, building on the computer vision and embedded computing courses at ISEN (BeagleBone, FPGA).

The constraints

  • everything runs on the embedded board, with no computer or network connection;
  • a modest ARM processor, with no graphics card;
  • a simple camera, ordinary table lighting and overlapping cards;
  • advice that follows the game live, every time a card is dealt.

The principle

From the card on the table to the advice given to the player, in four stages.

  1. Film

    A USB camera mounted above the table films the cards; OpenCV reads the frames directly on the BeagleBone.

  2. Recognise

    YOLOv8 Nano locates each card in the image and gives its rank and suit.

  3. Read the table

    The cards are split between the player's hand and the community board according to their position in the image; their number gives the stage of the hand: pre-flop, flop, turn or river.

  4. Advise

    The Python decision engine evaluates the hand, estimates the probability of winning and displays the advice: fold, call or raise.

The recognition model

The data

Photos of cards, annotated with Roboflow. Each box surrounds a card corner, where the rank and suit are printed: a card stays recognisable even when half hidden under another or held in a fan.

Augmentation

Roboflow generates several variants of each image (rotations, blur, brightness, contrast) so that the model copes with glare and table lighting.

Training

YOLOv8 Nano is fine-tuned on Google Colab, on a GPU, from weights pre-trained on the COCO dataset: transfer learning makes it possible to learn the 52 classes from a modest dataset.

Why Nano

With about 3 million parameters, it is the smallest version of YOLOv8: slightly less accurate than the larger ones, but the only one light enough for an embedded processor.

Evaluation

The mAP on a separate validation set measures detection quality, and the confusion matrix shows which cards the model still mixes up.

The decision engine

The rules

The program follows Texas Hold'em, the most widespread variant: each player combines their two cards with the five community cards, and the best five-card hand wins. Every hand is ranked, from high card to royal flush.

The odds of winning

The cards still unknown, the opponents' and those still to come, are drawn at random thousands of times: the share of games won gives the hand's equity. This Monte Carlo simulation is fast enough to run on the board.

The decision

The equity is compared with the pot odds, that is, the share of the final pot the player must put in to call. If the probability of winning exceeds that price, calling pays off on average in the long run (positive expected value); if it exceeds it by a wide margin, raising becomes worthwhile; otherwise, folding is best.

The player enters the amount to call and the size of the pot; everything else comes from the camera.

Running on the BeagleBone

Fitting a modern detector and a computation engine onto a board drawing a few watts.

ONNX export

The trained model is exported to ONNX and run with ONNX Runtime on the board's processor.

A smaller image

The input resolution is reduced to keep the computation time compatible with live advice.

Stable advice

A card is only confirmed once it has been seen in several consecutive frames, and the computation only reruns when the table changes: a passing glare does not change the advice.

Fully local

Camera, model and decision engine all run on the board, with no computer or network connection.

Review

Limitations

  • Glare on plastic-coated cards and heavily overlapping cards remain the hardest cases.
  • The embedded processor limits the frame rate: the advice follows the game rather than aiming for smooth video.
  • The advice relies on probabilities alone: it ignores the opponents' style and bluffing.

Next steps

  • Quantise the model to INT8 to speed up inference.
  • Move to a board with an AI accelerator, such as the BeagleBone AI-64.
  • Read the chips by vision too, to compute the pot odds without manual input.
  • Estimate the opponents' hand ranges from their bets.

Tools

YOLOv8 Nano (Ultralytics)

Card detection, fine-tuned from weights pre-trained on COCO.

Roboflow

Image annotation, augmentation and dataset export in YOLO format.

Google Colab

Model training on a GPU.

OpenCV

Camera capture and display of the advice.

ONNX Runtime

Model inference on the board's processor.

Python · NumPy

Rules engine, hand evaluation and Monte Carlo simulation.

BeagleBone

The embedded board that brings together the camera, the model and the program.