language: en | |
license: mit | |
tags: | |
- tensorflow | |
- image-classification | |
- mnist | |
- digits | |
datasets: | |
- mnist | |
metrics: | |
- accuracy | |
# 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 | |
```python | |
import tensorflow as tf | |
import numpy as np | |
# Load the model | |
model = tf.saved_model.load("path_to_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] | |
``` | |