3

I am trying to make an Object Recognition software for my final year project using OpenCV. After studying quite a lot about this field, I found out the plan of action should be this:

  • Extract features from a lot of images.
  • Create a training dataset from the extracted features.
  • Label the dataset.
  • Make the machine learn from the dataset.
  • Test the model.

I started from a single image. I was able to extract features from the image using SurfFeatureDetector class of OpenCV (simple_matcher.cpp program given in the samples). I saved the detected KeyPoints in an XML File using the following code:

SurfFeatureDetector detector(400);
vector<KeyPoint> keypoints1, keypoints2;
detector.detect(img1, keypoints1);
detector.detect(img2, keypoints2);
FileStorage fs("test.xml", FileStorage::WRITE);
write(fs, "data", keypoints1);

Now I am stuck at this point. I am not able to understand how do I create the training dataset from these features? And what should be my next step? Or, is my plan of action correct?

Thanks in advance.

3
  • 1
    Format and content of a training dataset depends on what you want to recognize. Please, specify your goal more clear. Commented Nov 20, 2013 at 8:44
  • I want to detect objects in an image, which may be multiple in number. So, i want to create the training set with, for example, 100 images with a ball, 100 images with a tree, and so on. Commented Nov 20, 2013 at 8:46
  • 1
    For starters, do this. Commented Nov 20, 2013 at 14:53

2 Answers 2

4

you would probably need to do these following steps.

  1. Find out and zero in on a feature detection and extraction algorithm you want to use(SIFT,SURF,ORB, there are few more).

  2. Detect and extract features. you should be storing descriptors extracted from a descriptor extractor in your xml files.

  3. add those descriptors to a trainer such as bowtrainer to create a dictionary.

  4. Train your classifier

You can find lot of examples here and you can watch this video if you want to realize something similar in your project.

Sign up to request clarification or add additional context in comments.

2 Comments

i used the BOWTrainer to create a vocabulary. But now, I cannot understand what to do next with the vocabulary. Please help.
Now,start training your classifier. You can look at thisexample
3

First, it would be easier to use popular datasets, for example, from here. It allows you to not spent time on images and gives a possibility to compare your results with state-of-the-art.

Second, it is not easy task. I recommend you to read papers related to the PASCAL VOC.

If you want to do the first try, read about bag-of-words model, for example it is pretty short and nice explanation what to do in the blog of the SO user @gillevi.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.