# Lightweight Neural Network Optimization for Rubber Ring Defect Detection
## 3 Results
### Experiment on the Rubber Ring Datasets  
After the feasibility of the network structure had been verified, we experimented on the rubber ring dataset using the same method. From the automatic optical inspection system, we collected 122 rubber ring images with defects. After preprocessing the rubber ring image dataset as outlined in Section 2.3, we used a layer-by-layer replacement approach to improve YOLOv5's neural network, as described in Section 3.1. We trained the network for 300 epochs and selected the model with the highest score on the validation set as the final test model. Using the same method, slightly different results were obtained. The first replacement layer was still convolutional layer 7. The number of parameters decreased to 91.6% of those in the original network, with an mAP50-95 decrease of only 0.6% and an mAP50 increase of 0.5% (Figure 12a). Convolutional layer 23 was chosen again as the second replacement layer. The number of parameters decreased to 82.9% of the original network, with an mAP50-95 decrease of only 0.1% and an mAP50 increase of 0.4% (Figure 12b). The difference became visible with the third replacement layer. Convolutional layer 17 was chosen as the third replacement layer because it had received the highest score. Although the number of parameters did not decrease substantially for this convolutional layer compared to those for the two previously replaced convolutional layers, the performance of the optimized network was comparable with that of the original network (Figure 12c). We replaced the fourth convolutional layer because it was obvious that there was an opportunity to further optimize the network. When convolutional layer 21 was used as the fourth replacement layer, the number of parameters was reduced to 78.2%, with mAP50 and mAP50-95 decreases of 0.3% and 0.9%, respectively. Convolutional layer 20 was chosen as the fifth replacement layer, and the number of parameters decreased to 76.0%, with mAP50 and mAP50-95 decreases of 0.3% and 1.2%, respectively. Convolutional layer 6 was chosen as the sixth replacement layer, and the number of parameters decreased to 69.5%,  
Figure 11: Score of the optimized network: (**a**) replacing one convolutional layer; (**b**) replacing convolutional layer 7 and another layer; and (**c**) replacing three convolutional layers. The higher the score of the neural network model, the greater the need for optimization. When this score is lower than that of the original network, it indicates that there is no room for further optimization. The blue column represents the highest scoring network and the pink column represents the others.  
with mAP50 and mAP50-95 decreases of 1.8% and 1.7%, respectively (Figure 12f). We also intended to replace convolutional layer 8, which contained more parameters than the other layers. Although replacing convolutional layer 8 could significantly reduce the number of parameters, its performance was not good according to the testing results. Therefore, for the rubber ring detection dataset, the replacement convolutional layers were convolutional layers 7, 23, 17, 21, 20, and 6. The scores after each round of network optimization are shown in Table 1.  
Figure 12: Replacement process from the first to the sixth replacement layer.