Skip to main content

tensorflow-wavelets is an implementation of Custom Layers for Neural Networks:

  • Discrete Wavelets Transform Layer
  • Duel Tree Complex Wavelets Transform Layer
  • Multi Wavelets Transform Layer

git clone https://github.com/Timorleiderman/tensorflow-wavelets.git
cd tensorflow-wavelets
pip install -r requirements.txt

Installation

tested with python 3.8

pip install tensorflow-wavelets

Usage

from tensorflow import keras
import tensorflow_wavelets.Layers.DWT as DWT
import tensorflow_wavelets.Layers.DTCWT as DTCWT
import tensorflow_wavelets.Layers.DMWT as DMWT

# Custom Activation function Layer
import tensorflow_wavelets.Layers.Threshold as Threshold

Examples

DWT(name="haar", concat=0)

"name" can be found in pywt.wavelist(family)

concat = 0 means to split to 4 smaller layers

from tensorflow import keras
model = keras.Sequential()
model.add(keras.Input(shape=(28, 28, 1)))
model.add(DWT.DWT(name="haar",concat=0))
model.add(keras.layers.Flatten())
model.add(keras.layers.Dense(nb_classes, activation="softmax"))
model.summary()
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
dwt_9_haar (DWT)             (None, 14, 14, 4)         0
_________________________________________________________________
flatten_9 (Flatten)          (None, 784)               0
_________________________________________________________________
dense_9 (Dense)              (None, 10)                7850
=================================================================
Total params: 7,850
Trainable params: 7,850
Non-trainable params: 0
_________________________________________________________________

name = "db4" concat = 1


model = keras.Sequential()
model.add(keras.layers.InputLayer(input_shape=(28, 28, 1)))
model.add(DWT.DWT(name="db4", concat=1))
model.summary()
Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
dwt_db4 (DWT)                (None, 34, 34, 1)         0
=================================================================
Total params: 0
Trainable params: 0
Non-trainable params: 0
_________________________________________________________________

DMWT

functional example with Sure Threshold


x_inp = keras.layers.Input(shape=(512, 512, 1))
x = DMWT.DMWT("ghm")(x_inp)
x = Threshold.Threshold(algo='sure', mode='hard')(x) # use "soft" or "hard"
x = DMWT.IDMWT("ghm")(x)
model = keras.models.Model(x_inp, x, name="MyModel")
model.summary()
Model: "MyModel"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         [(None, 512, 512, 1)]     0
_________________________________________________________________
dmwt (DMWT)                  (None, 1024, 1024, 1)     0
_________________________________________________________________
sure_threshold (SureThreshol (None, 1024, 1024, 1)     0
_________________________________________________________________
idmwt (IDMWT)                (None, 512, 512, 1)       0
=================================================================
Total params: 0
Trainable params: 0
Non-trainable params: 0
_________________________________________________________________

PyPi upload:

pip install --upgrade build
pip install --upgrade twine
python -m build
python -m twine upload --repository pypi dist/*

If our open source codes are helpful for your research, please cite our technical report:

@Article{e26100836,
AUTHOR = {Leiderman, Timor and Ben Ezra, Yosef},
TITLE = {Information Bottleneck Driven Deep Video Compression—IBOpenDVCW},
JOURNAL = {Entropy},
VOLUME = {26},
YEAR = {2024},
NUMBER = {10},
ARTICLE-NUMBER = {836},
URL = {https://www.mdpi.com/1099-4300/26/10/836},
ISSN = {1099-4300},
DOI = {10.3390/e26100836}
}

Free Software, Hell Yeah!

Metadata

Release files for tensorflow-wavelets 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tensorflow-wavelets 1.1.2
File Size Uploaded Provenance Actions
tensorflow_wavelets-1.1.2.tar.gz 23.0 kB With provenance Details for tensorflow_wavelets-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tensorflow-wavelets 1.1.2
File Interpreter ABI Platform Actions
tensorflow_wavelets-1.1.2-py3-none-any.whl Python 3 none any Details for tensorflow_wavelets-1.1.2-py3-none-any.whl

Total release size: 50.7 kB

Release files / tensorflow_wavelets-1.1.2.tar.gz

Download URL tensorflow_wavelets-1.1.2.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
26cca2abcb4b12ae5e51b9e15424366d6a3480cea01bf275de04a9610ccc51ad
BLAKE2b-256 checksum
How to use checksums
afb807e7ea5dce737801ac0308aa1ed23388727b4c46a69a66de5bcb1999900e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 7, 2025.

Transparency log

Release files / tensorflow_wavelets-1.1.2-py3-none-any.whl

Download URL tensorflow_wavelets-1.1.2-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9155e612edb6221a4244cae0aa9fdde1bb7aad955f246638f1281fee0c209b30
BLAKE2b-256 checksum
How to use checksums
b8162206ea1ad351861564a329aa6b90fc95f79f8f0ab0eb135286df2e3ab9af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 7, 2025.

Transparency log

Security for tensorflow-wavelets 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tensorflow_wavelets-1.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 7, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page