# Buckle Pose Estimation Using a Generative Adversarial Network
## 3 Methods
### Feature Reconstruction Module  
After obtaining the overall features of the target using dilated convolutions, the features are reconstructed by the decoder. The feature extraction network obtains three scale features that are recorded as deep features, \(F_{1}\); middle layer features, \(F_{2}\); and low features, \(F_{3}\). As shown in Figure 5, the deep features are upsampled to each scale using deconvolutions, and the original scale features are fused by skip connections to obtain the enhanced feature, \(f_{i}\) (\(i=1\), \(2\)), for each scale. The final segmentation image, \(R\), is obtained by adjusting the channel dimension of the feature map through a \(1\times 1\) convolution, as shown in Equations (3)-(5):  
\[f_{1}=\sigma(BN(upsample(dilate(F_{1})))), \tag{3}\]  
\[f_{i+1}=\sigma(BN(upsample(W_{1\times 1}*CAT(f_{i},F_{i+1})))(i=1,2), \tag{4}\]  
\[R=W_{1\times 1}*\sigma(BN(W_{3\times 3}*f_{3})), \tag{5}\]  
where \(\sigma\) is the rectified linear unit activation function, Rel.; \(upsample\) represents the deconvolution operation, \(dilate\) represents the dilate convolution, \(CAT\) represents the channel fusion (splicing); \(W_{1\times 1}\) represents a \(1\times 1\) convolution kernel, which changes the channel dimension of the concatenated feature, and \(W_{3\times 3}\) represents a \(3\times 3\) convolution kernel.  
Buckle pose estimation must regress the outer contour and the center edge line of the target. In each training sample, a positive sample pixel consists of the label position, whereas other positions are negative sample pixels. Therefore, the outer contour and the central edge line account for a small proportion of the overall pixels, which causes a serious imbalance between the positive and negative samples. We apply focal loss (\(FL\)) as the loss  
\begin{table}
\begin{tabular}{l c c c c c c c c c c} \hline \hline
**Layer** & **1** & **2** & **3** & **4** & **5** & **6** & **7** & **8** & **9** & **10** \\ \hline Name & Conv & Max- & Conv & Identity & Conv & Identity & Conv & Identity & Dilate & Dilate \\  & & Pooling & Block & Block2 & Block & Block3 & Block & Block5 & Conv1 & Conv2 \\ \hline Dilation size & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 3 & 2 \\ Kernel size & \(7\times 7\) & \(3\times 3\) & \(3\times 3\) & \((3\times 3)\) & \(2\) * & \(3\times 3\) & \((3\times 3)\) & \  
For the discriminator, \(D\), convolutional block stacking is used to extract features, and the spatial attention mechanism is added after obtaining deep features so that the network can focus more on generating the contour label values. Average pooling encodes global statistics, while Max pooling encodes the salient parts. It is the same as the attention module proposed by [36], the feature map, \(S\), is first obtained by stacking convolutional blocks. It is then averaged, and the maximum values of the channels in feature map \(S\) are calculated to obtain the average and maximum feature maps. The two maps are then channel-fused, and the channel is changed by a \(1\times 1\) convolution to obtain the attention map, \(M\), which is multiplied by the feature map \(S\) pixel-by-pixel. The calculated final attention feature map, \(SA\), is expressed as  
\[M=W_{1\times 1}*CAT(Ga(S),Gm(S)), \tag{8}\]  
\[SA=\varphi(S)\otimes M, \tag{9}\]  
where \(\varphi\) represents the sigmoid activation function, \(\otimes\) represents pixel-by-pixel multiplication, \(Ga\) and \(Gm\) are the global average and maximum values of all channels in the feature map, respectively.