# Multiple Pedestrian Tracking in Dense Crowds Combined with Head Tracking
## 3 Main Architecture
### Detector and Tracker
#### 3.1.2 Head Tracker  
Next, the outputs of head detector were input to the head tracker. The head tracker is an improved version of the particle filter [60]. The specific execution flow is as follows.  
Initialization. The tracklets were initialized at the beginning of the input video, and the weight of each particle was equalled at the initialization. Each particle was represented by a four-dimensional state space, with the states of each target being modelled as \((x_{c},y_{c},w,h,x_{c},y_{c},\dot{w},h)\), where \((x_{c},y_{c},w,h)\) represent the center coordinates of \(x\) and \(y\) axis, widths, heights of the bounding boxes, and the dotted represent the next prediction for the bounding boxes. In addition, new tracklets were also initialized for the bounding boxes that cannot match any existing tracklets.  
Predict and Update. For the subsequent video frame, a ROI pooling operation was performed on the feature maps of the targets of that frame. ROI pooling performed max pooling on inputs of nonuniform sizes to obtain feature maps of fixed sizes. This operation unified the sizes of the target feature maps without losing the local and shape information of the targets. Our particle filter refreshed the state information of particles through the prediction stage and update stage. In the particle prediction stage, the weight of each particle was set according to the foreground classification score of the classification head in Section 3.1.1. Then, we used the regression head in Section 3.1.1 to predict the position of each particle. The method of using the regression head to predict the positions of the particles is similar to that of [6], but the difference between them is that the bounding box regression operation was applied to the particles instead of the target tracklets in [6]. In the update stage of the particles, the weights of the particles were averaged to search the positions of the targets, and the corresponding formula is shown in (1). \(S_{t}^{k}\) represents the predicted position of the \(k\)th tracklets in the \(t\)th frame, \(M\) is the number of particles, \(p_{t}^{k,j}\) represents the position of \(i\)th particle associated with the \(k\)th tracklets in the \(t\)th frame; furthermore, \(w_{t}^{k,i}\) represents the weight of \(p_{t}^{k,j}\). We have  
\[S_{t}^{k}=\frac{1}{M}\sum_{i=1}^{M}p_{t}^{k,i}w_{t}^{k,i}. \tag{1}\]  
Resample. The particle filter itself has degenerate problems [60], so we used resampling techniques to replace less important particles. When the weights of particles on the positions of the regression head were over the threshold \(\bar{N}_{eff}^{k}\), \(M\) particles of would be resampled. The threshold \(\bar{N}_{eff}^{k}\) is defined as shown in (2):  
\[\bar{N}_{eff}^{k}=\frac{1}{\sum_{i=1}^{M}(w_{t}^{k,i})^{2}}. \tag{2}\]Cost Match. If the score of estimated state \(S\) of a tracklet was less than threshold \(\mu\), the tracklet would be set to the inactive state. According to the constant velocity assumption (CVS) model, the next positions of these tracklets were estimated. If the positions of the new tracklets have a high similarity with the detection results, the tracking of these tracklets will be resumed. The similarity calculation method is shown in (3), where \(\alpha\) and \(\beta\) are parameters representing weights, \(IoU\) represents the calculation of the IoU value between two bounding boxes, and \(d^{1}\) represents the Bhattacharyya distance between the corresponding color histograms in the HSV space [61], \(L_{t}^{i}\) and \(N_{t}^{j}\) respectively represent the \(i\)th inactive and the \(j\)th newly initialized tracklets in the \(t\)th frame. Once the tracklets were reidentified, we reinitialized the particles around their new positions. We have  
\[C=\alpha*IoU(L_{t}^{i},N_{t}^{j})+\beta*d^{1}(L_{t}^{i},N_{t}^{j}). \tag{3}\]