Created
April 30, 2017 02:03
-
-
Save bakercp/157573d1e27eec5f6fe4467c98477aa7 to your computer and use it in GitHub Desktop.
dlib SIMD tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dlib/image_io.h> | |
#include <dlib/image_transforms.h> | |
using namespace std; | |
using namespace dlib; | |
int main(int argc, char** argv) | |
{ | |
try | |
{ | |
int numRuns = 100; | |
double sum = 0.0; | |
for (int i = 0; i < numRuns; ++i) | |
{ | |
matrix<unsigned char, 1536, 2048> img; | |
dlib::array<array2d<double>> hog; | |
chrono::system_clock::time_point start = chrono::system_clock::now(); | |
impl_fhog::impl_extract_fhog_features(img, hog, 8, 1, 1); | |
chrono::system_clock::time_point end = chrono::system_clock::now(); | |
double msec = std::chrono::duration_cast<chrono::milliseconds>(end - start).count(); | |
sum += msec; | |
} | |
cout << "~" << (sum / numRuns) << " ms" << endl; | |
} | |
catch (exception& e) | |
{ | |
cout << "exception thrown: " << e.what() << endl; | |
} | |
} | |
Orange Pi Zero plus 2 (armbian)
neon not worked on aarch64
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -I.. -lpthread fhog_simd_ex.cpp && ./a.out
result single core
~450.77 ms
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this in your your
dlib/examples
folder and compile and run with something like ...Note that this will run 100 times and output the average time in milliseconds, so on a really slow processor it could take a while.
macOS
with default
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -I.. -lpthread fhog_simd_ex.cpp && ./a.out
with avx
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -mavx -I.. -lpthread fhog_simd_ex.cpp && ./a.out
Ubuntu
with default
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -I.. -pthread fhog_simd_ex.cpp && ./a.out
with avx
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -mavx -I.. -pthread fhog_simd_ex.cpp && ./a.out
Raspberry Pi 3
with default
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -I.. -lpthread fhog_simd_ex.cpp && ./a.out
with neon
g++ -DDLIB_NO_GUI_SUPPORT -DNO_MAKEFILE -std=c++11 -O3 -mfpu=neon -I.. -lpthread fhog_simd_ex.cpp && ./a.out