Downloads · 30 days
0
lane99/resnet_mnist_digits
resnet_mnist_digits is a image classification model from lane99. Use it when you need a label for an image. It is set up for keras. The card lists the license as afl-3.0.
This model is is a Residual Neural Network (ResNet) for classifying handwritten digits in the MNIST dataset. This model has 27.5 M parameters and achieves 99.45% accuracy on the MNIST test dataset (i.e., on digits not…
Downloads · 30 days
0
Access
Public
Updated Mar 4, 2023
Repo size
331 MB
Likes
1
Public
Click a slice to open those files.
.hdf5331 MB · 100%
From the Hugging Face model README
This model is is a Residual Neural Network (ResNet) for classifying handwritten digits in the MNIST dataset. This model has 27.5 M parameters and achieves 99.45% accuracy on the MNIST test dataset (i.e., on digits not seen during training).
This model takes as an input a 28x28 array of MNIST digits with values normalized to [0, 1]. The model was trained using Keras on an Nvidia Ampere A100.
Use the code below to get started with the model.
from tensorflow.keras import models
from tensorflow.keras.datasets import mnist
from tensorflow.keras.utils import to_categorical
from keras.utils.data_utils import get_file
# load the MNIST dataset test images and labels
(_, _), (test_images, test_labels) = mnist.load_data()
# normalize the images
test_images = test_images.astype('float32') / 255
# create one-hot labels
test_labels_onehot = to_categorical(test_labels)
# download the model
model_path = get_file('/path/to/resnet_mnist_digits.hdf5', 'https://huggingface.co/lane99/resnet_mnist_digits/resolve/main/resnet_mnist_digits.hdf5')
# import the model
resnet = models.load_model(model_path)
# evaluate the model
evaluation_conv = resnet.evaluate(test_images, test_labels_onehot)
print("Accuracy: ", str(evaluation_conv[1]))
This model was trained on the 60,000 entries in the MNIST training dataset.
This model was trained with a 0.1 validation split for 15 epochs using a batch size of 128.