Animal Sketch Classifier V4 for Core ML
AnimalSpeciesClassifierV4 is a compact Core ML image classifier for line-drawn
animals. It is designed for iOS applications that turn PencilKit strokes into a
normalized grayscale sketch before classification.
The model returns probabilities for 48 animal species and one other class. It
is not a classifier for photographs, real-world object detection, or multiple
animals in one image.
Try it
Try the interactive demo at c4-sketch.mrt.qzz.io.
Files
AnimalSpeciesClassifierV4.mlpackage/: FP16 Core ML ML Program for iOS 17+.labels.json: exact output labels and their behavior groups.preprocessing.json: required input rendering contract.SHA256SUMS: SHA-256 checksum for the model package files.
Input
Render one centered sketch into a 64 x 64 grayscale image:
- black background;
- white, antialiased, round strokes;
- aspect-fit drawing bounds with 10% padding;
- fixed 4-pixel stroke width, rendered at 4x supersampling and Lanczos downsampled.
The Core ML model applies its own 1/255 scale internally. Supply 8-bit image
values; do not pre-normalize the pixel values a second time.
Output labels
The output vocabulary contains bird, insect, fish, mammal, reptile, amphibian,
mollusk, and crustacean species plus other. See labels.json for the full
49-label mapping. Applications should treat other, low confidence, and close
top predictions as an unknown result rather than forcing an animal label.
Evaluation
This V4 release was trained from scratch with dynamic vector rasterization and multi-task behavior supervision. Recorded held-out results are:
- species accuracy: 85.14%;
- mapped behavior accuracy: 94.14%;
- mapped behavior macro recall: 90.19%;
- Core ML parity: 256/256 identical top-1 predictions against PyTorch, with a maximum probability delta of 0.007530.
These metrics are from Quick Draw-style held-out vectors. They do not guarantee the same accuracy for every PencilKit drawing style, particularly detailed, incomplete, abstract, or unsupported animal sketches.
Training data and provenance
The model was trained from scratch using recognized drawings from the official Google Quick, Draw! simplified vector dataset. The training set contains 840,000 samples, with 24,500 validation and 24,500 test samples. No pretrained third-party model weights are included.
Quick Draw dataset attribution: Google Creative Lab, Google Quick, Draw! Dataset, licensed under CC BY 4.0.
- Dataset: https://github.com/googlecreativelab/quickdraw-dataset
- Training code and reproducible pipeline: https://github.com/MorpKnight/animal-sketch-coreml
The Quick Draw dataset itself is not redistributed in this repository.
iOS usage
Add AnimalSpeciesClassifierV4.mlpackage to an Xcode project and enable target
membership. Xcode compiles it to AnimalSpeciesClassifierV4.mlmodelc at build
time. Load that compiled model through MLModel, wrap it in VNCoreMLModel,
then submit a grayscale CVPixelBuffer or image through VNCoreMLRequest.
Limitations
- The model recognizes sketches, not photos.
- It was trained on the 49 labels in
labels.json; unsupported animals can map tootheror a visually similar supported label. - It should not be used for safety-critical, wildlife-identification, medical, legal, or conservation decisions.
- The model does not perform object detection, segmentation, or AR tracking.
License
The model artifact in this repository is released under CC BY 4.0. See
LICENSE and MODEL_NOTICE.md for attribution and provenance details.
- Downloads last month
- -