Skip to content

Commit 7c46fee

Browse files
authored
Merge pull request lucasb-eyer#20 from reynoldscem/patch-1
Fix off-by-one error in `compute_unary` utility function.
2 parents 31d4a72 + 1697e65 commit 7c46fee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pydensecrf/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def compute_unary(labels, M, GT_PROB=0.5):
2828

2929
U = np.zeros((M, len(labels)), dtype='float32')
3030
U[:, labels > 0] = n_energy
31-
U[labels, np.arange(U.shape[1])] = p_energy
31+
U[labels - 1, np.arange(U.shape[1])] = p_energy
3232
U[:, labels == 0] = u_energy
3333
return U
3434

0 commit comments

Comments
 (0)