Using Computer Vision to Play Dreidel

This week marks the start of the Jewish holiday, Chanukah. Chanukah celebrates the eight-day supply chain shortage of oil that the Jews had to endure so many years ago.

As a brand new employee at Roboflow, I was asked to do a computer vision project. So I thought, why not combine a holiday I love so much, Chanukah, with something brand new in my life, Roboflow.

As a young Jewish boy growing up in Miami, we were taught a game during Chanukah called Dreidel.

Before I get into the machine learning project, let me explain to you the game.


How to Play Dreidel


Dreidel is a game where players take turns spinning a top with Hebrew characters on it. Based on how the top stops spinning, players take a different action.

For the uninitiated, here's what a spinning Dreidel looks like.

Rules:
1. The players are dealt gelt (chocolate wrapped in gold paper made to look like a coin)
2. Each player takes a turn at spinning the Dreidel
3. The Dreidel has four sides that each prompt an action to take by the spinner
- If נ‎ (nun) is facing up, the player does nothing.
- If ג‎ (gimel) is facing up, the player gets everything in the pot.
- If ה‎ (hay) is facing up, the player gets half of the pieces in the pool.
- If ש‎ (shin) the player adds one of their gelt to the pot
4. The winner, of course, gets to eat all the gelt

The Dreidel Project


When learning to play Dreidel, I would sometimes forget what the names of each character are and what action they correspond to in the game. I thought it’d be fun to create a computer vision model that could understand what each symbol on a Dreidel is, making it easier to learn to play the game.

My Roboflow model successfully sees the Dreidel and the corresponding characters when it finishes spinning. I used the "Try with Webcam" feature to immediately test out my model as shown!

To build the above model, I collected 569 images adding 1,371 annotations across each of them. I was careful to include images of different Dreidels and of Dreidels on various backgrounds. I’ve found this is essential to building a well-performing model: the model needs to be trained on diverse examples. I then trained my model with Roboflow and used the “Try with your Webcam” feature to open the model on my phone. A couple of months ago I heard about Roboflow and I had only a faint idea of what computer vision was. Now, in just a couple of weeks, I was able to build my first working model.

I annotated 569 images across 6 classes. Because every image has a Dreidel and only one character is shown, there's an imbalance in the number of Dreidels labeled compared to characters.

Above, you can see the Health Check that is provided by Roboflow’s platform. It was challenging to create class balances that were properly represented because each photo of the letter also included the Dreidel. As I continue to improve the model, I would add more pictures of only the Hebrew letters without the Dreidel in the photo.


Here's my project on Roboflow Universe. On the left, you can see the number of versions trained. In the center of the image you can see three key data points, we use to show how accurate our training model was (maP, precision, and recall).

Build On Top of What I’ve Started Using Roboflow Universe


I made this project as a starting point for others to build on top of what I’ve started. You could use the model I’ve created and build your own app that, for example, automatically scores the game or keeps tabs on which characters seem to be showing upmost.

I have uploaded the Dreidel dataset and model and shared it on Roboflow Universe so that you can use it.

The Dreidel Project Object Detection Dataset
Download 569 free images labeled with bounding boxes for object detection.


I hope this helps others learn the game of Dreidel! And if you build something using my dataset and/or model, please do let me know. I can’t wait to see it. Happy holidays!