# An Improved Lightweight Model for Defect Detection on Paths in Images
## 2 Materials and Methods
### Feature Fusion Network Lightweight Improvement  
In road defects, apart from larger-scale defects, there are a vast number of small defects, which are often a challenge in road defect detection. Therefore, the focus of model improvement should be directed towards this challenge. Due to the insufficient detailed information of small-scale road defects in images, it is difficult to capture enough features for accurate identification, especially under complex background conditions. Moreover, the scale variation of small-scale targets is significant under different distances and viewpoints, requiring a higher adaptability to scale changes.  
In YOLOv8, the PAN-FPN is introduced as its feature pyramid network. Figure 2 illustrates schematic representation of the PAN-FPN. The P1-P5 layers shown in the figure constitute a feature pyramid designed for multi-scale detection. Specifically, the pyramid levels P3, P4, and P5 are constructed by the neck network using feature maps from the C3, C4, and C5 stages of the backbone. These three levels possess progressively coarser resolution but richer semantic information and are subsequently fed to the detection heads. The highest-resolution feature maps, P1 and P2, while representing the earliest feature stages, are not utilized in the fusion process for the final detection task, out of consideration for balancing performance and computational cost. Furthermore, building on the FPN, a bottom-up path from PAN is introduced to pass low-level features to high-level features layer-by-layer, further enriching the multi-scale features.  
Despite enriching multi-scale features, the PAN-FPN structure still has potential for further optimization. Firstly, its feature fusion process relies heavily on repeated convolutions and channel concatenations, which introduces significant computational and parameter overhead. Secondly, this simple 'concatenation-and-convolution' fusion method may not be the optimal solution for exchange of information between different scales, potentially leading to inefficient information flow or feature redundancy. These limitations highlight the necessity of developing a more efficient and lightweight feature fusion paradigm, which serves as the motivation for our subsequent improvements.  
The Cross-Scale Feature Fusion Module (CCFM) was originally proposed by Baidu in RT-DETR [20]. This study incorporates the module back into the feature fusion component of the YOLOv8 object detection model. Before up-sampling the feature map, CCFM (as shown in Figure 3) fuses the extracted feature map through a lightweight lateral convolution operation, which uses a 1 \(\times\) 1 convolution kernel to mix channels of the feature  
Figure 2: Schematic representation of the PAN-FPN (Path Aggregation Network–Feature Pyramid Network) structure in YOLOv8.  
map, preparing for the channel count of subsequent layers. An additional convolutional layer is used before Concatenation to further refine features before feature fusion. The fused feature map is passed through a sequence of 1 \(\times\) 1 convolutional layers utilized to enhance the feature representation capability further. The indices and processing order of the feature maps are adjusted, optimizing the feature processing workflow to adapt to different feature fusion and down-sampling operations. Compared with the traditional FPN, CCFM emphasizes inter-stage communication more. It allows features from deeper layers of the network to interact more directly with shallower features, which helps to pass richer information between feature maps of different resolutions. After a series of lightweight convolutional kernels are used, CCFM can achieve effective feature fusion with less computational cost without sacrificing detection accuracy, optimizing it for lightweight and real-time application scenarios.