Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available:
5.25.2
metadata
title: Digit Recognition with CNN
emoji: π’
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false
Digit Recognition Model
This model is trained to recognize handwritten digits from the MNIST dataset.
Model Description
- Model Type: CNN with Attention
- Task: Image Classification
- Input: 28x28 grayscale images
- Output: Digit classification (0-9)
Training
The model was trained on the MNIST dataset using a CNN architecture with attention mechanisms.
Usage
import tensorflow as tf
import numpy as np
# Load the model
model = tf.saved_model.load('https://huggingface.co/nivashuggingface/digit-recognition/resolve/main/saved_model')
# Prepare input
image = tf.keras.preprocessing.image.load_img("digit.png", target_size=(28, 28))
image = tf.keras.preprocessing.image.img_to_array(image)
image = image.astype('float32') / 255.0
image = np.expand_dims(image, axis=0)
# Make prediction
predictions = model(image)
predicted_digit = tf.argmax(predictions, axis=1).numpy()[0]
AI Model Training Project
This project demonstrates a complete machine learning workflow from data preparation to model deployment, using the MNIST dataset with an innovative approach to digit recognition.
Project Structure
.
βββ data/ # Dataset storage
βββ models/ # Saved model files
βββ src/ # Source code
β βββ data_preparation.py
β βββ model.py
β βββ training.py
β βββ evaluation.py
β βββ deployment.py
βββ notebooks/ # Jupyter notebooks for exploration
βββ requirements.txt # Project dependencies
βββ README.md # Project documentation
Setup Instructions
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Run the training pipeline:
python src/training.py
Project Features
- Custom CNN architecture for robust digit recognition
- Data augmentation techniques
- Model evaluation and hyperparameter tuning
- Model deployment pipeline
- Performance monitoring
Learning Concepts Covered
Data Preprocessing
- Data loading and cleaning
- Feature engineering
- Data augmentation
Model Architecture
- Custom CNN design
- Layer configuration
- Activation functions
Training Process
- Loss functions
- Optimizers
- Learning rate scheduling
- Early stopping
Evaluation
- Metrics calculation
- Cross-validation
- Model comparison
Deployment
- Model saving
- Inference pipeline
- Performance monitoring