Kymatio: Scattering Transforms in Python

Mathieu Andreux, Tomás Angles, Georgios Exarchakis, Roberto Leonarduzzi, Gaspar Rochette, Louis Thiry, John Zarka, Stéphane Mallat, Joakim Andén, Eugene Belilovsky, Joan Bruna, Vincent Lostanlen, Muawiz Chaudhary, Matthew J. Hirn, Edouard Oyallon, Sixin Zhang, Carmine-Emanuele Cella, Michael EickenbergJMLR 2020

TL;DR

Kymatio is a new, high-performance Python library that makes the powerful wavelet scattering transform accessible to a wider audience. It provides a unified, user-friendly interface for 1D, 2D, and 3D signals, seamlessly integrating with popular deep learning frameworks like PyTorch and TensorFlow, and offering significant speedups on GPUs.

What Problem Does This Paper Address?

Many real-world signals, from images and audio to more complex data like molecular structures, exhibit inherent invariances to transformations like translation or rotation. Traditional machine learning models often struggle to capture these invariances, requiring extensive data augmentation or specialized architectures. The wavelet scattering transform offers a principled way to create signal representations that are inherently invariant to these transformations while preserving essential information. However, implementing these transforms, especially in multiple dimensions and for deep learning pipelines, has been complex and computationally demanding, limiting their widespread adoption. Kymatio aims to bridge this gap by providing an easy-to-use, efficient, and flexible software package.

Methods

Kymatio implements the scattering transform using a fixed, pre-defined convolutional network. This network consists of cascaded wavelet filters and non-linear modulus operations, followed by averaging low-pass filters. The core idea is that each layer of the network captures increasingly invariant features. Specifically, the first layer applies wavelet filters and a non-linearity to the input signal, producing first-order scattering coefficients. These coefficients are then filtered again, non-linearly transformed, and averaged to produce second-order coefficients, which are even more invariant. Kymatio focuses on second-order scattering coefficients, as higher-order ones typically contribute less to the overall representation.

Key methodological contributions of Kymatio include:

  • Unified API for 1D, 2D, and 3D: A single, consistent interface for applying scattering transforms across different signal dimensions.
  • Deep Learning Framework Integration: Seamless compatibility with PyTorch and TensorFlow/Keras, allowing scattering features to be directly used as inputs to neural networks.
  • GPU Acceleration: Optimized implementations for both CPUs and GPUs, with significant speedups reported for GPU usage.
  • Depth-First Traversal: An implementation strategy that reduces memory requirements, making it suitable for memory-constrained environments like GPUs.
  • Pythonic Implementation: A fully Python-based library, enhancing interoperability with the scientific Python ecosystem.

Datasets

The paper does not explicitly list specific datasets used for training or evaluation of Kymatio itself. However, it mentions that Kymatio can be used for various applications, including:

  • Image reconstruction and generation.
  • Hybrid scattering and CNN training on CIFAR and MNIST.
  • Regression of molecular properties on QM7/QM9.
  • Classifying recordings of spoken digits.

This indicates that Kymatio is designed to be a general-purpose tool applicable to a wide range of existing datasets.

Key Insights and Ideas

  • Invariance as a Feature: The scattering transform provides a principled way to build invariant representations, which is crucial for tasks where the exact position or orientation of features is less important than their presence and structure.
  • Computational Efficiency is Key: The paper highlights that while scattering transforms have strong theoretical properties, their practical adoption hinges on efficient implementation. Kymatio's focus on speed and memory footprint is therefore a significant contribution.
  • Bridging the Gap to Deep Learning: By integrating with PyTorch and TensorFlow, Kymatio democratizes the use of scattering features, allowing researchers to combine the strengths of handcrafted invariant features with the learning power of deep neural networks.
  • Depth-First for Memory: The depth-first traversal strategy is an elegant solution to a common bottleneck in deep learning and complex feature extraction, especially on hardware with limited memory.

Key Results

The paper emphasizes the usability and performance of Kymatio. While specific quantitative results on benchmark datasets are not detailed in this introductory paper, the key results are:

  • High-Performance Implementation: Kymatio offers a fast and efficient implementation of scattering transforms.
  • GPU Speedup: Significant speedups are achieved when running computations on GPUs compared to CPUs.
  • Broad Applicability: The library supports 1D, 2D, and 3D scattering transforms, making it versatile for various data types.
  • Seamless Integration: Compatibility with PyTorch and TensorFlow/Keras allows for easy incorporation into existing deep learning workflows.
  • User-Friendly Interface: The package is designed to be easy to use, well-documented, and includes extensive examples.

Limitations and Future Work

Limitations:

  • Focus on Second-Order Coefficients: Kymatio currently focuses on second-order scattering coefficients. While these capture most of the invariant energy, higher-order coefficients might be beneficial for certain tasks.
  • Fixed Filters: The filters used in the scattering transform are fixed and not learned. While this provides theoretical guarantees of invariance, it might limit adaptability compared to end-to-end learned models for specific tasks.

Future Work:

  • Further Optimization: Continued optimization for speed and backend support.
  • Flexibility: Enhancing flexibility in filter choices or network architectures.
  • New Applications: Exploring new applications in areas like generative modeling and 3D chemistry.

Summary updated

BibTeX
@article{andreux2020kymatio,
  author = {Mathieu Andreux and Tomás Angles and Georgios Exarchakis and Roberto Leonarduzzi and Gaspar Rochette and Louis Thiry and John Zarka and Stéphane Mallat and Joakim Andén and Eugene Belilovsky and Joan Bruna and Vincent Lostanlen and Muawiz Chaudhary and Matthew J. Hirn and Edouard Oyallon and Sixin Zhang and Carmine-Emanuele Cella and Michael Eickenberg},
  title = {{Kymatio: Scattering Transforms in Python}},
  journal = {J. Mach. Learn. Res.},
  year = {2020},
  url = {https://openreview.net/forum?id=os872LOqnU},
}
Figure