# Deep Learning-Based Algorithm for Recognizing Tennis Balls
## 4 Experimental Results and Analysis
However, the recognition speed of the Mask R-CNN-based recognition algorithm is lower than that of the Faster R-CNN-based recognition algorithm, because the Mask R-CNN-based recognition algorithm also must predict the value of the mask, i.e., the optimization algorithm used in this paper sacrifices a little detection speed, but effectively improves the recognition effect of the tennis ball and enhances the robustness of the recognition algorithm to the external environment. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**The Number** & **5** & **10** & **15** & **20** & **25** & **30** & **35** \\ \hline bbox loss & 0.15360 & 7.2653 \(\times 10^{-3}\) & 4.9997 \(\times 10^{-3}\) & 3.5553 \(\times 10^{-3}\) & 3.5126 \(\times 10^{-3}\) & 3.0002 \(\times 10^{-3}\) & 2.2143 \(\times 10^{-3}\) \\ class loss & 8.1305 \(\times 10^{-3}\) & 3.635 \(\times 10^{-3}\) & 5.0013 \(\times 10^{-3}\) & 3.3652 \(\times 10^{-3}\) & 3.9756 \(\times 10^{-3}\) & 1.5025 \(\times 10^{-3}\) & 3.5784 \(\times 10^{-3}\) \\ mask loss & 0.05362 & 0.04127 & 0.03597 & 0.03423 & 0.03362 & 0.03253 & 0.03155 \\ loss & 0.09865 & 0.05623 & 0.05123 & 0.04864 & 0.04556 & 0.04376 & 0.04289 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Detailed loss function data of Mask R-CNN at different iteration levels. Figure 24: Mask loss of Mask R-CNN 3. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Training** & **Total Loss** & **Number of** & **Number of** & **Accuracy Rate \%** & **Detection** & **Recognition** \\
**Method** & **Function** & **Accurate** & **Error** & **Speed/ms** & **Distance/mm** \\ \hline Color and contour & 0.50863 & 12 & 38 & 24 & 698.7 & 1000 \\ Cascade classifier & 0.01136 & 21 & 29 & 42 & 372.2 & 1500 \\ Faster R-CNN & 0.05923 & 38 & 12 & 76 & 180.4 & 3000 \\ Mask R-CNN & 0.04376 & 46 & 4 & 92 & 236.5 & 5000 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison of tennis ball recognition results using different recognition algorithms. Figure 25 shows the recognition of tennis balls indoors and outdoors with the improved and optimized algorithm based on Mask R-CNN convolutional network. In this case, the mask outline of the tennis ball is depicted with a solid line in (b) in Figure 25, while the image of the recognized tennis ball is marked with a dashed box in order to distinguish it from the solid line. As can be seen from Figures 16-21, the classification loss function and regression loss function of Mask R-CNN and Faster R-CNN neural networks significantly decrease in the interval between iteration layers 0 and 5. As the feature parameters on the training set samples are adjusted to delineate the main image features of the tennis ball, the model gets initial convergence, at this time, if the model is to be further trained, the gradient descent-based optimization method needs to reduce the learning rate of the model so that the learning rate is not too high resulting in the loss function values not converging; however, the learning rate cannot be reduced too much, otherwise the model will converge very slowly. Therefore, from Figures 16-21, we can see that the curves of the classification loss function and regression loss function of the two neural networks tend to fall flat, and the learning rate of the training model has a more obvious reduction: one is to ensure that the loss function fluctuates less and always decreases, and the other is to ensure the stable convergence of the training model. After the number of iterations of the training model exceeds 20, the learning rate further decreases and the model with recorded image features converged to a more complete degree, although there is room for learning and training, the convergence of the model is not obvious at this time and can be observed only by using electronic devices; after the number of iterations of the model reaches 30, the decline of the loss function curve is minimal and tends to be stable, which means that the model generated by the tennis sample at this time converged to a more appropriate level.