Digit Recognition with LatticaAI Demo Tutorial

Digit Recognition flow

Overview of the Model

Our Digit recognition model is trained on the MNIST dataset. This dataset is a collection of grayscale images of handwritten digits (0–9), each 28×28 pixels in size. We added some preprocessing and data augmentations to the training data, for better performance on real world sketches of handwritten digits.

The model architecture is FCNN (fully-connected neural network):

  1. Input Layer: flattens the 28x28 image into a 784-dimensional vector.

  2. Hidden Layer: a fully connected layer with 50 neurons and square activation.

  3. Output Layer: a fully connected layer with 10 neurons (one for each digit) and a softmax activation.

The reason we chose to use square activation instead of the popular ReLU activation, is that homomorphic operation are better suited for polynomial operators, and square is the simplest and lowest degree non-linear operator that we can use as layer activation.

model architecture

Here is a sample code for inferring digit from an image using the trained model:

264B
Open

Achieving Full Privacy with LatticaAI

First install our client package

See our step-by-step guide for a detailed explanation of each step in this flow. To use the image sharpening model use the sketchToNumber model ID

Last updated

Was this helpful?