# Real-Time Monitoring Method for Traffic Surveillance Scenarios Based on Enhanced YOLOv7
## 3 ETS-YOLOv7 Algorithm
### Compact Layer Aggregation Networks  
In the field of vehicle target detection, due to the computational constraints of edge devices, it is often necessary to limit the size of models to improve their universality. Therefore, considering both model accuracy and computational complexity, the CLAN lightweight module is proposed, as shown in Figure 3.  
In the original YOLOv7 network framework, the ELAN module serves as a feature extraction unit, consisting of 2D convolutions, batch normalization, and the SiLU activation function. While this module effectively enhances the network's feature extraction capability, it also incurs significant computational overhead. In response to this problem, this paper proposes a compact layer aggregation network that replaces certain 2D convolutions with depth-separable convolution (DSConv) [44], optimizes network gradients, and preserves  
Figure 3: Comparison between ELAN and CLAN. (**a**) ELAN structure; (**b**) CLAN structure. network width, thereby balancing computational efficiency and model accuracy. DSConv is a combination of depthwise convolution and pointwise convolution. As shown in Figure 4a, depthwise convolution extracts feature maps for each channel using a dedicated convolution kernel, thus maintaining the same number of feature maps as the channels in the input layer. However, this operation does not take into account the spatial correlation between different channels at the same location, so pointwise convolution is required to combine these feature maps into a new one. Pointwise convolution, shown in Figure 4b, is similar to 2D convolution but with a kernel size of \(1\times 1\times\mathrm{C_{in}}\), which expands the feature maps dimensionally, where \(\mathrm{C_{in}}\) represents the number of input feature map channels. This operation weigh the feature maps along the channel direction, ultimately producing feature maps with the same dimensions as those from 2D convolution. When performing convolution operations with an input channel as \(\mathrm{C_{in}}\), an output channel as \(\mathrm{C_{out}}\), and an output feature map size of \(\mathrm{H}\times\mathrm{W}\), the 2D convolution layer consists of \(\mathrm{C_{out}}\) filters, where each filter contains \(\mathrm{C_{in}}\) convolution kernels, and each kernel size is \(\mathrm{k}\times\mathrm{k}\). At this point, the computational complexity of 2D convolution is as follows:  
\[\mathrm{FLOPs}_{\mathrm{Conv}}=2\mathrm{k}^{2}\times\mathrm{H}\times\mathrm{W }\times\mathrm{C_{in}}\times\mathrm{C_{out}}. \tag{9}\]  
The number of parameters in 2D convolution at this point is as follows:  
\[\mathrm{P_{Conv}}=\mathrm{k}^{2}\times\mathrm{C_{in}}\times\mathrm{C_{out}}. \tag{10}\]  
In depthwise separable convolution, when handling the aforementioned convolution operations, the first step involves depthwise convolution, which conducts convolution  
Figure 4: Depth-separable convolution structure. (**a**) Depthwise convolution; (**b**) pointwise convolution. operations separately for each channel. The computational complexity is the sum of the computational complexities of each input channel:  
\[\text{FLOPs}_{\text{DepthwiseConv}}=2\text{k}^{2}\times 1\times\text{H} \times\text{W}\times\text{C}_{\text{in}}. \tag{11}\]  
The number of parameters is as follows:  
\[\text{P}_{\text{DepthwiseConv}}=\text{k}^{2}\times\text{C}_{\text{in}}\times 1. \tag{12}\]  
The second step is pointwise convolution, which performs convolution on the output feature map obtained from the first step on a per-pixel basis.