A comprehensive machine learning project that classifies hand-drawn sketches from Google's QuickDraw dataset using both deep learning (CNN) and classical machine learning approaches (SVM, Logistic Regression).
- Overview
- Features
- Dataset
- Models Implemented
- Results
- Installation
- Usage
- Project Structure
- Technologies Used
- Contributing
- License
- Acknowledgments
This project implements and compares multiple machine learning approaches for classifying hand-drawn sketches from the QuickDraw dataset. The dataset contains 28Γ28 grayscale images across 10 different categories. We explore both traditional machine learning algorithms and modern deep learning architectures to achieve high classification accuracy.
-
Multiple Model Implementations:
- Convolutional Neural Networks (CNN) with 4 different architectures
- Support Vector Machines (SVM) with multiple kernels
- Logistic Regression
-
Comprehensive Testing Suite:
- Random test sample predictions
- Per-class accuracy analysis
- Confidence distribution analysis
- Common misclassification patterns
- Model robustness testing (noise resistance)
-
Interactive Drawing Canvas:
- Real-time sketch recognition
- Draw your own sketches and get predictions
- Visual confidence scores
-
Detailed Visualizations:
- Training history plots
- Confusion matrices
- Per-class performance charts
- Confidence distribution graphs
The project uses Google's QuickDraw Dataset, which contains millions of hand-drawn sketches across 345 categories. For this project, we focus on 10 classes:
- π± Cat
- π Dog
- π Car
- π³ Tree
- βοΈ Sun
- π² Bicycle
- π House
- β Star
- βοΈ Cloud
- π Apple
Dataset Statistics:
- Samples per class: 20,000
- Total samples: 200,000
- Image size: 28Γ28 pixels (grayscale)
- Train/Val/Test split: 80/10/10
We implemented and compared 4 CNN architectures:
Conv2D(32) β MaxPool β Conv2D(64) β MaxPool β Dense(128) β Softmax
Conv2D(32) β MaxPool β Dense(128) β Softmax
Conv2D(32) β MaxPool β Conv2D(64) β Dense(128) β Softmax
Conv2D(32) β MaxPool β Conv2D(64) β MaxPool β Dense(64) β Softmax
Tested with multiple kernels:
- Linear Kernel
- RBF Kernel
- Polynomial Kernel
- Sigmoid Kernel
- Solver: L-BFGS
- Multi-class: Multinomial
- Max iterations: 100
| Model | Test Accuracy | Training Time |
|---|---|---|
| CNN V2 | ~93% | ~1600s (20 epochs) |
| SVM (Poly Kernel) | 84.10% | 32.74s |
| SVM (RBF Kernel) | 83.75% | 26.49s |
| Logistic Regression | 77.88% | 97.93s |
| SVM (Linear) | 69.08% | 26.42s |
| SVM (Sigmoid) | 69.19% | 23.25s |
The CNN V2 model achieves excellent accuracy across all classes, with most categories achieving >90% accuracy.
Best performing classes: Star, House, Sun Challenging classes: Cat vs Dog confusion
- Python 3.8 or higher
- pip package manager
git clone https://github.com/yourusername/quickdraw-classification.git
cd quickdraw-classificationpython -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activatepip install -r requirements.txtOpen the Jupyter notebook:
jupyter notebook ML_Project.ipynbOr use Google Colab for free GPU access:
- Upload
ML_Project.ipynbto Google Colab - Run all cells sequentially
Train CNN:
# The notebook automatically trains CNN V2
# Results are displayed with training history plotsTrain Classical ML Models:
# Logistic Regression and SVM models are trained
# on a subset for faster computationThe notebook includes an interactive canvas where you can:
- Draw a sketch using your mouse
- Click "Predict Drawing" to see the model's prediction
- View confidence scores for all classes
The project includes 6 comprehensive tests:
- Random Test Samples - Verify predictions on random samples
- Per-Class Accuracy - Analyze performance for each category
- Confidence Distribution - Understand model certainty
- Misclassification Patterns - Identify common errors
- Detailed Class Examples - Deep dive into each category
- Robustness Test - Test with noisy images
quickdraw-classification/
β
βββ ML_Project.ipynb # Main Jupyter notebook
βββ README.md # Project documentation
βββ requirements.txt # Python dependencies
βββ LICENSE # MIT License
βββ .gitignore # Git ignore rules
β
βββ quickdraw_data/ # Dataset directory (auto-created)
β βββ cat.npy
β βββ dog.npy
β βββ ...
β
βββ models/ # Saved models (optional)
β βββ cnn_v2_best.h5
β
βββ results/ # Results and visualizations (optional)
βββ confusion_matrix.png
βββ training_history.png
Deep Learning & Machine Learning:
- TensorFlow 2.x
- Keras
- scikit-learn
Data Processing & Visualization:
- NumPy
- Pandas
- Matplotlib
- Seaborn
- OpenCV
Interactive Components:
- ipycanvas
- ipywidgets
Dataset:
- QuickDraw library
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Add more drawing categories
- Implement data augmentation
- Try transfer learning approaches
- Optimize model architectures
- Add model deployment (Flask/FastAPI)
- Create a web interface
This project is licensed under the MIT License - see the LICENSE file for details.
- Google QuickDraw Dataset: https://quickdraw.withgoogle.com/data
- TensorFlow/Keras for deep learning framework
- scikit-learn for classical ML algorithms
- Inspired by research on sketch recognition and classification
Md.Jawwaad Sheriff (PES1UG23CS366)
Lakshya Mehta (PES1UG23CS324)
β If you found this project helpful, please consider giving it a star!
- Ha, D., & Eck, D. (2017). A Neural Representation of Sketch Drawings. arXiv preprint arXiv:1704.03477.
- Google QuickDraw Dataset Documentation
- TensorFlow Documentation
- scikit-learn Documentation