Direct design of biquad filter cascades with deep learning by sampling random polynomials.

Related tags

Deep Learning IIRNet
Overview

IIRNet

Direct design of biquad filter cascades with deep learning by sampling random polynomials.

License Open In Colab arXiv

Usage

git clone https://github.com/csteinmetz1/IIRNet.git
pip install .

Filter design

Start designing filters with just a few lines of code. In this example (demos/basic.py ) we create a 32nd order IIR filter to match an arbitrary response that we define over a few points. Internally, this specification will be interpolated to 512 points.

import torch
import numpy as np
import scipy.signal
import matplotlib.pyplot as plt
from iirnet.designer import Designer

# first load IIRNet with pre-trained weights
designer = Designer()

n = 32  # Desired filter order (4, 8, 16, 32, 64)
m = [0, -3, 0, 12, 0, -6, 0]  # Magnitude response specification
mode = "linear"  # interpolation mode for specification
output = "sos"  # Output type ("sos", or "ba")

# now call the designer with parameters
sos = designer(n, m, mode=mode, output=output)

# measure and plot the response
w, h = scipy.signal.sosfreqz(sos.numpy(), fs=2)

# interpolate the target for plotting
m_int = torch.tensor(m).view(1, 1, -1).float()
m_int = torch.nn.functional.interpolate(m_int, 512, mode=mode)

fig, ax = plt.subplots(figsize=(6, 3))
plt.plot(w, 20 * np.log10(np.abs(h)), label="Estimation")
plt.plot(w, m_int.view(-1), label="Specification")
# .... more plotting ....

See demos/basic.py for the full script.

Training

We provide a set of shell scripts that will launch training jobs that reproduce the experiments from the paper in configs/. These should be launched from the top level after installing.

./configs/train_hidden_dim.sh
./configs/filter_method.sh
./configs/filter_order.sh

Evaluation

Running the evaluation will require both the pre-trained models (or models you trained yourself) along with the HRTF and Guitar cabinet datasets. These datasets can be downloaded as follows:

First, change to the data directory and then run the download script.

cd data
./dl.sh

Note, you may need to install 7z if you don't already have it. brew install p7zip on macOS

Next download the pre-trained checkpoints if you haven't already.

mkdir logs
cd logs 
wget https://zenodo.org/record/5550275/files/filter_method.zip
wget https://zenodo.org/record/5550275/files/filter_order.zip
wget https://zenodo.org/record/5550275/files/hidden_dim.zip

unzip filter_method.zip
unzip filter_order.zip
unzip hidden_dim.zip

rm filter_method.zip
rm filter_order.zip
rm hidden_dim.zip

Now you can run the evaluation on checkpoints from the three different experiments as follows.

python eval.py logs/filter_method --yw --sgd --guitar_cab --hrtf --filter_order 16
python eval.py logs/hidden_dim --yw --sgd --guitar_cab --hrtf --filter_order 16

For the filter order experiment we need to run the eval script across all models for every order.

python eval.py logs/filter_order --guitar_cab --hrtf --filter_order 4
python eval.py logs/filter_order --guitar_cab --hrtf --filter_order 8
python eval.py logs/filter_order --guitar_cab --hrtf --filter_order 16
python eval.py logs/filter_order --guitar_cab --hrtf --filter_order 32
python eval.py logs/filter_order --guitar_cab --hrtf --filter_order 64

Note: Requires PyTorch >=1.8

Filter methods

ID Sampling method Name
(A) Normal coefficients normal_poly
(B) Normal biquads normal_biquad
(C) Uniform disk uniform_disk
(D) Uniform magnitude disk uniform_mag_disk
(E) Characteristic char_poly
(F) Uniform parametric uniform_parametric

Citation

 @article{colonel2021iirnet,
    title={Direct design of biquad filter cascades with deep learning by sampling random polynomials},
    author={Colonel, Joseph and Steinmetz, Christian J. and Michelen, Marcus and Reiss, Joshua D.},
    booktitle={arXiv:2110.03691},
    year={2021}}
You might also like...
This respository includes implementations on Manifoldron: Direct Space Partition via Manifold Discovery
This respository includes implementations on Manifoldron: Direct Space Partition via Manifold Discovery

Manifoldron: Direct Space Partition via Manifold Discovery This respository includes implementations on Manifoldron: Direct Space Partition via Manifo

Direct application of DALLE-2 to video synthesis, using factored space-time Unet and Transformers

DALLE2 Video (wip) ** only to be built after DALLE2 image is done and replicated, and the importance of the prior network is validated ** Direct appli

