Skip to content

Jaromek/playingCardRecognition

Repository files navigation

🃏 Playing Card Recognition

A deep learning project for playing card recognition using Convolutional Neural Networks (CNNs) in PyTorch. Includes scripts for training, evaluation, testing, and real-time camera-based recognition.


📁 Project Structure

├── cameraRecognition.py       # Real-time card recognition via webcam
├── modelTesting.ipynb         # Model evaluation and visualization notebook
├── neuralNetwork.py           # Neural network architecture, training, and utilities
├── transform.py               # Data augmentation and transformation helpers
├── acc81.5/                   # Trained models, results, plots, and confusion matrices
├── dataset/                   # Dataset (train/valid/test splits)
└── README.md                  # Project documentation

🗂️ Dataset Structure

dataset/
├── train/
├── valid/
└── test/

Each subfolder should contain one folder per card class with images inside.


🧠 Model Training

Train your neural network using the functions in NeuralNetworkMain.py.


📊 Model Evaluation

Use the modelTesting.ipynb notebook to:

  • Load the best model (acc81.5/best_model.pth)
  • Evaluate accuracy on the test set
  • Generate and visualize confusion matrices for:
    • Color
    • Rank
    • Suit
    • Full classes

🎥 Real-Time Recognition

Run the following command:

python cameraRecognition.py

The script will activate your webcam and start recognizing visible cards in real time.


🖼️ Results (Examples)

🔍 Live Recognition Sample:

Live Demo – EOD 98.5% Live Demo – KOD 95.3%

Live Demo – SOH75.8.png Live Demo – AOS88.png

📈 Learning Curve:

Learning Curve

♠️♥️♦️♣️ Confusion Matrices – Rank / Suit:

confusion-rank

confusion-suit


📦 Contents of acc81.5/

  • best_model.pth — best performing trained model
  • Training/validation loss and accuracy plots
  • Confusion matrices for various categories

📄 License

This project is intended for educational and research purposes only.

About

A deep learning project for playing card recognition using Convolutional Neural Networks (CNNs) in PyTorch. The project enables training, testing, and evaluation of models that classify playing cards from images, as well as real-time card recognition from a webcam.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors