#291 · Primary category: Computer Vision

pydensecrf

computer-vision crf cython eigen machine-learning pairwise-potentials unary-potentials

Python wrapper to Philipp Krähenbühl's dense (fully connected) CRFs with gaussian edge potentials.

Project last updated:03/05/24

GitHub Stars

2.0K

Forks

428

Contributors

17

License

MIT

Why we included this project

Segmentation models often output noisy per-pixel probabilities, and a fully-connected CRF is the classic way to clean those up into labels that respect object boundaries. This library wraps Philipp Krähenbühl's efficient dense CRF implementation behind a Cython interface, so you can run that post-processing step directly from Python. You hand it a unary energy, typically the negative log softmax of your network's output, add Gaussian and bilateral pairwise potentials that enforce spatial and color consistency, and the compiled C++ code with Eigen stays fast enough for inference-time use; bundled helpers like unary_from_softmax handle the common conversions. It complements a neural network rather than replacing it, which is why it turns up in many image segmentation pipelines. Expect the compiled install to need some coaxing on Windows and in Colab kernels, so budget a little setup time.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category