Lychee Fruit Detection Based on Monocular Machine Vision in Orchard Environment

Due to the change of illumination environment and overlapping conditions caused by the neighboring fruits and other background objects, the simple application of the traditional machine vision method limits the detection accuracy of lychee fruits in natural orchard environments. Therefore, this research presented a detection method based on monocular machine vision to detect lychee fruits growing in overlapped conditions. Specifically, a combination of contrast limited adaptive histogram equalization (CLAHE), red/blue chromatic mapping, Otsu thresholding and morphology operations were adopted to segment the foreground regions of the lychees. A stepwise method was proposed for extracting individual lychee fruit from the lychee foreground region. The first step in this process was based on the relative position relation of the Hough circle and an equivalent area circle (equal to the area of the potential lychee foreground region) and was designed to distinguish lychee fruits growing in isolated or overlapped states. Then, a process based on the three-point definite circle theorem was performed to extract individual lychee fruits from the foreground regions of overlapped lychee fruit clusters. Finally, to enhance the robustness of the detection method, a local binary pattern support vector machine (LBP-SVM) was adopted to filter out the false positive detections generated by background chaff interferences. The performance of the presented method was evaluated using 485 images captured in a natural lychee orchard in Conghua (Area), Guangzhou. The detection results showed that the recall rate was 86.66%, the precision rate was greater than 87% and the F1-score was 87.07%.


Introduction
Lychees are one of the most popular fruits and are widely cultivated in the hilly regions of southern China [1,2]. In 2018, the average annual yield of lychees in China was approximately 2.87 million tons, which brought considerable profits and tax revenue for lychee growers and the government. Therefore, this abundant annual lychee production signifies the importance of lychee yield estimation technologies. Current estimation methods mainly use satellite or low-altitude remote sensing technology or image information captured by ground-based vehicles, and fruit detection methods for these methods are inevitably adopting machine vision techniques. To date, an extensive amount of image analysis has been performed for the detection of many kinds of fruits [3][4][5][6][7][8].
It is a fundamental task to detect individual fruits for guaranteeing precision agricultural practices and this has become a hot spot in recent studies. These studies indicate that the growth of fruits in a monocular machine image mainly shows two phenomena-occlusion and overlapping-in the orchard environment [8][9][10][11][12]. Specifically, the occlusion phenomenon is caused by leaves and branches and the overlapping phenomenon is caused by neighboring lychee fruits. Xu et al. proposed a segmentation method that used the Snake model and corner detectors for detecting two apples in an overlapped condition; this segmentation method has an average error of 6.41% when detecting two apples in an overlapped condition. However, their method can detect apples in overlapped conditions only when there is no occlusion from branches or leaves [13]. Xiang and Jiang et al. proposed an algorithm based on binocular stereovision to improve the recognition performance for clustered tomatoes; in their method, edge curvature analysis was adopted to generate the edges map for fruits segmentation and achieved the recognition accuracy rate of 87.9%. However, their method needs to sort every curvature of the pixels on the edge, which makes the calculation time dependent on the length of the edge. When detecting clusters with a greater number of fruits carrying a long edge length in the foreground region, the calculation time will increase accordingly [14]. Liu and Zhao et al. adopted color information from both the red/green/blue (RGB) and hue/saturation/intensity (HSI) color space to train a back propagation neural network for apple segmentation; the Euclidean distance was used to calculate the edge area of segmented apples, from which the apples were recognized. The recognition accuracy of apples in a natural environment can be improved using this method. However, a high recognition error rate occurs when apples are overlapping or when a shadow occurs in the captured images [15]. Nguyen et al. proposed a detection method for occluded apples on trees with an RGB 3D camera using a camera system to build both color (RGB) and three-dimensional (3D) shape information of apples on trees. However, this algorithm is sensitive to light conditions and requires light shield construction to block direct sunlight in the testing orchard [16]. Chen et al. proposed a data-driven fruits detection method using a deep learning strategy to recognize apple and orange clusters, and achieved high accuracy. They trained the classifier using the NVIDIA Titan X graphics processing unit, which took more than 50 thousand iterations for the classifier's convergence. Although the deep learning strategy provides higher performance for detecting fruits, it depends heavily on the applied hardware devices [17]. Recently, Zhuang et al. proposed a detection method using the combination of marker-controlled watershed transform (MCWT) and convex hull operation to locate citrus fruits in overlapped and occluded conditions. However, their algorithm performs an average in detecting lychee clusters; hence, the watershed transform algorithm is sensitive to complex texture disturbances on lychee fruit surfaces [18]. He et al. proposed a method of green lychee recognition that used an improved linear discriminant analysis (LDA) classifier for classifying pixels and Hough transform circle detection to locate the fruit of lychee by the spherical shape features; this method provides a 76.4% recognition accuracy of clustered lychee fruits. However, in their method, the threshold of the Hough circle radius must be calculated by counting the average number of pixels of each lychee in the test sample images before running the Hough transformation. Therefore, their method greatly increases the workload of lychee detection in practical applications [19].
To summarize, the occurrence of background chaff interferences, such as branches, foliage, sky, remains challenging for target fruit detection using machine vision systems. In particular, detection methods for complicated overlapping conditions of neighboring lychee fruits have rarely been reported. Therefore, the overall objective of the research is to detect overlapping conditions of growing lychee fruits in orchard environments with changing illumination. There are three specific objectives of this study: (1) improve the contrast between the lychee fruits and background objects for images captured in environments with changing illumination; (2) extract potential lychees in occluded growing conditions; and (3) filter out some false detections using uniform local binary patterns (LBP) and a histogram intersection kernel (HIK)-based support vector machine (SVM).

Datasets
A variety of lychee called "Jing Gang Hong Nuo" was investigated in early to mid-May in Guangzhou. A total of 485 images (called dataset 1, with 2145 lychee fruits in total) and a total of 86 images (called dataset 2, with 213 lychee fruits in total) were captured using the cameras equipped on the iPhone 7 and SAMSUNG S6 mobile phones respectively in a natural lychee orchard, approximately 2-4 weeks before harvest. Due to the different settings of the adopted cameras, the resolution of the images in dataset 1 was 3024 × 4032 pixels while that in dataset 2 was 2560 × 1440 pixels.
In addition, the images in both datasets were captured with the cameras located approximately 30-100 cm from the lychee fruits under three different imaging circumstances, including wellilluminated, weakly illuminated and overexposure-illuminated conditions. The number of images captured under well-illuminated, weakly illuminated and overexposure-illuminated conditions were 152, 128 and 205, respectively, in dataset 1; and the number of images captured under the three different conditions were 26, 27 and 33, respectively, in dataset 2. Some examples in both dataset 1 and dataset 2 can be found in Figure 1.

Datasets
A variety of lychee called "Jing Gang Hong Nuo" was investigated in early to mid-May in Guangzhou. A total of 485 images (called dataset 1, with 2145 lychee fruits in total) and a total of 86 images (called dataset 2, with 213 lychee fruits in total) were captured using the cameras equipped on the iPhone 7 and SAMSUNG S6 mobile phones respectively in a natural lychee orchard, approximately 2-4 weeks before harvest. Due to the different settings of the adopted cameras, the resolution of the images in dataset 1 was 3024 × 4032 pixels while that in dataset 2 was 2560 × 1440 pixels.  Specifically, 200 images (i.e., 50 images captured under well-illuminated conditions, 50 images under weakly illuminated conditions and 100 images under overexposure-illuminated conditions) were manually selected from dataset 1 and served as the training samples. The lychee fruits in these images were collected as the positive training samples, and the regions containing only background participants were cropped as the negative samples. The remaining 285 images in dataset 1 were taken as test images, and the lychee regions (1604 lychee fruits in total) in the test images were manually annotated and served as the ground truth, as Figure 1(A1-A3) show. All images of dataset 2 were used as testing data, whose examples of which are shown in Figure 1(B1-B3). Figure 1(C1,C2) show non-lychee samples of foliage, branch, sky, pathway and lawn conditions of dataset 1 and dataset 2.

Application Hardware Architecture Design
At present, the estimation methods mainly use satellite remote sensing technology or image information captured by unmanned ground vehicles (UGVs) [20] or unmanned aerial vehicles (UAVs) [21], the fruit detection methods of which are inevitably adopting computer vision techniques. This paper takes camera mounted UGVs as an example. The camera mounted UGV system consisted of remote control, image acquisition module, lithium battery pack and industrial personal computer (IPC). The 2.4 GHz network motion signal of the UGV was sent by a remote control to the vehicle-mounted microcontroller STM32 to realize wheel and motor control. The UGV was equipped with an IPC powered by lithium battery pack, connected to an image acquisition module via USB. The angle of the camera on the module could be adjusted by the horizontal camera holder, and the acquired images were sent to the hard disk of the IPC for storage through USB. The image was processed by detection algorithm on the IPC, and the processed results were output to the mini-display by AV signal. The structure diagram of the UGV system is shown in Figure 2.
participants were cropped as the negative samples. The remaining 285 images in dataset 1 were taken as test images, and the lychee regions (1604 lychee fruits in total) in the test images were manually annotated and served as the ground truth, as Figure 1(A1) to (A3) show. All images of dataset 2 were used as testing data, whose examples of which are shown in Figure 1(B1) to (B3). Figure 1(C1) and (C2) show non-lychee samples of foliage, branch, sky, pathway and lawn conditions of dataset 1 and dataset 2.

Application Hardware Architecture Design
At present, the estimation methods mainly use satellite remote sensing technology or image information captured by unmanned ground vehicles (UGVs) [20] or unmanned aerial vehicles (UAVs) [21], the fruit detection methods of which are inevitably adopting computer vision techniques. This paper takes camera mounted UGVs as an example. The camera mounted UGV system consisted of remote control, image acquisition module, lithium battery pack and industrial personal computer (IPC). The 2.4 GHz network motion signal of the UGV was sent by a remote control to the vehicle-mounted microcontroller STM32 to realize wheel and motor control. The UGV was equipped with an IPC powered by lithium battery pack, connected to an image acquisition module via USB. The angle of the camera on the module could be adjusted by the horizontal camera holder, and the acquired images were sent to the hard disk of the IPC for storage through USB. The image was processed by detection algorithm on the IPC, and the processed results were output to the mini-display by AV signal. The structure diagram of the UGV system is shown in Figure 2.  Figure 3 shows a block diagram that summarizes the key procedures of the proposed lychee detection method, including image preprocessing, foreground segmentation, potential lychee region extraction and status identification.

Image Preprocessing and Foreground Segmentation
Due to the randomness of the location and lighting conditions of the naturally growing lychees, the color space of the imaging results can be distorted by changing the light angle and position. It is was necessary to pre-process the images using an illumination compensation procedure, which  Figure 3 shows a block diagram that summarizes the key procedures of the proposed lychee detection method, including image preprocessing, foreground segmentation, potential lychee region extraction and status identification.

Image Preprocessing and Foreground Segmentation
Due to the randomness of the location and lighting conditions of the naturally growing lychees, the color space of the imaging results can be distorted by changing the light angle and position. It is was necessary to pre-process the images using an illumination compensation procedure, which focused on adjusting the images captured under weak and overexposed illumination. The foreground segmentation procedure was used for segmenting the foreground and the background of lychee images, which improved the accuracy of the further processes. The image preprocessing and foreground segmentation preliminarily extracted the regions of interest (ROIs).

Image Preprocessing
Since the RGB image data could be easily affected by the illumination conditions in the orchard, the collected lychee images were prone to weak or overexposed illumination. Therefore, it was necessary to adjust the illumination distribution of the resultant images. To avoid altering the hue and saturation information, the input image was first converted from the RGB color space to the hue/saturation/value (HSV) color space, and the intensity component V was selected for illumination adjustment using the contrast limited adaptive histogram equalization (CLAHE) algorithm. There are two main parameters involved in the CLAHE algorithm [22], the number of blocks and the contrast enhancement limit, which are determined by trial and error method. These parameters were selected as 8 × 8 and 0.02, respectively, in the CLAHE algorithm for apple detection in an orchard environment [23]. In this study, in order to determine the setting of the number of blocks, different settings including 5 × 5, 8 × 8, 10 × 10, 12 × 12 and 15 × 15 were considered; for contrast enhancement limits, 0.005, 0.01, 0.015, 0.02 and 0.025 were included. In order to obtain the optimal parameter combination, 10 lychee images in the training dataset 1 were randomly selected, using the CLAHE algorithm under 25 groups of different parameters (5 numbers of blocks × 5 contrast enhancement limits). After processing with the R-B chromatic method for lychee fruit foreground segmentation, the average relative overlap rate S of each set of parameters was calculated using following equation:

Image Preprocessing
Since the RGB image data could be easily affected by the illumination conditions in the orchard, the collected lychee images were prone to weak or overexposed illumination. Therefore, it was necessary to adjust the illumination distribution of the resultant images. To avoid altering the hue and saturation information, the input image was first converted from the RGB color space to the hue/saturation/value (HSV) color space, and the intensity component V was selected for illumination adjustment using the contrast limited adaptive histogram equalization (CLAHE) algorithm. There Here, R h represents the segmented region after using the CLAHE algorithm and R r represents the manually segmented standard region for reference. As the results show in Table 1, when the number of blocks was 10 × 10 and the contrast enhancement limit was 0.015, the average relative overlap rate reached the highest value, 86%. Therefore, 10 × 10 and 0.015 were selected as the parameters to be used for the CLAHE algorithm in this paper. After the processing using the CLAHE algorithm, the illumination adjusted intensity component V' was obtained; then the three components including the H, S and V' were used to convert back into RGB color space. The lychee images from the test dataset were used to evaluate the performance of the above procedure.
The image illumination compensation method for the weakly illuminated and overexposed lychees in the images is shown in Figure 4. Figure 4A,C show images captured under weakly illuminated and overexposure illumination conditions, respectively. Figure 4B,D correspond to Figure 4A,D respectively, after processing with the CLAHE method. More detail is obtainable in Figure 4B than in Figure 4A since the weak illumination is compensated by the preprocessing method. This method also adjusts the overexposed regions, thereby providing more detailed information about the lychee fruits, as shown in Figure 4C,D. settings including 5 × 5, 8 × 8, 10 × 10, 12 × 12 and 15 × 15 were considered; for contrast enhancement limits, 0.005, 0.01, 0.015, 0.02 and 0.025 were included. In order to obtain the optimal parameter combination, 10 lychee images in the training dataset 1 were randomly selected, using the CLAHE algorithm under 25 groups of different parameters (5 numbers of blocks × 5 contrast enhancement limits). After processing with the R-B chromatic method for lychee fruit foreground segmentation, the average relative overlap rate S of each set of parameters was calculated using following equation: . (1) Here, Rh represents the segmented region after using the CLAHE algorithm and represents the manually segmented standard region for reference. As the results show in Table 1, when the number of blocks was 10 × 10 and the contrast enhancement limit was 0.015, the average relative overlap rate reached the highest value, 86%. Therefore, 10 × 10 and 0.015 were selected as the parameters to be used for the CLAHE algorithm in this paper. After the processing using the CLAHE algorithm, the illumination adjusted intensity component V' was obtained; then the three components including the H, S and V' were used to convert back into RGB color space. The lychee images from the test dataset were used to evaluate the performance of the above procedure.
The image illumination compensation method for the weakly illuminated and overexposed lychees in the images is shown in Figure 4. Figure 4A,C show images captured under weakly illuminated and overexposure illumination conditions, respectively. Figure 4B,D correspond to Figure 4A,D respectively, after processing with the CLAHE method. More detail is obtainable in Figure 4B than in Figure 4A since the weak illumination is compensated by the preprocessing method. This method also adjusts the overexposed regions, thereby providing more detailed information about the lychee fruits, as shown in Figure 4C,D.

Lychee Foreground Segmentation
Currently, lychee foreground segmentation is generally processed by the chromatic aberration method combined with an image processing algorithm. For example, Xiong et al. separated mature lychee from orchard background by dividing the Cr component threshold of YCbCr space [24], and Zhuang et al. [18] realized the segmentation of yellow citrus by using the method based on R-G chromatic mapping. However, these two methods are both not ideal for the segmentation of green immature lychee, which occurs often in our datasets. To efficiently separate and identify lychee regions in the image and exclude background, this study extracted information of lychee and background and performed a statistical analysis of the RGB color space. From any horizontal scan line across lychee fruits and background, as shown in Figure 5A, the color intensities of the pixels within the lychee fruit regions, wherein the position pixels along the horizontal axis are between 0 and 400, were different from those within the background regions, wherein the position pixels along the horizontal axis are between 400 and 1000. Specifically, in RGB color space, the grey-level intensity of the pixels within the lychee region in the red component R was always much higher than that in the blue component B, as shown in Figure 5B (the pixels along the horizontal axis between 0 and 400). In contrast, the grey-level intensity of pixels within the background region in the component R was always approximately equal to that in the component B. Therefore, the lychee fruits could be separated from the background region using red and blue (R-B) chromatic mapping. The segmentation result is shown in Figure 5C, which shows that the R-B chromatic mapping is an appropriate method.
immature lychee, which occurs often in our datasets. To efficiently separate and identify lychee regions in the image and exclude background, this study extracted information of lychee and background and performed a statistical analysis of the RGB color space. From any horizontal scan line across lychee fruits and background, as shown in Figure 5A, the color intensities of the pixels within the lychee fruit regions, wherein the position pixels along the horizontal axis are between 0 and 400, were different from those within the background regions, wherein the position pixels along the horizontal axis are between 400 and 1000.
Specifically, in RGB color space, the grey-level intensity of the pixels within the lychee region in the red component R was always much higher than that in the blue component B, as shown in Figure  5B (the pixels along the horizontal axis between 0 and 400). In contrast, the grey-level intensity of pixels within the background region in the component R was always approximately equal to that in the component B. Therefore, the lychee fruits could be separated from the background region using red and blue (R-B) chromatic mapping. The segmentation result is shown in Figure 5C, which shows that the R-B chromatic mapping is an appropriate method. In conclusion, the R-B chromatic subtraction method in RGB color space was adopted in this paper, which is especially suitable for foreground segmentation of lychee images under complex orchard environment conditions. To obtain more stable results, R-B was changed to a relative value as (R -B)/B. Then, the Otsu image segmentation algorithm was used to extract the potential fruit regions [25]. The combination of mathematical morphology methodology including erosion, dilation and hole filling operations were used to remove some image noise, bridge weakly connected potential fruits and fill holes, respectively, in the resultant binary image obtained by the Otsu algorithm.
After the foreground enhancement processing, the lychee image was further processed by R-B color component difference, in which chromatic aberration is the result that is statistically analyzed in the color space components. The difference between the foreground and background was further enlarged by increasing the contrast, and the Otsu algorithm was used for foreground segmentation. Figure 6 shows the foreground segmentation results. The results show that the image basically meets the requirement of complete foreground segmentation in the background segmentation process. In conclusion, the R-B chromatic subtraction method in RGB color space was adopted in this paper, which is especially suitable for foreground segmentation of lychee images under complex orchard environment conditions. To obtain more stable results, R-B was changed to a relative value as (R − B)/B. Then, the Otsu image segmentation algorithm was used to extract the potential fruit regions [25]. The combination of mathematical morphology methodology including erosion, dilation and hole filling operations were used to remove some image noise, bridge weakly connected potential fruits and fill holes, respectively, in the resultant binary image obtained by the Otsu algorithm.
After the foreground enhancement processing, the lychee image was further processed by R-B color component difference, in which chromatic aberration is the result that is statistically analyzed in the color space components. The difference between the foreground and background was further enlarged by increasing the contrast, and the Otsu algorithm was used for foreground segmentation. Figure 6 shows the foreground segmentation results. The results show that the image basically meets the requirement of complete foreground segmentation in the background segmentation process.

Two-Step Potential Lychee Region Extraction
To increase the lychee detection accuracy, this paper analyzes the position state of each lychee through topological analysis and determines the position state of each lychee so that the lychees in a simple state can be easily detected. Moreover, further separation processing was performed for the

Two-Step Potential Lychee Region Extraction
To increase the lychee detection accuracy, this paper analyzes the position state of each lychee through topological analysis and determines the position state of each lychee so that the lychees in a simple state can be easily detected. Moreover, further separation processing was performed for the overlapping areas of complex lychee adhesion.

Distinguishing the ROIs between Isolated and Overlapped Lychee Fruits
The images of the lychee fruits in the orchard could be roughly divided into three statuses: single isolated status, occluded (covered with leaves and branches) status, and overlapped status. Moreover, the differences in lychee fruit shape, which are not perfect circles or ovals, are complicated. Therefore, when using only the Hough circle method to transform the contour of a lychee, the obtained results often have deviations. Based on the above discussion, this paper proposes a status determination method for lychee positions (isolated, occluded, overlapped) based on the Hough circle and a lychee equivalent foreground area circle to eliminate the deviations in the Hough circle judging method. Here, the equivalent foreground area circle by definition is a circle that has the equal size of area to the lychee foreground region, and the center of the circle is the center of gravity of the lychee foreground area. Different from the Hough circle generation by edge information, the equivalent foreground area circle is determined by the position and area of each separate foreground area. This equivalent foreground area circle can accurately represent the location and total size of the potential lychee area after segmentation. The Hough circle refers to the circle generated by Hough circle transformation according to the boundary of the lychee fruit in the segmented foreground lychee image, which can roughly approximate the circle shape of the boundary of the potential lychee region. By analyzing the relationship between the Hough circle and the equivalent foreground area circle, it can quickly and accurately locate the position and status of a lychee in an image. Therefore, this paper proposes a lychee state judgment method based on equivalent area circles and Hough circles (ACHC), and its operating steps are as follows: Input: Binary images of lychee fruits foreground after segmentation I f .
Step 1. Select every foreground region C n from I f one by one. (n = 1, 2, . . . , N, N is the number of lychee regions) Step 2. Extract the edge of C n and operate the Hough transform.
Step 3. Calculate the circle center Oh n,i (X n,i , Y n,i ) and radius Rh n,i of each Hough circle. (i = 1, 2, . . . , p, p represents the number of Hough circles generated in C n ) Step 4. Generate the equivalent foreground area circles of C n by calculating its circle center Oa n,j (X n,j , Y n,j ) and radius Ra n,j . (j = 1, 2, . . . , q, q represents the number of equivalent foreground area circles in C n ) Here, the coordinates of the equivalent foreground area circle center Oa n,j (X n,j , Y n,j ) equal the coordinates of the center of gravity in C n , the radius Ra n,j is found using Equation (2): where the operation area() is to calculate the area.
Step 5. Calculate lychee fruits status S n of C n using Equations (3)-(8), where S n = 1 means single isolated, S n = 2 means occluded, S n = 3 means overlapped status.
Topological diagrams of the lychee location relationships are shown in Figure 7 below, where the grey area represents the C n , the green circles represent the Hough circles Oh n,i of C n and the blue circles represent the equivalent foreground area circles Oa n,j of C n .
Topological diagrams of the lychee location relationships are shown in Figure 7 below, where the grey area represents the Cn, the green circles represent the Hough circles Ohn,i of Cn and the blue circles represent the equivalent foreground area circles Oan,j of Cn.   Figure 7A shows that when the lychee foreground image is in a single isolated status, the position and shape size of the Hough circle is similar to that of the equivalent foreground area circle. Assuming that the Hough circle radius is Rhn,j, the equivalent foreground area circle radius is Ran, the number of equivalent foreground area circles is , and the number of Hough circles is , then the following expressions can be obtained: where the operation () is to select the maximum value in an array, therefore, ( ℎ , ) and ( , ) respectively represent the maximum radius of Hough circles and equivalent foreground area circles in the same foreground region Cn. Figure 7B shows that when the lychee foreground image is in an occluded status, the following expressions can be obtained:  Figure 7A shows that when the lychee foreground image is in a single isolated status, the position and shape size of the Hough circle is similar to that of the equivalent foreground area circle. Assuming that the Hough circle radius is Rh n,j , the equivalent foreground area circle radius is R an , the number of equivalent foreground area circles is p, and the number of Hough circles is q, then the following expressions can be obtained: where the operation max() is to select the maximum value in an array, therefore, max(Rh n,i ) and max(Ra n,j ) respectively represent the maximum radius of Hough circles and equivalent foreground area circles in the same foreground region C n . Figure 7B shows that when the lychee foreground image is in an occluded status, the following expressions can be obtained: p > 1 and q = 1 max(Rh n,i ) max(Ra n,j ) (5) (π(Rh n,i ) 2 ) < π(Ra n,j ) 2 (6) Figure 7C shows that when the lychee foreground image is in an overlapped status, the following expressions can be obtained: p = 1 and q > 1 max(Rh n,i ) max(Ra n,j ) (7) π(Ra n,j ) 2 < (π(Rh n,i ) 2 ) Output: Lychee fruits status S n .

Individual Fruit Extraction from Overlapped Lychee Regions
Lychee fruits often grow in clusters, which leads to overlapped regions in the images. In our team's previous work, we used the watershed transform method and convex hull operation to solve slight overlapping problems in the extraction of citrus fruit clusters, and this approach achieved accurate and efficient performance. However, the segmentation procedure using watershed transform might be affected by the changes in the noisy gradient; thus, this method might suffer from oversegmentation and generate many small foreground regions, which would further blur the contours of the segmented foreground objects. Unfortunately, the texture and color components on the surface of a lychee are much more complicated than those of a citrus fruit, which causes many kinds of noise in the image. Therefore, an extreme value segmentation method based on transverse searching in polar coordinates is proposed (PCEVP); this method can reduce the amount of computation and overcome the problem of noise interference in lychee fruit images. The algorithm steps run as follows: Input: The foreground region C n contains overlapping lychee fruits determined by ACHC (S n = 3).
Step 1. Extract the edge E of C n and the center of gravity A in C n , as shown in Figure 8A.
Step 2. Take the center of gravity A as the origin of the polar coordinate system.
Step 3. Calculate the distance from the origin A to the pixel points (indexed by d) on the edge of the domain using Equation (9) for every degree (360 • ) in a counter-clockwise direction, as shown in Figure 8B.
where the coordinates of A and E d in the XOY coordinate system are A(x A , y A ) and E d (x Ed , y Ed ), respectively. Figure 9 shows an example of a geometric calculation model of two overlapping lychee fruits.
Step 4. Calculate every maximal value point p j and minimal value point q i on the edge E (i = 1, 2, . . . , m, m is the number of minimal value points; j = 1, 2, . . . , m, m is the number of maximal value points).
Step 5. Separate the edge E by "q i -p j -q i+1 " order, as shown in Figure 8B ("q i -p j -q i+1 " represents "local minimal value point -local maximal value point -local minimal value point" order).
Step 6. Determine circles by every set of three extreme points "q i -p j -q i+1 ", as shown in Figure 8C. A large amount of image data shows that overlapping in the lychee fruit foreground region is a common phenomenon [26,27]. Therefore, PCEVP was used to further segment the overlapping foreground regions. Figure 8A shows the center of gravity of the foreground region (marked by a red asterisk) using mathematical morphology operations. Figure 8B indicates that the extreme value points can be found by calculating a graph of the Euclidean distance of the boundary of the foreground region, and Figure 8E shows the extreme value points in a 3D coordinate system. Figure 8D shows a graph of the Euclidean distance and extreme value points of the boundary of the foreground region. The local maximal and minimal value points always exist in the following order: "local minimal value point, local maximal value point, local minimal value point". Figure 8E shows the result of calculating all local maximal and minimal value points on the boundary of the foreground region, and the extracted individual foreground objects are marked with red dotted circles in Figure 8C, which are determined circles by every set of three extreme points: "local minimal value point, local maximal value point, local minimal value point".
Output: Location and size of every single lychee fruit in the foreground region C n .
Step 3. Calculate the distance from the origin A to the pixel points (indexed by d) on the edge of the domain using Equation (9) for every degree (360°) in a counter-clockwise direction, as shown in Figure 8B.
where the coordinates of A and Ed in the XOY coordinate system are A( A , A ) and ( , ) ,respectively. Figure 9 shows an example of a geometric calculation model of two overlapping lychee fruits. A large amount of image data shows that overlapping in the lychee fruit foreground region is a common phenomenon [26,27]. Therefore, PCEVP was used to further segment the overlapping foreground regions. Figure 8A shows the center of gravity of the foreground region (marked by a red asterisk) using mathematical morphology operations. Figure 8B indicates that the extreme value points can be found by calculating a graph of the Euclidean distance of the boundary of the foreground region, and Figure 8E shows the extreme value points in a 3D coordinate system. Figure  8D shows a graph of the Euclidean distance and extreme value points of the boundary of the foreground region. The local maximal and minimal value points always exist in the following order: "local minimal value point, local maximal value point, local minimal value point". Figure 8E shows the result of calculating all local maximal and minimal value points on the boundary of the foreground region, and the extracted individual foreground objects are marked with red dotted circles in Figure 8C, which are determined circles by every set of three extreme points: "local minimal value point, local maximal value point, local minimal value point". A large amount of image data shows that overlapping in the lychee fruit foreground region is a common phenomenon [26,27]. Therefore, PCEVP was used to further segment the overlapping foreground regions. Figure 8A shows the center of gravity of the foreground region (marked by a red asterisk) using mathematical morphology operations. Figure 8B indicates that the extreme value points can be found by calculating a graph of the Euclidean distance of the boundary of the foreground region, and Figure 8E shows the extreme value points in a 3D coordinate system. Figure  8D shows a graph of the Euclidean distance and extreme value points of the boundary of the foreground region. The local maximal and minimal value points always exist in the following order: "local minimal value point, local maximal value point, local minimal value point". Figure 8E shows the result of calculating all local maximal and minimal value points on the boundary of the foreground region, and the extracted individual foreground objects are marked with red dotted circles in Figure 8C, which are determined circles by every set of three extreme points: "local minimal value point, local maximal value point, local minimal value point". Output: Location and size of every single lychee fruit in the foreground region Cn.

LBP-SVM Recognition of Lychee Fruit
To improve the reliability of lychee detection results, a local binary pattern based support vector machine (LBP-SVM) classifier was adopted for recognition after data sample training. A uniform local binary pattern (LBP) is a parameter-less operator used to describe the local structure features of an image. An LBP operator is an image texture descriptor, while the surface texture of the lychee and the texture of the background have great differences that can be recognized by the naked eye. The image data represented by an LBP operator is of great significance to the perception and recognition of lychees [28]. The lychee image data are represented by LBP, as shown in Figure 10. To improve the reliability of lychee detection results, a local binary pattern based support vector machine (LBP-SVM) classifier was adopted for recognition after data sample training. A uniform local binary pattern (LBP) is a parameter-less operator used to describe the local structure features of an image. An LBP operator is an image texture descriptor, while the surface texture of the lychee and the texture of the background have great differences that can be recognized by the naked eye. The image data represented by an LBP operator is of great significance to the perception and recognition of lychees [28]. The lychee image data are represented by LBP, as shown in Figure 10. By defining a linear optimal hyperplane, the classification problem is transformed into an optimization problem to determine the hyperplane; note that the HIK-based SVM is approximately 2000 times faster than the general nonlinear kernel SVM [29]. When 1 and 2 are two histogram features of image data defined with the LBP, the HIK-based SVM function ( 1 , 2 ) expression is as follows: Under the condition of image data acquisition in this paper, the imaging distance was 30-100cm. Within our 2145 lychee fruit samples, the average number of pixels in the 160 smallest samples was 861 and the average number of pixels in the 160 largest samples was 1578. Therefore, to filter out the image artefacts with either small or large pixels while maintaining as many as possible potential fruit regions, only the ROIs with sizes between 800 and 1700 pixels were fed into the SVM model.

Results and Discussion
The performance of the proposed method was evaluated using the dataset described in Section 2. All the experiments were conducted based on MathWorks MATLAB R2018a.

Performance Evaluation under Well-Illuminated Conditions without Using LBP-SVM Classifier
To evaluate the performance of the two-step potential lychee region extraction method, wellilluminated lychee fruit images were first selected from test datasets A1 and B1, as shown in Figure 11. The use of the proposed two-step potential lychee region extraction method was called Method A. When Method A was replaced with the Hough transform circle detection method [19] in our detection framework, the above integrated procedures formed Method B. When Method A was replaced with the watershed transform [18] in our detection framework, the above integrated procedures formed Method C. When Method A was replaced with the sampling pixels on edge region methods that Liu and Zhao proposed [15] to segment lychee fruits in our detection framework, the above integrated procedures formed Method D. By defining a linear optimal hyperplane, the classification problem is transformed into an optimization problem to determine the hyperplane; note that the HIK-based SVM is approximately 2000 times faster than the general nonlinear kernel SVM [29]. When F 1 and F 2 are two histogram features of image data defined with the LBP, the HIK-based SVM function K(F 1 , F 2 ) expression is as follows: Under the condition of image data acquisition in this paper, the imaging distance was 30-100 cm. Within our 2145 lychee fruit samples, the average number of pixels in the 160 smallest samples was 861 and the average number of pixels in the 160 largest samples was 1578. Therefore, to filter out the image artefacts with either small or large pixels while maintaining as many as possible potential fruit regions, only the ROIs with sizes between 800 and 1700 pixels were fed into the SVM model.

Results and Discussion
The performance of the proposed method was evaluated using the dataset described in Section 2. All the experiments were conducted based on MathWorks MATLAB R2018a.

Performance Evaluation under Well-Illuminated Conditions without Using LBP-SVM Classifier
To evaluate the performance of the two-step potential lychee region extraction method, well-illuminated lychee fruit images were first selected from test datasets A1 and B1, as shown in Figure 11. The use of the proposed two-step potential lychee region extraction method was called Method A. When Method A was replaced with the Hough transform circle detection method [19] in our detection framework, the above integrated procedures formed Method B. When Method A was replaced with the watershed transform [18] in our detection framework, the above integrated procedures formed Method C. When Method A was replaced with the sampling pixels on edge region methods that Liu and Zhao proposed [15] to segment lychee fruits in our detection framework, the above integrated procedures formed Method D.  Figure 11 shows the results of lychee fruit cluster detection performance under well-illuminated conditions without using the LBP-SVM classifier by Method A, Method B, Method C and Method D. Figure 11A shows that lychee fruit clusters can be nicely detected (the blue circles fit more closely around the edges of the lychee fruits) under well-illuminated conditions using Method A. In the following figures, the blue circles represent the local result areas of the lychee fruits detected by the above methods. The red dots on the edge of the blue circle represent the extreme points of the lychee region determined by the PCEVP method proposed in this paper. The basic principle of the PCEVP method is to detect the potential lychee fruit region using the above red dots based on the "local minimum value point, local maximum value point, local minimum value point" arrangement rule and the three-point definite circle theorem. Figure 11B shows the results of Method B for comparison, which indicates that under the same test picture and the same preprocessing conditions, the results of the Hough circle test may have both missed fruits and made repetitive detections. The Hough circle transform (Method B) generally exhibited deficiencies in the following two aspects: (1) the region of the detected Hough circle in the image is generally smaller than the real region of a lychee; (2) two or more Hough circles are easily generated by mistake for the same lychee. Here, the reason for the first deficiency is that in the detection of the edge of the foreground region of lychee fruits after segmentation under various illuminated conditions, due to the irregular shape of the foreground region of the lychee fruits, the area detected by the Hough circle will be smaller than the real area of lychee fruits. The reason for the second deficiency is that the data images used in this paper were taken at a distance of 30-100 cm from the lychee fruits, which resulted in a large range of lychee fruit sizes in the test data. Therefore, the range setting of the Hough circle radius threshold was also large, thereby increasing the rate of repetitive detection via Hough circle transformation.  Figure 11 shows the results of lychee fruit cluster detection performance under well-illuminated conditions without using the LBP-SVM classifier by Method A, Method B, Method C and Method D. Figure 11A shows that lychee fruit clusters can be nicely detected (the blue circles fit more closely around the edges of the lychee fruits) under well-illuminated conditions using Method A. In the following figures, the blue circles represent the local result areas of the lychee fruits detected by the above methods. The red dots on the edge of the blue circle represent the extreme points of the lychee region determined by the PCEVP method proposed in this paper. The basic principle of the PCEVP method is to detect the potential lychee fruit region using the above red dots based on the "local minimum value point, local maximum value point, local minimum value point" arrangement rule and the three-point definite circle theorem. Figure 11B shows the results of Method B for comparison, which indicates that under the same test picture and the same preprocessing conditions, the results of the Hough circle test may have both missed fruits and made repetitive detections. The Hough circle transform (Method B) generally exhibited deficiencies in the following two aspects: (1) the region of the detected Hough circle in the image is generally smaller than the real region of a lychee; (2) two or more Hough circles are easily generated by mistake for the same lychee. Here, the reason for the first deficiency is that in the detection of the edge of the foreground region of lychee fruits after segmentation under various illuminated conditions, due to the irregular shape of the foreground region of the lychee fruits, the area detected by the Hough circle will be smaller than the real area of lychee fruits. The reason for the second deficiency is that the data images used in this paper were taken at a distance of 30-100 cm from the lychee fruits, which resulted in a large range of lychee fruit sizes in the test data. Therefore, the range setting of the Hough circle radius threshold was also large, thereby increasing the rate of repetitive detection via Hough circle transformation. Figure 11C shows the results using Method C for comparison, where the watershed transform algorithm was adopted. The results show that oversegmentation occurred using watershed transform. When conducting the watershed transform, to guarantee accurate segmentation of foreground objects, the ideal situation is to consider the foreground regions as a topographic surface and the lowest point of the topographic surface as the catchment basin. However, the watershed transfer might be sensitive to some disturbances that affect the characteristic of topographic surface of lychee fruits, such as significant texture appearance of lychee fruits, environment illumination, camera angle and camera noise, resulting in oversegmentation of lychee fruit regions. Figure 11D shows the results using Method D for comparison, where the sampling pixels on edge region method [15] was adopted. The results show that Method D is more suitable for the identification of lychees in single isolated status with a faster recognition speed, but its segmentation accuracy of overlapping lychee fruits is not high. Through the analysis of the operation process of Method D, it is found that Method D can only identify one lychee fruit for each independent lychee fruit foreground region, which leads to its low accuracy in identifying overlapping lychee fruits. In order to improve the accuracy of overlapping lychee fruits of Method D, we conducted an additional corrosion morphology operation on the foreground area of overlapping lychee fruits detected before its operation, which improved the accuracy of overlapping lychee fruits of Method D to a certain extent.
Here  FN). To further evaluate the performance of the methods, the F 1 -score is used to combine the metrics, including the number of TPs, the number of FPs and the number of FNs. The F 1 -score is adopted and defined as follows: The values of the F 1 -score for the different methods are also shown in Table 2. The results also demonstrate that the proposed Method A is more appropriate. Table 2 shows that: (1) The proposed method achieved acceptable detection results in both test datasets, where the detection performance is similar. Among them, their recall rate is around 89%, accuracy rate is around 80% and F 1 -score is close to 84%, indicating that proposed Method A is not sensitive to different settings of image acquisition procedure and has a certain generalization ability. (2) The detection speed is the average detection time (seconds per frame) for the test dataset. The time consumption of Method A in detecting images with lychee fruits is around 1 s, which is a little higher than the average time consumption of the other three methods (Method B is 0.745 s, Method C is 0.821 s, Method D is 0.654 s). (3) The test results of Method C indicate that it had the highest in recall rate, 93.02%, in three methods, which is about 4%-5% higher than the other two methods, but the testing precision rate of Method C is only 68.38%, which is caused by the oversegmentation phenomenon of watershed transform algorithm, and thus produces far more numbers of FP results than the other two methods. This result indicates that the method proposed in this paper can be used to detect clusters of lychee fruits and individually extract each fruit. The results also show that the proposed Method A can avoid misjudging a single lychee under occluded conditions by using ACHC processing, which can divide the potential foreground region of lychee fruits into three cases-isolated, occluded and overlapped-without any omission. Due to the variable lighting conditions in the orchard environment, the collected images will be overexposed and weakly illuminated. In view of the above situation, the image preprocessing step described in Section 3.1.1 is added to the method. The purpose of this test is to evaluate the influence of the preprocessing method on the precision and recall rate of the proposed detection method. Performance evaluation under overexposure and weakly illuminated conditions without using the LBP-SVM classifier is shown in Figure 12. Figure 12A,B represent the foreground segmentation and the final lychee extraction results, respectively, of the proposed Method A without image preprocessing in two different images of clustered lychee fruits from test datasets A2, A3, B2 and B3. Figure 12A,B, which do not use image preprocessing, contain many more white holes in the foreground than Figure 12C, which uses image preprocessing; this finding indicates that the foreground of two weakly illuminated lychee fruits is not successfully segmented in Figure 12A. Similarly, comparing Figure 12B,D shows that the foreground of two overexposed lychee fruits is not successfully segmented in Figure 12B. Figure 12C,D show that after using the image preprocessing method, the segmented lychee fruit foreground areas under either weakly illuminated or overexposed conditions are enhanced, which enables the successful detection of lychee fruits in weakly illuminated conditions, as shown by the yellow circles in Figure 12E,F. Figure 12 shows that image preprocessing based on the CLAHE algorithm improves the illuminated conditions by transforming each pixel with a transformation function derived from a neighborhood region, and uses the contrast enhancement limit to remove the effect of noise. Thus, the performance of the proposed method was improved by such preprocessing procedure. Table 3 shows that the time consumption of the proposed Method A in detecting overlapped lychee fruits under overexposed and weakly illuminated conditions is 1.242 s, which is nearly 0.2 s longer than the time consumption of the proposed Method A in well-illuminated conditions. When detecting lychee fruits under overexposed conditions using test data containing 634 lychee fruits in 214 pictures, among which the number of correct detections (TP) is 540, the number of missed detections (FN) is 94, the number of incorrect detections (FP) from background interference is 126, the precision rate reaches 81.08% and the recall rate is 85.17%. When detecting lychee fruits under weakly illuminated conditions, the test data included 268 lychee fruits in 94 images, the number of TPs is 227, the number of FNs is 41, the number of FPs is 67, the precision rate reaches 77.21% and the recall rate is 84.07%. In the end, the comprehensive precision of this method without the SVM classifier under overexposure and weakly illuminated conditions is 79.90%, the recall rate is 85.03% and the F 1 -score 82.38%. In contrast, as the sample shows in Figure 12E,F, the recall rate of Method B is 82.48% with a precision rate of 76.23%.
The results show that the method proposed in this paper can detect isolated, occluded and overlapped lychee fruits growing in various orchard environments, such as cloudy, sunny days, overexposed or uneven brightness conditions. However, there are always different interferences in an orchard environment, which can increase the probability of system misjudgment and will reduce the robustness of the whole detection system. Therefore, the detection results using the LBP-SVM classifier are tested and discussed below.  Table 3 shows that the time consumption of the proposed Method A in detecting overlapped lychee fruits under overexposed and weakly illuminated conditions is 1.242 s, which is nearly 0.2 s longer than the time consumption of the proposed Method A in well-illuminated conditions. When detecting lychee fruits under overexposed conditions using test data containing 634 lychee fruits in 214 pictures, among which the number of correct detections (TP) is 540, the number of missed detections (FN) is 94, the number of incorrect detections (FP) from background interference is 126, the precision rate reaches 81.08% and the recall rate is 85.17%. When detecting lychee fruits under weakly illuminated conditions, the test data included 268 lychee fruits in 94 images, the number of TPs is 227, the number of FNs is 41, the number of FPs is 67, the precision rate reaches 77.21% and the recall rate is 84.07%. In the end, the comprehensive precision of this method without the SVM classifier under overexposure and weakly illuminated conditions is 79.90%, the recall rate is 85.03%

