|
---
|
|
license: apache-2.0
|
|
tags:
|
|
- classification
|
|
- deep-learning
|
|
- cnn
|
|
model-index:
|
|
- name: Digit Recognizer
|
|
results:
|
|
- task:
|
|
type: image-classification
|
|
name: Image Classification
|
|
dataset:
|
|
name: Kaggle - MNIST dataset
|
|
type: mnist
|
|
link: https://www.kaggle.com/competitions/digit-recognizer/data
|
|
metrics:
|
|
- type: accuracy
|
|
value: 0.985
|
|
name: Accuracy
|
|
---
|
|
|
|
# Digit Recognizer v1.0.0
|
|
|
|
This repository hosts the trained model for **digit recognition** in images. The model is a CNN-based architecture designed to classify images containing single digits between 0 and 9.
|
|
|
|
## Model Details
|
|
|
|
- **Architecture:** A CNN model that classifies handwritten digits between 0 and 9.
|
|
- **Dataset:** [Kaggle - MNIST dataset](https://www.kaggle.com/c/digit-recognizer/data).
|
|
- **Version:** v1.0.0
|
|
- **Task:** Image Classification
|
|
- **License:** Apache 2.0
|
|
|
|
## Usage
|
|
|
|
To use this model for inference, you can load it using the `tensorflow` library.
|
|
|
|
Requires: [Pip](https://pypi.org/project/pip/)
|
|
|
|
```bash
|
|
# Clones the repository and installs dependencies
|
|
!git clone https://huggingface.co/preethamganesh/digit-recognizer-v1.0.0
|
|
!pip install tensorflow
|
|
|
|
# Imports TensorFlow
|
|
import tensorflow as tf
|
|
|
|
# Loads the pre-trained model from the cloned directory
|
|
model_path = "digit-recognizer-v1.0.0"
|
|
exported_model = tf.saved_model.load(model_path)
|
|
|
|
# Retrieves the default serving function from the loaded model
|
|
model = exported_model.signatures["serving_default"]
|
|
|
|
# Prepares a dummy input tensor for inference (batch size: 1, height: 28, width: 28, channels: 1)
|
|
input_data = tf.ones((1, 28, 28, 1), dtype=tf.float32)
|
|
|
|
# Performs inference using the model. The output will be a dictionary, with the classification logits in the key 'output_0'
|
|
output = model(input_data)["output_0"]
|
|
|
|
# Prints the predicted class (e.g., 0 for normal, 1 for abnormal)
|
|
predicted_digit = tf.argmax(output, axis=-1).numpy()[0]
|
|
print("Predicted digit: ", predicted_digit)
|
|
```
|
|
|
|
## Training Details
|
|
|
|
### Compute
|
|
|
|
- The model was trained on a GeForce 4070Ti GPU with 16GB VRAM.
|
|
- Training completed in approximately 20.3 seconds over 9 epochs.
|
|
|
|
### Dataset
|
|
|
|
- The model was trained on the [Kaggle - MNIST dataset](https://www.kaggle.com/c/digit-recognizer/data), which includes images containing digits between 0 - 9.
|
|
|
|
### Performance on test set
|
|
|
|
- **Accuracy:** 0.985
|
|
|
|
## Citation
|
|
|
|
If you use this model in your research, please cite the repository:
|
|
|
|
```bash
|
|
@misc{preethamganesh2024digitrecog,
|
|
title={Digit Recognizer - v1.0.0},
|
|
author={Preetham Ganesh},
|
|
year={2025},
|
|
url={https://huggingface.co/preethamganesh/digit-recognizer-v1.0.0},
|
|
note={Apache-2.0 License}
|
|
}
|
|
```
|
|
|
|
## Contact
|
|
|
|
For any questions or support, please contact [email protected].
|
|
|