Welcome to fbscatnet’s Documentation!

API Reference

This section documents the core modules of the fbscatnet package.

Generate Bank

class fbscatnet.generate_bank.FourierBesselWaveletBank(size, m, k, sigma=0.3, norm='l1', verbose=False)[source]

Bases: object

A bank of Fourier-Bessel wavelets indexed by parameters m and k.

Parameters:
size

Image size.

Type:

int

m

Maximum order.

Type:

int

k

Maximum angular index.

Type:

int

sigma

Scale parameter for the wavelets.

Type:

float

verbose

Display wavelet diagnostic prints.

Type:

bool

wavelet_bank

Stored dictionary of wavelets.

Type:

dict[str, np.ndarray]

mk_to_key

Mapping from (m, k) tuples to string keys.

Type:

dict[tuple, str]

get_keys()[source]

Return the dictionary keys representing individual wavelets.

Returns:

View of the string keys.

Return type:

KeysView[str]

get_values()[source]

Return the collection of wavelet arrays.

Returns:

View of the wavelet numpy arrays.

Return type:

ValuesView[np.ndarray]

summary(verbose=True)[source]

Print an optional summary of the wavelet bank parameters and size.

Parameters:

verbose (bool, optional) – Whether to print summary details. Defaults to True.

Returns:

A tuple containing (m, k, sigma).

Return type:

tuple[int, int, float]

plot_bank()[source]

Plot the grid of wavelets using matplotlib.

Return type:

None

Scatnet

class fbscatnet.scatnet.FourierBesselScatNet(bank, backend='cpu')[source]

Bases: object

A scattering network based on Fourier-Bessel wavelets for generating image embeddings.

Parameters:
size

Image spatial size.

Type:

int

bank

The bank of Fourier-Bessel wavelets.

Type:

FourierBesselWaveletBank

num_filters

Total number of filters in the wavelet bank.

Type:

int

bank_keys

List of string keys representing the filters.

Type:

list[str]

low_pass

Low-pass filter array retrieved from the bank.

Type:

np.ndarray

final_features

Generated feature embeddings from the last run.

Type:

np.ndarray

generate_embeddings(data, downsize, batch_size=32, use_multiprocessing=False)[source]

Generate scattering network feature embeddings for a given dataset.

Parameters:
  • data (np.ndarray) – Input image dataset of shape (num_samples, height, width).

  • downsize (int) – Spatial downsampling factor via block mean pooling.

  • batch_size (int, optional) – Number of samples per batch. Defaults to 32.

  • use_multiprocessing (bool, optional) – Whether to use multiple CPU cores (Ignored if backend=’gpu’). Defaults to False.

Returns:

Flattened feature embeddings of shape (num_samples, feature_dim).

Return type:

np.ndarray

save_embeddings(path)[source]

Save the generated feature embeddings to a compressed .npz file.

Parameters:

path (str)

Return type:

None

visualise_maps(image, downsize)[source]

Visualises Order 0 and Order 1 scattering maps.

Parameters:
  • image (np.ndarray) – A single 2D image array (height, width).

  • downsize (int) – Spatial downsampling factor. Set to 1 for no downsampling.

Return type:

None

Indices and Tables