Differentiable contour to mask and contour to distance map implementation with PyTorch
Project description
torch_contour
This library contains 2 pytorch layers for performing the diferentiable operations of :
- contour to mask
- contour to distance map.
It can therefore be used to transform a polygon into a binary mask or distance map in a completely differentiable way. In particular, it can be used to transform the detection task into a segmentation task. The two layers have no learnable weight, so all it does is apply a function in a derivative way.
Input (Float):
A polygon of size $2 \times n$ with
with $n$ the number of nodes
Output (Float):
A mask or distance map of size $1 \times H \times W$.
with $H$ and $W$ respectively the Heigh and Width of the distance map or mask.
Important:
The polygon must have values between 0 and 1. It is therefore important to apply a sigmoid function before the layer.*.
The predicted polygon must be ordered in counter-clockwise.
Example:
check out example.ipnb
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
File details
Details for the file torch_contour-0.0.4.tar.gz
.
File metadata
- Download URL: torch_contour-0.0.4.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69186e99bb3112a3bed88cb2c98b1cbce904110ad6a66b46f84159610535e25 |
|
MD5 | 1065c371e16882b5c3b49b17a03dce5c |
|
BLAKE2b-256 | 55731c695bb8dddbe0c81e814b47e47531bd70b8199c14bf9daf6eb3d400d30e |
File details
Details for the file torch_contour-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: torch_contour-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cebe69ab14354bc1436aa6e47b97bb4a123890799208ed4cbd45910b848e5573 |
|
MD5 | 5d5bbd4dd2a3e8c1137126a97d816044 |
|
BLAKE2b-256 | f744e60d8a47ed726371ecbcbc0f7e5102884928b31e4c235e94c8dbee713c47 |