Fit splines to images and videos through differentiable rendering.
Project description
splender
Fit splines to images and videos through differentiable rendering.
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
jaxversion: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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file splender-0.1.0.tar.gz.
File metadata
- Download URL: splender-0.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee3be4f5f96bcdbc6a34ac4679e5bc626edd2d245c66d10fb7ac97516723677
|
|
| MD5 |
309a9296d6759cc03a8c3d61dd9bbe9b
|
|
| BLAKE2b-256 |
b35fd7dd4ef6797af3600f63c15ace983ebd9ecefbde1c4e462d8d6379bc383d
|
Provenance
The following attestation bundles were made for splender-0.1.0.tar.gz:
Publisher:
publish.yml on kirkegaardlab/splender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
splender-0.1.0.tar.gz -
Subject digest:
aee3be4f5f96bcdbc6a34ac4679e5bc626edd2d245c66d10fb7ac97516723677 - Sigstore transparency entry: 230524838
- Sigstore integration time:
-
Permalink:
kirkegaardlab/splender@764f1cb80277e998adf47b0053538ba430f22379 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kirkegaardlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@764f1cb80277e998adf47b0053538ba430f22379 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file splender-0.1.0-py3-none-any.whl.
File metadata
- Download URL: splender-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab59e1f44f3e45c20207596976d8a70c618d510d324638bbb065c363e8412bca
|
|
| MD5 |
88d5802e84c57252a6f2947f2474ce69
|
|
| BLAKE2b-256 |
7ae720e27edc528dcb27c29ca1410c09772f9614d94e660273fab06d6886da05
|
Provenance
The following attestation bundles were made for splender-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on kirkegaardlab/splender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
splender-0.1.0-py3-none-any.whl -
Subject digest:
ab59e1f44f3e45c20207596976d8a70c618d510d324638bbb065c363e8412bca - Sigstore transparency entry: 230524843
- Sigstore integration time:
-
Permalink:
kirkegaardlab/splender@764f1cb80277e998adf47b0053538ba430f22379 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kirkegaardlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@764f1cb80277e998adf47b0053538ba430f22379 -
Trigger Event:
workflow_dispatch
-
Statement type: