Magic Dice Tray
The Magic Dice Tray is currently a work in progress, and is meant to give me more practical experience creating and training convolutional neural network (CNN) models.
The idea is to create a dice tray (box to hold and roll dice) for tabletop roleplaying games, like Dungeons & Dragons or Pathfinder, that automatically interprets and sums your dice rolls. These games use a set of dice beyond the classic 6-sided die (d6), including a d4, d6, d8, two d10's, a d12, and the famous 20-sided dice, the d20. The different geometries of these dice proves to be a challenge for machine learning models to identify, especially when rolled in mixed groups.
This project has a custom-made box, including an embedded Raspberry Pi 4 and camera module. The camera records a top-down view of the dice tray, capturing all the rolled dice. From here, object detection is done on the image to differentiate each die. Then the die type (d4, d6, d20 etc.) is classified using a CNN. Each different type of die has another CNN trained to identify the rolled number based on an image of that die. Finally, the identified numbers are summed together to give the final calculated total.
The difficulty of training machine learning models on this problem comes from the geometry of a subset of the dice, specifically the d4, d10 and d20. When viewing a 6-sided die from above, only the rolled side is visible. This is not at all the case for the d10 and d20. Depending on the angle of the image, multiple dice faces can appear to be the top number.
This project uses Python and Google Colab, alongside TensorFlow and Keras. The Raspberry Pi 4 runs on the Bullseye Debian Raspberry Pi OS.
This project (and project description) are both currently a WIP.