# A Novel Method for Wheat Spike Phenotyping Based on Instance Segmentation and Classification
## 3 Results and Discussion  
### Segmentation Results of Wheat Spike  
This study used the YOLOv8-seg instance segmentation model to segment wheat spike images from four datasets, including the Z618 dataset, the Y19 dataset, the S8 dataset, and the total dataset containing three varieties (TV). The training loss curves of the four datasets tended to be converged and stable when YOLOv8-seg models were trained to the 70 th epoch, and the training loss of segmentation was reduced to about 0.8 at the 70 th epoch. The instance segmentation results of YOLOv8-seg models for different datasets are shown in Table 1. According to Table 1, the model trained by Z618, Y19, S8, and TV datasets showed great segment performance, where the precision and recall were all above 0.97, with some even up to 0.99, indicating high accuracy and sensitivity to wheat spikelet area. Under conditions with an IOU threshold of 0.5, the AP of the model equaled 0.98-0.99. A more stringent IOU threshold, between 0.5 and 0.95, reduced the AP to around 0.85, but still within the range available for wheat spikelet segmentation. Compared to other research based on similar experiment settings, [PERSON] et al. [19] achieved recall of 0.9116 and precision of 0.9204 using CBAM-HRNet, a network based on stage structure, parallel convolutional branching, and multi-resolution fusion modules. [PERSON] et al. [20] realized recall of 0.9130 and precision of 0.9257 based on TransUNet. The comparison results showed that the YOLOv8-seg model adopted in this study fitted the task well and achieved good instance segmentation performance. The Z618 and Y19 datasets shared the best segmentation performance among single variety datasets, which was mainly because these two varieties of wheat spike both had plump grains, short awns, and spikelets with clear boundaries. The S8 spikes had the longest and thickest awns, which often easily occluded parts of the spikelets, especially during the late filling period. This resulted in more incorrect results between the spikelets and awns segmented by the YOLOv8-seg model. As shown in Figure 8, there were occasions when the model ignored or misidentified the pixels of the wheat spikelet on the top of the spike. Meanwhile, when viewed from the front, the S8 spikelets on the front and back were staggered on the rachis due to the sparse distribution of spikelets. The frontal spikelets were often segmented wrongly as the back ones, and vice versa. Therefore, the S8 dataset performed worst among all the datasets, especially in the recall indicator, which fell to 0.973. The TV dataset combined with all three varieties performed equally well. The precision of the model maintained 0.994 and the recall reached 0.979. Meanwhile, the AP of the TV dataset was higher than those of all the Z618, Y19, and S8 datasets. AP@[0.50] and AP@[0.50:0.95] reached 0.993 and 0.858, respectively, and the higher AP values indicated that the segmentation performance of wheat spikelets could be improved by combining three datasets of different varieties. On the one hand, the TV dataset contained more wheat spike images than the Z618, Y19, and S8 datasets, and the YOLOv8-seg model learned more spikelet features from the extra spike images. On the other hand, the TV dataset contained \begin{table}
\begin{tabular}{c c c c c c} \hline \multirow{2}{*}{**Dataset**} & \multicolumn{4}{c}{**Mask Image**} & \multicolumn{2}{c}{**Category**} \\ \cline{2-5}  & **Precision** & **Recall** & **AP@[0.50]** & **AP@[0.50:0.95]** & **A** \\ \hline Z618 & 0.994 & 0.989 & 0.995 & 0.850 & 100\% \\ \hline Y19 & 0.998 & 0.988 & 0.993 & 0.855 & 100\% \\ \hline S8 & 0.995 & 0.973 & 0.987 & 0.857 & 100\% \\ \hline TV & 0.994 & 0.979 & 0.993 & 0.858 & 100\% \\ \hline \end{tabular}
\end{table} 
Table 1: Instance segmentation results of YOLOv8-seg models for different datasets. more wheat varieties than the Z618, Y19, and S8 datasets. Although the spikelets were different in morphology for the three varieties, there were still many similar image features for these spikelets.