All Projects → tomrunia → Pytorchwavelets

tomrunia / Pytorchwavelets

Licence: mit
PyTorch implementation of the wavelet analysis from Torrence & Compo (1998)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytorchwavelets

Mathnet Filtering
Math.NET Filtering (formerly Neodym)
Stars: ✭ 157 (-20.3%)
Mutual labels:  filtering, signal-processing
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (+287.82%)
Mutual labels:  filtering, signal-processing
Python-Adaptive-Signal-Processing-Handbook
Python adaptive signal processing tutorials
Stars: ✭ 80 (-59.39%)
Mutual labels:  signal-processing, filtering
Python Pesq
PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users (narrow band and wide band)
Stars: ✭ 144 (-26.9%)
Mutual labels:  signal-processing
Pycwt
A Python module for continuous wavelet spectral analysis. It includes a collection of routines for wavelet transform and statistical analysis via FFT algorithm. In addition, the module also includes cross-wavelet transforms, wavelet coherence tests and sample scripts.
Stars: ✭ 146 (-25.89%)
Mutual labels:  signal-processing
Audio Reactive Led Strip
🎵 🌈 Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
Stars: ✭ 2,217 (+1025.38%)
Mutual labels:  signal-processing
Rustfft
A mixed-radix FFT library written in pure Rust
Stars: ✭ 183 (-7.11%)
Mutual labels:  signal-processing
Signals And Systems Lecture
Continuous- and Discrete-Time Signals and Systems - Theory and Computational Examples
Stars: ✭ 166 (-15.74%)
Mutual labels:  signal-processing
Dla
Deep learning for audio processing
Stars: ✭ 142 (-27.92%)
Mutual labels:  signal-processing
Stocks
Programs for stock prediction and evaluation
Stars: ✭ 155 (-21.32%)
Mutual labels:  signal-processing
Pycbc
Core package to analyze gravitational-wave data, find signals, and study their parameters. This package was used in the first direct detection of gravitational waves (GW150914), and is used in the ongoing analysis of LIGO/Virgo data.
Stars: ✭ 177 (-10.15%)
Mutual labels:  signal-processing
Computer Vision Video Lectures
A curated list of free, high-quality, university-level courses with video lectures related to the field of Computer Vision.
Stars: ✭ 154 (-21.83%)
Mutual labels:  signal-processing
Vuejs Datatable
A Vue.js component for filterable and paginated tables.
Stars: ✭ 148 (-24.87%)
Mutual labels:  filtering
Brainflow
BrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
Stars: ✭ 170 (-13.71%)
Mutual labels:  signal-processing
Pycroscopy
Scientific analysis of nanoscale materials imaging data
Stars: ✭ 144 (-26.9%)
Mutual labels:  signal-processing
Tftb
A Python module for time-frequency analysis
Stars: ✭ 185 (-6.09%)
Mutual labels:  signal-processing
Entropy
EntroPy: complexity of time-series in Python (DEPRECATED)
Stars: ✭ 142 (-27.92%)
Mutual labels:  signal-processing
Nwaves
.NET library for 1D signal processing focused specifically on audio processing
Stars: ✭ 151 (-23.35%)
Mutual labels:  filtering
Vue Bootstrap4 Table
Advanced table based on Vue 2 and Bootstrap 4 ⚡️
Stars: ✭ 187 (-5.08%)
Mutual labels:  filtering
Resdet
Detect source resolution of upscaled images
Stars: ✭ 191 (-3.05%)
Mutual labels:  signal-processing

Continuous Wavelet Transforms in PyTorch

This is a PyTorch implementation for the wavelet analysis outlined in Torrence and Compo (BAMS, 1998). The code builds upon the excellent implementation of Aaron O'Leary by adding a PyTorch filter bank wrapper to enable fast convolution on the GPU. Specifically, the code was written to speed-up the CWT computation for a large number of 1D signals and relies on torch.nn.Conv1d for convolution.

PyTorch Wavelets

Citation

If you found this code useful, please cite our paper Repetition Estimation (IJCV, 2019):

@article{runia2019repetition,
  title={Repetition estimation},
  author={Runia, Tom FH and Snoek, Cees GM and Smeulders, Arnold WM},
  journal={International Journal of Computer Vision},
  volume={127},
  number={9},
  pages={1361--1383},
  year={2019},
  publisher={Springer}
}

Usage

In addition to the PyTorch implementation defined in WaveletTransformTorch the original SciPy version is also included in WaveletTransform for completeness. As the GPU implementation highly benefits from parallelization, the cwt and power methods expect signal batches of shape [num_signals,signal_length] instead of individual signals.

import numpy as np
from wavelets_pytorch.transform import WaveletTransform        # SciPy version
from wavelets_pytorch.transform import WaveletTransformTorch   # PyTorch version

dt = 0.1         # sampling frequency
dj = 0.125       # scale distribution parameter
batch_size = 32  # how many signals to process in parallel

# Batch of signals to process
batch = [batch_size x signal_length] 

# Initialize wavelet filter banks (scipy and torch implementation)
wa_scipy = WaveletTransform(dt, dj)
wa_torch = WaveletTransformTorch(dt, dj, cuda=True)

# Performing wavelet transform (and compute scalogram)
cwt_scipy = wa_scipy.cwt(batch)
cwt_torch = wa_torch.cwt(batch)

# For plotting, see the examples/plot.py function.
# ...

Supported Wavelets

The wavelet implementations are taken from here. Default is the Morlet wavelet.

Benchmark

Performing parallel CWT computation on the GPU using PyTorch results in a significant speed-up. Increasing the batch size will give faster runtimes. The plot below shows a comaprison between the scipy versus torch implementation as function of the batch size N and input signal length. These results were obtained on a powerful Linux desktop with NVIDIA Titan X GPU.

Installation

Clone and install:

git clone https://github.com/tomrunia/PyTorchWavelets.git
cd PyTorchWavelets
pip install -r requirements.txt
python setup.py install

Requirements

  • Python 2.7 or 3.6 (other versions might also work)
  • Numpy (developed with 1.14.1)
  • Scipy (developed with 1.0.0)
  • PyTorch >= 0.4.0

The core of the PyTorch implementation relies on the torch.nn.Conv1d module.

License

MIT License

Copyright (c) 2018 Tom Runia ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].