## 2 Methods and Materials
### Dataset Production
#### 2.2.2 Image Annotation and Data Augmentation  
In this paper, the efficient interactive segmentation (EISeg) tool [40] was used to automatically annotate the citrus crown in the RGB and RGB-D images and generate a Common-Objects-in-Context-formatted annotation file [41]. Apart from the background items, the label categories accounted for seedling, flourishing, and fruiting crown stages. Following the image annotation, to improve model generalizability, the image data were augmented using random brightness changes, contrast enhancements, and random rotations. These methods are shown in Equations (5)-(8). Therefore, to simulate the effect of noise from everywhere in the natural environment, Gaussian noise was added to the image data, as shown in Figure 4.  
Figure 3: Tree crown RGB-D image generation process: (**a**) RGB image; (**b**) depth image; (**c**) RGB-D image.  
Brightness changes: the image contrast adjustment can directly use the following transformation formula to linearly change the image in RGB space:  
\[g(i,j)=f(i,j)+b \tag{5}\]  
where \(f(I,j)\) represents the gray level of the original pixel; the gray level of the converted pixel is \(g(I,j)\). A change in coefficient \(b\) affects the brightness of the image. When \(b\) is increased, the image becomes bright, and vice versa.  
Contrast enhancements: the equation for calculating the contrast can be written in the following form [42]:  
\[C=k\sqrt{\frac{1}{3 rc}\sum_{i=1}^{r}\sum_{j=1}^{c}\sum_{n=1}^{3}\left(X_{i,j,n }-\overline{X}\right)^{2}} \tag{6}\]  
where \(C\) represents \"Contrast.\" \(R\times c\times 3\) denotes the shape of color images. The value of \(k\) is greater than 1.  
Rotation: the pixel (\(x_{0}\), \(y_{0}\)) is rotated in the original image by angle \(\alpha\), as shown in Formula (7):  
\[[xy1]=[x_{0}y_{0}1]\left[\begin{array}{ccc}\cos\alpha&-\sin\alpha&0\\ \sin\alpha&\cos\alpha&0\\ 0&0&1\end{array}\right] \tag{7}\]  
where (\(x,y\)) is the pixel after rotation.  
Gaussian noise: Gaussian noise is a type of noise whose probability density function obeys the Gaussian distribution (normal distribution). The method for adding Gaussian noise can be expressed by the following formula:  
\[G(x,y)=f(x,y)+n(x,y) \tag{8}\]  
where \(G(x,y)\) is the image with added Gaussian noise;\(f(x,y)\) is the original image and \(n(x,y)\) is Gaussian additive noise.  
After data augmentation, images were divided into Datasets 1 and 2, which were both compartmentalized into training, verification, and testing sets at ratios of around 7:2:1. Dataset 1 contained 2000 RGB images and their annotation data, and Dataset 2 contained of the 2000 RGB-D type. See Table 2 for quantity distributions.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & & **Dataset 1** & & & **Dataset 2** & \\ \hline
**Growth** & **Training** & **Verification** & **Testing** & **Training** & **Verification** & **Testing** \\
**Period** & **Set** & **Set** & **Set** & **Set** & **Set** & **Set** \\ \hline Seedling & 455 & 132 & 65 & 425 & 152 & 68 \\ Flourishing & 464 & 146 & 66 & 479 & 131 & 67 \\ Fruition & 481 & 122 & 69 & 496 & 107 & 64 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Image distribution of citrus crown after data augmentation.  
Figure 4: Data augmentation process: (**a**) Original image; (**b**) Add Gaussian noise; (**c**) Rotate; (**d**) Enhance brightness; (**e**) Enhance contract.