"vscode:/vscode.git/clone" did not exist on "91c72cdf520dc9d2b4614771a6fdc98f29f250e2"
Commit abe7c4c4 authored by lucasb-eyer's avatar lucasb-eyer
Browse files

Add some documentation about @markusnagel's utils.

parent cd4bc405
......@@ -67,6 +67,16 @@ probabilities `py`, don't forget to `U = -np.log(py)` them.
Requiring the `reshape` on the unary is an API wart that I'd like to fix, but
don't know how to without introducing an explicit dependency on numpy.
### Getting a Unary
There's two common ways of getting unary potentials:
1. From a hard labeling generated by a human or some other processing.
This case is covered by `from pydensecrf.utils import compute_unary`.
2. From a probability distribution computed by, e.g. the softmax output of a
deep network. For this, see `from pydensecrf.utils import softmax_to_unary`.
Pairwise potentials
-------------------
......@@ -165,6 +175,14 @@ arguments just like in the 2D gaussian and bilateral cases.
The potential will be computed as `w*exp(-0.5 * |f_i - f_j|^2)`.
### Pairwise potentials for N-D
User @markusnagel has written a couple numpy-functions generalizing the two
classic 2-D image pairwise potentials (gaussian and bilateral) to an arbitrary
number of dimensions: `create_pairwise_gaussian` and `create_pairwise_bilateral`.
You can access them as `from pydensecrf.utils import create_pairwise_gaussian`
and then have a look at their docstring to see how to use them.
Learning
--------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment