# Image Semantic Segmentation Fusion of Edge Detection and AFF Attention Mechanism
## 2 Method
### Hybrid Model of Improved PSP-Net Network Combined with Improved HED
#### 2.1.2 Improved HED Network Model  
In this paper, HED [28, 29] is improved to obtain the edge detection network. The improved model can effectively extract features of different scales, and learn features of other scales while doing so. The improved model integrates deep semantic features and shallow contour edge features. The accuracy of contour information in semantic segmentation results is improved. In the model, the output of each side is upsampled by the bilinear difference algorithm, restored to the size of the original image, and then the output result is fused through the fusion layer.  
The improved HED network is shown in Figure 5. The improved HED network takes the VGG-16 model as the main frame, it induces the output of 5 sides, respectively, while carrying out convolution. The last full-link layer in HED is removed and a full convolutional network is obtained. At the same time, dilated convolution is introduced to increase the receptive field of feature extraction. After upsampling at each level, loss and sigmoid layers are added to calculate the loss of each layer, respectively. After the fusion of features at each level, the loss of the sigmoid layer is calculated.  
Edge detection using the improved HED network can be divided into five different stages. Each stage consists of a convolution layer, pooling layer and dilated convolution at different scales. That is, five different side branches are distinguished, and features are obtained by means of convolution, pooling and void convolution in each stage. The cavity rate of the cavity convolution is 2, and the convolution kernel is 3 \(\times\) 3.  
Each stage parameters of the improved HED network are shown in Table 1.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Network Layer** & **Convolution Kernel Size** \\ \hline Stage1(Pooling1 + Dilated Conv + Sigmoid) & [3; 3; 64] \\ Stage2(pooling2 + Dilated Conv + Sigmoid) & [3; 3; 128] \\ Stage3(pooling3 + Dilated Conv + Sigmoid) & [3; 3; 256] \\ Stage4(pooling4 + Dilated Conv + Sigmoid) & [3; 3; 512] \\ Stage5(pooling5 + Dilated Conv + Sigmoid) & [3; 3; 512] \\ \hline \hline \end{tabular}
\end{table}
Table 1: Parameters of each stage in the improved HED network.  
Figure 5: Improved HED network.  
In the improved HED network, under the same computational conditions, dilated convolution [30; 31] provides a larger receptive field without loss of resolution, which can better capture multi-scale context information and the size of the output feature image will not be changed. Figure 6 is the schematic of dilated convolution.  
The larger the receptive field value of the neuron in the dilated convolution is, the more pixel range the convolution kernel can contact. This means that more global semantic level features are extracted when extracting features. On the other hand, if the receptive field value is smaller, the features contained in it tend to be local and detailed. Therefore, the value of the receptive field can be used to roughly judge the abstraction level of each layer.