An offline handwriting recognition model and hardware that will let you type with ease. COE-320 Practical Training Project
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Smart Stylus™

An offline handwriting recognition pen like hardware and tensorflow based model implementation that will type what you write with it. Right now it supports english alphabets and numbers. That are 62 symbols!


Smart Stylus™ from scratch


Trained Model in Action

Stylus in Action

Basic Hardware Concept

The circuitry used by a mouse for recognizing and tracking movement have been embedded in the structure of a pen . Thus ,when you use the pen to write the CNN converts them to letters and produces a typed result.


  • Convolution Layer
    • 16 3x3 Filters
  • Max Pool
    • 3x3 Same Padding
  • Rectified Linear Unit
  • Convolution Layer
    • 10 3x3 Filters
  • Max Pool
    • 2x2 Same Padding
  • Rectified Linear Unit
  • Inception 16 filters
  • Fully Connected
    • 1 Hidden Layer, 500 Neurons
    • TanH activation
  • Softmax Layer
Can I edit the model?

Yes, Model structure is stored seperately in models/ expects following function from a model script

def create_network(img_height, img_width, num_classes)

And it should return x, y, y_true, optimizer

How can train the new model? has been designed to aid this by using preconfigured values and training method. You can expect a detailed explanation of different parameters by typing --help. examples

  • --show
    • Show loaded training data
  • --train
    • Train model
  • --restore save/validations
    • Test model



We're using public dataset Chars74K

  • It contains 62 classes [A-Za-z0-9]
  • It has 55 samples per class
  • All images are of fixed resolution 1200x900
How to download dataset?

You can download and unzip dataset by running shell script.


We're are preprocessing dataset because of various reasons

  • We can reduce dimensions
  • We can eliminate empty spaces
  • We don't need 3 channels
  • Samples are not properly scaled
  • Too big to fit into memory and train on home pc
Stages of normalization
  • Bounding box calculation
  • Samples croping
  • Reducing channels
  • Scale to fit properly in maximum bounding box
  • Dimensions Reduction
How to preprocess data ?

You can preprocess data after downloading dataset by executing python

  • It expects that system has all the dependencies installed
    • pip3 install -r requirements.txt
    • bash ./
    • python

It will create two files normalized-train.bin & normalized-val.bin under dataset directory.

Normalized dataset

Normalized dataset


This is a part of Academic Project Report under Practical Training (COE-320) at NSIT.



MIT © Aman Priyadarshi