CASE STUDY · 11 / 15 · AI · 2026
PawSense
Sees, hears and understands your cat or dog, on the phone first.
91.7%
BREED ACCURACY (TOP-5 99.6%)
3
ON-DEVICE MODELS
37
BREEDS, SELF-TRAINED
115
AUTOMATED TESTS
THE BRIEF
The problem
Pet apps that “understand” your pet usually ship every frame to the cloud: slow, battery-hungry and useless offline. I wanted detection and breed recognition to run live on the phone, with the cloud only for the deep read.
My part
Everything, alone: trained the breed model in Python, wrote the Flutter app and the Swift Core ML bridge, built the Node.js backend that streams Claude’s analysis, and set up CI/CD to TestFlight and Play.
Four builds. One product.
- 01Mobile appLive, Sound, Clips and Feed tabs; a long-lived inference isolate; Core ML on iOS through a Swift bridge.FLUTTER · SWIFT
- 02On-device MLEfficientNet-B0 trained on Oxford-IIIT Pet, exported to TFLite and Core ML, every export re-tested.PYTHON · TF · CORE ML
- 03Streaming backendClip upload API, idempotent job store and a WebSocket that streams Claude vision’s answer word by word.NODE.JS · FASTIFY
- 04CI/CDTests and E2E on an emulator, Docker to GHCR, Fastlane to TestFlight and Play internal testing.GITHUB ACTIONS · FASTLANE
From camera to insight.
Pick a step to see what runs underneath.
STEP 01 · ON-DEVICE
Camera frames go to one long-lived inference isolate. A frame scheduler drops frames instead of queuing them and slows down when no pet is in view, the battery is low or the phone is hot. EfficientDet-Lite0 boxes every cat and dog.
UNDER THE HOOD
ARCHITECTURE
On-device first. The cloud only reads the clip, and streams the answer back.
CAMERA + MIC
Flutter app
ON-DEVICE
TFLite, Core ML, YAMNet
OFFLINE
Drift queue + feed
API
Fastify + WebSocket
VISION
Claude, streamed
CAMERA + MIC → ON-DEVICE MODELS → OFFLINE QUEUE → FASTIFY API → CLAUDE VISION → STREAMED BACK OVER WEBSOCKET
Decisions that mattered.
01 · SPEED
One isolate, not one per frame.
Spawning an isolate and rebuilding interpreters every frame would eat the whole 33 ms budget. One isolate owns all three models; only frames and results cross the boundary.
02 · CORRECTNESS
Preprocessing lives inside the model.
Rescaling and normalisation are the model’s first layers, so Dart, Swift and Python feed identical raw pixels. The most common on-device ML bug is gone by construction.
03 · RESILIENCE
Offline-first, stream don’t wait.
Every result is written to the local database first. Clips wait in a persistent queue that survives the app being killed, and answers stream in token by token.
FOUND ON REAL DEVICES
- Caught a broken model export that silently dropped the weights (8 MB to 0.3 MB, 2.7% accuracy) by re-testing every export on the full test set.
- Fixed a native crash on Android when the GPU delegate failed, by dropping an explicit XNNPACK delegate TFLite already applies.
- Fixed sideways boxes on iPhone caused by rotating already-rotated frames, and queued clips breaking after iOS app updates.
STACK

