File size: 9,527 Bytes
47b46be | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | ---
license: mit
language:
- ko
- fr
tags:
- speech-enhancement
- multimodal
- bone-conduction
- streaming
- onnx
datasets:
- yskim3271/Throat_and_Acoustic_Pairing_Speech_Dataset
- yskim3271/vibravox_16k
library_name: pytorch
pipeline_tag: audio-to-audio
---
# BAFNet+ Pre-Trained Checkpoints and Streaming ONNX Artifacts
Official pre-trained model checkpoints and deployable FP32 streaming ONNX graph for:
> **Low-Latency Body- and Air-Conducted Speech Enhancement via Automatic Level Balancing and Reliability-Guided Fusion**
> Yunsik Kim, Youngseok Kim, and Yoonyoung Chung (POSTECH)
> IEEE/ACM Transactions on Audio, Speech, and Language Processing (TASLP)
- **Code Repository**: https://github.com/yskim3271/BAFNet-plus
- **Audio Samples & Spectrogram Demo**: https://yskim3271.github.io/BAFNet-plus/
- **HuggingFace Repository**: https://huggingface.co/yskim3271/BAFNet-plus
---
## Model Family & Released Artifacts
This repository distributes **6 PyTorch checkpoints** (5 algorithmic-latency tiers trained on Korean **TAPS** and the 50 ms operating point trained on French **Vibravox**) together with the **50 ms stateful FP32 streaming ONNX graph** and its sidecar metadata JSON (**8 primary model/deployment files** plus self-contained `config.yaml` files and integrity manifests `SHA256SUMS.txt` and `manifest.json`).
Every staged `config.yaml` is **self-contained**: mapping and masking branch architectures (`args_mapping` and `args_masking`) are embedded directly inside `model.param`, `checkpoint_mapping`/`checkpoint_masking` are cleared to `null`, `load_pretrained_weights` is `false`, and dataset noise/RIR paths use generic placeholders (`/path/to/...`).
### Download & Integrity Table
Total model, configuration, and ONNX payload: **78.84 MiB** across **14** repository files (plus `README.md`, `manifest.json`, and `SHA256SUMS.txt`; generated 2026-11-22 05:35:21 UTC).
| Artifact | Category | Dataset | Size | SHA-256 (prefix) |
|---|---|---|---:|---|
| [`checkpoints/bafnetplus_12ms/best.th`](checkpoints/bafnetplus_12ms/best.th) | PyTorch Checkpoint | TAPS (12.5 ms) | 11.09 MiB | `2b93c04c60e3...` |
| [`checkpoints/bafnetplus_12ms/config.yaml`](checkpoints/bafnetplus_12ms/config.yaml) | Hydra Config (Sanitized) | TAPS (12.5 ms) | 3.3 KiB | `39d993a5f515...` |
| [`checkpoints/bafnetplus_25ms/best.th`](checkpoints/bafnetplus_25ms/best.th) | PyTorch Checkpoint | TAPS (25 ms) | 11.09 MiB | `31a10bf22072...` |
| [`checkpoints/bafnetplus_25ms/config.yaml`](checkpoints/bafnetplus_25ms/config.yaml) | Hydra Config (Sanitized) | TAPS (25 ms) | 3.3 KiB | `30fff9a0dbd2...` |
| [`checkpoints/bafnetplus_50ms/best.th`](checkpoints/bafnetplus_50ms/best.th) | PyTorch Checkpoint | TAPS (50 ms) | 11.09 MiB | `3ab190dc2d3e...` |
| [`checkpoints/bafnetplus_50ms/config.yaml`](checkpoints/bafnetplus_50ms/config.yaml) | Hydra Config (Sanitized) | TAPS (50 ms) | 3.3 KiB | `4d566b9f4001...` |
| [`checkpoints/bafnetplus_75ms/best.th`](checkpoints/bafnetplus_75ms/best.th) | PyTorch Checkpoint | TAPS (75 ms) | 11.09 MiB | `281239d2e1e5...` |
| [`checkpoints/bafnetplus_75ms/config.yaml`](checkpoints/bafnetplus_75ms/config.yaml) | Hydra Config (Sanitized) | TAPS (75 ms) | 3.3 KiB | `58d6ae8514e8...` |
| [`checkpoints/bafnetplus_100ms/best.th`](checkpoints/bafnetplus_100ms/best.th) | PyTorch Checkpoint | TAPS (100 ms) | 11.09 MiB | `52b954844efb...` |
| [`checkpoints/bafnetplus_100ms/config.yaml`](checkpoints/bafnetplus_100ms/config.yaml) | Hydra Config (Sanitized) | TAPS (100 ms) | 3.3 KiB | `7a43a967c270...` |
| [`checkpoints/vbx_bafnetplus_50ms/best.th`](checkpoints/vbx_bafnetplus_50ms/best.th) | PyTorch Checkpoint | Vibravox (50 ms) | 11.09 MiB | `220d47140941...` |
| [`checkpoints/vbx_bafnetplus_50ms/config.yaml`](checkpoints/vbx_bafnetplus_50ms/config.yaml) | Hydra Config (Sanitized) | Vibravox (50 ms) | 3.3 KiB | `fca0682a06a5...` |
| [`onnx/bafnetplus_50ms_fp32.onnx`](onnx/bafnetplus_50ms_fp32.onnx) | Streaming ONNX | TAPS (50 ms) | 12.20 MiB | `e94ea811014d...` |
| [`onnx/bafnetplus_50ms_fp32.onnx.json`](onnx/bafnetplus_50ms_fp32.onnx.json) | ONNX Sidecar | TAPS (50 ms) | 103.3 KiB | `d49024ccd7a0...` |
Integrity verification:
```bash
sha256sum -c SHA256SUMS.txt
```
See [`manifest.json`](manifest.json) for machine-readable byte sizes, MD5 digests, and SHA-256 checksums.
---
## Benchmark Summary
### TAPS Multi-SNR & Cross-Platform Latency Tiers (16 kHz)
| Model ID | $T_{\text{alg}}$ | $\rho$ | Chunk | TAPS 0 dB PESQ | TAPS 0 dB STOI | TAPS $-10$ dB PESQ | GPU RTF | DSP RTF (p99) | CPU RTF (p99) |
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| `bafnetplus_12ms` | 12.5 ms | 0.975 | 2 frames | 3.369 | 0.953 | 3.026 | 0.46 | 1.60 (1.85) | 2.44 (2.56) |
| `bafnetplus_25ms` | 25 ms | 0.95 | 4 frames | 3.451 | 0.957 | 3.100 | 0.22 | 1.33 (1.57) | 1.84 (1.94) |
| `bafnetplus_50ms` *(default)* | 50 ms | 0.90 | 8 frames | 3.485 | 0.959 | 3.111 | 0.12 | 0.80 (0.94) | 1.11 (1.16) |
| `bafnetplus_75ms` | 75 ms | 0.84 | 12 frames | 3.484 | 0.959 | 3.119 | 0.08 | 0.61 (0.72) | 0.93 (0.97) |
| `bafnetplus_100ms` | 100 ms | 0.78 | 16 frames | 3.501 | 0.959 | 3.161 | 0.07 | 0.52 (0.58) | 0.87 (0.90) |
### Cross-Corpus Validation (Vibravox, 16 kHz)
| Model ID | $T_{\text{alg}}$ | $-20$ dB PESQ | $-10$ dB PESQ | $0$ dB PESQ | $+10$ dB PESQ | $+15$ dB PESQ |
|---|---:|---:|---:|---:|---:|---:|
| `vbx_bafnetplus_50ms` | 50 ms | 2.938 | 3.168 | 3.441 | 3.770 | 3.933 |
Model size and complexity: **2.782 M** parameters and **44.73 GMACs/s** at 16 kHz across all five TAPS latency tiers.
---
## Quickstart
### 1. Download from HuggingFace Hub
```bash
pip install huggingface_hub omegaconf torch
```
```python
from huggingface_hub import snapshot_download
local_dir = snapshot_download(repo_id="yskim3271/BAFNet-plus")
print("Downloaded BAFNet+ artifacts to:", local_dir)
```
### 2. PyTorch Loading (Self-Contained `config.yaml`)
Each checkpoint directory contains a sanitized, self-contained `config.yaml` with embedded `args_mapping` and `args_masking`, so no external pre-trained branch checkpoints are needed:
```python
from pathlib import Path
import torch
from omegaconf import OmegaConf
from src.checkpoint import ConfigDict, load_checkpoint, load_model
from src.stft import mag_pha_istft, mag_pha_stft
from src.utils import get_stft_args_from_config
ckpt_dir = Path(local_dir) / "checkpoints" / "bafnetplus_50ms"
cfg = OmegaConf.load(ckpt_dir / "config.yaml")
model_params = OmegaConf.to_container(cfg.model.param, resolve=True)
model_params["args_mapping"] = ConfigDict(model_params["args_mapping"])
model_params["args_masking"] = ConfigDict(model_params["args_masking"])
device = "cpu" # or "cuda"
model = load_model(cfg.model.model_lib, cfg.model.model_class, model_params, device=device)
model = load_checkpoint(model, str(ckpt_dir), "best.th", device=device)
model.eval()
stft_args = get_stft_args_from_config(cfg.model)
stft_args["compress_factor"] = float(cfg.compress_factor)
# Paired 16 kHz waveforms: bcs, noisy_acs of shape [1, T]
bcs = torch.randn(1, 16000, device=device)
noisy_acs = torch.randn(1, 16000, device=device)
with torch.inference_mode():
bcs_mag, bcs_pha, bcs_com = mag_pha_stft(bcs, **stft_args)
acs_mag, acs_pha, acs_com = mag_pha_stft(noisy_acs, **stft_args)
est_mag, est_pha, _ = model((bcs_com, acs_com))
enhanced = mag_pha_istft(est_mag, est_pha, **stft_args)
```
### 3. Streaming ONNX Quickstart (50 ms FP32 Functional-Stateful Graph)
The `onnx/bafnetplus_50ms_fp32.onnx` artifact is an opset-17 functional-stateful graph (`190` explicit states, `chunk_size=8`, `T_export=14`, `2,605` simplified nodes) paired with `onnx/bafnetplus_50ms_fp32.onnx.json`. Use `BAFNetPlusOrtStreaming` from the official codebase:
```bash
pip install onnxruntime
```
```python
from pathlib import Path
import torch
from src.models.streaming.onnx.ort_wrapper import BAFNetPlusOrtStreaming
onnx_path = Path(local_dir) / "onnx" / "bafnetplus_50ms_fp32.onnx"
streamer = BAFNetPlusOrtStreaming.from_onnx(str(onnx_path), device="cpu")
# Option A: Full-utterance streaming emulation (16 kHz mono tensors [T])
bcs_wav = torch.randn(32000)
acs_wav = torch.randn(32000)
enhanced_full = streamer.process_audio(bcs_wav, acs_wav)
# Option B: Chunk-by-chunk real-time processing (50 ms output step = 800 samples)
streamer.reset_state()
hop_samples = streamer.output_samples_per_chunk # 800 samples @ 16 kHz
out_chunks = []
for start in range(0, len(bcs_wav), hop_samples):
y = streamer.process_samples(
bcs_wav[start : start + hop_samples],
acs_wav[start : start + hop_samples],
)
if y is not None:
out_chunks.append(y)
```
---
## Citation
If you use these checkpoints, ONNX artifacts, or code in your research, please cite:
```bibtex
@article{Kim2026BAFNetPlus,
author = {Yunsik Kim and Youngseok Kim and Yoonyoung Chung},
title = {Low-Latency Body- and Air-Conducted Speech Enhancement via Automatic Level Balancing and Reliability-Guided Fusion},
journal = {IEEE/ACM Transactions on Audio, Speech, and Language Processing},
year = {2026},
note = {Submitted for publication}
}
@inproceedings{Kim2025BAFNet,
author = {Yunsik Kim and Yonghun Song and Yoonyoung Chung},
title = {{BAF-Net}: Body- and Air-Conducted Speech Enhancement with Dual-Branch Adaptive Fusion Network},
booktitle = {Proc. Interspeech},
year = {2025}
}
```
## License
Released under the [MIT License](https://opensource.org/licenses/MIT).
|