Skip to main content

splender

arXiv PyPI

Fit splines to images and videos through differentiable rendering.

splender

Usage

Here is a basic example of trying to fit the number of 5 of the MNIST dataset.

import splender
import jax
from PIL import Image
import numpy as np

image = Image.open('img_5.png')
image = np.array(image, dtype=np.float32) / 255.0

init_splines = splender.knot_init.get_splines_from_frame(image)[0][:, ::-1]
init_splines = jax.numpy.array(init_splines, dtype=jax.numpy.float32)
init_knots = splender.knot_init.downsample_points(init_splines, 6)[None]

key = jax.random.key(42)
image = image[None]
init_knots = init_knots[None] / 28

model = splender.image.SplenderImage(key=key, init_knots=init_knots, res=28, global_scale=0.3)
model, _ = splender.optim.fit(model, image, video=False)
x_spline, y_spline, _ = model.fit_spline(model.loc_params[0, 0] + model.knot_params[0, 0])
s = jax.numpy.linspace(0, 1, 100) 
final_splines = jax.numpy.stack([x_spline(s), y_spline(s)], axis=-1)

resulting in

Some more elavorated example notebooks can be found under examples/

Installation

pip install splender

[!NOTE] If you want it to run on GPU, remember to install it alongside the correct jax version: pip install splender jax[cuda12]

Documentation

PENDING

For a more technical discussion on the model, please check out the paper

Citation

If you use splender in your research and need to reference it, please cite it as follows:

@article{zdyb2025splinerefinementdifferentiablerendering,
  title={Spline refinement with differentiable rendering},
  author={Frans Zdyb and Albert Alonso and Julius B. Kirkegaard},
  year={2025},
  eprint={2503.14525},
  archivePrefix={arXiv},
  primaryClass={eess.IV},
  url={https://arxiv.org/abs/2503.14525},
  journal={arXiv preprint arXiv:2503.14525},
}

License

Splender is licensed under the MIT License. See the LICENSE file for more details.

Metadata

Release files for splender 0.1.0

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

Source distribution (sdist)

Source distribution for splender 0.1.0
File Size Uploaded
splender-0.1.0.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for splender 0.1.0
File Interpreter ABI Platform
splender-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / splender-0.1.0.tar.gz

Download URL splender-0.1.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aee3be4f5f96bcdbc6a34ac4679e5bc626edd2d245c66d10fb7ac97516723677
BLAKE2b-256 checksum
How to use checksums
b35fd7dd4ef6797af3600f63c15ace983ebd9ecefbde1c4e462d8d6379bc383d
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 Jun 6, 2025.

Transparency log

Release files / splender-0.1.0-py3-none-any.whl

Download URL splender-0.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab59e1f44f3e45c20207596976d8a70c618d510d324638bbb065c363e8412bca
BLAKE2b-256 checksum
How to use checksums
7ae720e27edc528dcb27c29ca1410c09772f9614d94e660273fab06d6886da05
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 Jun 6, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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