Indian AMD: YAMNet-GRU (person vs machine on Indian phone calls)
This is a small, fast answering-machine / voicemail detector for Indian outbound calls (Hindi and Indian English). It listens to the first seconds of a call and tells a live person from a machine: carrier announcements ("the number you are calling is switched off"), voicemail greetings, IVR menus, and robocalls.
- 3.5M parameters, 14 MB, and about 11–70 ms per check on one CPU thread.
- It needs no transcript and no speech-to-text; it works on the audio directly.
- It was built because no public AMD model handles Hindi. Every public model we tested flagged 44–90% of Hindi speakers as machines; this one flags 13.3% (details below).
Results
Test set: 526 held-out clips, kept separate from training (no shared speakers, scripts or files). Every clip went through a real 8 kHz G.711 µ-law round trip, so it sounds like a phone line.
Decision rule: the machine-only rule described below. "Caught" means the share of machines it detected; "wrongly flagged" means the share of real people it called a machine.
| Group (clips) | Result | Median audio heard |
|---|---|---|
| Real US robocalls (150) | 99.3% caught | 1.1 s |
| Indian English machine voices (45) | 100% caught | 1.3 s |
| Hindi machine voices (24) | 100% caught | 1.3 s |
| Hindi-then-English machine voices (7) | 100% caught | 1.3 s |
| Indian English people (150) | 2.7% wrongly flagged | – |
| Hindi people (150) | 13.3% wrongly flagged | – |
Share called "machine" by seconds of audio heard (one-shot, threshold 0.5):
| Group | 1 s | 2 s | 3 s | 4 s | 6 s | 10 s |
|---|---|---|---|---|---|---|
| Robocall | 93.3% | 94.0% | 93.3% | 94.7% | 96.7% | 99.3% |
| Indian machine voices | 100% | 100% | 100% | 100% | 100% | 100% |
| Indian English people | 10.7% | 2.7% | 2.0% | 1.3% | 0.7% | 0.7% |
| Hindi people | 20.0% | 13.3% | 12.0% | 11.3% | 12.7% | 12.0% |
Compared with public models on the same test set and rule
| Model | Hindi people wrongly flagged | Indian English people wrongly flagged | CPU per check |
|---|---|---|---|
| AbijahKaj/whisper-telephony-amd (as published) | 61.3% | 5.3% | ~750 ms |
| ozonetg/amd-telephony-yamnet-gru (as published, CC BY-NC) | 44.0% | 4.0% | ~10–70 ms |
| EfficientAT mn04 / CED-tiny (AudioSet, zero-shot) | ~90% | 96–98% | 15–75 ms |
| This model | 13.3% | 2.7% | 11–70 ms |
Speed (CPU, 1 thread, PyTorch fp32, Intel Core Ultra 7 155H)
| Audio heard | 1 s | 2 s | 4 s | 8 s |
|---|---|---|---|---|
| ms per check | 10.8 | 18.3 | 34.2 | 69.9 |
How to use
import numpy as np, soundfile as sf
from huggingface_hub import snapshot_download
import sys
folder = snapshot_download("Aakash22134/indian-amd-yamnet-gru")
sys.path.insert(0, folder)
from amd_yamnet import AMDYamnet, MachineOnlyRule
model = AMDYamnet.from_pretrained(folder)
audio, sr = sf.read("call_start.wav", dtype="float32") # mono, 16 kHz (resample 8 kHz phone audio up)
print("p_machine:", model.p_machine(audio)) # one-shot, uses the last 8 s
t = MachineOnlyRule(model).run(audio) # the rule used for the results above
print("machine at %.2f s" % t if t is not None else "person")
Requirements: torch, torchaudio, numpy, safetensors (and soundfile for the example).
The decision rule (MachineOnlyRule)
- Start checking 0.8 s after speech starts, then every 0.5 s, up to 8 s.
- Say "machine" if p ≥ 0.9 once, or p ≥ 0.75 on two checks in a row. Otherwise stay "person".
- It is asymmetric on purpose. Hanging up on a real person is the costly mistake, so "person" is never decided early. A voice bot can start talking normally and stop only if "machine" fires.
- Run inference on a worker thread (for example
asyncio.to_thread), not on the audio event loop.
Training
-
Backbone: Google YAMNet (AudioSet), loaded from the MIT PyTorch port w-hc/torch_audioset. Head: linear 1024→128 + tanh, then a bidirectional GRU (hidden 96), then linear → 1 logit. The whole network was fine-tuned.
-
Frontend: YAMNet's: 16 kHz, 25 ms / 10 ms STFT, 64 mel bands (125–7500 Hz), log(mel + 0.001), 0.96 s patches with a 0.48 s hop, last 8 s of audio.
-
Data: about 8,000 clips, ~16.7 h. Batch sampling: 55% people and 45% machines; Hindi is 32% of every batch.
Group Class Clips Source Telephony people person 1,500 AbijahKaj/telephony-amd-dataset (train split) Indian English people person 1,374 (458 speakers) Mozilla Common Voice, "India and South Asia" accent Hindi people person 1,600 Google FLEURS hi_in(train split)Telephony machines machine 2,000 AbijahKaj/telephony-amd-dataset (train split) Robocalls machine 1,223 wspr-ncsu/robocall-audio-dataset Indian English and Hindi machine voices machine 360 ~80 scripts written for this model (carrier announcements, bank and telecom IVR, voicemail, Hinglish), spoken by Microsoft edge-tts en-IN / hi-IN voices -
Augmentation: each sample is the first 1–8 s of a clip, after 0–0.8 s of leading silence, with random loudness, light noise (SNR 25–45 dB), and a real G.711 µ-law 8 kHz round trip.
-
Optimisation: 6 epochs × 250 steps × batch 32, AdamW (backbone lr 1e-4, head 1e-3), cosine decay, bf16 on one RTX 2000 Ada (~9 min). Best epoch chosen on a held-out validation split.
Test set
| Group | Clips | Source |
|---|---|---|
| Real US robocalls | 150 | robocall-audio-dataset, files not used in training |
| Indian machine voices | 76 | 34 scripts different from training, edge-tts en-IN / hi-IN voices |
| Indian English people | 150 | Common Voice, speakers not in training |
| Hindi people | 150 | FLEURS hi_in validation split (separate speakers from train) |
All test clips were loudness-normalised and sent through G.711 µ-law at 8 kHz.
License and attribution
-
Model weights and code: Apache-2.0.
-
YAMNet (Google, tensorflow/models, Apache-2.0). PyTorch port and the vendored network code in
amd_yamnet.pyare from w-hc/torch_audioset: MIT, © 2021 Haochen (seeLICENSE-torch_audioset-MIT). -
Training data:
- Google FLEURS (CC BY 4.0, attribution: Conneau et al., 2022)
- Mozilla Common Voice (CC0)
- wspr-ncsu robocall-audio-dataset (public domain)
- AbijahKaj/telephony-amd-dataset (no license stated on its card)
- audio generated with Microsoft edge-tts (subject to Microsoft's service terms)
If you plan commercial use, review the last two items yourself.
-
No CC BY-NC model weights were used to train this model.