Bag of features with dense SIFT and SVM - understanding and implementation












1















My aim is to detect some underwater object - badminton racket among others.
I have over 160 images of this racket laying underwater. I have created binary masks for this racket object (object I want to detect) and then I calculated based on that racket masks the underwater scenery masks (rocks, leafs, etc..,objects I don't want to detect). Now I want to use BOF with dense sift. What I intend to do:




  1. Create a visual dictionary - compute dense SIFT on the image applying the racket mask and then background mask(on each image I am calculating SIFT two times - for objects I want to detect(racket) and for all other underwater objects

  2. Having dictionary I have to calculate my SVM train data - so once again for every image I calculate SIFT applying my object mask( and label it 1) and applying background mask(label 0) - I am calculating frequency (histogram) of visual words from the dictionary.

  3. Object recognition - that part is tricky for me. My trained svm knows the frequencies of dictionary visual words for the racket(label 1) and the background(label 0). Now I have an image i want to test my SVM on - racket laying underwater among some rocks and other things. When I put that data in my SVM it will detect "both frequencies of visual words" - because on the image is my racket, and there is background as well. It is detecting both things. Now how I can prevent that? My idea is to segment image I want to classify on several (10-50) regions and then on each region calculate dense SIFT and then svm prediction based on dense sift on those regions?


Am I right, or I misunderstood something about this BOF method. If I am wrong, how can I achieve my goal. Once again at my disposal, I have a 160 sets of images(original frame, mask on the racket, mask on the background).










share|improve this question





























    1















    My aim is to detect some underwater object - badminton racket among others.
    I have over 160 images of this racket laying underwater. I have created binary masks for this racket object (object I want to detect) and then I calculated based on that racket masks the underwater scenery masks (rocks, leafs, etc..,objects I don't want to detect). Now I want to use BOF with dense sift. What I intend to do:




    1. Create a visual dictionary - compute dense SIFT on the image applying the racket mask and then background mask(on each image I am calculating SIFT two times - for objects I want to detect(racket) and for all other underwater objects

    2. Having dictionary I have to calculate my SVM train data - so once again for every image I calculate SIFT applying my object mask( and label it 1) and applying background mask(label 0) - I am calculating frequency (histogram) of visual words from the dictionary.

    3. Object recognition - that part is tricky for me. My trained svm knows the frequencies of dictionary visual words for the racket(label 1) and the background(label 0). Now I have an image i want to test my SVM on - racket laying underwater among some rocks and other things. When I put that data in my SVM it will detect "both frequencies of visual words" - because on the image is my racket, and there is background as well. It is detecting both things. Now how I can prevent that? My idea is to segment image I want to classify on several (10-50) regions and then on each region calculate dense SIFT and then svm prediction based on dense sift on those regions?


    Am I right, or I misunderstood something about this BOF method. If I am wrong, how can I achieve my goal. Once again at my disposal, I have a 160 sets of images(original frame, mask on the racket, mask on the background).










    share|improve this question



























      1












      1








      1


      1






      My aim is to detect some underwater object - badminton racket among others.
      I have over 160 images of this racket laying underwater. I have created binary masks for this racket object (object I want to detect) and then I calculated based on that racket masks the underwater scenery masks (rocks, leafs, etc..,objects I don't want to detect). Now I want to use BOF with dense sift. What I intend to do:




      1. Create a visual dictionary - compute dense SIFT on the image applying the racket mask and then background mask(on each image I am calculating SIFT two times - for objects I want to detect(racket) and for all other underwater objects

      2. Having dictionary I have to calculate my SVM train data - so once again for every image I calculate SIFT applying my object mask( and label it 1) and applying background mask(label 0) - I am calculating frequency (histogram) of visual words from the dictionary.

      3. Object recognition - that part is tricky for me. My trained svm knows the frequencies of dictionary visual words for the racket(label 1) and the background(label 0). Now I have an image i want to test my SVM on - racket laying underwater among some rocks and other things. When I put that data in my SVM it will detect "both frequencies of visual words" - because on the image is my racket, and there is background as well. It is detecting both things. Now how I can prevent that? My idea is to segment image I want to classify on several (10-50) regions and then on each region calculate dense SIFT and then svm prediction based on dense sift on those regions?


      Am I right, or I misunderstood something about this BOF method. If I am wrong, how can I achieve my goal. Once again at my disposal, I have a 160 sets of images(original frame, mask on the racket, mask on the background).










      share|improve this question
















      My aim is to detect some underwater object - badminton racket among others.
      I have over 160 images of this racket laying underwater. I have created binary masks for this racket object (object I want to detect) and then I calculated based on that racket masks the underwater scenery masks (rocks, leafs, etc..,objects I don't want to detect). Now I want to use BOF with dense sift. What I intend to do:




      1. Create a visual dictionary - compute dense SIFT on the image applying the racket mask and then background mask(on each image I am calculating SIFT two times - for objects I want to detect(racket) and for all other underwater objects

      2. Having dictionary I have to calculate my SVM train data - so once again for every image I calculate SIFT applying my object mask( and label it 1) and applying background mask(label 0) - I am calculating frequency (histogram) of visual words from the dictionary.

      3. Object recognition - that part is tricky for me. My trained svm knows the frequencies of dictionary visual words for the racket(label 1) and the background(label 0). Now I have an image i want to test my SVM on - racket laying underwater among some rocks and other things. When I put that data in my SVM it will detect "both frequencies of visual words" - because on the image is my racket, and there is background as well. It is detecting both things. Now how I can prevent that? My idea is to segment image I want to classify on several (10-50) regions and then on each region calculate dense SIFT and then svm prediction based on dense sift on those regions?


      Am I right, or I misunderstood something about this BOF method. If I am wrong, how can I achieve my goal. Once again at my disposal, I have a 160 sets of images(original frame, mask on the racket, mask on the background).







      opencv image-processing machine-learning svm sift






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 27 '18 at 9:17







      Karol Żurowski

















      asked Nov 27 '18 at 9:06









      Karol ŻurowskiKarol Żurowski

      170111




      170111
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53496065%2fbag-of-features-with-dense-sift-and-svm-understanding-and-implementation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53496065%2fbag-of-features-with-dense-sift-and-svm-understanding-and-implementation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)