DeepFilterNet
A Low Complexity Speech Enhancement Framework for Full-Band Audio (48kHz) using on Deep Filtering.
News
-
Original DeepFilterNet Paper: DeepFilterNet: A Low Complexity Speech Enhancement Framework for Full-Band Audio based on Deep Filtering
- Paper: https://arxiv.org/abs/2110.05588
- Samples: https://rikorose.github.io/DeepFilterNet-Samples/
- Demo: https://huggingface.co/spaces/hshr/DeepFilterNet
- Video Lecture: https://youtu.be/it90gBqkY6k
-
New DeepFilterNet2 Paper: DeepFilterNet2: Towards Real-Time Speech Enhancement on Embedded Devices for Full-Band Audio
Usage
This framework supports Linux, MacOS and Windows. Training is only tested under Linux. The framework is structured as follows:
libDFcontains Rust code used for data loading and augmentation.DeepFilterNetcontains DeepFilterNet code training, evaluation and visualization as well as pretrained model weights.pyDFcontains a Python wrapper of libDF STFT/ISTFT processing loop.pyDF-datacontains a Python wrapper of libDF dataset functionality and provides a pytorch data loader.
PyPI
Install the DeepFilterNet python package via pip:
# Install cpu/cuda pytorch (>=1.8) dependency from pytorch.org, e.g.:
# Install DeepFilterNet
# Or install DeepFilterNet including data loading functionality for training (Linux only)
To enhance noisy audio files using DeepFilterNet run
# Specify an output directory with --output-dir [OUTPUT_DIR]
Manual Installation
Install cargo via rustup. Usage of a conda or virtualenv recommended.
Installation of python dependencies and libDF:
# Recommended: Install or activate a python env
# Mandatory: Install cpu/cuda pytorch (>=1.8) dependency from pytorch.org, e.g.:
# Install build dependencies used to compile libdf and DeepFilterNet python wheels
# Build and install libdf python package required for enhance.py
# Optional: Install libdfdata python package with dataset and dataloading functionality for training
# Required build dependency: HDF5 headers (e.g. ubuntu: libhdf5-dev)
# Install remaining DeepFilterNet python dependencies
# Alternatively for developement: Install only dependencies and work with the repository version
# You may need to set the python path
To enhance noisy audio files using DeepFilterNet run
)
# Enhance audio with original DeepFilterNet
# Enhance audio with DeepFilterNet2
Training
The entry point is DeepFilterNet/df/train.py. It expects a data directory containing HDF5 dataset
as well as a dataset configuration json file.
So, you first need to create your datasets in HDF5 format. Each dataset typically only holds training, validation, or test set of noise, speech or RIRs.
# Install additional dependencies for dataset creation
# Go to DeepFilterNet python package
///
# Prepare text file (e.g. called training_set.txt) containing paths to .wav files
#
# usage: prepare_data.py [-h] [--num_workers NUM_WORKERS] [--max_freq MAX_FREQ] [--sr SR] [--dtype DTYPE]
# [--codec CODEC] [--mono] [--compression COMPRESSION]
# type audio_files hdf5_db
#
# where:
# type: One of `speech`, `noise`, `rir`
# audio_files: Text file containing paths to audio files to include in the dataset
# hdf5_db: Output HDF5 dataset.
/ -- 48000
All datasets should be made available in one dataset folder for the train script.
The dataset configuration file should contain 3 entries: "train", "valid", "test". Each of those contains a list of datasets (e.g. a speech, noise and a RIR dataset). You can use multiple speech or noise dataset. Optionally, a sampling factor may be specified that can be used to over/under-sample the dataset. Say, you have a specific dataset with transient noises and want to increase the amount of non-stationary noises by oversampling. In most cases you want to set this factor to 1.
dataset.cfg
Finally, start the training script. The training script may create a model base_dir if not
existing used for logging, some audio samples, model checkpoints, and config. If no config file is
found, it will create a default config. See
DeepFilterNet/pretrained_models/DeepFilterNet
for a config file.
# usage: train.py [-h] [--debug] data_config_file data_dir base_dir
/ // /// ///
Citation Guide
Iy you use this framework, please cite: DeepFilterNet: A Low Complexity Speech Enhancement Framework for Full-Band Audio based on Deep Filtering
If you use the DeepFilterNet2 model, please cite: DeepFilterNet2: Towards Real-Time Speech Enhancement on Embedded Devices for Full-Band Audio
License
DeepFilterNet is free and open source! All code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option. This means you can select the license you prefer!
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.