# TCE-YOLOv5: Lightweight Automatic Driving Object Detection Algorithm Based on YOLOv5
## 3 Method
### C3 Res2 Net  
After the _backbone_ network has extracted the basic features of an image, the _neck_ network should further fuse and enhance these features. In the _neck_ module of YOLOv5, the C3 module is also an important part, which fuses feature information of different levels through multiple convolution and residual connection. However, to align with the improvements made to the backbone network and enhance the detection accuracy for small and medium-sized targets, this paper did not adopt a C3 module. Instead, it utilized C3 Res2 Net, which replaces the Bottleneck in the C3 module of the YOLOv5 neck network with a Res2 Net [36] structure. Res2 Net is an improved residual network structure, which is characterized by the introduction of more scale variations in each residual block. Traditional residual blocks typically contain only one path, but Res2 Net enriches the feature representation by adding multiple branches. These branches have different convolution kernel sizes or channel numbers, allowing richer contextual information to be captured. In this way, Res2 Net was able to significantly improve the model's performance while  
Figure 3: Modified Bottleneck structure diagram. (**a**) The original Bottleneck; (**b**) the modified version. Figure 2: TCE-YOLOv5 network structure. keeping the parameter count low. In this paper, we replace the Bottleneck in the C3 module of the YOLOv5 _neck_ network with a Res2 Net structure. Specifically, we replace each Bottleneck unit in the C3 module with a Res2 Net block with multiple branches. These branches extract features through different convolution operations and fuse them through residual connection. In this way, we can take advantage of Res2 Net's scaling characteristics to enhance the feature extraction capability of the C3 module. The replacement C3 module maintains the original input-output interface, so it can be seamlessly integrated into YOLOv5's _neck_ network. The structure of Res2 Net is shown in Figure 4. By constructing hierarchical residual connections within a single residual block, this structure improves the multi-scale feature representation capability of the network at a finer level. Res2 Net divides channels into S groups convolution operation. The larger the value of S, the stronger the receptive field's ability to learn multi-scale features. As shown in Figure 4, after the \(1\times 1\) convolution layer in the Res2 Net module, the feature map is evenly divided into \(S\) feature map subsets, represented by \(x_{i}\), where \(i\in 1,2,\ldots S\). The number of channels for \(x_{i}\) is \(1/S\) of the original channels, and the feature map size remains the same as the input. Each \(x_{i}\), except for \(x_{1}\), has a corresponding \(3\times 3\) convolution that can accept and integrate feature information from all preceding subsets \((x_{2},\ldots,x_{S-1})\). This design enables Res2 Net to effectively integrate feature information of different scales, thus enhancing the feature extraction capability of the model. The Res2 Net structure can be expressed by the following equation:  
\[y_{i}= \begin{cases}x_{i}&i=1,\\ K_{i}(x_{i})&i=2,\\ K_{i}(x_{i}+y_{i-1})&2<i<=S,\end{cases}  \tag{1}\]  
Figure 4: Replacement of the Bottleneck in C3 with Res2 Net. where \(K_{i}\) represents the convolution operation of \(3\times 3\), \(x\) represents the input feature map, and \(y\) represents the output feature map. In this paper, we set \(S\) to 3. First, when S increases, although richer multi-scale features can be captured, the parameter count and computational complexity of the model will increase accordingly. Choosing \(S=3\) can control the complexity and computation of the model to a certain extent, which is especially important for application scenarios where performance is maintained or hardware requirements are reduced. Secondly, selecting \(S=3\) can reduce unnecessary redundancy and improve feature fusion efficiency while ensuring feature diversity.