Sketch preprocessing
This 64 × 64 image is the input the Core ML classifier receives. Draw or choose an example to see how the model input changes.
| Training corpus | 840,000 Google Quick Draw sketches across 49 classes (48 animals + other) |
|---|---|
| Held-out evaluation | 85.14% top-1 accuracy (20,859 / 24,500 Quick Draw test sketches) |
| Input tensor | 64 × 64 grayscale raster, white strokes on black, centered with 10% padding |
| On-device package | FP16 Core ML package (~3.4 MB payload) integrated via Vision |
| Scope boundary | Classifier pipeline and Vision/Core ML bridge; drawing UI and 2.5D AR shaders by teammates |
Turning sketches into AR companions
AniMagic is an Apple Developer Academy team prototype where you sketch an animal with PencilKit and place an animated 2.5D cutout companion into your room with ARKit. My ownership covered the ML half end-to-end: baseline selection, dataset prep, PyTorch training, V4 evaluation, FP16 Core ML export, and Vision integration inside SwiftUI. Teammates built the drawing UI, cutout animations, and AR shaders.
Training data and the 49th class
I curated 840,000 training sketches from Google Quick Draw across 49 classes—48 animal species plus an aggregated other class so non-animal scribbles get rejected cleanly instead of forcing random animal guesses. Validation and test splits each held 24,500 examples.
Across all 49 held-out Quick Draw test classes (including other), V4 scored 85.14% top-1 accuracy (20,859 / 24,500). Measuring real-world accuracy on human PencilKit drawings would require collecting a separate PencilKit holdout set.
Matching training and Core ML preprocessing
Most sketch-classifier bugs come from preprocessing drift between Python training and Swift runtime. Both sides run the same raster contract shown in the workbench above: crop to ink bounds, center inside 10% padding, resize to 64 × 64 grayscale, and invert to white strokes on black.
Converting the weights to FP16 Core ML brought the model payload down to ~3.4 MB (separate from total app bundle size or runtime memory), running offline through Apple’s Vision framework.