# Lightweight Neural Network Optimization for Rubber Ring Defect Detection
## 3 Results  
### Validating Feasibility on the COCO (Common Objects in Context) Dataset [31]  
To test the proposed novel network structure idea, we verified the feasibility of the method using the COCO dataset. The accuracy of the network was evaluated by AP (average precision). The AP metric can be calculated as follows:  
\[Precision=\frac{TP}{TP+FP} \tag{5}\]  
\[Recall=\frac{TP}{TP+FN} \tag{6}\]  
\[AP=\frac{Precision+Recall}{2} \tag{7}\]  
where _TP_, _FP_, and _FN_ represent the number of true-positive, false-positive, and false-negative samples, respectively [26]. Since AP achieves a good tradeoff between precision and recall, it was an appropriate metric to objectively evaluate the detection performance of the network. We did not choose to replace convolutional layer 0; hence, all the 0s in Figures 8-10 correspond to data from the original network. We let the parameters of the original network to be equal to 1. We proposed a formula to examine the performance of the optimized network. The second term was the _parameter_, which had a negative coefficient since a smaller _parameter_ value resulted in a higher network _score_. The formula for the performance score of each network in the replacement process was as follows:  
\[score=a\times\left(\frac{mAP50+mAP50-95}{2}\right)+b\times parameter \tag{8}\]  
where parameter \(\in\) [0, 1] represents the ratio of parameters of the optimized network to those of the original network, and a and b refer to two weighting factors obtained from the COCO dataset. To test the network architecture optimization method based on the Ghost module, we verified its feasibility on the COCO dataset. Good results were obtained by replacing certain convolutional layer in the CNNs with the Ghost module in YOLOv5's neural network. The network's performance was on par with that of the original network. Figure 8 shows the performance data of the network after we replaced each convolutional layer. Notably, the  
Figure 8: Metrics of the network when replacing one convolutional layer. number of parameters decreased the most when convolutional layers 7, 8, and 23 were replaced. After a synthetic analysis of the factors of mAP50, mAP50-95, and the parameters, a decision was made to conduct the following experiment based on replacing convolutional layer 7. By replacing the three convolutional layers, we accomplished our aim of decreasing the number of network parameters while minimizing the impact on network performance. Our findings were supported by the results, which showed that (1) the CNNs included redundant features and (2) that these redundancies were minimal. Therefore, we decided to finally optimize the structure of YOLOv5's neural network by replacing convolutional layers 7, 8, and 23 with the Ghost module. When layer 8 was replaced, the number of parameters decreased the most, reaching 83% of the original value. However, the other metrics did not perform as well as expected. The number of parameters also decreased to less than 84% of the original value when we replaced convolutional layer 23, while mAP50-95 increased by 0.1% and _mAP50_ decreased by 2.0% (Figure 9). As a result, convolutional layer 23 was chosen as the second convolutional layer to be replaced. Figure 10: Replacing convolutional layer 7 or 23 and another convolutional layer. Figure 9: Replacing convolutional layer 7 and another convolutional layer. When three layers of the network were replaced, the findings were less surprising, as shown in Figure 10. Because the remaining layers had fewer parameters compared to the two convolutional layers, the number of parameters did not reduce substantially. The results only became acceptable when convolutional layer 8 was replaced with the Ghost module: mAP50 and mAP50-95 decreased by 0.3% and 2.2%, respectively. The total number of parameters decreased to 75% of the original value. Our policy was that, when the score of the optimized network decreased below that of the original network, there was no more room for improvement in that specific network.