Menu

"BUSY BUG" on face detection---- once we initialize the Detection, 100% CPU will be used

Harley
2016-08-25
2016-08-29
  • Harley

    Harley - 2016-08-25

    Dear Yermalayeu Ihar and other experts on SIMD project,
    I am trying to use SIMD for face detection as Yermalayeu Ihar metioned the SIMD makes face detection 2~3 times faster than opencv version.

    But I got a "BUSY BUG" as shown in below code, once we initialize the Detection, then 100% CPU will be used, no matter whether we do face detection or not.

    Can you fix this bug ? Because we want do face detection at any time and release the CPU when stop it.

    Best regards.

    Harley@HK


    #include "Simd/SimdDetection.hpp"
    #include "Test/TestUtils.h"
    #include "windows.h"

    int main()
    {
    typedef Simd::Detection<Simd::Allocator> Detection;
    Detection::View image;
    Test::Load(image, "../../data/image/lena.pgm");
    Detection detection;
    detection.Load("../../data/cascade/lbp_face.xml");

    detection.Init(image.Size()); //###### BUSY BUG HERE !!! #####
    
    //Detection::Objects objects;
    //detection.Detect(image, objects, 3, 0.2);
    while(1)
    {
        Sleep(1000);
        printf("Sleep to show the  ###### BUSY BUG ##### \n");
    }
    

    }

     
  • Yermalayeu Ihar

    Yermalayeu Ihar - 2016-08-25

    It is a short sample of using Simd::Detection and it doesn't check correctness of input data. I would check the result of execution of functions Test::Load() and Detection::Load(). Might be the paths to the files are not correct.

     
    • Harley

      Harley - 2016-08-25

      Dear Yermalayeu Ihar, thanks for your prompt reply.
      Waiting for your solution :)

       
      • Yermalayeu Ihar

        Yermalayeu Ihar - 2016-08-25

        I can't check path to files on your computer. At my computer the example works fine.

         
        • Harley

          Harley - 2016-08-26

          Dear Yermalayeu Ihar, I set a sleeping here:

                  void Run()
                  {
                      while (_run)
                      {
                          if (_tasks.size())
                          {
                              _tasks.front()->Run();
                              std::unique_lock<std::mutex> lk(_mutex);
                              _tasks.pop();
                              _cv.notify_one();
                          }
                          else
                          {
                              Sleep(1);/// + [8/26/2016 harley]
                          }
                          std::this_thread::yield();
                      }
                  }
          
           
          • Yermalayeu Ihar

            Yermalayeu Ihar - 2016-08-26

            My current platform is Windows 10 (VS 2015). Could you tell me about your platform?
            Because this bug depends on used OS or Compiler.
            Your solution of the problem isn't general because it uses Windows' specific function ::Sleep().

             
  • Yermalayeu Ihar

    Yermalayeu Ihar - 2016-08-26

    I have reproduced this bug. There is a problem: if we insert sleep(1) it will lead to decreasing of performance (about 20%). Now I am seeking better solution.

     
  • Yermalayeu Ihar

    Yermalayeu Ihar - 2016-08-26

    I have fixed this bug. Thank you for your bug report.

     

    Last edit: Yermalayeu Ihar 2016-08-26
    • Harley

      Harley - 2016-08-29

      Dear Yermalayeu Ihar, I tested your updated version, and it runs really faster than simply adding a Sleeping, Well done! My platform is Windows 10 (VS 2012 Express).
      By the way, could you let me know why SIMD does not support TreeBased .xml model file, only support StumpBased .xml model file ?

      Harley@HK,China

       
      • Yermalayeu Ihar

        Yermalayeu Ihar - 2016-08-29

        Because there isn't any effective way to optimize (with using SIMD) calculation of these cascades. Also because using of stump based cascedes is default behevior of trainig utiltities in OpenCV (and there isn't any tree based cascades in standard OpenCV samples of HAAR and LBP cascades).

         

        Last edit: Yermalayeu Ihar 2016-08-29

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.