https://github.com/r4f405/mnist-number-recognition-python
This project implements a handwritten digit recognizer using a model trained on the MNIST dataset.
https://github.com/r4f405/mnist-number-recognition-python
matplotlib mnist-classifier mnist-dataset mnist-handwriting-recognition mnist-image-dataset numpy-python pillow pillow-library python python3 scipy tensorflow
Last synced: 8 days ago
JSON representation
This project implements a handwritten digit recognizer using a model trained on the MNIST dataset.
- Host: GitHub
- URL: https://github.com/r4f405/mnist-number-recognition-python
- Owner: R4F405
- License: gpl-3.0
- Created: 2025-04-13T22:29:45.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-05-06T13:26:18.000Z (13 days ago)
- Last Synced: 2025-05-06T14:43:00.962Z (13 days ago)
- Topics: matplotlib, mnist-classifier, mnist-dataset, mnist-handwriting-recognition, mnist-image-dataset, numpy-python, pillow, pillow-library, python, python3, scipy, tensorflow
- Language: Python
- Homepage:
- Size: 1.05 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MNIST Digit Recognition โ๏ธ๐ข
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://www.python.org/downloads/release/python-380/)This project implements a handwritten digit recognizer using a model trained on the MNIST dataset. The system can process images of digits, center them appropriately, and predict which number they represent.
## ๐ก Description
This program uses a neural network trained with the MNIST dataset to recognize handwritten digits. Main features:
- Image processing to adapt them to the MNIST format (28x28 pixels)
- Automatic digit centering based on the center of mass
- Image normalization and binarization
- Prediction using a pre-trained model## โ Requirements
- Python 3.8 or higher
- TensorFlow
- NumPy
- Matplotlib
- PIL (Pillow)
- SciPyYou can install the dependencies with:
```bash
pip install tensorflow numpy matplotlib pillow scipy
```## ๐ Project Structure
```
.
โโโ modelo_mnist.keras # Pre-trained TensorFlow model
โโโ numero.png # Example image to predict
โโโ Reconocer_Numeros.py # Main script
```## โถ๏ธ Usage
1. Place an image of a handwritten digit named `numero.png` in the project directory.
2. Make sure the pre-trained model `modelo_mnist.keras` is in the directory.
3. Run the script:```bash
python Reconocer_Numeros.py
```The program will display the processed image and the digit prediction.
## โ๏ธ How it Works
The script performs the following operations:
1. Loads and processes the image:
* Converts to grayscale
* Inverts colors (assumes white background, black digit)
* Resizes to 28x28 pixels
* Binarizes the image
* Normalizes values between 0 and 1
* Centers the digit based on its center of mass2. Loads the pre-trained model with TensorFlow.
3. Performs digit prediction and displays the result.
## ๐จ Customization
To use another image, simply change the `ruta_imagen` variable in the code or modify the file to accept command-line arguments.
## ๐ License
This project is under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for more details.
## ๐จโ๐ป Author
R4F405
[LinkedIn](https://www.linkedin.com/in/rafaspg) ยท [GitHub](https://github.com/R4F405)