# An Edge-Guided Deep Learning Solar Panel Hotspot Thermal Image Segmentation Algorithm
## 3 Proposed Algorithm
### Edge Feature Enhancement  
In order to solve the edge-blurred problem of hot spots in thermal infrared images, which leads to poor performance of hot spot edge segmentation, this paper intends to add edge information as prior information to the network to guide it in better feature extraction. An edge-aware module is introduced to extract edge features related to the target. Afterwards, the edge guidance pyramid structure is proposed to fuse the edge features with the features of each layer guiding the feature extraction network to pay more attention to the edge details of the target and improve the segmentation accuracy. The edge-aware module was proposed by [PERSON] et al. [22], which integrates low-level features and high-level features, aiming at mining the edge semantic information of the target.  
In this paper, the module is combined with the Mask R-CNN algorithm, and its structure is shown in Figure 2, which is manifested as follows: First, the network extracts the features of each stage from C1-1 to C1-5 of the input image through ResNet50. We select the low-level feature C1-2 containing local edge information of the image and the high-level feature C1-5 containing global semantic information as input of the edge-aware module and use two 1 \(\times\) 1 convolution layers to change the channel number of channels for low-level and high-level features. Moreover, the low-level features and the up-sampled high-level features are integrated through the concatenation operation. Finally, the edge features of the target are obtained by using two 3 \(\times\) 3 convolution layers, one 1 \(\times\) 1 convolution layer, and the sigmoid function.  
As we all know, the expressive ability of features at different levels of feature maps is different. Low-level features mainly reflect details such as light and shade, edges, etc., while high-level features mainly reflect a richer overall structure. Therefore, we need to consider the information interaction and exchange of features at different layers to achieve the purpose of detecting targets at different scales. On the other hand, if the edge features are only fused with a certain layer, such as high-level or low-level features, without considering the information interaction between the features of other layers and edge features, it will be difficult for the network to adapt to changes in the size and scale of hot spots. The  
Figure 2: Edge-aware module.  
information interaction between different scale features and the fusion of multi-scale features with edge features are both important, not only taking into account details and the whole, but also improving the adaptability of the network to the scale change of hot spots.  
Inspired by the FPN structure in Mask R-CNN and literature [22; 23], we propose an edge-guided pyramid structure, which combines edge features with the features of each layer to guide the network in learning the target edge, and its structure is shown in Figure 3. Firstly, feature maps of different scales are extracted by using ResNet50 (as shown in Figures C1-1 to C1-5) and transformed into a unified number of channels by using \(1\times 1\) convolution (as shown in Figures C2-2 to C2-5). Secondly, the multi-scale features and edge features are multiplied at the element level with additional jump connections to obtain the initial fusion features. Thirdly, we add and fuse the upper-level feature maps obtained by up-sampling with each corresponding element in the lower-level feature maps to form new feature maps. Finally, a \(3\times 3\) convolution is used to smooth the fused feature maps to eliminate the aliasing effect of up-sampling and obtain more fully fused feature maps (as shown in Figures C3-2 to C3-5). The C3-6 feature layer is obtained by maximizing the pooling of the C3-5 feature layer.