Kymatio is a Python module for computing wavelet and scattering transforms.
It is built on top of PyTorch, but also has a fast CUDA backend via cupy and skcuda.
Use kymatio if you need a library that:
- integrates wavelet scattering in a deep learning architecture,
- supports 1-D, 2-D, and 3-D wavelets, and runs seamlessly on CPU and GPU hardware.
- A brief intro to wavelet scattering is provided in User Guide. For a list of publications see Publications.
Quick StartOn Linux or macOS, open a shell and run the instruction of kymatio.
In the Python intepreter, you may then call:
which should run without error if the package has been correctly installed.
Apply 2D scattering to a 32x32 random imageThe following code imports
Scattering2Dclass, which implements the 2D scattering transform. It then creates an instance of this class to compute the scattering transform at scale
J = 2of a
32x32image consisting of Gaussian white noise:
import torch from kymatio import Scattering2D scattering = Scattering2D(J=2, shape=(32, 32)) x = torch.randn(1, 1, 32, 32) Sx = scattering(x) print(Sx.size())
This should output:
torch.Size([1, 1, 81, 8, 8])
This corresponds to 81 scattering coefficients, each corresponding to an 8x8 image.
Check out the User Guide for more scattering transform examples.