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-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: crfseg-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ade36d8daabfe81ba53c213d74e7a46ec1a2d7e866aa323a3716ac60e29cb13c
MD5 d33a38c86a5c552299e23249a8facb99
BLAKE2b-256 8c84997133247d5df009907be4df7c6cf1eab1c1b12267fa59ab0e9061cfa33e

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