2017-09-05 15:58:47 -0600 | received badge | ● Enthusiast |
2017-08-18 14:15:05 -0600 | commented question | SVM application causing my system to hang I reshaped the HOG descriptors as you suggested. But the error keeps being generated because the training data and the label matrices are not equally sized in order for the train() method to work - labels matrix is 1x200 whereas the SVMtrainingData matrix is 1x424116003 . My understanding is that each image from the data set is given a flag value (for example 1 or 0) according to whether it is a positive image or a negative one. However, the training data for the HOG features will produce a much larger matrix. How can i resolve this conundrum? |
2017-08-18 10:40:46 -0600 | commented question | SVM application causing my system to hang I made the changes as you suggested regarding the images, I dont know how to reshape the hog. The size of the training data is 1x424116003 and since the labels are 1x200 this is now throwing the error: 'Sizes of input arguments do not match (Response array must contain as many elements as the total number of samples) in cvPreprocessCategoricalResponses' when training the classifier: svmClassifier.train(SVMtrainingData, labels, new Mat(), new Mat(), params); |
2017-08-18 08:49:29 -0600 | asked a question | SVM application causing my system to hang I am using OpenCV java to build a leaf classifier. I extract HOG features from two datasets, one containing 100 images of a target leaf and another containing 100 negative images, images are sized to 50x50 pixels for both datasets. The extracted HOG descriptors are feed into a SVM for training and the application then tests the classifier with a sample dataset containing images sized to the training set. Here is my code: (more) |
2017-08-15 11:08:49 -0600 | received badge | ● Self-Learner (source) |
2017-08-15 09:53:16 -0600 | answered a question | I am using the opencv_annotation tool with java version 2.4.9 and running the utility from Windows 10 command line - I keep getting the following error : Sorry for not getting back, I was on my hols. The solution for the problem is to use -images=/data/text.txt and -annotations=/data/annotations.txt, i.e. a single horizontal dash (-) in front of the key words. |
2017-08-15 06:33:41 -0600 | asked a question | How to Surf Descriptors as input for a SVM Classifier I am using the Java implementation to build a SVM classifier to classify tree leaves. I get the following errors when I try to train the SVM: OpenCV Error: Sizes of input arguments do not match () in cv::Mat::push_back, file ........\opencv\modules\core\src\matrix.cpp, line 650 CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\core\src\matrix.cpp:650: error: (-209) in function cv::Mat::push_back ] at org.opencv.core.Mat.n_push_back(Native Method) at org.opencv.core.Mat.push_back(Mat.java:1863) at mark.smart.csc7057.surfdetectorandsvm.SurfDetectorAndSVM.main(SurfDetectorAndSVM.java:126) OpenCV Error: Sizes of input arguments do not match () in cv::Mat::push_back, file ........\opencv\modules\core\src\matrix.cpp, line 650 CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\core\src\matrix.cpp:650: error: (-209) in function cv::Mat::push_back ] at org.opencv.core.Mat.n_push_back(Native Method) at org.opencv.core.Mat.push_back(Mat.java:1863) at mark.smart.csc7057.surfdetectorandsvm.SurfDetectorAndSVM.main(SurfDetectorAndSVM.java:167) OpenCV Error: Bad argument (There is only a single class) in cvPreprocessCategoricalResponses, file ........\opencv\modules\ml\src\inner_functions.cpp, line 729 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\ml\src\inner_functions.cpp:729: error: (-5) There is only a single class in function cvPreprocessCategoricalResponses ] at org.opencv.ml.CvSVM.train_0(Native Method) at org.opencv.ml.CvSVM.train(CvSVM.java:270) at mark.smart.csc7057.surfdetectorandsvm.SurfDetectorAndSVM.main(SurfDetectorAndSVM.java:228) I have read that a BOW trainer should be employed to cluster the surf descriptors, unfortunately this feature is currently not available with the java implementation. I would appreciate any guidance (with sample code if possible) to resolve this problem. The code I have used is as follows: public static void main(String[] args) { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); File leafImages = null; String leafImageAbsPathAsStr = ""; File[] leafImageFilePaths; File negImages = null; String negImageAbsPathAsStr = ""; File[] negImageFilePaths; final int leafImageWidth = 50; final int leafImageHeight = 50; final int size = 200; Mat leafGrayMat; Mat negGrayMat; Mat negBinMat = new Mat(); Mat SVMtrainingData = new Mat(size, 1, CvType.CV_32FC1); Mat labels = new Mat(size, 1, CvType.CV_32FC1); List<float> trainingLabels = new ArrayList<float>(); MatOfKeyPoint keyPoints = new MatOfKeyPoint(); MatOfKeyPoint descriptors = new MatOfKeyPoint(); FeatureDetector featureDetector = FeatureDetector.create(FeatureDetector.SURF); DescriptorExtractor descriptorExtractor = DescriptorExtractor.create(DescriptorExtractor.SURF); try { leafImages = new File("Images//acer_campestre_100_images"); } catch(Exception e) { e.printStackTrace(); } try { negImages = new File("Images//neg_images_100"); } catch(Exception e) { e.printStackTrace(); } Float[] trainingLabelsArray = trainingLabels.toArray(new ... (more) |
2017-08-02 14:13:40 -0600 | asked a question | I am using the opencv_annotation tool with java version 2.4.9 and running the utility from Windows 10 command line - I keep getting the following error : "The path for the output file contains an error and could not be opened. Please check again!" I don't understand why I am getting this error since I am using the same directory for both the --images and --annotations params and I am supplying the absolute filename in both cases. |
2017-07-01 11:21:42 -0600 | commented question | problem using msbuild I have decided to use an older version of OpenCV (2.4.11) which includes the nonfree SIFT/SURF features. |
2017-06-30 11:45:56 -0600 | asked a question | problem using msbuild When trying to build the SIFT/SURF nonfree features into the latest version of opencv I get the following error in cmake: CMake error in CMakeLists.txt: Failed to run MSBuild command: MSBuild.exe: to get the value of VCTargetsPath: I am using OpenCV java implementation for Eclipse |