Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‚‘ CardVision AI

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.


πŸš€ Live Demo

πŸ”— Streamlit App: https://cardvision-ai.streamlit.app/


πŸ“Έ Preview

image

✨ Features

  • 🧠 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

πŸ— Model Architecture

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

πŸ“Š Training Details

Parameter Value
Framework PyTorch
Classes 53
Image Size 224 Γ— 224
Optimizer Adam
Loss Function CrossEntropyLoss
Scheduler ReduceLROnPlateau
Early Stopping βœ…
Best Model Checkpoint βœ…
Dynamic Quantization βœ…

πŸ“ˆ Model Performance

  • Training Accuracy: ~95%
  • Validation Accuracy: ~84%

The model was additionally tested on unseen internet images and demonstrated good generalization under different lighting conditions.


πŸ“‚ Project Structure

CardVision-AI/
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ best_model_quantized.pth
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
└── images/
    β”œβ”€β”€ demo.png
    └── architecture.png

βš™ Installation

Clone the repository

git clone https://github.com/theghostloop/CardVision-AI.git

Move into the project directory

cd CardVision-AI

Install dependencies

pip install -r requirements.txt

Run the application

streamlit run app.py

πŸ›  Tech Stack

  • Python
  • PyTorch
  • TorchVision
  • Streamlit
  • Pillow

🎯 Future Improvements

  • Transfer Learning using ResNet/EfficientNet
  • Grad-CAM Visualizations
  • Webcam Live Prediction
  • Batch Image Prediction
  • Model Explainability

πŸ‘¨β€πŸ’» Author

Prince

If you found this project useful, consider giving it a ⭐ on GitHub!

About

πŸ‚‘ CardVision AI is a deep learning web app that classifies 53 playing card classes from uploaded images. Built with PyTorch and Streamlit, it features a custom CNN trained to ~84% validation accuracy. Optimised with dynamic quantization (196 MB β†’ 49 MB), the interactive app displays top-5 predictions with confidence scores in real time.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages