## 4 Multi-Objective Segmentation and Localization Method for Tomato Plants
### Location of Axillary Bud Removal Points of Tomato Plants
#### 4.2.2 Axillary Bud Removal Point Calculation  
Having achieved the accurate multi-target segmentation of tomato plants, the next critical step is to accurately calculate the removal points for the axillary buds. This process is critical for automated robotic pruning operations, as it directly affects pruning efficiency and future plant growth. To ensure healthy post-pruning plant growth and increased yield, the accurate localization of the axillary bud removal points requires consideration of both the morphological features of the axillary buds and their positional relationships to the main stem. In this section, we present the method for calculating the axillary bud removal points based on the segmentation results obtained from the VGG16-UNet model. This method includes contour detection, feature point extraction, axillary bud position determination, and precise removal point calculation. Through this series of accurate calculation steps, our aim is to provide the robot with accurate pruning guidance, thereby enabling efficient and non-destructive axillary bud pruning. Step 1: Contour detection and feature point extraction  
The contour of the axillary bud region was delineated, and the left and right endpoints of the axillary bud contour were determined, followed by the calculation of its centroid. The centroid, denoted as \(\text{p}(n_{c},m_{c})\), is calculated by the weighted average of the coordinates of each contour point, as described by the following formula:  
\[n_{c}=\frac{M_{10}}{M_{00}} \tag{5}\]  
\[m_{c}=\frac{M_{01}}{M_{00}} \tag{6}\]  
\[M_{10}=\sum_{x}\sum_{y}x\cdot I(x,y) \tag{7}\]  
\[M_{01}=\sum_{x}\sum_{y}y\cdot I(x,y) \tag{8}\]  
\[M_{00}=\sum_{x}\sum_{ywhere \(n_{c}\) and \(m_{c}\), respectively, represent the abscissa and ordinate of the axillary bud centroid, while \(c\) denotes the centroid index, where (\(c=1,2,3...\)), indicates the pixel value at the center (\(x\),\(y\)) of the region. Step 2: Judging the left and right branches of the axillary buds  
The vertical axis of each axillary bud center coordinate was extracted. Then, the contour points of the main branch were traversed to find the points whose vertical axis coincided with that of the axillary bud center. Subsequently, the horizontal axes of the two points were compared to determine the left and right branches of the axillary buds. Step 3: Calculating the axillary bud removal point  
According to agricultural standards, the optimum length of axillary bud stubble is approximately 1 cm, a criterion that aligns with the agronomic requirements [15]. Observations have shown that the points of axillary buds at around 30 days are predominantly in the range of \(7\pm 1\) cm. Therefore, in this study, the axillary bud removal was chosen near the end of the main branch and positioned at 1/4 distance from the center of the axillary bud. This choice ensures that the axillary bud removal point meets the pruning requirements. The tomato plant has an axillary bud (Edge1) at its left end and another axillary bud (Edge2) at its right end. The coordinates (\(s_{1}\), \(t_{1}\)), (\(s_{2}\), \(t_{2}\)), and (\(n_{1}\), \(m_{1}\)) represent the pixel values of the left endpoint, the right endpoint, and the centroid of Edge1, respectively. Similarly, (\(s_{4}\), \(t_{4}\)), (\(s_{5}\), \(t_{5}\)), and (\(n_{2}\), \(m_{2}\)) denote the pixel values of the left endpoint, right endpoint, and centroid of Edge2, as shown in Figure 7.  
Figure 7: Tomato axillary bud removal point positioning. The pruning point coordinates for the axillary bud (Edge1) located at the left end of the main branch mask are calculated as follows:  
\[\left\{ \begin{array}{l}s_{0}=\frac{3s_{2}+n_{1}}{4}\\ t_{0}=\frac{3t_{2}+n_{1}}{4}\end{array} \right. \tag{10}\]  
where \(s_{0}\) and \(t_{0}\) are the coordinates of the trim point of Edge1. The formula for calculating the coordinates of the pruning point when the axillary bud (Edge1) is at the right end of the main branch mask is as follows:  
\[\left\{