# Improved Mask R-CNN Combined with Otsu Preprocessing for Rice Panicle Detection and Segmentation
## 3 Experimental Results and Analysis
### Results and Analysis  
#### 3.2.1 Experimental Results  
Table 1 shows the detection results of the model with different anchor box sizes. The accuracy of the original Mask R-CNN model is 68.58% using original prior box sizes of [32,64,128,256,512]. Under the same conditions, the model was trained with different anchor frame sizes, producing the RPN-panicle1, RPN-panicle2, Mask R-CNN, RPN-panicle3, and RPN-panicle models. The optimal model was RPN-panicle2, which showed an accuracy improvement of 11.67% over the original model with an optimal RPN anchor box size of [16,32,64,128,256]. Then, the detection box accuracy was improved by improving the loss function and NMS algorithm, and the final improved model, named Panicle-Mask, achieved a mAP of 89.10% after training. The IoU of the detection box was 84.42% after training. The IoU value obtained by training using the most basic Mask R-CNN model was 59.73%, while the IoU value obtained by using the method in this paper was 87.42%. Figure 6 shows the detection results for four randomly selected images. Otsu, Mask R-CNN, and Panicle-Mask represent the segmentation method based on Otsu thresholding, detection and segmentation based on the Mask R-CNN, and detection and segmentation based on the improved Mask R-CNN combined with the Otsu thresholding algorithm. As shown in Figure 6, all three methods could segment the rice panicles. Among them, the latter two methods detected different rice panicles labelled with different colors, where each rectangular box represents the smallest rice panicle enclosed within the box, and the labelled numerical part indicates the confidence level of detection. Unlike the Otsu algorithm, the Mask R-CNN-based algorithm both detected and segmented the rice panicles, and their number and relative positions were obtained from the number and coordinate information of the rectangular boxes. The background interfered greatly with the Otsu algorithm, but when the color difference between the rice panicle and the background was relatively large, a better segmentation effect was achieved. In contrast, when the image contains similar colors, the segmentation is incomplete, and there are many false detections. Due to the use of the Otsu algorithm to preprocess the image, the influence of the background on detection was reduced, and the model was improved and optimized according to the characteristics of the dataset. Therefore, Panicle-Mask has higher accuracy. Figure 7 shows examples of the binary images transformed using the three methods after segmentation. The similarity of the images can be further measured according to the gray image, and the proportion of rice panicles in the image can be calculated from the binary image. As seen in Figure 7, the binarized images obtained by the Otsu algorithm based on threshold segmentation were correctly segmented, but a large amount of background was also segmented as rice panicles with gaps. The results detected directly using the original Mask R-CNN algorithm showed many missed detections, while the detection using the combination of the Otsu thresholding segmentation algorithm and the improved Mask R-CNN algorithm made up for the respective shortcomings of the individual elements. Further analysis of the examples in Figure 6 reveals that the results obtained by the Otsu algorithm were both on the high side and those obtained by the original Mask R-CNN algorithm were both on the low side. The results obtained by the combined and improved Panicle-Mask algorithm were the most similar to the real results.