pyfishervector icon indicating copy to clipboard operation
pyfishervector copied to clipboard

Multivariate Normal Issue

Open hugos94 opened this issue 7 years ago • 4 comments

I am using the latest version of opencv and several functions have been modified. I adapted the code to work with the current version, however, when function g = [multivariate_normal(mean=means[k], cov=covs[k]) for k in range(0, len(weights)) ] is applied the following error is returned:numpy.linalg.linalg.LinAlgError: singular matrix.

I know that some function is returning a singular matrix, which makes it impossible to apply the function multivariate_normal.

What should I do? I'm really needing FisherVector applied to the Bag Of Words, and that was the only implementation I found.

Sorry for the bad english and thanks for the help.

hugos94 avatar May 23 '17 12:05 hugos94

@jacobgil I can confirm.

Here is the main code modification I made before encountering this issue.

em = cv2.ml.EM_create()
em.setClustersNumber(N)
em.trainEM(descriptors)

return np.float32(em.getMeans()), np.float32(em.getCovs()), np.float32(em.getWeights())[0]

hendrycks avatar Aug 05 '17 23:08 hendrycks

What is 'pdf' in line 38 'gaussians[index] = np.array([g_k.pdf(x) for g_k in g])' ????? I can't find the function @hendrycks @hugos94 @ @jacobgil

luntai avatar Oct 16 '17 08:10 luntai

@hugos94 hi sorry to bother you .how you solve the problem numpy.linalg.linalg.LinAlgError: singular matrix

Usernamezhx avatar Mar 26 '18 09:03 Usernamezhx

@jacobgil I can confirm.

Here is the main code modification I made before encountering this issue.

em = cv2.ml.EM_create()
em.setClustersNumber(N)
em.trainEM(descriptors)

return np.float32(em.getMeans()), np.float32(em.getCovs()), np.float32(em.getWeights())[0]

i have tired to implement this modification but is showing error in em.trainEM(descriptors) TypeError: ml_StatModel.train() missing required argument 'layout' (pos 2) If you have got this solution please share. Thank you

Hridaydeep avatar May 04 '20 16:05 Hridaydeep