Skip to main content

Tensorflow 2.0 implementation of Sinusodial Representation networks (SIREN).

Project description

Tensorflow Sinusodial Representation Networks (SIREN)

Tensorflow 2.0 implementation of Sinusodial Representation networks (SIREN) from the paper Implicit Neural Representations with Periodic Activation Functions.

Usage

Copy the tf_siren folder to your local directory and import either SinusodialRepresentationDense or SIRENModel.

from tf_siren.siren import SinusodialRepresentationDense
from tf_siren.siren_mlp import SIRENModel

# You can use SinusodialRepresentationDense exactly like you ordinarily use Dense layers.
ip = tf.keras.layers.Input(shape=[2])
x = SinusodialRepresentationDense(32,
                                  activation='sine', # default activation function
                                  w0=1.0)(ip)        # w0 represents sin(w0 * x) where x is the input.

model = tf.keras.Model(inputs=ip, outputs=x)

# Or directly use the model class to build a multi layer SIREN
model = SIRENModel(units=256, final_units=3, final_activation='sigmoid',
                   num_layers=5, w0=1.0, w0_initial=30.0)

Results on Image Inpainting task

A partial implementation of the image inpainting task is available as the train_inpainting_siren.py and eval_inpainting_siren.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 root of the project directory.

These weights generates the following output after 5000 epochs of training with batch size 8192 while using only 10% of the available pixels in the image during training phase.

Requirements

Tensorflow 2.0+ Matplotlib to visualize eval result

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tf_siren-0.0.1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

tf_siren-0.0.1-py2.py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page