mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 02:16:34 +08:00
KCF speedup (#1374)
* kcf use float data type rather than double. In our practice, float is good enough and could get better performance. With this patch, one of my benchmark could get about 20% performance gain. Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> * Offload transpose matrix multiplication to ocl. The matrix multiplication in updateProjectMatrix is one of the hotspot. And because of the matrix shape is special, say the m is very short but the n is very large. The GEMM implementation in neither the clBLAS nor the in trunk implementation are very inefficient, I implement an standalone transpose matrix mulplication kernel here. It can get about 10% performance gain on Intel desktop platform or 20% performance gain on a braswell platform. And in the mean time, the CPU utilization will be lower. Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> * Add verification code for kcf ocl transpose mm kernel. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> * tracking: show FPS in traker sample * tracking: fix MSVC warnings in KCF * tracking: move OCL kernel initialization to constructor in KCF
This commit is contained in:

committed by
Vadim Pisarevsky

parent
0058eca130
commit
41995b76e8
@@ -117,6 +117,7 @@ int main( int argc, char** argv ){
|
||||
|
||||
bool initialized = false;
|
||||
int frameCounter = 0;
|
||||
int64 timeTotal = 0;
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
@@ -142,11 +143,14 @@ int main( int argc, char** argv ){
|
||||
}
|
||||
else if( initialized )
|
||||
{
|
||||
int64 frameTime = getTickCount();
|
||||
//updates the tracker
|
||||
if( tracker->update( frame, boundingBox ) )
|
||||
{
|
||||
rectangle( image, boundingBox, Scalar( 255, 0, 0 ), 2, 1 );
|
||||
}
|
||||
frameTime = getTickCount() - frameTime;
|
||||
timeTotal += frameTime;
|
||||
}
|
||||
imshow( "Tracking API", image );
|
||||
frameCounter++;
|
||||
@@ -159,5 +163,8 @@ int main( int argc, char** argv ){
|
||||
paused = !paused;
|
||||
}
|
||||
|
||||
double s = frameCounter / (timeTotal / getTickFrequency());
|
||||
printf("FPS: %f\n", s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user