Downloads · 30 days
11
5% of all-time downloads
immartian/improved_digits_recognition
improved_digits_recognition is a image classification model from immartian. Use it when you need a label for an image. The card lists the license as apache-2.0.
Model type: Convolutional Neural Network (CNN) Model Architecture: 3 Convolutional Layers, 1 Adaptive Pooling Layer, 1 Fully Connected Layer Framework: PyTorch Task: Image Classification (Digits 0-9)
Downloads · 30 days
11
5% of all-time downloads
All-time downloads
236
Public
Repo size
226 KB
Likes
1
Public
Click a slice to open those files.
.bin229 KB · 95%
From the Hugging Face model README
Model type: Convolutional Neural Network (CNN)
Model Architecture: 3 Convolutional Layers, 1 Adaptive Pooling Layer, 1 Fully Connected Layer
Framework: PyTorch
Task: Image Classification (Digits 0-9)
This model is a Convolutional Neural Network (CNN) trained on the MNIST dataset and designed to classify handwritten digits from 0 to 9. The model uses data augmentation to improve its robustness, especially for noisy or rotated images. The preprocessing step includes Gaussian blur for noise reduction, making the model more resilient to outliers and noisy digit inputs.
The model was trained on the MNIST dataset, which consists of 60,000 training images and 10,000 test images of handwritten digits. The images are 28x28 pixels in grayscale.
This model is designed for:
You can load the trained model in PyTorch and use it to classify digit images as shown below:
import torch
from torchvision import transforms
from PIL import Image
# Load the model
model = ImageClassifier()
model.load_state_dict(torch.load('mnist_classifier.pth'))
model.eval()
# Preprocess an input image
transform = transforms.Compose([
transforms.Resize((28, 28)),
transforms.ToTensor(),
transforms.Normalize((0.5,), (0.5,))
])
img = Image.open('path_to_image').convert('L')
img_tensor = transform(img).unsqueeze(0)
# Perform inference
with torch.no_grad():
output = model(img_tensor)
predicted_label = torch.argmax(output, dim=1).item()
print(f"Predicted Label: {predicted_label}")
The model was evaluated on the MNIST test set, achieving the following results:
The model was tested on noisy images (e.g., images with added noise or distortions), and the preprocessing steps (Gaussian blur, resizing) helped improve the model’s performance on such inputs.
There are no significant ethical concerns related to this model. However, users should be aware that the model is specifically trained on simple MNIST digits and may not perform well in more complex scenarios.
For any questions or feedback, please reach out to the model author via [[email protected]].