# Contour Detection for Fibre of Preserved Szechuan Pickle Based on Dilated Convolution
## 4 Experiments
### Comparison of RCF, HED and Dilated-HED  
We evaluate dilated-HED, HED and RCF on the test set, which is composed of 424 pairs of pictures. The detection accuracy is evaluated using two measures: Pixel Accuracy (PA) and Mean Intersection over Union (MIoU). Both are proposed in [2] and are standard measures for semantic segmentation. Pixel accuracy (PA) is the simplest indicator used to calculate the ratio between the number of pixels correctly classified and the total number of pixels. It can be defined as  
\[\text{PA}=\frac{\sum_{i=0}^{k}p_{ii}}{\sum_{i=0}^{k}\sum_{j=0}^{k}p_{ij}}\, \tag{4}\]  
\(k\)+1 represents the number of categories of contours, including background. \(p_{ij}\) represents the number of pixels that belong to class i but are predicted to be class \(j\). MIoU is a standard metric to calculate the ratio of intersection and union between sets. Its definition is as follows:  
\[MIoU=\frac{1}{k+1}\sum\
olimits_{i=0}^{k}\frac{p_{ii}}{\sum_{j=0}^{k}p_{ij}+ \sum_{j=0}^{k}p_{ji}-p_{ii}}\, \tag{5}\]  
Before we loaded the data into the model for training, we first adjusted the size of the picture to \(512\times 512\). The main reason for this is memory constraints and control parameters. The output images on the dataset are grayscale, with gray values ranging from 0 to 255. The value of 0 represents the background, and the value of pixel is closer to 255, the more likely it is to be a contour. By setting the threshold, we can filter out the possible points to get the predicted contours. Compared with HED and RCF networks, our method achieves better processing results. For a specific comparison, see Figure 4. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Categories** & **Continuous contour** & **Discrete contour** & **Total** \\ \hline Train set & 910 & 786 & 1696 \\ Test set & 256 & 168 & 424 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Introduction to our dataset. From the comparison of the above results, we can see that RCF outputs more false regions, which are distributed on both sides of the right contour, and the background area of non-preserved Szechuan pickle is also recognized as a contour. HED can detect the area where the section of preserved Szechuan pickle is located, but there are also many false regions. RCF and HED have low accuracy and high misjudgment rates, which means they are not suitable for contour detection in our project. Our model can detect the contour of fibre accurately, which is distributed irregularly. In addition, the PA and MIoU of the three methods are measured as shown in Table 2.  
In the evaluation index, the background is also a category, and the background is much larger than the target in the image, so the value of PA is large no matter which method is used. The result shows that PA of our method is 99.52% and MIoU is 49.99%. We use dilated convolution at conv1-1 and the dilated rate is [(2,2), (1,1)]. From the data, we can see that the values of PA and MIoU obtained by \begin{table}
\begin{tabular}{c c c c c c} \hline
**Categories** & **RCF** & **HED** & **Ours** & **Continuous Contour (Ours)** & **Discrete Contour (Ours)** \\ \hline PA & 89.91 & 95.72 & **99.52** & **99.52** & **99.53** \\ MIoU & 45.16 & 48.08 & **49.99** & **49.99** & **49.98** \\ \hline \end{tabular}
\end{table} 
Table 2: Pixel Accuracy (PA) and Mean Intersection over Union (MIoU) by three methods (Unit: %). Figure 4: Comparison of richer convolutional features for edge detection (RCF), holistically-nested edge detection (HED) and dilated-HED. From left to right: (**a**) original images; (**b**) the results of RCF; (**c**) the results of HED; (**d**) the results of our method; (**e**) labels, also known as ground-truth. RCF are the lowest, followed by HED, and our model gets the best results. This is consistent with the conclusion obtained from Figure 3. Compared with the HED and RCF, the PA of our results increased by 3.80% and 9.61%, and the MIoU increased by 1.91% and 4.83% respectively.