Tiny Intent v3
Mini voice command classifier
2 min readupdated
This ultra-compact convolutional neural network (CNN) is designed to recognize intents from transcribed speech directly on a smartphone. The model accepts a sentence and determines one of 16 possible commands with a confidence score. Weighing just 1.10 MB in the ONNX int8 (8-bit quantization for faster execution) format, it runs entirely offline on mobile devices. It is well-suited for mobile app developers building voice assistants or smart utilities.
Key features
- Weighs just 1.10 MB and contains 1.14 million parameters
- Runs entirely offline on a phone via ONNX Runtime
- Supports Hindi (Devanagari), Hinglish (Latin), and English
- Achieves 96.2% accuracy on the test dataset
What you can do
- Integrate into a Flutter or React mobile app for local control of calls, alarms, and timers
- Set up a hybrid system: local processing for simple commands with cloud fallback for complex requests
- Use alongside a lightweight Whisper model to recognize voice commands in Hindi and English
Example
import json, re
import numpy as np
import onnxruntime as ort
vocab = json.load(open("vocab.json", encoding="utf-8"))
labels = json.load(open("labels.json", encoding="utf-8"))
def encode(text):
words = re.findall(r"[\u0900-\u097f]+|[a-z0-9]+", str(text).lower())
ids = [vocab.get(w, 1) for w in words][:32]
ids += [0] * (32 - len(ids))
return ids
sess = ort.InferenceSession("intent_model_int8.onnx", providers=["CPUExecutionProvider"])
def understand(text):
x = np.array([encode(text)], dtype=np.int64)
logits = sess.run(None, {"input": x})[0][0]
probs = np.exp(logits) / np.exp(logits).sum()
i = int(probs.argmax())
return {"intent": labels[str(i)], "confidence": float(probs[i])}
print(understand("kal subah 6 baje alarm laga do"))Read more
DetailsTest accuracy: 96.2% on the test set
Requirements: CPU / mobile devices, minimal resource consumption
Limitations: identifies only the intent itself (times, names, and parameters are extracted using simple rules in the app code)
License: MIT










Comments