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.
├── 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/
├── train/
├── valid/
└── test/
Each subfolder should contain one folder per card class with images inside.
Train your neural network using the functions in NeuralNetworkMain.py.
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
Run the following command:
python cameraRecognition.py
The script will activate your webcam and start recognizing visible cards in real time.
best_model.pth— best performing trained model- Training/validation loss and accuracy plots
- Confusion matrices for various categories
This project is intended for educational and research purposes only.






