I want to train an AI to detect the class (i.e. suit and rank) of playing cards. Playing cards from different decks may use slightly different shapes or colors to represent these attributes, and I want the system to work across many decks. I bought many different decks, scanned and labeled them. Next up would be to create training data with an augmentation library. I found two examples of how other people did that:

  1. Image detection using YOLO algorithm and poker cards
  2. Playing card detection with YOLO

The problem is that I want my AI to be able to detect multiple cards of the same class in one picture. In the examples above, they put a label on the top left corner of a card. This makes sense since it is a very good indicator of what class the card is in. Unfortunately, every card has two of these labels.

I think their solution returns "detected" if any instance of a given label is found. But many cards with the same label could be in the same picture, and I am not sure if I can detect the quantity of the class with this solution. For example, if there are 2 Ace of Clubs in a picture, I would like my system to output "2", rather than "detected".

Do you think it is feasible to mark the whole card, prepare the data accordingly, and train an AI that detects the count as well?


1 Answer 1


Although it was not crystal clear, we'll assume that by, "Multiple cards of the same class in one picture," is meant that multiple cards of identical suit and rank will be grouped together in the same example image but each card in the image will be selected from a unique deck.

That arrangement would only be fruitful if the objective of training was to classify, flag, or otherwise analyze the same kind of groupings after training. Otherwise, it would likely be most productive and efficient to first devise a way to divide up the images by deck so that the focus of learning is detection of the three dimensions or perhaps just the first two, depending on the intended use of the trained network.

  • Rank
  • Suit
  • Style

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .