I test the performance of some samples in the opencv source tree depending on whether the halogen is used or not.
Surprisingly, performance is worse if halogen is used for calculation:
- squeezenet_halide: ~ 24 ms with halide and ~ 16 ms without halide.
- resnet_ssd_face: ~ 84 ms with halide and ~ 36 ms without halide.
I compiled halide and opencv following the instructions in this tutorial . The opencv code was downloaded from the main branch of the opencv git repository .
I tested performance using the sample resnet_ssd_face.cpp and 'squeezenet_halide.cpp files. In both cases, I turn on one of these lines of code before calling forward to activate or deactivate the halide:
net.setPreferableBackend(DNN_BACKEND_HALIDE); // use Halide
net.setPreferableBackend(DNN_BACKEND_DEFAULT); // NOT use Halide
Time is measured using this code immediately after calling the "forward" function:
std::vector<double> layersTimings;
double freq = cv::getTickFrequency() / 1000;
double time = net.getPerfProfile(layersTimings) / freq;
std::cout << "Time: " << time << " ms" << std::endl;
Is there anything in the textbook? Should Halide be generated with various parameters?
My setup:
OS: Linux (Ubuntu 16.04)
CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
GPU: nVidia GeForce GT 730 (Driver Version: 384.90)
Cuda: CUDA Version 9.0.176
source
share