OnePen

OnePen Logo

OnePen

AI-Powered Gesture Recognition for Frictionless Handwritten Note-Taking


TL;DR

OnePen is the first handwriting note-taking app that lets users format and edit notes without ever lifting their hand or touching a toolbar.
By recognizing handwritten gestures in real time, it reduces hand movement and context switchingβ€”helping users write up to 30% faster and stay in flow.

I designed and deployed a fully in-browser ML system that recognizes gestures like underline, box, delete, and brackets using a hybrid vision + geometry model, achieving 99.89% accuracy with ~20 ms latency on-device.


πŸš€ NOT A DEMO Β· NOT A PROTOTYPE
⭐ OnePen is a published app, used by real users, that measurably improves how people write.

πŸ† Winner β€” β€œMost Novel Use of AI”, HackUMASS XII


Why it matters (real, practical impact)


What makes it novel


Technical highlights


Stack

TensorFlow / Keras Β· TensorFlow.js Β· Python Β· MLflow Β· Canvas API Β· PWA


πŸ” Deep Dive


🚨 The Problem

Handwritten note-taking is full of interruptions.
Changing colors, highlighting, erasing, or switching pens forces you to lift your hand, reach for a toolbar, then return to the page.

These tiny actions add upβ€”quietly breaking your flow and focus.


✨ The Solution

OnePen removes that friction.

It’s a handwriting-first note-taking web app powered by AI gesture recognition, allowing you to write, format, and organize naturallyβ€”without ever touching a toolbar.

One pen. Zero interruptions.

πŸŽ₯ Watch Demo β†’


πŸš€ Key Features

✍️ Gesture Recognition (ML-Powered)

Quick Draw β€” Instantly styles strokes (fully customizable):

Gesture Action
Box Groups and styles enclosed content
Wavy box Groups content with alternative styling
Strike-through Deletes crossed strokes
Box / Curly / Circle brackets Styles child content within bracket height

Draw + Hold β€” Opens a radial tool dial

6 gestures Γ— 8 tools = 48 quick-access tools

Draw any gesture (except delete), hold briefly, and select a toolβ€”without lifting your pen.


πŸ“š Study Tools


🧠 Smart Notes


πŸ“¦ Media & Export


🧩 Technical Overview

System Architecture

System Architecture


Model Architecture

OnePen uses a hybrid dual-input model that fuses visual and geometric stroke features:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  96Γ—96 Image    β”‚     β”‚  12D Geometric  β”‚
β”‚    (stroke)     β”‚     β”‚    Features     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MobileNetV3    β”‚     β”‚   Dense 128β†’64  β”‚
β”‚  + SE Attention β”‚     β”‚  + LayerNorm    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β–Ό
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚    Concat     β”‚
           β”‚   384 β†’ 192   β”‚
           β”‚   + Dropout   β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                   β–Ό
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚   8 Classes   β”‚
           β”‚   (softmax)   β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Why hybrid?
Image-only models struggled with visually similar gestures (box vs bracket, underline vs delete).
Adding geometric features improved accuracy by ~5–8%.


The 12 Geometric Features

# Feature Why It Helps
1 Closure ratio Boxes form closed loops
2 Compactness Underlines are elongated
3 Spread ratio Underlines have low spread
4 Aspect ratio Distinguishes wide vs tall
5 Edge fraction Boxes cluster on edges
6 Point count Deletes use more points
7 Height diff Underlines stay below threshold
8 Horizontal variance Underlines vary in X
9 Total path length Wavy strokes are longer
10 Perimeter ratio Size-invariant metric
11 Spine verticality Deletes are diagonal
12 Vertical variance Underlines have low Y variance

Model Performance

Model Accuracy Size Inference
MobileNetV3-Large 99.88% 5 MB 30 ms
MobileNetV3-Small (Chosen) 99.89% 2.5 MB 20 ms
EfficientNetV2-B0 β€” 7 MB 60 ms

Chosen for near-perfect accuracy with ultra-fast browser inference.


Data Pipeline

  1. Custom data collection app (4 writers, varied styles)
  2. Augmentation: rotation, shear, scale, flip (6Γ— data)
  3. Preprocessing: normalization, 96Γ—96 rendering, feature extraction
  4. Full experiment tracking with MLflow

Stroke Samples

Runs entirely in-browser. Optional Flask backend for math solving.


⚑ Quick Start

git clone https://github.com/yourusername/OnePen.git
cd OnePen

python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

cd app
python -m http.server 8000

### Train Your Own Model

```bash
make dataset   # Preprocess collected data
make train     # Train hybrid CNN (~200 epochs)
make export    # Export to TensorFlow.js

Project Structure

OnePen/
β”œβ”€β”€ app/                      # Progressive Web App
β”‚   β”œβ”€β”€ index.html           # Main interface
β”‚   β”œβ”€β”€ draw.js              # Canvas engine (zoom, pan, stylus)
β”‚   β”œβ”€β”€ predict.js           # TensorFlow.js inference
β”‚   β”œβ”€β”€ sw.js                # Service worker (offline)
β”‚   └── manifest.json        # PWA manifest
β”‚
β”œβ”€β”€ src/modifiers/           # ML Library
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── architecture.py  # Hybrid CNN definition
β”‚   β”œβ”€β”€ features/
β”‚   β”‚   └── geometric.py     # 12D feature extraction
β”‚   └── data/
β”‚       β”œβ”€β”€ loader.py        # Dataset loading
β”‚       └── augmenter.py     # Data augmentation
β”‚
β”œβ”€β”€ scripts/                 # CLI Tools
β”‚   β”œβ”€β”€ train.py            # Training script
β”‚   └── export.py           # TF.js export
β”‚
β”œβ”€β”€ config/config.yaml       # Hyperparameters
└── mlruns/                  # MLflow experiments

Tech Stack

Layer Technologies
Frontend Canvas API, TensorFlow.js, IndexedDB, Service Workers
ML TensorFlow/Keras, MobileNetV3, Squeeze-and-Excitation
Backend Flask, Pix2Text (math), Google Drive API
DevOps MLflow, pytest, ruff, mypy

What I Learned


License

MIT


Author

Andy Huynh β€” GitHub