Object detection with OpenCV SVM
Asked Answered
S

1

11

I was unable to find good explanations at one place on the internet. There are too much stuff and instead of finding out what to do, I get more confused.

My goal: Create an Android application that detects objects in real time using the camera (my objects are steering wheel and a car tire.)

Until now I tried the haar classifier but it was difficult to train, took a lot of time and couldn't train it correctly so I decided to look for another way to achieve my goal.

Now I found out about the Feature Detectors and the SVM training. My questions are:

1: Which algorithm should I use (SURF, ORB, FREAK etc.)?

2: What do you think about HOG + Bag-Of-Words?

3: Would you tell how to train the SVM or give a link if you have? - I didn't find any tutorial about this. I keep searching but my time is limited and I decided to ask.

4: Which algorithm will give the best results?

5: Should I implement it in native with the Android NDK or there wont be such a big difference with the Java implementation?

If you have any tutorials or references, please add them to your answer or in the comments. Sorry for the long question, as I said my time is limited (It's a school project.) and also I think it will be good if people can find those answers at one place. I will appreciate every answer, even if it is not a full answer. Thank you in advance!

Suitable answered 10/12, 2014 at 19:28 Comment(3)
"(my objects are steering wheel and a car tire.) " - and, imho, your major problem. can you re-negotiate that ? (school-problem). telling apples from bananas would be a much friendlier scenario. do you know, what 'inner class variance' means ? your previous posts showed, that it's damn hard to find such a thing as 'the' steering-wheel. it won't get much better there, even with more sophisticated algorithms.Phantasy
I'm note exactly sure I understand what you want to tell me (maybe because my English skills aren't good enough). And no' I don't kno what inner class variance means.Suitable
Also, I didn't achieved my goal yet because I'm using OpenCV for the very first time and it is difficult.Suitable
W
9

1: There is no optimal algorithm for all cases but algorithms that suit certain very specific cases depending on the requirements of the application.

You can try SIFT and SURF which are the most popular descriptors but are not very efficient (slow) and require a lot of memory. If efficiency is your objective you can try binary descriptors (eg. BRIEF, ORB, BRISK, FREAK) which are much more efficient and require less storage. Take a look at FAST detector also.

2: Bag-of-Words for image classification problem is a method of recognizing object categories given a set of positive training images containing an object class, and a set of negative training images that don’t.

Bag-Of-Words will get you a vector representation of each training image.

After getting this you will have to train a classifier to discriminate vectors corresponding to positive (steering wheel and a car tire) and negative training images. You can use a SVM classifier for this.

3: You have here a tutorial of the complete approach (BOW + SVM) in OpenCV 2.3. You'll need to make some changes in the code but the general idea is there: http://www.morethantechnical.com/2011/08/25/a-simple-object-classifier-with-bag-of-words-using-opencv-2-3-w-code/

Also, the OpenCV tutorial for SVM: http://docs.opencv.org/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html

4: As I said before, there is no perfect algorithm so I can not answer you. I think after taking some tests with the alternatives you have in (1.) you're going to be able to answer it to us. :)

5. I think you should use the Android NDK but I don't know much about Android development.

http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html http://opencv.org/platforms/android.html

Wilheminawilhide answered 13/12, 2014 at 16:39 Comment(4)
First, thank you for your detailed answer! And scond I would like to ask you is BOW + SVM the best or a good approach to achieve my goal?Suitable
As I explained to you, it is impossible to tell you if that approach will solve your problem effectively. Either way my bet is that the BOW + SVM approach will give you good results. But you need to try to confirm this.Wilheminawilhide
First, sorry for that I keep asking questions, but things aren't easy for me. I found out that I cannot use BOW with binary descriptors. Unfortunately SIFT and SURF are non-free and that's why I don't want to use them. I can't find how to train an SVM with FAST extracted feature. Is that possible? Do you have any references for doing that? Thank you very much in advance. (Maybe if you have answers to these questions it will be good if you add them to your answer)Suitable
Actually u can use BOW with binary descriptors. My advice is to first try this approach using SIFT or SURF. If the results are good, then you can try using binary descriptors. As i said, FAST is only a detector. That is, it only detects keypoints, after that you need to describe the keypoints using a descriptor.Wilheminawilhide

© 2022 - 2024 — McMap. All rights reserved.