# An Improved CrowdDet Algorithm for Traffic Congestion Detection in Expressway Scenarios
## 3 Methodology
### Baseline Detector  
The primary objective of this paper is to improve vehicle detection performance under severe occlusion conditions, ultimately enhancing the accuracy of traffic congestion detection. In traffic congestion scenarios, vehicle occlusion poses a problem similar to that of dense pedestrian detection. Therefore, this paper selected the CrowdDet algorithm [20] as the baseline detector, as it addresses the problem of detecting dense pedestrians. The detector has demonstrated good performance on the CoCo [32], CityPerson [33], and CrowdHuman [34] datasets, which contain lightly, moderately, and heavily occluded pedestrians, respectively. This is similar to vehicle detection under free-flow, slow-flow, and congestion conditions on expressways. The network architecture of the CrowdDet algorithm is shown in Figure 2.  
The CrowdDet algorithm mainly consists of the ResNet-50 [35] backbone network, the feature pyramid network (FPN) [36], the Mask R-CNN [37], and the Crowddet component used to simultaneously perform classification and regression tasks. The ResNet-50 backbone network is a residual network structure widely used for feature extraction in images due to its excellent performance. FPN is a feature pyramid network that combines high-level and low-level feature maps in a top-down structure to improve multi-scale detection accuracy. Mask R-CNN uses RPN to propose bounding boxes on the feature map, and then, it selects the corresponding window based on the proposal boxes on the feature map. As the window sizes are different, ROIAlign is used for standardization, resulting in a proposal box feature map of 256 \(\times\) 7 \(\times\) 7. The CrowdDet algorithm first considers that when multiple objects overlap severely, a proposal box corresponding to a single object will lead to a decrease in performance. Therefore, for each proposal box \(b_{i}\), a set of ground-truth instances \(G(b_{i})\) is predicted instead of a single object. This is shown in Equation (1):  
\[G(b_{i})=\left\{g_{i}\in G\mid IOU(b_{i},g_{i})\geq\theta\right\} \tag{1}\]  
where \(G\) is the set of all ground-truth boxes, and \(\theta\) is the given \(IOU\) threshold. For each proposal box \(b_{i}\), most methods use a detection function to predict a pair \((c_{i},I_{i})\) to represent the associated instance. However, the CrowdDet algorithm generates a set of predicted instances \(P(b_{i})\) by introducing \(K\) detection functions, as shown in Equation (2):  
\[P(b_{i})=\left\{\left(c_{i}^{(1)},I_{i}^{(1)}\right),\left(c_{i}^{(2)},I_{i}^ {(2)}\right),\ldots,\left(c_{i}^{K},I_{i}^{K}\right)\right\} \tag{2}\]  
where \(K\) is a given constant, representing a set of \(K\) pairs of predictions, where \(c_{i}^{K}\)and\(I_{i}^{K}\) are the class label confidence and relative coordinates of the \(K\)-th prediction of box \(b_{i}\). Figure 2: CrowdDet network architecture. Then, in order to minimize the discrepancy between the predicted instance set \(P(b_{i})\) and the ground-truth instance \(G(b_{i})\) set corresponding to proposal box \(b_{i}\), the EMD loss is designed, as shown in Equation (3):  
\[L(b_{i})=\underset{\pi\in\Pi}{min}\sum_{k=1}^{K}\Big{[}L_{cls}\Big{(}c_{i}^{(k)},g_{\pi_{k}}\Big{)}+L_{rgg}\Big{(}I_{i}^{(k)},g_{\pi_{k}}\Big{)}\Big{]} \tag{3}\]  
where \(\pi\) represents a specific permutation of \((1,2,\cdots,K)\), with the k-th element being \(\pi_{k}\), and \(g_{\pi_{k}}\) is the ground-truth box corresponding to \(\pi_{k}\). \(L_{cls}(\cdot)\) and \(L_{reg}(\cdot)\) represent the classification loss and the bounding box regression loss, respectively. To better detect objects in occluded scenes, the CrowdDet algorithm proposes Set NMS. Set NMS inserts an extra detection to determine whether two boxes come from the same proposal before suppressing one with NMS. If they do, the suppression is skipped. Using Set NMS in conjunction with multi-instance prediction can achieve significant improvements in occlusion detection.