Fatal error detected on SVM
so i had to edit cuz enough new question
soo i think i properly prepared my data to be trained by the svm but i keep getting a fatal error
> # A fatal error has been detected by the Java Runtime Environment:
> #
> # SIGSEGV (0xb) at pc=0x0000000000000000, pid=10990,
> tid=0x00007f110a447700
> #
> # JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build
> 1.8.0_121-b13)
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode
> linux-amd64 compressed oops)
> # Problematic frame:
> # C 0x0000000000000000
> #
> # Failed to write core dump. Core dumps have been disabled. To enable
> core dumping, try "ulimit -c
> unlimited" before starting Java again
> #
> # An error report file with more information is saved as:
> # /home/tomna/Desktop/NB/MainClass/hs_err_pid10990.log
> #
> # If you would like to submit a bug report, please visit:
> # http://bugreport.java.com/bugreport/crash.jsp
> # The crash happened outside the Java Virtual Machine in native code.
> # See problematic frame for where to report the bug.
> #
and here is my code
private static Mat trainingLabels = new Mat();
private static Mat trainingData = new Mat();
private static Mat classes = new Mat();
private static SVM clasificador = SVM.create();
public static MatOfFloat v_descriptors = new MatOfFloat();
public static TermCriteria S = new TermCriteria(TermCriteria.MAX_ITER+TermCriteria.EPS, 1000, 1e-6);
public static void trains() {
System.out.println("Training...");
v_descriptors.copyTo(trainingData);
trainingData.convertTo(trainingData, CvType.CV_32F);
trainingLabels.copyTo(classes);
classes.convertTo(classes,CvType.CV_32S);
clasificador.setType(SVM.C_SVC);
clasificador.setKernel(SVM.LINEAR);
clasificador.train(trainingData, ROW_SAMPLE, classes);
clasificador.save(XML);
}
public static void trainPositives() {
MatOfFloat descriptorsValues = new MatOfFloat();
for (File file : new File(PATH_POSITIVE).listFiles()) {
Mat img = getMat(file.getAbsolutePath());
HOGDescriptor d = new HOGDescriptor(new Size(32, 16), new Size(8, 8), new Size(4, 4), new Size(4, 4), 9);
d.compute(img, descriptorsValues);
Mat labelsMat = new Mat(1, 1, CvType.CV_32SC1, new Scalar(1));
v_descriptors.push_back(descriptorsValues.reshape(1, 1));
trainingLabels.push_back(labelsMat);
}
//
System.out.println(v_descriptors);
System.out.println(trainingLabels);
}
public static void trainNegatives() {
MatOfFloat descriptorsValues2 = new MatOfFloat();
for (File file : new File(PATH_NEGATIVE).listFiles()) {
Mat img = getMat(file.getAbsolutePath());
HOGDescriptor d = new HOGDescriptor(new Size(32, 16), new Size(8, 8), new Size(4, 4), new Size(4, 4), 9);
d.compute(img, descriptorsValues2);
Mat labelsMat = new Mat(1, 1, CvType.CV_32SC1, new Scalar(-1));
v_descriptors.push_back(descriptorsValues2.reshape(1, 1));
trainingLabels.push_back(labelsMat);
}
System.out.println(v_descriptors);
System.out.println(trainingLabels);
}
would you be so nice, and replace the screenshot with a text version ?
@berak i just edited with a text version and thank you
@Tomma, btw, initialize your HOGDescriptor properly !