Skip to main content

Thin Plate Spline implementation with PyTorch

Project description

torch-tps

Lint and Test

Implementation of Thin Plate Spline. (See numpy implementation with thin-plate-spline library)

Install

Pip

$ pip install torch-tps

Conda

Not yet available

Getting started

import torch
from tps import ThinPlateSpline

# Some data
X_c = torch.normal(0, 1, (800, 3))
X_t = torch.normal(0, 2, (800, 2))
X = torch.normal(0, 1, (300, 3))

# Create the tps object
tps = ThinPlateSpline(alpha=0.0)  # 0 Regularization

# Fit the control and target points
tps.fit(X_c, X_t)

# Transform new points
Y = tps.transform(X)

Examples

We provide different examples in the example folder. (From interpolation, to multidimensional cases and image warping).

Image warping

The elastic deformation of TPS can be used for image warping. Here is an example of tps to increase/decrease the size of the center of the image or using random control points:

Input ImageIncreased ImageDecreased ImageWarped Image

Have a look at example/image_warping.py.

Build and Deploy

$ python -m build
$ python -m twine upload dist/*

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

torch_tps-1.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

torch_tps-1.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file torch_tps-1.1.1.tar.gz.

File metadata

  • Download URL: torch_tps-1.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for torch_tps-1.1.1.tar.gz
Algorithm Hash digest
SHA256 3f56699b6dc933b57b11e8ca59fe6165a052f818dff37867b1c88ce2b49437a4
MD5 b53e6a778aa8007a52a1a72406594b8d
BLAKE2b-256 634cc042b7b0c6e4c66626a945b2d734dd27be82401e800019899bcaa06d04a3

See more details on using hashes here.

File details

Details for the file torch_tps-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: torch_tps-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for torch_tps-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a6590a7e762721baa031a973c9f9345de16334c32e3158e78c78853568c2b0
MD5 1b8d6876830d19bbb48adac635de3d6a
BLAKE2b-256 a0fb4063b8b6c3ded06c7d4e613752527b08c4bbfb21107f5b0749cc6b2d1ddf

See more details on using hashes here.

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