Fisherfaces using OpenImaj - LAPACK ERROR: DSYGVD returned 40
Fisherfaces using OpenImaj - LAPACK ERROR: DSYGVD returned 40
我正在尝试使用 OpenImaj 制作 Fisherfaces,但下面的代码会导致以下错误:
Exception in thread "main" java.lang.RuntimeException: LAPACK ERROR: DSYGVD returned 40
at org.openimaj.math.matrix.GeneralisedEigenvalueProblem.sygvd(GeneralisedEigenvalueProblem.java:57)
at org.openimaj.math.matrix.GeneralisedEigenvalueProblem.symmetricGeneralisedEigenvectorsSorted(GeneralisedEigenvalueProblem.java:221)
at org.openimaj.math.matrix.algorithm.LinearDiscriminantAnalysis.learnBasis(LinearDiscriminantAnalysis.java:211)
at org.openimaj.image.model.FisherImages.train(FisherImages.java:195)
at org.openimaj.image.model.FisherImages.train(FisherImages.java:159)
at org.openimaj.tutorial.facialanalysis.FisherfacesExample.main(FisherfacesExample.java:35)
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.vfs2.FileSystemException;
import org.openimaj.data.dataset.GroupedDataset;
import org.openimaj.data.dataset.ListDataset;
import org.openimaj.data.dataset.VFSGroupDataset;
import org.openimaj.experiment.dataset.split.GroupedRandomSplitter;
import org.openimaj.image.DisplayUtilities;
import org.openimaj.image.FImage;
import org.openimaj.image.ImageUtilities;
import org.openimaj.image.model.FisherImages;
public class FisherfacesExample {
public static void main(String[] args) {
try {
// getting a set of face images
VFSGroupDataset<FImage> dataset = new VFSGroupDataset<FImage>(
"zip:http://datasets.openimaj.org/att_faces.zip", ImageUtilities.FIMAGE_READER);
// forming training set & testing set
int nTraining = 1;
int nTesting = 5;
GroupedRandomSplitter<String, FImage> splits = new GroupedRandomSplitter<String, FImage>(dataset, nTraining,
0, nTesting);
GroupedDataset<String, ListDataset<FImage>, FImage> training = splits.getTrainingDataset();
GroupedDataset<String, ListDataset<FImage>, FImage> testing = splits.getTestDataset();
// set number of components and train the training set of images
int components = 50;
FisherImages fisher = new FisherImages(components);
fisher.train(training);
//drawing the first 12 basis vectors
List<FImage> fisherFaces = new ArrayList<FImage>();
for (int i = 0; i < 12; i++) {
fisherFaces.add(fisher.visualise(i));
}
DisplayUtilities.display("FisherFaces", fisherFaces);
} catch (FileSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
请问问题出在哪里?在训练人脸图像训练集之前我应该做些什么吗?谢谢。
这个错误几乎可以肯定是因为您试图对每个 class 仅使用一个示例进行训练。增加训练样本数再试
(技术原因:FisherFaces 使用 multiclass 线性判别分析,其中涉及计算每个 class 的协方差矩阵;您无法使用每个 [=14] 的单个样本正确计算它=])
增加训练图像的数量解决了错误。
但是还有一个问题:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at
org.openimaj.image.model.FisherImages.getBasisVector(FisherImages.java:230)
at
org.openimaj.image.model.FisherImages.visualise(FisherImages.java:243)
at
org.openimaj.tutorial.facialanalysis.FisherfacesExample.main(FisherfacesExample.java:41)
组件数量的有意义值是多少?谢谢。
我正在尝试使用 OpenImaj 制作 Fisherfaces,但下面的代码会导致以下错误:
Exception in thread "main" java.lang.RuntimeException: LAPACK ERROR: DSYGVD returned 40 at org.openimaj.math.matrix.GeneralisedEigenvalueProblem.sygvd(GeneralisedEigenvalueProblem.java:57) at org.openimaj.math.matrix.GeneralisedEigenvalueProblem.symmetricGeneralisedEigenvectorsSorted(GeneralisedEigenvalueProblem.java:221) at org.openimaj.math.matrix.algorithm.LinearDiscriminantAnalysis.learnBasis(LinearDiscriminantAnalysis.java:211) at org.openimaj.image.model.FisherImages.train(FisherImages.java:195) at org.openimaj.image.model.FisherImages.train(FisherImages.java:159) at org.openimaj.tutorial.facialanalysis.FisherfacesExample.main(FisherfacesExample.java:35)
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.vfs2.FileSystemException;
import org.openimaj.data.dataset.GroupedDataset;
import org.openimaj.data.dataset.ListDataset;
import org.openimaj.data.dataset.VFSGroupDataset;
import org.openimaj.experiment.dataset.split.GroupedRandomSplitter;
import org.openimaj.image.DisplayUtilities;
import org.openimaj.image.FImage;
import org.openimaj.image.ImageUtilities;
import org.openimaj.image.model.FisherImages;
public class FisherfacesExample {
public static void main(String[] args) {
try {
// getting a set of face images
VFSGroupDataset<FImage> dataset = new VFSGroupDataset<FImage>(
"zip:http://datasets.openimaj.org/att_faces.zip", ImageUtilities.FIMAGE_READER);
// forming training set & testing set
int nTraining = 1;
int nTesting = 5;
GroupedRandomSplitter<String, FImage> splits = new GroupedRandomSplitter<String, FImage>(dataset, nTraining,
0, nTesting);
GroupedDataset<String, ListDataset<FImage>, FImage> training = splits.getTrainingDataset();
GroupedDataset<String, ListDataset<FImage>, FImage> testing = splits.getTestDataset();
// set number of components and train the training set of images
int components = 50;
FisherImages fisher = new FisherImages(components);
fisher.train(training);
//drawing the first 12 basis vectors
List<FImage> fisherFaces = new ArrayList<FImage>();
for (int i = 0; i < 12; i++) {
fisherFaces.add(fisher.visualise(i));
}
DisplayUtilities.display("FisherFaces", fisherFaces);
} catch (FileSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
请问问题出在哪里?在训练人脸图像训练集之前我应该做些什么吗?谢谢。
这个错误几乎可以肯定是因为您试图对每个 class 仅使用一个示例进行训练。增加训练样本数再试
(技术原因:FisherFaces 使用 multiclass 线性判别分析,其中涉及计算每个 class 的协方差矩阵;您无法使用每个 [=14] 的单个样本正确计算它=])
增加训练图像的数量解决了错误。 但是还有一个问题:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at org.openimaj.image.model.FisherImages.getBasisVector(FisherImages.java:230) at org.openimaj.image.model.FisherImages.visualise(FisherImages.java:243) at org.openimaj.tutorial.facialanalysis.FisherfacesExample.main(FisherfacesExample.java:41)
组件数量的有意义值是多少?谢谢。