Skip to main content

PyTorch implementation of conditional random field for multiclass semantic segmenation.

Project description

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:

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)

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

crfseg-0.2.0.tar.gz (6.6 kB view details)

Uploaded Source

File details

Details for the file crfseg-0.2.0.tar.gz.

File metadata

  • Download URL: crfseg-0.2.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for crfseg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e1f14f8d418abfd2bde2d60dc3e36a7e8b4e2bb874001df1620cee81dee18646
MD5 fa8323fefd7e95ce775c8d95d6709fc4
BLAKE2b-256 fde295991c599dd6bf5c68c542bfab72031f745e8e07dfb53eb31da28ee937ff

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