Registry / ai-ml / pytorch-wavelets

pytorch-wavelets

JSON →
library1.3.0pypypiunverified

A port of the Dual-Tree Complex Wavelet Transform (DTCWT) toolbox to run on PyTorch, enabling wavelet-based image processing, denoising, and feature extraction with GPU support. Current version 1.3.0 (released 2021), with no recent releases since June 2021.

pip install pytorch-wavelets
INSTALL
IMPORT
SIG · PYTORCH-WAVELETS
P
pytorch-wavelets
ai-mlpythonv1.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DWTForward
from pytorch_wavelets import DWTForward
from pytorch_wavelets.dwt import DWTForward
DWTForward is exported at the package level
DWTInverse
from pytorch_wavelets import DWTInverse
from pytorch_wavelets.idwt import DWTInverse
DWTInverse is also at package level
DTCWTForward
from pytorch_wavelets import DTCWTForward
from pytorch_wavelets.dtcwt import DTCWTForward
DTCWT is the complex dual-tree transform; directly importable

Basic DWT forward and inverse on a random image batch

import torch from pytorch_wavelets import DWTForward, DWTInverse # Create a random image batch (B, C, H, W) x = torch.randn(2, 3, 64, 64) # Forward DWT with wavelet 'db1' (Haar) and 3 levels xfm = DWTForward(J=3, wave='db1', mode='zero') yl, yh = xfm(x) # yl: lowpass, yh: list of highpass components # Inverse DWT ifm = DWTInverse(wave='db1', mode='zero') recon = ifm((yl, yh)) # Check reconstruction error print(torch.abs(x - recon).max().item())
Debug
Known issues
breakingWavelet name 'db1' may not be recognized on some installations if PyWavelets is not installed. This package uses PyWavelets for wavelet filter banks.
fix
Install PyWavelets: pip install PyWavelets. Alternatively, use built-in wavelets like 'haar' (which always works).
affects: all
gotchaThe DTCWT functions (DTCWTForward, DTCWTInverse) require the 'dtcwt' backend (not always installed by default). Ensure you have the scipy dependency.
fix
Install scipy: pip install scipy. The dtcwt backend uses scipy for some operations.
affects: all
deprecatedThe 'require_grad' argument in DWTForward/DTCWTForward is deprecated and may be removed. Use the default behavior instead.
fix
Remove require_grad=True from calls; gradients are automatically handled via torch tensors.
affects: >=1.2.0
gotchaThe output of DWTForward is a tuple (yl, yh). yh is a list of highpass subbands per level. Many users mistakenly treat yh as a single tensor.
fix
Access highpass bands as yh[j] for level j, where j=0 corresponds to finest scale.
affects: all
Upgrade
Version history
1.3.0latest on PyPI · released Apr 13, 2023
Audit
Dependencies
torchrequiredCore dependency; package wraps PyTorch tensors and functions
numpyrequiredUsed for array conversions and scipy integration
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
pytorch-wavelets — pip install pytorch-wavelets · libregistry