PyTorch 2.0 · MediaPipe · ST-GCN Jan 2026

NeuroCalc: Dual Hands
Arithmetic Recognition

NeuroCalc live inference example — recognising hand gestures as arithmetic operations

Abstract

NeuroCalc is a real-time hand gesture recognition system that interprets arithmetic operations (digits 0–9 and operators +, −, ×, ÷, =) performed with both hands in front of a webcam. The hands are modelled as a dynamic graph of 42 vertices extracted by MediaPipe, projected into a canonical rotation-invariant reference frame, and classified by a Spatio-Temporal Graph Convolutional Network (ST-GCN). The system reaches 93.65% validation accuracy on a custom 15-class dataset and runs at 30 FPS on CPU thanks to an asynchronous strided inference engine that reduces compute load by approximately 75%.

Motivation

This project is my second time tackling an image/video ML model. In my previous project, I used a standard CNN with a public dataset to recognise characters on a licence plate. Standard Convolutional Neural Networks struggle with dynamic hand gestures due to high variance in camera distance and orientation. I wanted to explore a fundamentally different approach: treating the hands as a graph rather than a grid of pixels.

By projecting the data into a canonical reference frame before it reaches the neural network, I drastically reduced the complexity of the learning manifold. I also built my own dataset from scratch — 21 videos per character across 15 classes (digits and operators) — to have full control over the training distribution and to practise the end-to-end ML pipeline.

Implementation

Geometric Kernel — Unified Scene Projection

Raw coordinates are sensitive to the user’s position, so the Geometric Kernel anchors the coordinate system to the dominant hand’s wrist using Gram-Schmidt orthogonalisation. This canonicalises the dual-hand topology into a rotation-invariant manifold, effectively decoupling the semantic gesture from the user’s global orientation.

Adaptive Graph Convolution

To capture semantic relationships between unconnected joints, the network uses an Adaptive Graph Convolution layer that can “invent” new edges beyond the physical skeleton. This lets the model learn cross-hand relationships (e.g., both index fingers touching for “=”).

Temporal Convolution Blocks

Temporal evolution is handled by interleaved TCN blocks with dilated convolutions. These give the network a wide receptive field over time, which helps distinguish between static digits and dynamic signs like “Minus” (a sweeping motion).

Asynchronous Strided Inference

To maintain a smooth 30 FPS UI, the inference engine runs the ST-GCN on every N-th frame in a background thread, reducing CPU load by approximately 75% while the main thread continues rendering the webcam feed and overlay.

How to Use It

  1. Clone the repository and install dependencies: cd neuro_calc   poetry install
  2. Record your own hand gesture data (or skip to step 4 to use the pre-trained model): poetry run python tools/recorder.py
  3. Train the model: poetry run python train.py
  4. Run live inference: poetry run python inference.py
View Code Read Report