desert-ant-labs/shapes
<!-- card-header:start (generated from manifest.json, edit below this block) -->
Shapes
Rough sketch. Perfect shape.
On-device single-stroke shape recognition.
- SDKs, install and examples: https://github.com/Desert-Ant-Labs/desert-ant-core/blob/main/docs/models/shapes.md
- Website: https://desertant.com/models/shapes/
<!-- card-header:end -->
Turn a rough circle drawing into a clean shape, with fitted vector geometry ready to snap to. Built for PencilKit-style "smart shapes": draw, pause, and the rough stroke becomes a crisp shape. The model is tiny (200KB Core ML, 1.3MB LiteRT) and runs in a few milliseconds on device.
✏️ ➜ ▭ · ✏️ ➜ △ · ✏️ ➜ ◯ · ✏️ ➜ ★
Try it
- Live demo: desert-ant-labs/shapes-demo: draw one stroke, get a fitted shape, fully in your browser.
<!-- card-install:start (generated from manifest.json, edit below this block) --> | | | | --- | --- | | Platforms | iOS, macOS, tvOS, visionOS, Android, Linux, Windows, Browser, Node | | Weights | v0.3.0 |
Install
Swift (requirements)
.package(url: "https://github.com/Desert-Ant-Labs/desert-ant-core.git", from: "3.3.0")Then add the Shapes product to your target.
Kotlin (requirements)
implementation("ai.desertant:shapes:3.3.0")JavaScript (requirements)
npm i @desert-ant-labs/shapes @litertjs/core # browser
npm i @desert-ant-labs/shapes # Node, prebuilt native core<!-- card-install:end -->
Files
Inputs and outputs
- Input: an ordered list of stroke points in canvas coordinates. Single stroke.
- Output: a shape class plus fitted geometry, or nothing if the stroke is rejected.
Classes
line, rectangle, triangle, ellipse, star, plus none (the reject class: scribbles, partial shapes, and other non-shape strokes). Squares and circles are covered by rectangle and ellipse (snapped when near-regular).
Limitations
- Single stroke only; multi-stroke shapes aren't recognized.
- Tuned for deliberate shapes; very rough or ambiguous strokes are rejected by design.
<!-- card-footer:start (generated from manifest.json, edit above this block) -->
License
Desert Ant Labs Source-Available License. Free for most apps, and a commercial license is required at scale. Full terms are at the link. Licensing: <licensing@desertant.com>.
See `THIRD_PARTY_NOTICES.md`.
Citation
@software{shapes_2026,
title = {Shapes: On-device single-stroke shape recognition},
author = {Desert Ant Labs},
year = {2026},
url = {https://huggingface.co/desert-ant-labs/shapes},
}© 2026 Desert Ant Labs · <https://desertant.com> <!-- card-footer:end -->
