Skip to main content

Wavelet scattering transforms in Python with GPU acceleration

Project description

Kymatio: wavelet scattering in PyTorch

Kymatio is an implementation of the wavelet scattering transform in the Python programming language, suitable for large-scale numerical experiments in signal processing and machine learning.

Use Kymatio if you need a library that:

  • supports 1-D, 2-D, and 3-D wavelets,
  • integrates wavelet scattering in a deep learning architecture, and
  • runs seamlessly on CPU and GPU hardware.

What makes Kymatio different?

Kymatio stands out with respect to these other packages thanks to three assets: flexibility, portability, and scalability.

Flexibility

The Kymatio organization associates the developers of several pre-existing different packages for wavelet scattering, including ScatNet, scattering.m, PyScatWave, WaveletScattering.jl, and PyScatHarm.

The resort to PyTorch tensors as inputs to Kymatio allows the programmer to backpropagate the gradient of wavelet scattering coefficients, thus integrating them within an end-to-end trainable pipeline, such as a deep neural network.

Portability

Each of these algorithms is written in a high-level imperative paradigm, making it portable to any Python library for array operations as long as it enables complex-valued linear algebra and a fast Fourier transform (FFT).

As of the first stable version, NumPy and CuPy are the two available backends, for CPU and GPU hardware respectively.

Scalability

Kymatio integrates the construction of wavelet filter banks in 1D, 2D, and 3D, as well as memory-efficient algorithms for extracting wavelet scattering coefficients, under a common application programming interface.

Running Kymatio on a graphics processing unit (GPU) rather than a multi-core conventional computer processing unit (CPU) allows to speed up the scattering transform. As of the alpha release, the speedup with respect to CPU-based MATLAB code is of the order of 10 in 1D and of the order of 100 in 2D.

We refer to our official benchmarks for further details.

Installation

Dependencies

Kymatio requires:

  • Python (>= 3.6)
  • PyTorch (>= 0.4)
  • SciPy (>= 0.13)

Standard installation (on CPU hardware)

We strongly recommend running Kymatio in a Conda environment, because this simplifies the installation of PyTorch. One the aformentioned dependencies are installed, you may install the latest version of Kymatio by using the package manager pip, which will automatically download Kymatio from the Python Package Index (PyPI):

pip install kymatio

Linux and macOS are the two operating systems that are officially supported by Kymatio.

GPU acceleration

To run Kymatio on a graphics processing unit (GPU), you should install the CUDA library and install the scikit-cuda dependency by running the following pip command:

pip install scikit-cuda cupy

Then, set the KYMATIO_BACKEND to skcuda:

os.environ["KYMATIO_BACKEND"] = "skcuda"

Available backends: PyTorch and scikit-cuda

Kymatio is designed to interoperate on a variety of backends for array operations. The user may control the choice of backend at runtime by setting the environment variable KYMATIO_BACKEND, or by editing the Kymatio configuration file (~/.config/kymatio/kymatio.cfg on Linux).

At the time of alpha release, the two available backends are PyTorch (torch) and scikit-cuda (skcuda) for 1D scattering and 2D scattering, and PyTorch only for 3D scattering.

PyTorch is the default backend in 1D, 2D, and 3D scattering. Yet, for applications of the 2D scattering transform to large images (e.g. ImageNet, of size 224x224), we recommend the scikit-cuda backend, which is substantially faster than PyTorch.

Documentation

The documentation of Kymatio is officially hosted on the kymat.io website.

Online resources

Building the documentation from source.

The documentation can also be found in the doc/ subfolder of the GitHub repository. To build the documentation locally, please clone this repository and run

pip install -r requirements_optional.txt
cd doc; make clean; make html

Why the name, Kymatio?

Kyma (κύμα) means wave in Greek. By the same token, Kymatio (κυμάτιο) means wavelet.

Note that the organization and the library are capitalized (Kymatio) whereas the corresponding Python module is written in lowercase (import kymatio).

The recommended pronunciation for Kymatio is kim-ah-tio. In other words, it rhymes with patio, not with ratio.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kymatio-0.1.0a0.tar.gz (44.7 kB view details)

Uploaded Source

Built Distribution

kymatio-0.1.0a0-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file kymatio-0.1.0a0.tar.gz.

File metadata

  • Download URL: kymatio-0.1.0a0.tar.gz
  • Upload date:
  • Size: 44.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for kymatio-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 8b86b7b136e9790593831dfe2fe6e2d6a3b7eee4091fdd8c9b63518560ee8732
MD5 f13f8d4aa02d9a6ef42b7228da45d21f
BLAKE2b-256 7920e8d8ff0aa0f4635ac11a5d380637128b94d3537f0f2a460821ab4fa09088

See more details on using hashes here.

File details

Details for the file kymatio-0.1.0a0-py3-none-any.whl.

File metadata

  • Download URL: kymatio-0.1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for kymatio-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 62b8a06a2c4b47638603a30be6891c28b3150ee53b28bc485d6a97b7ef74835d
MD5 31bbb259a5f986457c8ca8591b5b7f8f
BLAKE2b-256 e1e0d466795f512735df1ba7482f37b92d8162d870036f94d0ea8136f9f2ce04

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page