Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
pydensecrf
Commits
e88e90f4
Commit
e88e90f4
authored
May 16, 2016
by
lucasb-eyer
Browse files
Add documentation comment to `compute_unary`.
parent
74652c2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
pydensecrf/utils.py
pydensecrf/utils.py
+14
-0
No files found.
pydensecrf/utils.py
View file @
e88e90f4
...
@@ -5,7 +5,21 @@ def compute_unary(labels, M, GT_PROB=0.5):
...
@@ -5,7 +5,21 @@ def compute_unary(labels, M, GT_PROB=0.5):
"""
"""
Simple classifier that is 50% certain that the annotation is correct
Simple classifier that is 50% certain that the annotation is correct
(same as in the inference example).
(same as in the inference example).
Parameters
----------
labels: nummpy.array
The label-map.
M: int
The number of labels there are.
GT_PROB: float
The certainty of the ground-truth (must be within (0,1)).
"""
"""
assert
0
<
GT_PROB
<
1
,
"`GT_PROB must be in (0,1)."
labels
=
labels
.
flatten
()
u_energy
=
-
np
.
log
(
1.0
/
M
)
u_energy
=
-
np
.
log
(
1.0
/
M
)
n_energy
=
-
np
.
log
((
1.0
-
GT_PROB
)
/
(
M
-
1
))
n_energy
=
-
np
.
log
((
1.0
-
GT_PROB
)
/
(
M
-
1
))
p_energy
=
-
np
.
log
(
GT_PROB
)
p_energy
=
-
np
.
log
(
GT_PROB
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment