Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multivariate Normal Issue #3

Open
hugos94 opened this issue May 23, 2017 · 4 comments
Open

Multivariate Normal Issue #3

hugos94 opened this issue May 23, 2017 · 4 comments

Comments

@hugos94
Copy link

hugos94 commented May 23, 2017

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.

@hendrycks
Copy link

@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]

@luntai
Copy link

luntai commented Oct 16, 2017

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

@Usernamezhx
Copy link

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

@Hridaydeep
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants