crfseg: CRF layer for segmentation in PyTorch
Conditional random field (CRF) is a classical graphical model which allows to make structured predictions in such tasks as image semantic segmentation or sequence labeling.
You can learn about it in papers:
- Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials
- Conditional Random Fields as Recurrent Neural Networks
Installation
pip install crfseg
Usage
Can be easily used as differentiable (and moreover learnable) postprocessing layer of your NN for segmentation.
import torch
import torch.nn as nn
from crfseg import CRF
model = nn.Sequential(
nn.Identity(), # your NN
CRF(n_spatial_dims=2)
)
batch_size, n_channels, spatial = 10, 1, (100, 100)
x = torch.zeros(batch_size, n_channels, *spatial)
log_proba = model(x)
Release files for crfseg 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crfseg-1.0.0.tar.gz | 6.9 kB | Details |
Release files / crfseg-1.0.0.tar.gz
| Download URL | crfseg-1.0.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ade36d8daabfe81ba53c213d74e7a46ec1a2d7e866aa323a3716ac60e29cb13c
|
|
BLAKE2b-256 checksum How to use checksums |
8c84997133247d5df009907be4df7c6cf1eab1c1b12267fa59ab0e9061cfa33e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|