Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions: how to optimize the speed of landmark detection code #46

Closed
ardeal opened this issue Apr 26, 2017 · 4 comments
Closed

Questions: how to optimize the speed of landmark detection code #46

ardeal opened this issue Apr 26, 2017 · 4 comments
Labels

Comments

@ardeal
Copy link

ardeal commented Apr 26, 2017

Hi Patrikhuber,

I would like to run only landmark detection on your SDM code, and I would like to make the prediction code run faster as long as the landmark accuracy is good for me.

as you might know that, the most time needed for SDM landmark is for HOG calculation, and the time is mostly related with the size of ROI image calculated in adaptive_vlhog.hpp file.

my questions are:

  1. in your rcr-train.cpp file, you set hog_params as follows:
    std::vectorrcr::HoGParam hog_params{
    { VlHogVariant::VlHogVariantUoctti, 5, 11, 4, 1.0f },
    { VlHogVariant::VlHogVariantUoctti, 5, 10, 4, 0.7f },
    { VlHogVariant::VlHogVariantUoctti, 5, 8, 4, 0.4f },
    { VlHogVariant::VlHogVariantUoctti, 5, 6, 4, 0.25f } };
    why is num_cells 5? shouldn't it be an even number?

  2. in order to keep the accuracy and promote the speed, what are the best hog_params according to your experience?

  3. in rcr-train.cpp file, the regressor level is 4. should it be smaller? what is the best regressor level according to your experience?

@patrikhuber
Copy link
Owner

patrikhuber commented Apr 26, 2017

Hi,

1: I think an odd number is fine ;-) But for this one you should really look at the VlHog documentation, it will have all the details!

2: The ones that are set are pretty good and also a good trade-off. You can search through the issue list here, I think in one of the issues I posted a table or XLS with some parameter values and results. As for the speed, I'm not sure which parameters have main influence on speed, you'll have to test that.

3: 4 is the best trade-off imho, 3 is too little, 5 gives slightly better result but is slower/bigger.

@ardeal
Copy link
Author

ardeal commented Apr 27, 2017

Thanks Patrikhuber for your answer!

I tested some parameters and would like to share my test result with you and all developers:
I tried to reduce the cell size from big to small, and I found out that the following HOG parameters gave the best trade-off between and performance and speed:
rcr::HoGParam hogptemp1 = { VlHogVariant::VlHogVariantUoctti, 4, 6, 4, 0.6f };
rcr::HoGParam hogptemp2 = { VlHogVariant::VlHogVariantUoctti, 4, 4, 4, 0.4f };
rcr::HoGParam hogptemp3 = { VlHogVariant::VlHogVariantUoctti, 4, 3, 4, 0.3f };
rcr::HoGParam hogptemp4 = { VlHogVariant::VlHogVariantUoctti, 4, 2, 4, 0.2f };

I set the landmarks number to 21 and the time needed is 6.6ms on I5 3.2G CPU, 7 landmarks and the time is 2.6ms.

@ardeal
Copy link
Author

ardeal commented Apr 27, 2017

the major time needed for SDM prediction is to calculate HOG for each regressor and each landmark. if we reduce the number of landmarks, the time needed will be greatly reduced.
Furthermore, HOG parameters will also greatly affect the time needed, especially cell size of HOG.

@patrikhuber
Copy link
Owner

Yep that makes total sense! Thanks for posting back for anyone that may find it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants