Thanks to visit codestin.com
Credit goes to github.com

Skip to content

An easy-to-use, lightweight yet powerful CNN-based AI that can accurately recognize smiley and sad faces from 100×100 pixel drawings, capable of handling variations in position, size, and small noise.

License

Notifications You must be signed in to change notification settings

IbrokhimN/Smiley

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

😊 Smiley Predictor – Pro Edition

Python PyTorch License Status

Smiley Predictor – interactive Python app to draw a smiley 🙂 or sad 🙁 face on a 100×100 grid and get real-time predictions using a PyTorch CNN trained on synthetic varied data.

Works even if the drawing is slightly off-center or noisy.


🌟 Features

  • 🎨 Draw smiley 🙂 or sad 🙁 faces on a 100×100 canvas
  • Real-time predictions
  • 🧹 Clear canvas (Right-click or Clear button)
  • 🖌 Adjustable brush size & color
  • ↩️ Undo / Redo (advanced GUI)
  • 🚀 GPU acceleration
  • 📦 Pre-trained model: smiley_model_varied.pth

🏗 Model Architecture

Input: 1 × 100 × 100
 └─ Conv2d(1 → 16, 3x3, padding=1) → ReLU
     └─ Conv2d(16 → 32, 3x3, padding=1) → ReLU
         └─ MaxPool2d(2x2)
             └─ MaxPool2d(2x2)
                 └─ Flatten
                     └─ Linear(32*25*25 → 64) → ReLU
                         └─ Linear(64 → 2) → Softmax
Output: Smiley / Not Smiley

This simple CNN handles shifted, noisy, or varied faces.


📈 Training Metrics (Example)

Loss vs Epochs Training & Validation Loss

Accuracy vs Epochs Training & Validation Accuracy

✅ Reached ~100% accuracy on synthetic varied data.


📸 Prediction Examples

Drawing Prediction
Smiley Smiley 🙂
Noise Not Smiley 🙁

🔧 Installation

git clone https://github.com/IbrokhimN/Smiley.git
cd Smiley
pip install -r requirements.txt

Python 3.10+ recommended


▶️ Usage

python3 draw_smiley_varied.py
  • Draw face using left mouse button
  • Prediction updates in real-time
  • Clear canvas: Right-click or Clear button

📝 Notes

  • Model trained on synthetic images with:

    • Random positions
    • Small noise
    • Varied face placement
  • Works best with rough smiley/sad shapes

  • For better accuracy:

    • Increase dataset size
    • Include different drawing styles

📌 Try it Now

python3 draw_smiley_varied.py

Draw a face and watch real-time predictions!


📜 License

MIT License – free to use, modify, and share

About

An easy-to-use, lightweight yet powerful CNN-based AI that can accurately recognize smiley and sad faces from 100×100 pixel drawings, capable of handling variations in position, size, and small noise.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages