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:


pip install crfseg


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

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.

Files for crfseg, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size crfseg-1.0.0.tar.gz (6.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page