opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

cv::EM - probably bug in serialization/deserialization code

Open opencv-pushbot opened this issue 9 years ago • 0 comments

Transferred from http://code.opencv.org/issues/3516

|| Stepan Mracek on 2014-01-31 08:25
|| Priority: Normal
|| Affected: 2.4.8 (latest release)
|| Category: ml
|| Tracker: Bug
|| Difficulty: 
|| PR: 
|| Platform: x64 / Linux

cv::EM - probably bug in serialization/deserialization code

Hi,
I think I found a bug in cv:EM. In the attached code, I'm loading the samples and the testing input matrices. After training of cv::EM I'm passing the testing input. I'm getting likelihood output 12.9455. Then I'm serializing learned cv:EM. However, I'm getting different likelihood output (8.33443) from deserialized cv:EM. I think that they should be the same.

History

Vladislav Vinogradov on 2014-01-31 08:34
Hello Stepan,

Thank you for reporting the issue!

Unfortunately our resources are limited at the moment.
If you could work on a solution for the issue on your side, a contribution (see http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute) would be very appreciated!
-   Assignee changed from Maria Dimashova to Stepan Mracek
-   Status changed from New to Open
Yohan Breux on 2014-09-11 02:44
Hello, 

I have encountered the same problem and found a solution. 
The problem is in decomposeCovs,when computing back the covsEigenValues from loaded covariance matrix. 
SVD is used to compute the singular values, but it stores it in ASCENDING order.
Doing so, the position of the different eigen values are changed.

The basic solution I applied is to directly extract the diagonal values of covariance matrix in the case EM::COV_MAT_DIAGONAL.

opencv-pushbot avatar Jul 27 '15 10:07 opencv-pushbot