Performance Evaluation in an Orchard Environment Using the LBP-SVM Classifier
The purpose of this test is to evaluate the performance of the LBP-SVM classifier in filtering out the FP detections generated by the background chaff interferences and calculate the improvement in the detection precision rate provided by the LBP-SVM classifier for the detection method proposed in this paper. The test results are shown in Figure 13.  To detect and match lychee fruits and clusters under natural orchard environments, the key detection method proposed in this paper uses ACHC processing to identify and locate the isolated lychee fruits. This processing approach can avoid the disadvantages of mistaken matches in single lychees under occluded conditions and simultaneously distinguish the lychee cluster for further detection. After ACHC processing, a clustered lychee fruit matching method based on a three-point definite circle theorem was proposed, which was referred to as PCEVP processing. Specifically, PCEVP processing is designed for identifying and locating adhesion and overlapping of lychee fruits. Finally, to reduce the probability of an FN of lychee fruits, the LBP + SVM classification method was applied. The lychee fruits in the orchard environment with changing illumination conditions were further tested by incorporating the recognition results of the LBP + SVM classifiers. The results illustrate that the method could accurately identify the clustered lychee fruits from complicated backgrounds. The To evaluate the performance of the LBP-SVM module, 568 lychee fruit and 277 background target samples were extracted from the training images to train the SVM classifiers using HIK, linear and nonlinear kernel functions. The remaining samples served as the test samples. Figure 13 shows that isolated and overlapped lychee fruits could be detected under variable illumination conditions using the LBP-SVM classifier, thereby reducing the FN rate. Figure 13A,C indicate that the lychee fruit cluster can be detected, and the red arrows indicate seven FP detection errors, wherein the leaves-as background interference-are mistakenly detected as immature lychees. Figure 13B,D show that four FP errors are removed by the LBP-SVM classifier. Herein, there are three FP errors still in Figure 13B,D, which are indicated by three red arrows, in which two are caused by misjudging the leaves and the other is caused by misjudging a person wearing a green jacket. Figure 13 indicates that the misjudgment caused by leaves was eliminated by the SVM classifier. However, the misjudgment caused by the person wearing a green jacket has not been eliminated because this occasional background interference was not added to the training data set of the SVM classifier.
According to the detection results shown in Table 4, the TP rate was 86.69%. The FP rate was 13.34%. The FN rate was 12.40%. The precision, recall and F 1 -score were 87.48%, 86.66% and 87.07%, respectively. The highest TP rate was 88.75%, which was achieved under well-illuminated conditions. The lowest TP rate was 84.70%, which was under weakly illuminated conditions. The time consumed by the proposed Method A mainly occurred during clustered lychee extraction and clustered lychee matching. The time consumed by the isolated lychee detection mainly occurred in the searching of the fruit regions using the LBP-SVM classifiers, and the total average processing time was nearly 0.2 s longer than that without using the LBP-SVM classifier. The average time consumed from the extraction of clustered overlapped lychee fruits to fruit localization was 1.412 s. However, adopting the LBP-SVM classifier greatly reduced the number of FPs-from 126 down to 80-under overexposure illumination, which increased the precision rate from 81.08% to 87.10%. Similarly, the LBP-SVM classifier reduced the number of FPs from 67 down to 38 under weakly illuminated conditions, and the precision rate correspondingly increased from 77.21% to 85.66%. Moreover, the LBP-SVM classifier reduced the number of FPs from 151 down to 81 under well-illuminated conditions, and the precision rate subsequently increased from 80.49% to 88.49%. The LBP-SVM classifier improved the recall rate of detection by approximately 7%. To detect and match lychee fruits and clusters under natural orchard environments, the key detection method proposed in this paper uses ACHC processing to identify and locate the isolated lychee fruits. This processing approach can avoid the disadvantages of mistaken matches in single lychees under occluded conditions and simultaneously distinguish the lychee cluster for further detection. After ACHC processing, a clustered lychee fruit matching method based on a three-point definite circle theorem was proposed, which was referred to as PCEVP processing. Specifically, PCEVP processing is designed for identifying and locating adhesion and overlapping of lychee fruits. Finally, to reduce the probability of an FN of lychee fruits, the LBP + SVM classification method was applied. The lychee fruits in the orchard environment with changing illumination conditions were further tested by incorporating the recognition results of the LBP + SVM classifiers. The results illustrate that the method could accurately identify the clustered lychee fruits from complicated backgrounds. The performance of the procedure by incorporating fruit recognition indicates that the proposed Method A could account for the robustness against the influence of occlusion and variable illumination to some extent. The above results indicate that the proposed detection method could more accurately detect single lychee fruits than overlapped lychee clusters. From the interactive performance of the proposed Method A using the test dataset, the average processing time from the extraction of clustered lychees was 1.412 s, which could meet the requirements of automatic yield estimation.
The demonstrated performance shows that the proposed Method A could detect lychee fruits and clusters successfully and robustly in an orchard. However, there are still some shortcomings of the proposed method A. Firstly, the color and texture information of the acquired lychee color images will inevitably change when the illumination intensity in the orchard changes dramatically. Although the training samples used to train the LBP-SVM classifiers contained the information of three different kinds of illumination and textures, the resultant classifier could still not cover all the possible illumination conditions; therefore, some parts of the pixels may also be incorrectly classified. Secondly, when most of the clustered lychee fruits were occluded, some seriously overlapped clustered lychee fruits may be incorrectly matched; hence, further research is needed to improve the matching accuracy of seriously overlapped clustered lychee fruits in orchard environments.

Conclusions
This study proposed a two-step detection method for lychee clusters using monocular machine vision technology for yield estimation in orchard environments. An effective algorithm was initially given to solve complicated overlapped and occluded conditions of lychee fruits. The main conclusions are as follows: (1) The proposed two-step lychee fruits detection method can detect clusters of lychee fruits under well-illuminated conditions using different image acquisition equipment. This method can avoid misjudgments in detecting single lychees under occluded conditions when using ACHC processing. Overlapped lychee fruits can be further separated using PCEVP processing, which is helpful to avoid missed detections. The results show that the comprehensive precision of this method without SVM classifier in well-illuminated conditions is 80.49%, the recall rate is 88.75% and the F 1 -score is 84.42%.
(2) The two-step method can also be adopted to detect lychee fruits under overexposed and weakly illuminated conditions with a recall rate of 85.03% and an F 1 -score of 82.38%. However, without using the LBP-SVM classifier, the precision rate is only 79.9% as a result of misjudging background chaff interferences. Furthermore, the results demonstrated that the proposed method can be used for fruits in different levels of maturity, including lychee fruits.
(3) The misjudged detection results can be filtered out by the LBP-SVM classifier, which helps reduce the FN rate and provides a precision rate of 87.48% and a recall rate of 86.66%, which is nearly 8% higher than that without the use of the LBP-SVM classifier. An average running time of 1.412 s using the test lychee images was recorded in the experiments, indicating that the proposed method has obtained real-time performance for lychee detection in natural environment.
Further improvements will be considered by incorporating more effective descriptors for lychee detection with higher precision rates and exploring an improved PCEVP method for lychee fruits growing in heavy and dense clusters.