This application is a number recognition tool that utilizes deep learning models to classify hand-drawn digits. Built with Streamlit, it provides an interactive way to test a Convolutional Neural Network (CNN) model trained on the MNIST dataset.
- Users can draw digits (0-9) on a canvas.
- The application processes the drawing and makes a prediction using a trained CNN model.
- Compares predictions from two different models.
- Displays the resized image and confidence scores for each prediction.
- Python: Primary programming language.
- Streamlit: Web-based interactive UI framework.
- OpenCV: Image processing.
- NumPy & Pandas: Data manipulation.
- Keras & TensorFlow: Deep learning framework for model inference.
- PIL (Pillow): Image handling.
- streamlit-drawable-canvas: Interactive drawing canvas.
To run this application locally, follow these steps:
- Clone the repository:
git clone https://github.com/WillOfHeaven/MinorGP.git cd MinorGP - Install the required dependencies:
pip install -r requirements.txt
- Run the Streamlit application:
streamlit run app.py
- Open the web interface.
- Draw a digit (0-9) on the canvas.
- The application will process and predict the number.
- Compare results between different models.
- New Model:
new_mnist(4x4)_epoch70.h5 - Old Model:
mnist.h5 - Both models were trained on the MNIST dataset but have different architectures and training parameters.
To improve the model performance, you can retrain it using additional data or fine-tune its parameters.
-
Prepare Data
- Collect additional handwritten digits.
- Preprocess images (resize to 28x28, normalize, grayscale conversion).
-
Load Existing Model
from keras.models import load_model model = load_model("new_mnist(4x4)_epoch70.h5")
-
Fine-Tune or Train from Scratch
- Freeze earlier layers if using transfer learning.
- Use an augmented dataset to avoid overfitting.
from keras.preprocessing.image import ImageDataGenerator datagen = ImageDataGenerator( rotation_range=10, zoom_range=0.1, width_shift_range=0.1, height_shift_range=0.1 ) model.fit(datagen.flow(X_train, y_train, batch_size=32), epochs=10, validation_data=(X_test, y_test))
-
Save the Updated Model
model.save("updated_mnist_model.h5")
-
Deploy the Updated Model
- Replace
new_mnist(4x4)_epoch70.h5withupdated_mnist_model.h5inapp.py. - Restart the application.
- Replace
- Gaurav Rawat ( Alternative Solution explorer )
- Karthik Sharma Dhulipati ( ML Research )
- Mohak Kumar Srivastava ( UI )
- Naman Jain ( Research )
- Sambuddha Chatterjee ( ML Pipeline )
We welcome your feedback and contributions! If you encounter any issues or have suggestions for improvements, feel free to submit an issue or pull request on GitHub.