torch-tps


Nametorch-tps JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/raphaelreme/torch-tps
SummaryThin Plate Spline implementation with PyTorch
upload_time2024-04-26 09:19:34
maintainerNone
docs_urlNone
authorRaphael Reme
requires_python>=3.7
licenseMIT
keywords interpolation pytorch machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # torch-tps

[![Lint and Test](https://github.com/raphaelreme/torch-tps/actions/workflows/tests.yml/badge.svg)](https://github.com/raphaelreme/torch-tps/actions/workflows/tests.yml)

Implementation of Thin Plate Spline.
(See numpy implementation with [thin-plate-spline](https://github.com/raphaelreme/tps) library)


## Install

### Pip

```bash
$ pip install torch-tps
```

### Conda

Not yet available


## Getting started

```python

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 Image](example/images/dog_with_bbox.png)![Increased Image](example/images/increase_warped_dog.png)![Decreased Image](example/images/decrease_warped_dog.png)![Warped Image](example/images/random_warped_dog.png)

Have a look at `example/image_warping.py`.

## Build and Deploy

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/raphaelreme/torch-tps",
    "name": "torch-tps",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "interpolation, pytorch, machine learning",
    "author": "Raphael Reme",
    "author_email": "raphaelreme-dev@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/63/4c/c042b7b0c6e4c66626a945b2d734dd27be82401e800019899bcaa06d04a3/torch_tps-1.1.1.tar.gz",
    "platform": null,
    "description": "# torch-tps\n\n[![Lint and Test](https://github.com/raphaelreme/torch-tps/actions/workflows/tests.yml/badge.svg)](https://github.com/raphaelreme/torch-tps/actions/workflows/tests.yml)\n\nImplementation of Thin Plate Spline.\n(See numpy implementation with [thin-plate-spline](https://github.com/raphaelreme/tps) library)\n\n\n## Install\n\n### Pip\n\n```bash\n$ pip install torch-tps\n```\n\n### Conda\n\nNot yet available\n\n\n## Getting started\n\n```python\n\nimport torch\nfrom tps import ThinPlateSpline\n\n# Some data\nX_c = torch.normal(0, 1, (800, 3))\nX_t = torch.normal(0, 2, (800, 2))\nX = torch.normal(0, 1, (300, 3))\n\n# Create the tps object\ntps = ThinPlateSpline(alpha=0.0)  # 0 Regularization\n\n# Fit the control and target points\ntps.fit(X_c, X_t)\n\n# Transform new points\nY = tps.transform(X)\n```\n\n## Examples\n\nWe provide different examples in the `example` folder. (From interpolation, to multidimensional cases and image warping).\n\n\n### Image warping\n\nThe 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:\n\n![Input Image](example/images/dog_with_bbox.png)![Increased Image](example/images/increase_warped_dog.png)![Decreased Image](example/images/decrease_warped_dog.png)![Warped Image](example/images/random_warped_dog.png)\n\nHave a look at `example/image_warping.py`.\n\n## Build and Deploy\n\n```bash\n$ python -m build\n$ python -m twine upload dist/*\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Thin Plate Spline implementation with PyTorch",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/raphaelreme/torch-tps"
    },
    "split_keywords": [
        "interpolation",
        " pytorch",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0fb4063b8b6c3ded06c7d4e613752527b08c4bbfb21107f5b0749cc6b2d1ddf",
                "md5": "1b8d6876830d19bbb48adac635de3d6a",
                "sha256": "d0a6590a7e762721baa031a973c9f9345de16334c32e3158e78c78853568c2b0"
            },
            "downloads": -1,
            "filename": "torch_tps-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1b8d6876830d19bbb48adac635de3d6a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5123,
            "upload_time": "2024-04-26T09:19:33",
            "upload_time_iso_8601": "2024-04-26T09:19:33.352316Z",
            "url": "https://files.pythonhosted.org/packages/a0/fb/4063b8b6c3ded06c7d4e613752527b08c4bbfb21107f5b0749cc6b2d1ddf/torch_tps-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "634cc042b7b0c6e4c66626a945b2d734dd27be82401e800019899bcaa06d04a3",
                "md5": "b53e6a778aa8007a52a1a72406594b8d",
                "sha256": "3f56699b6dc933b57b11e8ca59fe6165a052f818dff37867b1c88ce2b49437a4"
            },
            "downloads": -1,
            "filename": "torch_tps-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b53e6a778aa8007a52a1a72406594b8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4796,
            "upload_time": "2024-04-26T09:19:34",
            "upload_time_iso_8601": "2024-04-26T09:19:34.859263Z",
            "url": "https://files.pythonhosted.org/packages/63/4c/c042b7b0c6e4c66626a945b2d734dd27be82401e800019899bcaa06d04a3/torch_tps-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 09:19:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "raphaelreme",
    "github_project": "torch-tps",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "torch-tps"
}
        
Elapsed time: 0.32828s