This repository contains the implementation of the IAPR final project offered at EPFL. The final model achieved 98% accuracy on the test set on the exam day. The project details are given below and the codes are available inside the src folder.
An anonymous researcher that we will name Lann Yecun is convinced that the MNIST dataset still has great potential. He decides to create a playing card game based on MNIST digits and different figures. The game uses a standard 52 card deck which is composed of four French suits/colours: clubs (♣), diamonds (♦), hearts (♥) and spades (♠). Each suit includes 10 digit cards (from 0 to 9) and 3 figures (Jack-J, Queen-Q, and King-K). Here is an example of the 13 spade cards with their name.
We can find the same arrangement of cards for the clubs, diamonds, and hearts.
The rules are based on the simple battle card game. The goal of the game is to win as many points as possible. Each turn, the 4 players play a card in front of them. As displayed in the example below. The rules are the following:
- The cards are ranked in the following order : 0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < J < Q < K.
- The player with the highest-ranked card wins the round and obtains 1 point.
- If the highest-ranked card is the same for multiple players we call it a draw and all winners get 1 points.
- In this configuration, we do not take into account the suits. The game only rely on the card ranks.
- The game lasts 13 rounds. After the last round, the winner is the player that has the largest number of points.
- In the example below Player 1 wins the round with his Queen ( 0 < 8 < J < Q).
If two or more players have the same number of points they share the victory.
The advanced rules take into account the suits.
- At the beginning of each round a random player is designated as the dealer. The dealer places a green token with the letter D next to him (player 1 in the example below).
- Only the cards that belong to the same suit as the one of the dealer are considered valid. In the example below, only Player 4 is competing with Player 1 as spade was selected by the dealer (e.i., Player 1). Player 2 and 3 are out for this round. Player 1 wins the round and 1 point with the Queen ( 0♠ < Q♠).
- There cannot be any draw between the players as they are not any card duplicates.
- We use the same system as the standard method to count the points.
- The orientation of the card is linked to the position of the player around the table. For instance, to read the card of the 3rd player you will have to rotate it by 180°.
- The digits always face the players around the table. The figures can have random orientations.
- Player 1 always seats south of the table. The players are always ordered counter-clockwise as in the example.
- The dealers can change between the rounds and games.
- Some cards might apear multiple times per game.
- Pictures are always taken from rougthly the same altitude.
- The digits from the training set would not be the same as the one of the testing set.
You will be given the images of 7 games that were played (download link). The data are composed of:
- 7 folder named after the games (game1 to game7).
- Each game includes 13 ordered images (1st to 13th round).
- Each game includes a csv file with the ground truth of the game. The first row list the players (P1 to P4) as well as the dealer (D). The following rows represent the rounds (1 to 13). We represent the card played with 2 character as
where
is the rank of the card and
is the suit. For example, QS means "(Q)ueen of (S)pade" and 0D means "(0) of (D)iamond". The dealer is represented by the ID of the player (e.g. P1 -> 1).
The task is to ready yourself for the final evaluation. The day of the exam we will give you a new folder with a new game. ! The digits on the cards differ from the one of the traning set. When given a new data folder with 13 images your should be able to:
Task 0
- Plot an overlay for each round image that shows your detections and classification. You can for example plot bounding boxes around the cards/dealer token and add a text overlay with the name of the classes.
Task 1
- (a) Predict the rank of the card played by each player at each round (Standard rules).
- (b) Predict the number of points of each player according to Standard rules
Task 2
- (a) Detect which player is the selected dealer for each round.
- (b) Predict the rank and the suit of the card played by each player at each round (Advanced rules).
- (c) Predict the number of points of each player according to Advanced rules

