[vlfeat] 19/44: fisher.c: fixes a bug causing NaNs with degenerate GMMs

Dima Kogan dima at secretsauce.net
Wed Sep 16 21:05:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

dkogan-guest pushed a commit to branch master
in repository vlfeat.

commit 4ff03017abd0a8d7c2cd6a09cba6a34a767d1893
Author: Andrea Vedaldi <vedaldi at gmail.com>
Date:   Wed Jan 14 14:50:27 2015 +0000

    fisher.c: fixes a bug causing NaNs with degenerate GMMs
---
 vl/fisher.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/vl/fisher.c b/vl/fisher.c
index 7307b21..480e29f 100644
--- a/vl/fisher.c
+++ b/vl/fisher.c
@@ -426,6 +426,15 @@ VL_XCAT(_vl_fisher_encode_, SFX)
     TYPE * uk = enc + i_cl*dimension ;
     TYPE * vk = enc + i_cl*dimension + numClusters * dimension ;
 
+    /*
+    If the GMM component is degenerate and has a null prior, then it
+    must have null posterior as well. Hence it is safe to skip it.  In
+    practice, we skip over it even if the prior is very small; if by
+    any chance a feature is assigned to such a mode, then its weight
+    would be very high due to the division by priors[i_cl] below.
+    */
+    if (priors[i_cl] < 1e-6) { continue ; }
+
     for(i_d = 0; i_d < (signed)numData; i_d++) {
       TYPE p = posteriors[i_cl + i_d * numClusters] ;
       if (p < 1e-6) continue ;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/vlfeat.git



More information about the debian-science-commits mailing list