Tensorflow Fourier Feature Mapping Networks
Tensorflow 2.0 implementation of Fourier Feature Mapping networks from the paper Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains.
Installation
- Pip install
$ pip install --upgrade tf_fourier_features
- Pip install (test support)
$ pip install --upgrade tf_fourier_features[tests]
Usage
from tf_fourier_features import FourierFeatureProjection
from tf_fourier_features import FourierFeatureMLP
# You should use FourierFeatureProjection right after the input layer.
ip = tf.keras.layers.Input(shape=[2])
x = FourierFeatureProjection(gaussian_projection = 256, gaussian_scale = 1.0)(ip)
x = tf.keras.layers.Dense(256, activation='relu')(x)
x = tf.keras.layers.Dense(3, activation='sigmoid')(x)
model = tf.keras.Model(inputs=ip, outputs=x)
# Or directly use the model class to build a multi layer Fourier Feature Mapping Network
model = FourierFeatureMLP(units=256, final_units=3, final_activation='sigmoid', num_layers=4,
gaussian_projection=256, gaussian_scale=10.0)
Results on Image Inpainting task
A partial implementation of the image inpainting task is available as the train_inpainting_fourier.py and eval_inpainting_fourier.py scripts inside the scripts directory.
Weight files are made available in the repository under the Release tab of the project. Extract the weights and place the checkpoints folder at the scripts directory.
These weights generates the following output after 2000 epochs of training with batch size 8192 while using only 10% of the available pixels in the image during training phase.
If we train for using only 20% of the available pixels in the image during training phase -
If we train for using only 30% of the available pixels in the image during training phase - .
Citation
@misc{tancik2020fourier,
title={Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains},
author={Matthew Tancik and Pratul P. Srinivasan and Ben Mildenhall and Sara Fridovich-Keil and Nithin Raghavan and Utkarsh Singhal and Ravi Ramamoorthi and Jonathan T. Barron and Ren Ng},
year={2020},
eprint={2006.10739},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
Requirements
- Tensorflow 2.0+
- Matplotlib to visualize eval result
Metadata
Release files for tf-fourier-features 0.0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tf_fourier_features-0.0.2.1.tar.gz | 6.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tf_fourier_features-0.0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 12.9 kB
Release files / tf_fourier_features-0.0.2.1.tar.gz
| Download URL | tf_fourier_features-0.0.2.1.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dd78055117ee3164c611b7b7110dc66f2d6b755f93dcef3ee89a5ed0417f09c
|
|
BLAKE2b-256 checksum How to use checksums |
63155456dbac22fdef24a4ffc76e51c92fa7a26624bed43dcc58df35f1080d71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4
|
Release files / tf_fourier_features-0.0.2.1-py2.py3-none-any.whl
| Download URL | tf_fourier_features-0.0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6691b415c5e2b85c65e198c03bb3aa1a5f3897339b15ec557f8999a023e2d98a
|
|
BLAKE2b-256 checksum How to use checksums |
a1d0e5e907b7680a2f79c90f6a41ae1d744c358e254ee5bbfea45f1b1960cf01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4
|
Security for tf-fourier-features 0.0.2.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.