Pytorch Implementation of Continual Learning With Filter Atom Swapping (ICLR'22 Spolight) Paper
Pytorch Implementation of Continual Learning With Filter Atom Swapping (ICLR'22 Spolight) Paper

Continual Learning With Filter Atom Swapping Pytorch Implementation of Continual Learning With Filter Atom Swapping (ICLR'22 Spolight) Paper If find t

Little Ball of Fur - A graph sampling extension library for NetworKit and NetworkX (CIKM 2020)
Little Ball of Fur - A graph sampling extension library for NetworKit and NetworkX (CIKM 2020)

Little Ball of Fur is a graph sampling extension library for Python. Please look at the Documentation, relevant Paper, Promo video and External Resour

The Python ensemble sampling toolkit for affine-invariant MCMC

emcee The Python ensemble sampling toolkit for affine-invariant MCMC emcee is a stable, well tested Python implementation of the affine-invariant ense

Code for ICLR 2021 Paper,
Code for ICLR 2021 Paper, "Anytime Sampling for Autoregressive Models via Ordered Autoencoding"

Anytime Autoregressive Model Anytime Sampling for Autoregressive Models via Ordered Autoencoding , ICLR 21 Yilun Xu, Yang Song, Sahaj Gara, Linyuan Go

《LightXML: Transformer with dynamic negative sampling for High-Performance Extreme Multi-label Text Classification》(AAAI 2021) GitHub:

LightXML: Transformer with dynamic negative sampling for High-Performance Extreme Multi-label Text Classification

Symbolic Parallel Adaptive Importance Sampling for Probabilistic Program Analysis in JAX

SYMPAIS: Symbolic Parallel Adaptive Importance Sampling for Probabilistic Program Analysis Overview | Installation | Documentation | Examples | Notebo

Official PyTorch implementation for FastDPM, a fast sampling algorithm for diffusion probabilistic models

Official PyTorch implementation for "On Fast Sampling of Diffusion Probabilistic Models". FastDPM generation on CIFAR-10, CelebA, and LSUN datasets. S

Comments
  • Add files via upload

    Add files via upload

    Improving the synthetic dataset evaluation script, all models now evaluating same validation set, line-by-line readouts for MSE by filter method & total MSE across the sets, able to load models one-by-one from a lightning logs directory (though won't be able to handle the case of a missing version atm)

    opened by JTColonel 0
  • Adding synthetic dataset evaluation

    Adding synthetic dataset evaluation

    it's a rough sketch, still need to make sure all filters have a min_order set in the validation sampling, need to load and unload several models to automate the testing

    opened by JTColonel 0
  • Add files via upload

    Add files via upload

    -train.py now has a dictionary containing different training datasets, able to switch by filter type -train.sh reflects now setting '--filter_method = x' -data.py chaged IIRFilterDataset to include --min_order=None --ilter.py has several changes including degree N coefficient sampling and minimum orders for validation sampling -mlp.py now applies normalization to the zeros as well, giving us a model that outputs minimum phase filters

    opened by JTColonel 0
Owner
Christian J. Steinmetz
Building tools for musicians and audio engineers (often with machine learning). PhD Student at Queen Mary University of London.
Christian J. Steinmetz
Implement of "Training deep neural networks via direct loss minimization" in PyTorch for 0-1 loss

This is the implementation of "Training deep neural networks via direct loss minimization" published at ICML 2016 in PyTorch. The implementation targe

Cuong Nguyen 1 Jan 18, 2022
[NeurIPS 2021] “Improving Contrastive Learning on Imbalanced Data via Open-World Sampling”,

Improving Contrastive Learning on Imbalanced Data via Open-World Sampling Introduction Contrastive learning approaches have achieved great success in

VITA 24 Dec 17, 2022
Pytorch implementation of Straight Sampling Network For Point Cloud Learning (ICIP2021).

Pytorch code for SS-Net This is a pytorch implementation of Straight Sampling Network For Point Cloud Learning (ICIP2021). Environment Code is tested

Sun Ran 1 May 18, 2022
Code for the paper "JANUS: Parallel Tempered Genetic Algorithm Guided by Deep Neural Networks for Inverse Molecular Design"

JANUS: Parallel Tempered Genetic Algorithm Guided by Deep Neural Networks for Inverse Molecular Design This repository contains code for the paper: JA

Aspuru-Guzik group repo 55 Nov 29, 2022
DeepCAD: A Deep Generative Network for Computer-Aided Design Models

DeepCAD This repository provides source code for our paper: DeepCAD: A Deep Generative Network for Computer-Aided Design Models Rundi Wu, Chang Xiao,

Rundi Wu 85 Dec 31, 2022
DLL: Direct Lidar Localization

DLL: Direct Lidar Localization Summary This package presents DLL, a direct map-based localization technique using 3D LIDAR for its application to aeri

Service Robotics Lab 127 Dec 16, 2022
GDR-Net: Geometry-Guided Direct Regression Network for Monocular 6D Object Pose Estimation. (CVPR 2021)

GDR-Net This repo provides the PyTorch implementation of the work: Gu Wang, Fabian Manhardt, Federico Tombari, Xiangyang Ji. GDR-Net: Geometry-Guided

null 169 Jan 7, 2023
This repository contains codes of ICCV2021 paper: SO-Pose: Exploiting Self-Occlusion for Direct 6D Pose Estimation

SO-Pose This repository contains codes of ICCV2021 paper: SO-Pose: Exploiting Self-Occlusion for Direct 6D Pose Estimation This paper is basically an

shangbuhuan 52 Nov 25, 2022