A Python application for training, saving, loading, and using a neural network to classify handwritten digits from the MNIST dataset. The application features a Tkinter-based GUI for easy interaction.
- Train neural networks with customizable hyperparameters
- Save and load trained models
- Interactive drawing canvas for digit classification
- Real-time probability distribution display
- User-friendly GUI interface
my_mnist_app/
│
├── main.py # Application entry point
├── model.py # PyTorch model definitions
├── train_utils.py # Training utilities
├── gui/
│ ├── train_gui.py # Training interface
│ └── draw_gui.py # Drawing and classification interface
│
├── README.md
└── requirements.txt
- Python 3.7+
- pip package manager
- Clone the repository:
git clone https://github.com/yourusername/my_mnist_app.git
cd my_mnist_app
- Create and activate virtual environment:
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
python main.py
- Set hyperparameters:
- Learning rate
- Batch size
- Number of epochs
- Click "Train Model"
- Monitor training progress
- Save model when complete
- Click "Draw & Classify"
- Draw a digit in the canvas
- Click "Classify" to get predictions
- Use "Clear" to reset the canvas
If encountering SSL errors during MNIST download:
pip install --upgrade certifi
- Ensure digits are centered in the canvas
- Try increasing training epochs
- Adjust learning rate and batch size
- Verify image preprocessing
- Train for multiple epochs to improve accuracy
- Use appropriate learning rates (e.g., 0.001)
- Draw digits clearly and centered
- Save models regularly to avoid retraining
MIT License
- PyTorch
- Tkinter
- MNIST Dataset
For more information or to report issues, please visit the project repository.