# Performance Optimization of Object Tracking Algorithms in OpenCV on GPUs
## 5 Evaluation
### Experimental Results  
#### 5.2.1 Object Detection with the Haar Classifier  
In this algorithm, the runHaarClassifier kernel occupied the largest portion in the execution time as described in Section 3.1. Therefore, optimizing the kernel can be the most effective optimization to improve the performance of the object detection algorithm. Our analysis in Section 3.1 revealed that the algorithm has low occupancy, thereby under-utilizing the GPU. Therefore, we applied the two optimization schemes, _occup_ and _wave_, to increase the number of active wavefronts.  
As compared to the baseline, _occup_ improved the average throughput by 37% and 47% in the APU and d-GPU environments, respectively. _Wave_ improved the average throughput by 44% and 34% over the baseline in the APU and d-GPU environments, respectively. Furthermore, _occup_ and _wave_ can be combined together, which is denoted as _occup + wave_. As compared to the baseline, _occup + wave_ improved the throughput further by 67% and 77% in the APU and d-GPU environments, respectively.  
Table 7 shows the profiling result of the runHaarClassifier kernel with FHD using a hardware performance counter. The table demonstrates which factors in the GPU improve the kernel's performance. In the table, _VALUInsts_, _SALUInsts_, and _FlatVMemInsts_ indicate how many instructions are executed per work-item in VALU, SALU, and LDS memory. Furthermore, the _VALUBusy_, _SALUBusy_, and _MemUnitBusy_ values indicate the time ratio that the unit is active while the kernel executes.  
Figure 10 shows the throughput of the runHaarClassifier kernel in the object detection algorithm. The results in the figure are normalized to the baseline. The number in parentheses is an actual occupancy while running on real GPU hardware; baseline(30) indicates that the baseline showed 30% of the actual occupancy.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Hardware** & **APU** & **Discrete GPU (d-GPU)** \\ \hline  & CPU & RISC CPU 3.4 GHz & CISC CPU 3.5 GHz \\ \hline  & Core Frequency & 800 MHz & 1000 MHz \\ GPU & Number of CUs & 8 & 28 \\  & Number of PEs & 512 & 1792 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Experiment environment configuration.  
Figure 10: Normalized object detection latency using runHaarClassifier.  
The value of _VALUInsts_ for _occup_ was significantly lower than that of the baseline. This result is because more work-items were simultaneously activated by our scheme, improving the occupancy. Furthermore, a significant increment of the _MemUnitBusy_ value suggests that the accessing memory unit was pipelined more efficiently than before. In other words, memory access per unit time increased because more work-items were concurrently activated.  
Experimental results in _Wave_ also show a significant reduction of _VALUInsts_, _SALUInsts_, and _FlatVMemInsts_ due to the increasing number of generated work-items. In addition, the _VALUBusy_ and _SALUBusy_ values increased because the _Wave_ case activates the total number of wavefronts provided by the GPU, unlike activating the few wavefronts in the _occup_ case.