## 3 Methodology
### Integration of SSD and KCF Tracker  
Running hand detection on every frame of camera inference or video feed is computationally expensive and requires heavy computation. Thus, the SSD detector is proposed to combine with KCF visual tracker to reduce the heavy computation of the system and as a backup when the visual tracker fails to track hand movement by reinitializing the detector. Figure 1 shows the workflow of the tracking-by-detection algorithm by combining the SSD detector with the KCF visual tracker. The system consists of two phases, namely, the detection phase and the tracking phase. The detection phase is activated on the first frame and when the tracking state fails to recover the correct position. For this purpose, the tracking mode is controlled by a Boolean state \"Trackable\" as \"True or False\" as an indicator to activate or deactivate the tracking process on every successive frame. In the detection phase, first, the system will check for tracking status. If no tracking process is running, i.e., \"Trackable = False\", the SSD detector will be activated.  
In this phase, if a hand is detected, a set of bounding boxes will be drawn on the inference window, and the tuple (data variable) which is used to store the bounding box coordinates will be updated with the new set of bounding box coordinates. The KCF tracker is then initialized and activated, and the system will proceed for the tracking phase. Moving forward in the tracking phase, the system will always check the bounding box tuples to prevent passing the empty bounding box coordinates to the tracker, which may  
Figure 1: Flowchart of the integration of SSD and KCF Tracker.  
cause the KCF tracker to crash due to an initialization error. If the bounding box tuple is not empty, the Boolean state \"Trackable\" is set to \"True\" to indicate that the tracking process is in progress. The tracker will be updated with the bounding box coordinates obtained from the SSD detector. If the update process is successful, a new set of bounding boxes will be drawn on the inference window on every successive frame, and the bounding box tuples will be updated with the new set of bounding box coordinates. However, if the KCF tracker failed midway during the hand tracking process, the SSD detector will be reinitialized by setting the \"Trackable\" parameter to \"False\". The system will then be looped back to the detection phase for reinitialization purposes. The performance of tracking rate and accuracy of this tracking-by-detection algorithm is evaluated by computing its Tracker Detection Rate (TRDR) and Object Tracking Error (OTE) [33], as obtained by Equations (1) and (2), respectively:  
\[\text{TRDR}=\frac{\Sigma\text{ True Positives}}{\Sigma\text{ Ground Truth Points}}\times\text{ }100 \tag{1}\]  
\[\text{OTE}=\frac{\sum_{i=1}^{N}\sqrt{\left(Gx_{i}-Px_{i}\right)^{2}+\left(Gy _{i}-Py_{i}\right)^{2}}}{N} \tag{2}\]  
where True Positives indicates the predicted bounding box position overlapped with respect to the Ground truth position at IoU threshold of 0.5, \(N\) is the number of tracked frames, \((Gx_{i},Gy_{i})\) represents the ground truth of the hand's centroid position, and \((Px_{i},Py_{i})\) represents the estimated hand's centroid position for the \(i\)-th frame.