Playing cards detection

Hello everyone,

I’m trying to implement a classifier that can identify playings cards. I used the techniques from lessons 1 and 2 but couldn’t make it work (loss was too high).
However, when I made the model predict only the rank of the card it was really good. Same thing goes for the suit. Now that I am at lesson 3, I decided to try the multi class classifier to solve this problem (I thought it might “split” the identification into 2 parts and since the model was very good at picking suit and rank separately…)

I have a dataset of about 500 images which I resized to be 280px * 280px and here is what it looks like :

After training for 15 epochs, I’m getting these results :
20

Since the results seemed good, I created another batch of playing card images and made predictions using the previously exported model.
On this “test” set, my model is doing really poorly (about 10-15% wrong predictions). For example, it confuses 3 with 5, just gives the suit without the rank, … It’s often close to the answer but not right.

How can I improve this model ? Should I go back to a single class classifier and maybe find more training examples ? Should I train 2 separate models (1 for suit, 1 for rank) ? Is a multi class classifier even appropriate for this kind of problem ?

Any help or suggestion is appreciated,

Thanks :slight_smile:

A great question that gets me designing.

I don’t think that we ever studied classification with two independent set of classes. You could use multi-label and pick the largest probability from each of the two class sets. But both multi-label and multi-class throw away the structure that each card is classified into two independent classes.

My opinion therefore is to train two multi-class models and ensemble the outputs. Each model would be specialized to discriminate within its class.

As for the Test set anomoly, if the validation set is drawn from a deck also in the Training set, the model may be specializing on deck styles. What happens to accuracy if you make sure there is no overlap of decks between Train and Validation? If it drops you might be seeing a failure to generalize.

HTH, and please let us know what you figure out.

Thanks a lot for this great answer. I’ll make these 2 models as well as splitting the validation set differently so hopefully they will improve in generalization ! Can’t wait to see what the result will be :slightly_smiling_face:

I’ll post new results here later this week

i am interested in this. Can you provide me the Data ?