Fast
Available wavelet families ―
Haar (haar)
Daubechies (db)
Symlets (sym)
Coiflets (coif)
Biorthogonal (bior)
Reverse biorthogonal (rbio)
Note ― The permissible input shapes are
The installation of the TFDWT
package is recommended inside a virtual environment with tensorflow[and-cuda]
installed at first.
Pre-installation checks (Tested in Gentoo and Debian bookworm)
- Create a new virtual enironment with a specific Python version (use the Python version supported by TensorFlow)
conda info --envs
env_name='tf219'
conda create -n $env_name python=3.12 ipykernel
# activate virtual environment
conda activate tf219
- Install TensorFlow using official guide in https://www.tensorflow.org/install/pip
# For GPU users
pip install tensorflow[and-cuda]
# Verify setup
python3 -c "import tensorflow as tf; print(f'{tf.config.list_physical_devices('GPU')}, \nTF version {tf.__version__}')"
Install TFDWT from PyPI (Option
pip install TFDWT
Install TFDWT from Github (Option
Download the package
git clone https://github.com/kkt-ee/TFDWT.git
Change directory to the downloaded TFDWT
cd TFDWT
Run the following command to install the TFDWT package
pip install .
Compute $\text{DWT}$ $1\text{D}$ and $\text{IDWT}$ $1\text{D}$ of batched, multichannel $x$ of shape $(\text{batch, length, channels})$
"""Perfect Reconstruction 1D DWT level-1 Filter bank"""
from TFDWT.DWTIDWT1Dv1 import DWT1D, IDWT1D
LH = DWT1D(wave='bior3.1')(x) # Analysis
x_hat = IDWT1D(wave='bior3.1')(LH) # Synthesis
Compute $\text{DWT}$ $2\text{D}$ and $\text{IDWT}$ $2\text{D}$ of batched, multichannel $x$ of shape $(\text{batch, height, width, channels})$
"""Perfect Reconstruction 2D DWT level-1 Filter bank"""
from TFDWT.DWTIDWT2Dv1 import DWT2D, IDWT2D
LLLHHLHH = DWT2D(wave=wave)(x) # Analysis
x_hat = IDWT2D(wave=wave)(LLLHHLHH) # Synthesis
Compute $\text{DWT}$ $3\text{D}$ and $\text{IDWT}$ $3\text{D}$ of batched, multichannel $x$ of shape $(\text{batch, height, width, depth, channels})$
"""Perfect Reconstruction 3D DWT level-1 Filter bank"""
from TFDWT.DWTIDWT3Dv1 import DWT3D, IDWT3D
LLLLLHLHLLHHHLLHLHHHLHHH = DWT3D(wave=wave)(x) # Analysis
x_hat = IDWT3D(wave=wave)(LLLLLHLHLLHHHLLHLHHHLHHH) # Synthesis
NOTE ― Using the above forward and inverse transforms the above
Python 3.12.7
TensorFlow 2.15 to 2.19
Keras 2 and 3
Numpy 2.0.2
CUDA 12.5.1
pip uninstall TFDWT
TFDWT (C) 2025 Kishore Kumar Tarafdar, Prime Minister's Research Fellow, EE, IIT Bombay, भारत 🇮🇳