digits / README.md
etweedy's picture
Update README.md
1e5dbae

A newer version of the Gradio SDK is available: 5.13.0

Upgrade
metadata
title: Digits
emoji: 🔢
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 3.12.0
app_file: app.py
pinned: false
license: apache-2.0

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

This gradio app predicts digits using a convolutive neural network (CNN) that was trained on the MNIST hand-drawn digit data set: @article{lecun2010mnist, title={MNIST handwritten digit database}, author={LeCun, Yann and Cortes, Corinna and Burges, CJ}, journal={ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist/}, volume={2}, year={2010} }

The PyTorch network architecture: Sequential( (conv1): Conv2d(1, 32, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2)) (relu1): ReLU() (pool1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (conv2): Conv2d(32, 64, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2)) (relu2): ReLU() (pool2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (flatten): Flatten(start_dim=1, end_dim=-1) (fc1): Linear(in_features=3136, out_features=1024, bias=True) (dropout): Dropout(p=0.5, inplace=False) (fc2): Linear(in_features=1024, out_features=10, bias=True) )

The model was trained using cross entropy loss function, the Adam stochastic optimizer. Training was done for 10 epochs, using batch size of 64, and with a learning rate of 0.001.

The training and validation accuracy after each epoch was as follows:

Epoch 1 ---- train accuracy: 0.9607 ---- val accuracy: 0.9885 Epoch 2 ---- train accuracy: 0.9870 ---- val accuracy: 0.9894 Epoch 3 ---- train accuracy: 0.9893 ---- val accuracy: 0.9892 Epoch 4 ---- train accuracy: 0.9925 ---- val accuracy: 0.9914 Epoch 5 ---- train accuracy: 0.9932 ---- val accuracy: 0.9872 Epoch 6 ---- train accuracy: 0.9947 ---- val accuracy: 0.9904 Epoch 7 ---- train accuracy: 0.9946 ---- val accuracy: 0.9888 Epoch 8 ---- train accuracy: 0.9947 ---- val accuracy: 0.9920 Epoch 9 ---- train accuracy: 0.9962 ---- val accuracy: 0.9912 Epoch 10 ---- train accuracy: 0.9960 ---- val accuracy: 0.9915