wq2012 commited on
Commit
8ad970a
·
0 Parent(s):

Initial release of aec_single_interfering pretrained checkpoint, TFLite model, and Model Card

Browse files
.gitattributes ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ *.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
2
+ *.meta filter=lfs diff=lfs merge=lfs -text
3
+ *.tflite filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: lingvo
4
+ tags:
5
+ - audio
6
+ - speech-enhancement
7
+ - echo-cancellation
8
+ - textual-echo-cancellation
9
+ - tensorflow
10
+ - tflite
11
+ datasets:
12
+ - libritts
13
+ - ljspeech
14
+ metrics:
15
+ - wer
16
+ - mcd
17
+ arxiv: 2008.06006
18
+ ---
19
+
20
+ # AEC-Seq2seq Neural Baseline — Single Interfering Voice (`AecSingleInterfering`)
21
+
22
+ Multi-source attention sequence-to-sequence **Acoustic Echo Cancellation (`AEC-Seq2seq`)** neural baseline model trained on 24 kHz **LibriTTS** user speech mixed at 0 dB SNR with reverberant **LJ Speech** (single-speaker TTS interference). Uses dual audio encoders (`SpeechEncoderV1`) on both the microphone mixture and the full reference TTS playback audio (~240–310 KB side input).
23
+
24
+ - **GitHub Repository**: [https://github.com/wq2012/tec](https://github.com/wq2012/tec)
25
+ - **PyPI Package**: [`textual-echo-cancellation`](https://pypi.org/project/textual-echo-cancellation/)
26
+ - **Paper**: [Textual Echo Cancellation (IEEE SLT 2021, arXiv:2008.06006v4)](https://arxiv.org/pdf/2008.06006)
27
+ - **Audio Demo Page**: [https://google.github.io/speaker-id/publications/TEC/](https://google.github.io/speaker-id/publications/TEC/)
28
+
29
+ > **Open-Source Reproduction Notice**: This pretrained model was trained using the standalone open-source reproduction library ([`wq2012/tec`](https://github.com/wq2012/tec)) built on [`lingvo`](https://github.com/tensorflow/lingvo) and `tensorflow`. It does not use Google's proprietary internal codebase or internal training data infrastructure.
30
+
31
+ ---
32
+
33
+ ## Model Performance
34
+
35
+ ### 1. Open-Source Reproduction Evaluation (`AecSingleInterfering`)
36
+
37
+ Evaluated on 24 kHz **LibriTTS** (`test-clean`, `test-other`) mixed at 0 dB SNR with synthetic room impulse responses (RT60 = 0.25 s) under the **Single interfering voice (LibriTTS + LJ Speech)** condition, using `Qwen3-ASR-0.6B-F16` via `audio.cpp` for ASR WER scoring and 13-MFCC Dynamic Time Warping for MCD:
38
+
39
+ | Metric | `test-clean` | `test-other` |Paper Reference (`AEC-Seq2seq`) |
40
+ | :--- | :---: | :---: | :---: |
41
+ | **WER (%) ↓** | **12.06%** (24/199) | **23.16%** (41/177) | 8.30% / 24.3% |
42
+ | **MCD (dB) ↓** | **8.85 dB** | **9.86 dB** | 6.38 dB / 7.07 dB |
43
+ | **Side Input Size (KB) ↓** | **243.465 KB** | **209.085 KB** | 310 KB |
44
+ | **Computational Complexity ↓** | **9.51 GFLOPS** | **9.51 GFLOPS** | 9.51 GFLOPS |
45
+
46
+ ### 2. Full Comparison Across All Pretrained Models & Baselines
47
+
48
+ | Condition | Method | Hugging Face Model | WER (%) test-clean ↓ | WER (%) test-other ↓ | MCD (dB) test-clean ↓ | MCD (dB) test-other ↓ | Side Input test-clean (KB) ↓ |
49
+ | :--- | :--- | :--- | :---: | :---: | :---: | :---: | :---: |
50
+ | **Single interfering voice** *(LibriTTS + LJSpeech)* | `GroundTruth` | — | 3.52 | 6.78 | 0.00 | 0.00 | 0.000 |
51
+ | | `MicrophoneSignal` | — | 90.45 | 114.12 | 12.86 | 14.61 | 0.000 |
52
+ | | `NlmsAec` (AEC-NLMS) | — | 88.44 | 107.34 | 12.80 | 14.48 | 243.465 |
53
+ | | `NoSideInputSingleInterfering` | [`wq2012/vanilla_seq2seq_single_interfering`](https://huggingface.co/wq2012/vanilla_seq2seq_single_interfering) | 45.23 | 91.53 | 9.58 | 11.34 | 0.000 |
54
+ | | `AecSingleInterfering` | [`wq2012/aec_single_interfering`](https://huggingface.co/wq2012/aec_single_interfering) | 12.06 | 23.16 | 8.85 | 9.86 | 243.465 |
55
+ | | **`TecSingleInterfering`** | **[`wq2012/tec_single_interfering`](https://huggingface.co/wq2012/tec_single_interfering)** | **21.61** | **46.89** | **8.24** | **9.28** | **0.076** |
56
+ | **Multiple interfering voices** *(LibriTTS + VCTK)* | `GroundTruth` | — | 5.03 | 7.82 | 0.00 | 0.00 | 0.000 |
57
+ | | `MicrophoneSignal` | — | 34.17 | 48.97 | 7.67 | 7.70 | 0.000 |
58
+ | | `NlmsAec` (AEC-NLMS) | — | 28.64 | 34.98 | 7.92 | 8.40 | 186.922 |
59
+ | | `NoSideInputMultiInterfering` | [`wq2012/vanilla_seq2seq_multi_interfering`](https://huggingface.co/wq2012/vanilla_seq2seq_multi_interfering) | 31.16 | 42.39 | 7.93 | 8.72 | 0.000 |
60
+ | | `AecMultiInterfering` | [`wq2012/aec_multi_interfering`](https://huggingface.co/wq2012/aec_multi_interfering) | 8.54 | 22.22 | 7.80 | 7.88 | 186.922 |
61
+ | | **`TecMultiInterfering`** | **[`wq2012/tec_multi_interfering`](https://huggingface.co/wq2012/tec_multi_interfering)** | **26.63** | **45.27** | **7.96** | **8.40** | **0.037** |
62
+
63
+ ---
64
+
65
+ ## Files in This Repository
66
+
67
+ - `best.ckpt.data-00000-of-00001`, `best.ckpt.index`, `best.ckpt.meta`, `checkpoint`: TensorFlow / Lingvo checkpoint for `AecSingleInterfering`.
68
+ - `model.tflite`: Dynamic-range quantized TensorFlow Lite (`.tflite`) FlatBuffer model for on-device inference.
69
+ - `evaluation_metrics.json`: Verified evaluation results (`test-clean` and `test-other`) for `AecSingleInterfering`.
70
+
71
+ ---
72
+
73
+ ## How to Use
74
+
75
+ ### 1. Install `textual-echo-cancellation`
76
+
77
+ ```bash
78
+ pip3 install textual-echo-cancellation huggingface_hub
79
+ ```
80
+
81
+ ### 2. Download the Model from Hugging Face
82
+
83
+ ```python
84
+ from huggingface_hub import snapshot_download
85
+
86
+ model_dir = snapshot_download(repo_id="wq2012/aec_single_interfering")
87
+ print("Downloaded model to:", model_dir)
88
+ ```
89
+
90
+ ### 3. Run Inference via CLI (`scripts/inference.py`)
91
+
92
+ ```bash
93
+ python3 -m scripts.inference \
94
+ --model AecSingleInterfering \
95
+ --checkpoint_path "${MODEL_DIR}/best.ckpt" \
96
+ --mixed_wav /path/to/mixed_input.wav \
97
+ --interfering_wav /path/to/reference_tts.wav \
98
+ --output_wav /tmp/enhanced_clean.wav
99
+ ```
100
+
101
+ ### 4. Run Inference via Python API
102
+
103
+ ```python
104
+ import os
105
+ from huggingface_hub import snapshot_download
106
+ from tec import inference
107
+
108
+ model_dir = snapshot_download(repo_id="wq2012/aec_single_interfering")
109
+ ckpt_path = os.path.join(model_dir, "best.ckpt")
110
+
111
+ result = inference.run_inference_on_wav(
112
+ model_name="AecSingleInterfering",
113
+ mixed_wav_path="/path/to/mixed_input.wav",
114
+ interfering_text="currently in mountain view it is 72 degrees",
115
+ checkpoint_path=ckpt_path,
116
+ output_wav_path="/tmp/enhanced_clean.wav",
117
+ )
118
+ print("Enhanced log-Mel spectrogram shape:", result["predicted_mel"].shape)
119
+ ```
120
+
121
+ ### 5. On-Device Inference with Quantized TFLite (`model.tflite`)
122
+
123
+ ```python
124
+ import os
125
+ import numpy as np
126
+ import tensorflow as tf
127
+ from huggingface_hub import snapshot_download
128
+
129
+ model_dir = snapshot_download(repo_id="wq2012/aec_single_interfering")
130
+ tflite_path = os.path.join(model_dir, "model.tflite")
131
+
132
+ interpreter = tf.lite.Interpreter(model_path=tflite_path)
133
+ interpreter.allocate_tensors()
134
+
135
+ for detail in interpreter.get_input_details():
136
+ interpreter.set_tensor(
137
+ detail["index"], np.zeros(detail["shape"], dtype=detail["dtype"])
138
+ )
139
+
140
+ interpreter.invoke()
141
+ output_details = interpreter.get_output_details()
142
+ enhanced_mel = interpreter.get_tensor(output_details[0]["index"])
143
+ print("TFLite predicted log-Mel shape:", enhanced_mel.shape)
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Citation
149
+
150
+ If you use this model or the `textual-echo-cancellation` library in your research, please cite the original paper:
151
+
152
+ ```bibtex
153
+ @inproceedings{ding2021textual,
154
+ title={Textual Echo Cancellation},
155
+ author={Ding, Shaojin and Jia, Ye and Hu, Ke and Wang, Quan},
156
+ booktitle={2021 IEEE Spoken Language Technology Workshop (SLT)},
157
+ pages={666--673},
158
+ year={2021},
159
+ organization={IEEE}
160
+ }
161
+ ```
best.ckpt.data-00000-of-00001 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9afc8cfcffa5e9f87bc7721a483c2e49b326fcec023288c9a6a85d2df543446
3
+ size 220352660
best.ckpt.index ADDED
Binary file (9.19 kB). View file
 
best.ckpt.meta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74be278d996dcacb52309310e79507a85f1e9c575ddddf302f8d5f9bc53c9012
3
+ size 6136313
checkpoint ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ model_checkpoint_path: "best.ckpt"
2
+ all_model_checkpoint_paths: "best.ckpt"
evaluation_metrics.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "AecSingleInterfering",
3
+ "condition": "Single interfering voice (LibriTTS + LJ Speech)",
4
+ "test_clean": {
5
+ "method": "AecSingleInterfering",
6
+ "num_evaluated": 20,
7
+ "mcd_db": 8.846418113635536,
8
+ "side_input_kb": 243.4647,
9
+ "wer": {
10
+ "wer": 12.06030150753769,
11
+ "word_errors": 24,
12
+ "total_words": 199
13
+ }
14
+ },
15
+ "test_other": {
16
+ "method": "AecSingleInterfering",
17
+ "num_evaluated": 20,
18
+ "mcd_db": 9.862275762203211,
19
+ "side_input_kb": 209.0852,
20
+ "wer": {
21
+ "wer": 23.163841807909606,
22
+ "word_errors": 41,
23
+ "total_words": 177
24
+ }
25
+ }
26
+ }
model.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ddadb6a0da7e6dd74a9a954d8cb9e1c77035e84f143245cce363daee7405c0d
3
+ size 18828960