# Lem-Detector: An Efficient Detector for Photovoltaic Panel Defect Detection
## 3 Methods
### Multi-Scale Multi-Feature Fusion Pyramid Network (MMFPN)  
As the network depth increases, the features corresponding to small-scale defects often become diminished due to the limited number of pixels they occupy in the image, leading to a loss of information and potential neglect during detection, which adversely affects detection accuracy. To address this issue and re-correct the selection of easily overlooked small-scale information, we propose the MMFPN to integrate the feature information \(S_{2}\), \(S_{3}\), \(S_{4}\), and \(S_{5}\) extracted by the Backbone. Initially, the high-level feature \(S_{5}\) undergoes intra-scale feature interaction via the AIFI module, and then it is combined with the features \(S_{2}\), \(S_{3}\), and \(S_{4}\) in the MMFPN. The process begins with top-down feature fusion, wherein the high-level feature maps, which contain rich global semantic information but have low spatial resolution, are upsampled and fused with the low-level feature maps. This process enriches the spatial information of high-level feature maps, significantly improving the detection performance of multi-scale targets, especially small objects. The generated fused features \(P_{1}\), \(P_{2}\), and \(P_{3}\) are obtained through the fusion process as described in Equation (7), where \(P_{i}\) represents the fused feature information, and \(P_{i}=CIA(X_{i},X_{j})\) denotes the Complementary Information Aggregation module (CIA), with \(X_{i}\), and \(X_{j}\) being the input feature information. Subsequently, three additional bottom-up feature fusions occur, wherein the high spatial resolution but semantically sparse information from the low-level feature maps is downsampled and fused with the high-level feature maps. This enhances the semantic information of the low-level feature maps, contributing to more accurate classification and generating the fused features \(P_{4}\), \(P_{5}\), and \(P_{6}\). The fusion process is described in Equation (8). During feature fusion, the CIA module captures easily overlooked detailed information by receiving adjacent high-level semantic and low-level semantic information. It introduces a bidirectional fusion mechanism between high-resolution and low-resolution features, ensuring more effective information transfer between features, which further enhances the results of multi-scale feature fusion. Finally, the features \(P_{3}\), \(P_{4}\), \(P_{5}\), and \(P_{6}\) are input into the Decoder for precise classification and localization, as shown in Equation (9). \[P_{1}=CIA(S_{5},S_{4})\ P_{2}=CIA(P_{1},S_{3})\ P_{3}=CIA(P_{2},S_{2}) \tag{7}\]\[P_{4}=CIA(P_{3},P_{2})\ P_{5} =CIA(P_{4},P_{1})\ P_{6}=CIA(P_{5},S_{5}) \tag{8}\] \[P_{out} =(P_{3},P_{4},P_{5},P_{6}) \tag{9}\]  
In terms of the fusion method, our proposed CIA module focuses on the complementary semantic information within feature layers. By facilitating cross-layer interactions, it learns the semantic dependencies between multi-scale channel feature mappings, effectively integrating clearer boundary information from shallow features with richer categorical information from deep features. This approach preserves the complementary information from different levels of semantic data, thereby achieving more accurate classification and localization. The specific structure of the CIA is illustrated in Figure 6.  
To avoid redundancy and inconsistencies that may arise from directly merging semantic information from different feature levels, the CIA selectively aggregates boundary and semantic information. Shallow and deep feature representations, denoted as \(f_{\text{L}}\) and \(f_{\text{H}}\), are input into the module and are adjusted to a unified size using \(1\times 1\) convolution.