Giter VIP home page Giter VIP logo

adriansroman / deepwavetorch Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 2.0 97.92 MB

DeepWave: A Recurrent Neural-Network for Real-Time Acoustic Imaging (PyTorch implementation)

License: Creative Commons Attribution 4.0 International

Jupyter Notebook 98.85% Python 1.15%
acoustic-imaging deep-learning gnns graphsignalprocessing pytorch pytorch-implementation sound-localization acoustic-camera

deepwavetorch's Introduction

DeepWave: A Recurrent Neural-Network for Real-Time Acoustic Imaging (PyTorch)

This repository contains a PyTorch implementation of the DeepWave model originally published at NeurIPS 2019

| paper | original code |

Get started with DeepWave (PyTorch) inference

Open In Colab

Main building blocks:

  • SphericalChebConv: Spherical Chebyshev graph convolutions
  • BackProjLayer: project correlation matrix into image form (intensity map form)
  • ReTanh: Rectified hyperbolic tangent action function
  • DeepWave: the actual model architecture

DeepWave (PyTorch) architecture:

Deepwave: input=S (visibility matrix), trainable={mu, D, tau}
    y <- BackProjLayer(S) 
conv4 <- SphericalChebConv(I_init) + y
conv4 <- ReTanh(conv4)
conv3 <- SphericalChebConv(conv4) + y
conv3 <- ReTanh(conv3)
conv2 <- SphericalChebConv(conv3) + y
conv2 <- ReTanh(conv2)
conv1 <- SphericalChebConv(conv2) + y
conv1 <- ReTanh(conv1)
conv0 <- SphericalChebConv(conv1) + y
I_out <- ReTanh(conv0)

Many of the operations used in this implementation were borrowed from the repository deepsphere-pytorch.

Installation

First time setup

Create a Python virtual environment

python3 -m venv /path/to/your_new_venv

Start your_new_venv

source /path/to/<your_new_venv>/bin/activate
  • Clone DeepWaveTorch (this repo!).
git clone [email protected]:adrianSRoman/DeepWaveTorch.git 
  • Initialize submodules
git submodule init
  • Start ImoT_tools: plotting library used to nicely visualize DeepWave's output
cd ImoT_tools
pip install -r requirements.txt
python3 setup.py develop
  • Start DeepWave: original DeepWave implementation. Used for benchmarking against the PyTorch implementation. Data loaders are also re-used from the original implementation.
cd DeepWave
python3 setup.py develop
  • Start DeepWaveTorch: new DeepWave PyTorch implementation.
cd DeepWaveTorch
pip install -r requirements.txt
python3 setup.py develop

Executing example notebooks

  • Start your_new_venv
source /path/to/<your_new_venv>/bin/activate
  • Create a Jupyter Kernel to contain your required packages (first time setup only)
pip install ipykernel
ipython kernel install --user --name=<your_new_kernel_name>
  • Start Jupyter
jupyter notebook
  • Select a given notebook you want to work with
  • Select your_new_kernel_name under: Kernel > Change kernel > your_new_kernel_name

Extracting visibility matrices (DeepWave's input)

Extracting visibility matrices S is perhaps the main aspect you will need because they are DeepWave's input! To save you some time we created a simple notebook that for a given audio track of M microphones and N samples (we use an eigenmike32), it generates a visibility matrix (MxM) over 100 msec audio frames. Open In Colab

Note: the data extraction for the experiments in this repo (including extracting visibility matrices) was done using the run.sh files from the original DeepWave code see example run.sh. The run.sh files perform three tasks:

(1) Extract data from a mic array of N channels to generate visibility matrices S (this is what DeepWave takes as input). Extract a ground truth intensity field I which DeepWave learns how to generate. The script will then generate a .npz file.

(2) Merge datasets in single .npz files for the 9 different extracted frequency bands across all tracks.

(3) Train the original DeepWave model. After training is done, you will find .npz files containing the trained weights of the model for each frequency band.

Overall, you can either use the colab notebook to extract visibility matrices, or execute the run.sh scripts from the original DeepWave repo (you choose).

Qualitative and quantitative comparison against the original DeepWave implementation

Qualitatively, the implementation from this repository generates the same intensity fields as the original DeepWave implementation.

Inferred intensity field for a single frequency band: DeepWave original Vs. DeepWave PyTorch

YouTube presentation

Mexico LatAm BISH Bash: DeepWave

License

Shield: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0

deepwavetorch's People

Contributors

adriansroman avatar iranroman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

iranroman baekms

deepwavetorch's Issues

TODO list

  • add setup.py to be able to pip install -e .
  • link to colab notebook with inference examples on LOCATA, FRIDA, and DCASE 2022
  • add examples that qualitatively show that this implementation is the same as the original

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.