Fourier-Bessel wavelet scattering transforms
Project description
fbscatnet
fbscatnet is a high-performance Python library for computing Fourier-Bessel wavelet scattering transforms. It generates robust, feature embeddings from 2D images, making it an ideal feature extractor for computer vision, biomedical imaging, and physics-based machine learning. This is a brand new project of mine that I have been working on for some time. I would love any criticism, improvements, corrections to both the code and the maths.
Features
- Novel Wavelet: New wavelet relying on Bessel basis functions.
- Hardware Accelerated: Seamlessly switch between multi-core CPU execution (
scipy/joblib) and GPU acceleration (cupy). - Highly Optimized: Vectorised filtering in the frequency domain for maximum throughput across large image batches.
- ML-Ready: Outputs flattened feature arrays directly compatible with
scikit-learn,xgboost, orpytorch.
Installation
Install the base package (CPU-only) via pip:
pip install fbscatnet
To enable GPU acceleration, install with the gpu extra (requires a CUDA-compatible GPU):
pip install fbscatnet[gpu]
Quickstart
Extracting features from a dataset takes just a few lines of code:
import numpy as np
import logging
from fbscatnet import FourierBesselWaveletBank, FourierBesselScatNet, logger_config
logger_config.enable_colored_logs(logging.DEBUG) # IMPORTANT: SET TO SEE LOGS
# 1. Create some dummy image data (e.g., 10 grayscale images of size 64x64)
images = np.random.rand(10, 64, 64)
# 2. Instantiate a Fourier-Bessel Wavelet Bank
# size: spatial dimension (64x64), m: angular order, k: radial roots
bank = FourierBesselWaveletBank(size=64, m=2, k=2, sigma=0.1)
# 3. Initialize the Scattering Network
# Use backend="gpu" if you installed with CuPy
net = FourierBesselScatNet(bank=bank, backend="cpu")
# 4. Generate feature embeddings
# downsize: spatial pooling factor (must evenly divide the image size)
features = net.generate_embeddings(images, downsize=4, use_multiprocessing=True)
print(f"Generated embeddings shape: {features.shape}")
# Output: (10, feature_dimension)
Visualising Wavelet Maps
If you want to inspect how the wavelet filters are interacting with your image at the first scattering order, fbscatnet includes a built-in plotting tool:
# Pass a single 2D image to visualize
single_image = images[0]
net.visualise_maps(single_image, downsize=4)
API Overview
Sphinx documentation at: https://smee18.github.io/FourierBesselWavelets/
The example folder also contains a full pipeline, classifying MNIST using the library
The pdf of my notes taken along this project contains an in-depth explanation of the mathematics behind these wavelets. Here you can find all derivations, proofs and useful information. Some stuff might seem trivial but my goal is to really expose all aspects so anyone new to wavelet theory can understand the mathematics behind these Fourier Bessel wavelets.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fbscatnet-1.0.0.tar.gz.
File metadata
- Download URL: fbscatnet-1.0.0.tar.gz
- Upload date:
- Size: 264.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c67f84a0c41389982e9ed6103aa615f0d1fdb1914ccca081ab92c2ef5e54766
|
|
| MD5 |
b4fe838f332c9aa8c50cc2be066f068a
|
|
| BLAKE2b-256 |
680964b34150e930e8eda264806c17b2c864a043307c47b32b16b394c782690d
|
Provenance
The following attestation bundles were made for fbscatnet-1.0.0.tar.gz:
Publisher:
publish.yaml on Smee18/FourierBesselWavelets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fbscatnet-1.0.0.tar.gz -
Subject digest:
3c67f84a0c41389982e9ed6103aa615f0d1fdb1914ccca081ab92c2ef5e54766 - Sigstore transparency entry: 2300050964
- Sigstore integration time:
-
Permalink:
Smee18/FourierBesselWavelets@08696e324cf95bfa07b2c49be4c1323c302dfd7a -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Smee18
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@08696e324cf95bfa07b2c49be4c1323c302dfd7a -
Trigger Event:
push
-
Statement type:
File details
Details for the file fbscatnet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fbscatnet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84d144441706a3fb0df7fe8e9798f07ae9821baa1229b37845c417a4e6d8b019
|
|
| MD5 |
7b36b72526a6a5d962d8481849f3ce79
|
|
| BLAKE2b-256 |
64fce32ade16076bc20e43eb1f1f2dbccc9faa6b3f5b63aff530627be36942db
|
Provenance
The following attestation bundles were made for fbscatnet-1.0.0-py3-none-any.whl:
Publisher:
publish.yaml on Smee18/FourierBesselWavelets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fbscatnet-1.0.0-py3-none-any.whl -
Subject digest:
84d144441706a3fb0df7fe8e9798f07ae9821baa1229b37845c417a4e6d8b019 - Sigstore transparency entry: 2300051014
- Sigstore integration time:
-
Permalink:
Smee18/FourierBesselWavelets@08696e324cf95bfa07b2c49be4c1323c302dfd7a -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Smee18
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@08696e324cf95bfa07b2c49be4c1323c302dfd7a -
Trigger Event:
push
-
Statement type: