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.
- 🎨 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
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.
✅ Reached ~100% accuracy on synthetic varied data.
git clone https://github.com/IbrokhimN/Smiley.git
cd Smiley
pip install -r requirements.txt
Python 3.10+ recommended
python3 draw_smiley_varied.py
- Draw face using left mouse button
- Prediction updates in real-time
- Clear canvas: Right-click or Clear button
-
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
python3 draw_smiley_varied.py
Draw a face and watch real-time predictions!
MIT License – free to use, modify, and share