Coder Social home page Coder Social logo

tingyuansen / kymatio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kymatio/kymatio

1.0 1.0 0.0 1.6 MB

Wavelet scattering transforms in Python with GPU acceleration

Home Page: https://kymat.io

License: BSD 3-Clause "New" or "Revised" License

Python 99.24% Shell 0.52% Dockerfile 0.24%

kymatio's Introduction

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. Scattering transforms are translation-invariant signal representations implemented as convolutional networks whose filters are not learned, but fixed (as wavelet filters).

PyPI License Build Status Downloads codecov

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.

Flexibility

The Kymatio organization associates the developers of several pre-existing 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).

Currently, there are two available backends, PyTorch (CPU and GPU) and scikit-cuda (GPU only).

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 for significant speedups in computing the scattering transform. The current speedup with respect to CPU-based MATLAB code is of the order of 10 in 1D and 3D and of the order of 100 in 2D.

We refer to our official benchmarks for further details.

How to cite

If you use this package, please cite the following paper:

Andreux M., Angles T., Exarchakis G., Leonarduzzi R., Rochette G., Thiry L., Zarka J., Mallat S., Andén J., Belilovsky E., Bruna J., Lostanlen V., Hirn M. J., Oyallon E., Zhang S., Cella C., Eickenberg M. (2019). Kymatio: Scattering Transforms in Python. arXiv preprint arXiv:1812.11214. (paper)

Installation

Dependencies

Kymatio requires:

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

Standard installation (on CPU hardware)

We strongly recommend running Kymatio in an Anaconda environment, because this simplifies the installation of PyTorch. This is most easily achieved by running

conda install pytorch torchvision -c pytorch

Once PyTorch is installed, you may install the latest version of Kymatio 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 officially supported operating systems.

GPU acceleration

To run Kymatio on a graphics processing unit (GPU), you can either use the PyTorch-style cuda() method to move your object to GPU. For extra speed, 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 operate on a variety of backends for tensor 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).

The two available backends are PyTorch (torch) and scikit-cuda (skcuda).

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

Installation from source

Assuming PyTorch is already installed (see above) and the Kymatio source has been downloaded, you may install it by running

pip install -r requirements.txt
python setup.py install

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

Support

We wish to thank the Scientific Computing Core at the Flatiron Institute for the use of their computing resources for testing.

Flatiron

We would also like to thank École Normale Supérieure for their support.

ENS

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.

kymatio's People

Contributors

janden avatar eickenberg avatar szagoruyko avatar lostanlen avatar edouardoyallon avatar eugenium avatar louity avatar andreuxmath avatar f0k avatar tomas-angles avatar dylex avatar gabrielhuang avatar johmathe avatar tingyuansen avatar nshervt avatar rleonarduzzi avatar florentinguth avatar grlee77 avatar jonas1312 avatar gexarcha avatar

Stargazers

Rohan Naidu avatar

Watchers

James Cloos avatar

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.