A deep learning-based Playing Card Classification application built from scratch using PyTorch and deployed with Streamlit.
The model classifies 53 different playing card classes (including Joker) from an uploaded image and displays the predicted card along with confidence scores.
π Streamlit App: https://cardvision-ai.streamlit.app/
- π§ Custom CNN built completely from scratch
- π Supports 53 Playing Card Classes
- π· Upload any playing card image
- π― Predicts the card with confidence score
- π Displays Top-5 Predictions
- β‘ Dynamic Quantization (196 MB β 49 MB)
- π Interactive Streamlit Web App
Input Image (224 Γ 224 Γ 3)
β
Conv2D (3 β 32)
ReLU
MaxPool
β
Conv2D (32 β 64)
ReLU
MaxPool
β
Conv2D (64 β 128)
ReLU
MaxPool
β
Flatten
β
Linear (100352 β 512)
β
ReLU
β
Dropout (0.5)
β
Linear (512 β 53)
β
Prediction
| Parameter | Value |
|---|---|
| Framework | PyTorch |
| Classes | 53 |
| Image Size | 224 Γ 224 |
| Optimizer | Adam |
| Loss Function | CrossEntropyLoss |
| Scheduler | ReduceLROnPlateau |
| Early Stopping | β |
| Best Model Checkpoint | β |
| Dynamic Quantization | β |
- Training Accuracy: ~95%
- Validation Accuracy: ~84%
The model was additionally tested on unseen internet images and demonstrated good generalization under different lighting conditions.
CardVision-AI/
β
βββ app.py
βββ best_model_quantized.pth
βββ requirements.txt
βββ README.md
βββ images/
βββ demo.png
βββ architecture.png
Clone the repository
git clone https://github.com/theghostloop/CardVision-AI.gitMove into the project directory
cd CardVision-AIInstall dependencies
pip install -r requirements.txtRun the application
streamlit run app.py- Python
- PyTorch
- TorchVision
- Streamlit
- Pillow
- Transfer Learning using ResNet/EfficientNet
- Grad-CAM Visualizations
- Webcam Live Prediction
- Batch Image Prediction
- Model Explainability
Prince
If you found this project useful, consider giving it a β on GitHub!