## 2 Proposed Vehicle Detection and Tracking System
### Vehicle Tracking with Occlusion Handling  
In the previous section, a light pairing process is proposed to find all the possible vehicles in front of the host vehicle, which it can reduce the falsely detected vehicles. On the other hand, missed pairings still occur and cannot be fixed if the system only considers vehicle detection in single frames. Missed detection happens because of several problems, which may cause either the disappearance or the distorted appearance (size, shape, or color) of one lamp in a light pair. The following problems may lead to the pairing failure: (1) partial vehicle occlusion; (2) two vehicle lights of two different vehicles are detected as one connected region when one vehicle is too close to another vehicle; (3) left-turning or right-turning vehicles; (4) blooming effect of only one light in oncoming vehicles. To solve these problems, a vehicle tracking method with occlusion handling is proposed. In the vehicle tracking process, the detection results are refined by associating the spatiotemporal features of vehicles in sequential frames. It is assumed that a pair of vehicle lights form a vehicle, such that any vehicles that have two light pairs will be put into the post-processing step to group two pairs into one pair. To facilitate describing the vehicle tracking process, the following terms are defined:  
1. \(\mathbf{P^{t}}=\{P^{t}_{i}=(P^{t}_{i}(1),P^{t}_{i}(2)|\ P^{t}_{i}(1)\ \text{and}\ P^{t}_{i}(2)\in\mathbf{TL^{t}}\), \(l(P^{t}_{i}(1))<l(P^{t}_{i}(2))\), \(i=(1,...,n^{t}_{p})\}\) and \(\mathbf{RTL^{t}}\) denote the set of light pairs and the remaining light trackers retrieved from the light pairing step, respectively. 2. \(TP^{t}_{i}=<P^{1}_{i},P^{2}_{i},...,P^{t}_{i}>\) denotes the light pair tracker representing for the trajectory of light pair \(P^{t}_{i}\). 3. The location of light pair \(P^{t}_{i}\) is determined by the bounding box of \(P^{t}_{i}\): \[ \begin{cases}t(P^{t}_{i})=min\{t(P^{t}_{i}(1),t(P^{t}_{i}(2)\}\\ I(P^{t}_{i})=min\{l(P^{t}_{i}(1),l(P^{t}_{i}(2)\}\\ r(P^{t}_{i})=max\{r(P^{t}_{i}(1),r(P^{t}_{i}(2)\}\\ b(P^{t}_{i})=max\{b(P^{t}_{i}(1),b(P^{t}_{i}(2)\}\\ \end{cases} \] (13)
4. \(\mathbf{TP^{t-1}}=\{TP^{t-1}_{j}|\ j=(1,...,n^{t-1}_{pt})\}\) denotes the set of light pair trackers in the previous frame \(t-1\) In the vehicle tracking process, a light pair tracker might be in one of four possible states:  
1. **Update:** if a light pair \(P^{t}_{i}\in\mathbf{P^{t}}\) in the current frame \(t\) matches a light pair tracker \(TP^{t-1}_{j}\in\mathbf{TP^{t-1}}\) in the previous frame \(t-1\). Then, the light pair tracker \(TP^{t}_{j}\) is associated with \(P^{t}_{i}\) and it is added  
Figure 10: Results of light pair verification: (**a**,**c**) without verification; (**b**,**d**) with verification. to the set of light pair trackers \(\mathbf{TP^{t}}\) in the current frame. The matching condition for light pair is defined based on the overlapping score in Equation (5) and the ratio of pair widths of two frames \(t-1\) and \(t\): \[ \begin{cases}S_{0}(P_{i}^{t},TP_{j}^{t-1})>\tau_{mp}\\ \frac{min\left\{W(P_{i}^{t}),W(TP_{j}^{t-1})\right\}}{max\left\{W(P_{i}^{t}),W( TP_{j}^{t-1})\right\}}>\tau_{mpw}\end{cases} \] (14) where \(\tau_{mp}\) and \(\tau_{mpw}\) are the matching thresholds for verifying whether \(P_{i}^{t}\) can be associated with \(TP_{j}^{t-1}\). The values of \(\tau_{mp}\) and \(\tau_{mpw}\) are chosen experimentally as 0.3 and 0.7, respectively. 2. **Appear**: if a light pair \(P_{i}^{t}\in\mathbf{P}^{t}\) in the current frame \(t\) does not match any light pair trackers \(TP_{j}^{t-1}\in\mathbf{TP^{t-1}}\) in the previous frame \(t-1\). Then, a new light pair tracker \(TP_{i}^{t}\) is created and it is added to the set of light pair trackers \(\mathbf{TP^{t}}\) in the current frame. 3. **Disappear**: a light pair tracker is determined to have disappeared if it satisfies the following two conditions.