0

I am using OpenCV , C++ and trying to detect object in images. Till now what i have done.

1. from small image(108x64) patch i extracted desired 6200(from one patch) feature. Then i wrote these feature in train.txt and test.txt file in svmLight format.

.2 Then I gave train.txt to svmLight and got model-file. Using this model file i can test classification accuracy which is 90% approx. I have done till now in Ubuntu and OpenCV and C++. and it's command line training and testing both.

3. Now I want to detect object from original images(480x640) using model-file generated during training.

BUT the problem is I don't know how to use model-file to detect object from original image(640x480). I want very basic/fundamental thing that how to use this model-file for detection using simple sliding window(108x64) and svmLight or (LatentSVM or cvSVM). Plz don't tell me that I should resize my original image(image pyramid ) for good accuracy and i should use ADM(Active Deformable Model/Snake). Don't tell me about local maxima suppression to remove extra rectangle box. Just tell me how to detect(step by step complete implementation) and get rectangle box. Thanks in advance , waiting for experts reply.

Kaushal Joshi
  • 33
  • 1
  • 1
  • 7

1 Answers1

0

Thanks GOD , I did it. what I had in my object detection project that

  1. first i implemented feature extraction part . So using a small image patch i extracted desired feature and write it in a train.txt file in SVMLight format. I used C++ it's very easy. I used 10 image patch so 10 line i wrote in .txt file with appropriate label(1 or -1) with dimension of each feature vector is 6200(so each line in train.txt file have 6200 index and corresponding value).
  2. Second in the same way i generate a test.txt file also. Here label is not necessary but then you need to put 0 as label instead of 1 or -1

    1. I got executable of SVMLight . So simple i use $./svm_learn train.txt model.txt command in Ubuntu. after this i got model file .

    2. I did classification as $./svm_classify test.txt model.txt predict.txt command , and it showed accuracy and precision/recall rate . I got 95% accuracy . It will depend upon number of sample you use for training . later I used 800 positive and 800 negative then i got 97% accuracy . I was very happy .

Till here I did . I got result and was very happy. but After that i don't know what to do and how to do . Then i read lot's of document and article to use this model file for detection object in original image (size 512x512) . Main thing I had no idea how to use Modelfile . After reading lot's of artical in Internet and stackoverflow I really got confused . But somewhere in stackoverflow i read that take code from SVMLight and integrate it with your Application. Same I did.

So Now come to solution of above problem I asked in Question.

  1. first i download the SVMLight Source Code . Tried to understand it. Then I came to conclusion that use only svm_classify module in my Application . Then I copied selected piece of code from svm_classify.c to my Application or you can say I integrated/merged svm_classify.c in my Application.

Don't worry about Modelfile svm_classify load it and will do all work for you.

  1. Then you will get processed value(variable) for every small detection window or inputvector or for each line in test.txt . variable name is"dist" . if it is +ve then object is present in detection window or in test_input_vector else object not present.

NOTE: SVMLight is free to use only for non-commercial . I am using it as research , M-tech project(non-comercial) in government University. If I am avoiding any rule please let me know.

If anyone have doubt . most welcome.

Kaushal Joshi
  • 33
  • 1
  • 1
  • 7