Abstract
Biological movement is executed through modular subroutines known as motor primitives. This paper introduces a generative framework that models handwriting as a sequence of these primitives triggered by a central timing controller. Utilizing a Factorial Hidden Markov Model (fHMM) combined with an "Integrate and Fire" timing mechanism, the system effectively decomposes unpartitioned handwriting data into a compact, sparse code. Our findings indicate that this approach not only achieves high reconstruction accuracy for complex characters but also captures the natural variability inherent in human handwriting.
Introduction
Modeling human movement, particularly handwriting, presents a significant challenge due to the complexity of biological motor control. Humans do not plan every point of a trajectory; instead, evidence suggests the use of "motor primitives"—short, reusable blocks of motion. In machine learning, the difficulty lies in handling "unpartitioned" data where the boundaries between these primitives are unknown. This research bridges the gap between biological motor control and generative modeling by proposing a system that infers underlying primitives and their timing from raw handwriting data.
Methodology
The proposed generative framework consists of two primary layers: a Factorial Hidden Markov Model (fHMM) and a timing model based on neural dynamics.
Factorial Hidden Markov Model (fHMM)
Unlike standard HMMs that maintain a single state, an fHMM employs multiple independent Markov chains, or "factors," running in parallel. In this context, each factor represents a specific motor primitive. The observable output at any time step is a linear superposition of the active primitives. This "Piano Model" allows for the simultaneous activation of different motion components to form complex trajectories.
Timing Model: Integrate and Fire (IF)
To coordinate the activation of primitives, the authors implement a stochastic Integrate and Fire (IF) model, a concept borrowed from computational neuroscience. The decision to initiate a primitive is treated like a neuron reaching a voltage threshold. This mechanism accounts for temporal variance, reflecting how humans write the same characters with varying rhythms. The model is trained using the Expectation-Maximization (EM) algorithm, where the E-step infers primitive "spikes" and the M-step learns the primitive shapes.
Experimental Results
Data was collected using an INTUOS 3 WACOM digitization tablet, capturing 5-dimensional input (position, pressure, tilt, orientation) at 200Hz. The model was tested on datasets for characters such as ‘g’ and ‘m’.
Reconstruction and Generative Power
The model successfully reconstructed complex characters using a library of approximately 20 primitives. For the ‘g’ dataset, the average reconstruction error in velocity space was remarkably low (e.g., 0.0617 for x-velocity). Beyond reconstruction, the model can generate new instances of characters that maintain human-like variance, demonstrating its robust generative capabilities.
Discussion
A key insight from this work is the "Scribbling" phenomenon. When the top-down timing controller is disconnected and primitives are sampled randomly, the output resembles human doodling. This suggests that scribbling is the manifestation of motor primitives operating without a structured plan. Furthermore, the model shows that different characters can share the same set of primitives, suggesting that learning to write may involve mastering new timing sequences for existing motor skills.
Conclusion and Future Work
This research provides a biologically inspired method for encoding and generating handwriting data. The resulting representation is highly compact, offering potential for efficient digital ink storage. Future work will address the limitations of fixed primitive lengths and explore "style transfer" by combining one individual's primitive shapes with another's timing patterns. Scaling the model to encompass full cursive scripts remains a primary objective.
Summary updated