ONNX export
The trained model is exported to ONNX and run with ONNX Runtime on the board's processor.
Personal project · Edge AI
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.
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.
A personal project carried out in 2025, building on the computer vision and embedded computing courses at ISEN (BeagleBone, FPGA).
From the card on the table to the advice given to the player, in four stages.
A USB camera mounted above the table films the cards; OpenCV reads the frames directly on the BeagleBone.
YOLOv8 Nano locates each card in the image and gives its rank and suit.
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.
The Python decision engine evaluates the hand, estimates the probability of winning and displays the advice: fold, call or raise.
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.
Roboflow generates several variants of each image (rotations, blur, brightness, contrast) so that the model copes with glare and table lighting.
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.
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.
The mAP on a separate validation set measures detection quality, and the confusion matrix shows which cards the model still mixes up.
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 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 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.
Fitting a modern detector and a computation engine onto a board drawing a few watts.
The trained model is exported to ONNX and run with ONNX Runtime on the board's processor.
The input resolution is reduced to keep the computation time compatible with live 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.
Camera, model and decision engine all run on the board, with no computer or network connection.
Card detection, fine-tuned from weights pre-trained on COCO.
Image annotation, augmentation and dataset export in YOLO format.
Model training on a GPU.
Camera capture and display of the advice.
Model inference on the board's processor.
Rules engine, hand evaluation and Monte Carlo simulation.
The embedded board that brings together the camera, the model and the program.