PyTorch implementation of conditional random field for multiclass semantic segmenation.
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
pip install crfseg
Can be easily used as differentiable (and moreover learnable) postprocessing layer of your NN for segmentation. It is adaptive to a number of input's spatial dimensions.
import torch from crfseg import MeanFieldCRF model = nn.Sequential( nn.Identity(), # your NN MeanFieldCRF() ) batch_size, n_channels, spatial = 10, 1, (100, 100) x = torch.zeros((batch_size, n_channels, *spatial)) log_proba = model(x)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size crfseg-0.1.3-py3-none-any.whl (7.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size crfseg-0.1.3.tar.gz (5.5 kB)||File type Source||Python version None||Upload date||Hashes View hashes|