Skip to content

Commit abe7c4c

Browse files
committed
Add some documentation about @markusnagel's utils.
1 parent cd4bc40 commit abe7c4c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ probabilities `py`, don't forget to `U = -np.log(py)` them.
6767
Requiring the `reshape` on the unary is an API wart that I'd like to fix, but
6868
don't know how to without introducing an explicit dependency on numpy.
6969

70+
### Getting a Unary
71+
72+
There's two common ways of getting unary potentials:
73+
74+
1. From a hard labeling generated by a human or some other processing.
75+
This case is covered by `from pydensecrf.utils import compute_unary`.
76+
77+
2. From a probability distribution computed by, e.g. the softmax output of a
78+
deep network. For this, see `from pydensecrf.utils import softmax_to_unary`.
79+
7080
Pairwise potentials
7181
-------------------
7282

@@ -165,6 +175,14 @@ arguments just like in the 2D gaussian and bilateral cases.
165175

166176
The potential will be computed as `w*exp(-0.5 * |f_i - f_j|^2)`.
167177

178+
### Pairwise potentials for N-D
179+
180+
User @markusnagel has written a couple numpy-functions generalizing the two
181+
classic 2-D image pairwise potentials (gaussian and bilateral) to an arbitrary
182+
number of dimensions: `create_pairwise_gaussian` and `create_pairwise_bilateral`.
183+
You can access them as `from pydensecrf.utils import create_pairwise_gaussian`
184+
and then have a look at their docstring to see how to use them.
185+
168186
Learning
169187
--------
170188

0 commit comments

Comments
 (0)