Digits
Understand how Digits recognizes handwritten digits through a neural-network device.
Digits recognizes handwritten digits. It runs as a guest application named xila-digits in the Applications repository.
Context
Section titled “Context”Digits depends on the drawing representation of Pixel Painter and a neural-network device. See Guest applications for how the bundle is packaged and launched. The native and browser image profiles include the bundle.
How it works
Section titled “How it works”Digits crops the drawn ink and fits it into a 28 by 28 input. It embeds a TensorFlow Lite model. It opens /devices/nn/cpu for reading and writing. The native runtime registers a loader at that path.
The following sequence shows model loading and prediction.
Digits writes the model to the device. It then sends device::neural_network::LOAD with a TensorFlow Lite LoadRequest. It checks the input and output tensors, writes the input, and sends device::neural_network::COMPUTE. It reads ten scores and ranks the three highest.
Design choices and trade-offs
Section titled “Design choices and trade-offs”The embedded model travels with the guest. The neural-network device performs inference. The guest prepares the drawing and validates the returned probabilities.
Limits
Section titled “Limits”Digits requires one float32 input shaped [1, 784] and one float32 output shaped [1, 10]. Empty drawings do not produce an input.
API reference
Section titled “API reference”executables/digits: application source.device::neural_network: neural-network device interface.wasmcrate: guest API Rustdoc.packaging/digits.json: package metadata.