I'm trying to classify images using fisher vectors as described in: Sánchez, J., Perronnin, F., Mensink, T., & Verbeek, J. (2013). Image classification with the fisher vector: Theory and practice. International Journal of Computer Vision, 105(3), 222–245. http://doi.org/10.1007/s11263-013-0636-x
To try out and evaluate this method I want to use the OpenIMAJ library, since according to their JavaDoc they use exactly this method to create the fisher vectors, but I can't get it work. I've tried creating the SIFT feature vectors with OpenIMAJ and OpenCV but for both I get the same error: EM algorithm was never able to compute a valid likelihood given initial parameters. Try different init parameters (or increasing n_init) or check for degenerate data.
If someone has already experience using this method I would greatly appreciate any help. I've created a little example which should illustrate the problem:
// load an image
LocalFeatureList<Keypoint> findFeatures = new DoGSIFTEngine()
.findFeatures(ImageUtilities
.readMBF(
new URL(
"http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png"))
.flatten());
// convert to double array
double[][] data = new double[findFeatures.size()][findFeatures.get(0)
.getDimensions()];
for (int i = 0; i < findFeatures.size(); i++) {
data[i] = findFeatures.get(i).getFeatureVector().asDoubleVector();
}
GaussianMixtureModelEM gaussianMixtureModelEM = new GaussianMixtureModelEM(
64, CovarianceType.Diagonal);
// error is thrown here
MixtureOfGaussians estimate = gaussianMixtureModelEM.estimate(data);