Documentation
¶
Overview ¶
Command mnistdraw is an interactive version of Apple's "Training a Neural Network using MPS Graph" sample: draw a digit with the mouse and watch the network classify it as you draw.
It is the UI half of the sample, which the headless mnisttrain example does not cover. The same MPSGraph network is trained on MNIST at startup, then each stroke is normalized the way MNIST was and fed back through the graph for a live prediction.
The window has three parts:
- a canvas to draw on, left
- one bar per digit showing the softmax probability, right
- Train, Clear, and a status line, bottom
Training runs on a background goroutine so the window stays responsive, and the graph uses a dynamic batch dimension so the very same weights serve both the 40-image training steps and the single-image canvas predictions.
Usage:
mnistdraw [-data dir] [-iterations n] [-batch n] [-lr rate]