Fruit sorting device and method based on improved YOLOv8
By improving the YOLOv8 algorithm combined with the mechanical structure, the problem of high cost and low efficiency of fruit sorting is solved, efficient and accurate fruit sorting is achieved, adapting to the needs of small vendors, reducing costs and improving efficiency.
Patent Information
- Application Number
- CN202510702796.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-05-29
AI Technical Summary
The existing fruit sorting technology is costly and inefficient, and cannot meet the needs of small vendors. Traditional manual sorting is prone to errors. The existing machine vision system cannot fully detect the surface of the fruit, resulting in omission of bad fruits and poor fruits.
The improved YOLOv8 algorithm is used in combination with mechanical structure, and the frozen layer transfer learning, RCIoULoss function and firework algorithm are used to achieve all-round multi-angle recognition and classification of fruits, reducing costs and improving efficiency.
It realizes efficient and accurate fruit sorting, reduces costs, adapts to the needs of small vendors, improves sorting efficiency, and reduces labor costs.
Smart Images

Figure CN120228053A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of fruit sorting, and particularly relates to a fruit sorting device and method based on improved YOLOv8. Background Art
[0002] Through sorting, defective, damaged or non-standard fruits can be removed, ensuring the quality of fruits, reducing losses, and also helping to achieve product standardization. It is an important step before fruit transportation and sale.
[0003] Traditional manual sorting is not only time-consuming and laborious, but also prone to sorting errors due to human factors, with low efficiency. Existing fruit sorting technologies mainly include machine vision, spectral detection, X-ray detection, etc. However, the cost is relatively high, which is suitable for large-scale fruit wholesale markets and cannot meet the needs of small vendors. Moreover, some existing visual recognition systems cannot comprehensively detect the surface of fruits, easily leading to omissions of bad and inferior fruits, and at the same time, there is a problem of slow processing speed and prone to incorrect processing. Summary of the Invention
[0004] The purpose of the embodiments of the present invention is to provide a fruit sorting device based on improved YOLOv8, aiming to solve the problems proposed in the above background art.
[0005] The embodiments of the present invention are implemented as follows. A fruit sorting device based on improved YOLOv8 includes: A feeding bottom plate, on which a size classification conveyor shaft is provided; A first conveyor belt, connected to the feeding bottom plate, the other side of the first conveyor belt is connected to a second conveyor belt, a conveyor belt baffle is provided between the first conveyor belt and the second conveyor belt, and an arc baffle is provided on the other side of the second conveyor belt; A connecting plate, connected to the second conveyor belt, and a first channel and a second channel are provided on the other side of the connecting plate; An induction component, electrically connected to the conveyor belt baffle and the first conveyor belt, for controlling the states of the first conveyor belt and the conveyor belt baffle; A visual recognition component, electrically connected to the arc baffle, for collecting information of the fruits rolling on the second conveyor belt and controlling the state of the arc baffle; An intelligent sorting drive component, connected to the visual recognition component and the connecting plate, for receiving and analyzing the data collected by the visual recognition component, controlling the state of the connecting plate, and driving the connecting plate to be connected to the first channel or the second channel.
[0006] Preferably, the induction component includes: A sensor, installed on a sensor base, for detecting whether there are fruits at the starting end of the second conveyor belt; The first servo drive assembly is connected to the conveyor belt baffle. The first servo drive assembly drives the rotation of the conveyor belt baffle based on the information detected by the sensor, driving the conveyor belt baffle to block between the first conveyor belt and the second conveyor belt. At the same time, the first conveyor belt is controlled to open and close based on the information detected by the sensor.
[0007] Preferably, the visual recognition assembly includes: A camera, installed on the camera base, for collecting information about the fruits rolling on the second conveyor belt; The second servo drive assembly is connected to the arc baffle. The second servo drive assembly drives the rotation of the arc baffle based on the information detected by the camera, for restricting or releasing the restriction of the fruits rolling on the second conveyor belt.
[0008] Preferably, the intelligent sorting drive assembly includes: An analysis and calculation module, connected to the visual recognition assembly. The analysis and calculation module uses an improved YOLOv8 model introducing the RCIoU Loss function and the fireworks algorithm, for analyzing and judging the state of the fruits; The third servo drive assembly is connected to the connecting plate. The third servo drive assembly controls the rotation angle of the connecting plate based on the result judged by the analysis and calculation module, driving the connecting plate to be connected to the first channel or the second channel.
[0009] Preferably, the first servo drive assembly, the second servo drive assembly and the third servo drive assembly have the same structure but different positions, and each includes a servo motor installed on the servo motor groove. The servo motors are respectively connected to the conveyor belt baffle, the arc baffle or the connecting plate, for driving the rotation of the conveyor belt baffle, the arc baffle or the connecting plate.
[0010] Another object of the embodiment of the present invention is to provide a fruit sorting method based on the improved YOLOv8, using the above fruit sorting device, including the following steps: Place the fruits on the size classification conveyor shaft. During the rolling process, the fruits fall into different feeding bottom plates and roll onto the first conveyor belt in the feeding bottom plates; The fruits are conveyed by the first conveyor belt to the starting end of the second conveyor belt. When the induction component detects that there are no fruits on the second conveyor belt, the fruits are conveyed onto the second conveyor belt. When the induction component detects that there are fruits on the second conveyor belt, control the rotation of the conveyor belt baffle to block between the first conveyor belt and the second conveyor belt, and control the first conveyor belt to stop conveying; The visual recognition assembly detects and collects data on the fruits on the second conveyor belt, and controls the rotation of the arc baffle to block the conveying path, driving the fruits to rotate in place on the second conveyor belt. When the visual recognition assembly finishes recognition, control the arc baffle to rotate in the reverse direction; The intelligent sorting drive component receives the data collected by the visual recognition component for analysis and calculation, determines the state of the fruits, controls the rotation angle of the connecting plate, drives the connecting plate to connect with Channel 1 or Channel 2, and the fruits enter Channel 1 or Channel 2 to complete the sorting.
[0011] The fruit sorting device based on the improved YOLOv8 provided by the embodiment of the present invention solves the problems of frequent manual classification operation errors for small fruit vendors and the large size and high cost of intelligent sorting equipment. It has a unique mechanical structure, combines traditional sorting with intelligent sorting, and uses a single-chip microcomputer to achieve electric control, so as to realize the recognition and classification of fruits in all directions and at multiple angles; adopts the improved YOLOv8 algorithm, uses the transfer learning strategy, and fine-tunes based on the self-prepared data set on the basis of the pre-trained model yolov8n. During the fine-tuning process, the lower layers of the pre-trained model are frozen, so as to retain the general features in object detection, which can greatly improve the training efficiency and reduce the cost; introduces the RCIoULoss function, and significantly improves the robustness of circular target positioning and reduces the misdetection caused by angle sensitivity by dynamically weakening the redundant angle penalty, radial difference measurement and dual-channel shape optimization; in the process of image classification, by defining the feature matrix and improving the Fireworks Algorithm (FAW), the selected feature matrix is obtained to realize the classification of the image, which converges faster and the edge fits more accurately in the fruit detection scenario, and the mAP@0.5 and mAP@0.5:0.95 of the relative traditional YOLOv8 model are respectively increased by 4.23 and 2.40 percentage points; By introducing automated and intelligent technologies, combining visual recognition, mechanical control and electric control systems, the embodiment of the present invention can achieve efficient and accurate sorting of fruits, meet the needs of small vendors, reduce costs and improve sorting efficiency. It is a bridge connecting agricultural production and market demand and promotes agricultural modernization. Description of the Drawings
[0012] Figure 1 It is a structural schematic diagram of a fruit sorting device based on the improved YOLOv8 provided by the embodiment of the present invention; Figure 2 is Figure 1 The partial enlarged structural schematic diagram of; Figure 3 It is a flowchart of the frozen layer transfer learning of the analysis and calculation module in a fruit sorting device based on the improved YOLOv8 provided by the embodiment of the present invention; Figure 4 It is the RCIoULoss function structure of the analysis and calculation module in a fruit sorting device based on the improved YOLOv8 provided by the embodiment of the present invention; Figure 5 It is a flowchart of a fruit sorting method based on the improved YOLOv8 provided by the embodiment of the present invention.
[0013] In the attached drawings: 1 - feed bottom plate, 2 - size classification conveyor shaft, 3 - conveyor belt 1, 4 - conveyor belt baffle, 5 - conveyor belt 2, 6 - sensor base, 7 - camera base, 8 - servo groove, 9 - servo, 10 - arc baffle, 11 - connecting plate; 12 - channel 1; 13 - channel 2. Specific implementation mode
[0014] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the attached drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0015] The following describes the specific implementation of the present invention in detail with reference to specific embodiments.
[0016] As Figure 1 shown, a structural diagram of a fruit sorting device based on improved YOLOv8 provided by an embodiment of the present invention includes: A feed bottom plate 1, on which a size classification conveyor shaft 2 is provided; A conveyor belt 1, connected to the feed bottom plate 1, the other side of the conveyor belt 1 is connected to a conveyor belt 2 5, a conveyor belt baffle 4 is provided between the conveyor belt 1 and the conveyor belt 2 5, and an arc baffle 10 is provided on the other side of the conveyor belt 2 5; A connecting plate 11, connected to the conveyor belt 2 5, and a channel 1 12 and a channel 2 13 are provided on the other side of the connecting plate 11; An induction component, electrically connected to the conveyor belt baffle 4 and the conveyor belt 1, for controlling the states of the conveyor belt 1 and the conveyor belt baffle 4; A visual recognition component, electrically connected to the arc baffle 10, for collecting information of the fruits rolling on the conveyor belt 2 5 and controlling the state of the arc baffle 10; An intelligent sorting drive component, connected to the visual recognition component and the connecting plate 11, for receiving and analyzing the data collected by the visual recognition component, controlling the state of the connecting plate 11, and driving the connecting plate 11 to be connected to the channel 1 12 or the channel 2 13.
[0017] In an embodiment of the present invention, the fruit sorting device based on the improved YOLOv8 addresses the problems raised in the prior art and is provided with an induction component, a visual recognition component, and an intelligent sorting drive component. The entire sorting process includes traditional sorting, conveying, visual recognition, and intelligent sorting. By combining traditional sorting and intelligent sorting, it uses the form of traditional sorting to quickly classify the size of fruits, and uses the form of intelligent sorting to classify fruits according to the degree of defects. It not only meets the requirements of fast, efficient, and accurate classification, but also has the characteristics of small size and low cost, enabling small fruit vendors to use modern, automated, and intelligent equipment to achieve fruit classification, greatly reducing the labor cost. Among them, the feeding bottom plate 1, the size classification conveyor shaft 2, and the first conveyor belt 3 are traditional sorting structures. Different-sized fruits of the same type are placed on the size classification conveyor shaft 2 at the front end of the device, and they roll under the action of gravity. When the diameter is smaller than the spacing of the size classification conveyor shaft 2, the fruits fall onto different feeding bottom plates 1, thus achieving size classification. The feeding bottom plate 1 gathers the fruits to the middle position, which is conducive to the smooth progress of subsequent visual recognition. At the same time, when the feeding bottom plate 1 is placed, it can form a certain angle with the horizontal. Specifically, a reasonable inclination angle can be determined according to the weight of the fruits, so that the fruits can roll under the action of gravity. The first conveyor belt 3 serves to prepare for visual recognition, conveying the fruits to the starting end of the second conveyor belt 5. The arc structure of the arc-shaped baffle 10 matches the shape of the fruits. When the second conveyor belt 5 is always in motion, with the assistance of the arc-shaped baffle 10, it helps the fruits to keep rolling on the second conveyor belt 5, facilitating the all-round detection of the fruit quality by the visual recognition component. The intelligent sorting drive component calculates and analyzes the data collected by the visual recognition component, classifies the fruits into good fruits and substandard fruits, and controls the connecting plate 11 to connect to the first channel 12 or the second channel 13 to achieve classification according to the degree of fruit defects.
[0018] As Figure 2 shown, as a preferred embodiment of the present invention, the induction component includes: A sensor, installed on the sensor base 6, for detecting whether there are fruits at the starting end of the second conveyor belt 5; A servo drive component one, connected to the conveyor belt baffle 4. The servo drive component one drives the conveyor belt baffle 4 to rotate based on the information detected by the sensor, driving the conveyor belt baffle 4 to block between the first conveyor belt 3 and the second conveyor belt 5. At the same time, the first conveyor belt 3 is controlled to open and close based on the information detected by the sensor; The drive component one includes a servo 9, installed in the servo groove 8. The servo 9 is connected to the conveyor belt baffle 4 and is used to drive the conveyor belt baffle 4 to rotate.
[0019] The position and angle of the sensor are adjusted according to actual requirements and installed on the sensor base 6. When a fruit is conveyed to the starting end of the second conveyor belt 5 and there is a fruit on the second conveyor belt 5, the first servo drive assembly controls the rotation of the conveyor belt baffle 4 to block the conveying path and controls the first conveyor belt 3 to stop conveying; The conveyor belt baffle 4 is connected to the connecting member on the servo 9. Starting the servo 9 can drive the conveyor belt baffle 4 to rotate above for blocking. After one sorting is completed, the servo 9 can be started to drive the conveyor belt baffle 4 to rotate below.
[0020] Such as Figure 2 shown, as another preferred embodiment of the present invention, the visual recognition assembly includes: A camera, installed on the camera base 7, for collecting information of the fruits rolling on the second conveyor belt 5; The second servo drive assembly, connected to the arc-shaped baffle 10, and the second servo drive assembly drives the arc-shaped baffle 10 to rotate based on the information detected by the camera, for restricting or releasing the restriction of the fruits from rolling on the second conveyor belt 5; The second drive assembly includes a servo 9, installed in the servo groove 8, and the servo 9 is connected to the arc-shaped baffle 10 for driving the arc-shaped baffle 10 to rotate.
[0021] The position and angle of the camera are adjusted according to actual requirements and installed on the camera base 7. When there is a fruit on the second conveyor belt 5, the second servo drive assembly controls the rotation of the arc-shaped baffle 10. The arc-shaped structure of the arc-shaped baffle 10 fits the shape of the fruit to help the fruit continue to roll, and the camera can collect fruit information from multiple angles in real time; The arc-shaped baffle 10 is connected to the connecting member on the servo 9. Starting the servo 9 can drive the arc-shaped baffle 10 to rotate to the vertical state to block the transmission path. After the visual recognition is completed, the servo 9 can be started to drive the arc-shaped baffle 10 to rotate to the horizontal state.
[0022] Such as Figure 2 shown, as a preferred embodiment of the present invention, the intelligent sorting drive assembly includes: An analysis and calculation module, connected to the visual recognition assembly. The analysis and calculation module uses an improved YOLOv8 model introducing the RCIoU Loss function and the fireworks algorithm for analyzing and judging the state of the fruits; The third servo drive assembly, connected to the connecting plate 11. The third servo drive assembly controls the rotation angle of the connecting plate 11 based on the result judged by the analysis and calculation module, driving the connecting plate 11 to be connected to the first channel 12 or the second channel 13; The third drive assembly includes a servo 9, installed in the servo groove 8, and the servo 9 is connected to the connecting plate 11 for driving the connecting plate 11 to rotate.
[0023] The visual recognition component transmits the collected data to the intelligent sorting drive component, performs calculations using the analysis and calculation module, and drives the servo drive component three according to the results calculated by the analysis and calculation module. The servo 9 drives the connecting plate 11 to rotate to different angles, drives the connecting plate 11 to be connected to the first channel 12 or the second channel 13, and drives the fruits into different channels; Among them, the analysis and calculation module is based on the improved YOLOv8 (You Only Look Once version 8) algorithm. YOLOv8 is an object detection algorithm based on convolutional neural network (CNN), which can simultaneously complete image classification, localization, and bounding box regression in a single forward pass. By combining global information and local features, it realizes efficient and accurate object detection. It is a deep learning algorithm widely used in object detection and computer vision tasks. Its main advantages lie in its extremely high inference speed and real-time processing ability. Based on the traditional YOLOv8, the embodiment of the present invention uses frozen layer transfer learning to improve the training efficiency, and uses the RCIoU Loss function to improve the adaptability to circular targets, improve the detection accuracy, and obtain the selected feature matrix through the definition of the feature matrix and the improvement of the fireworks algorithm (FAW) to realize the classification of images; Traditional YOLOv8 network architecture: YOLOv8 belongs to a single-stage object detector. Its core idea is to directly predict the position and category of the object on the image without generating candidate regions like two-stage detectors. The input image is divided into grids, and each grid is responsible for predicting the object containing its center point. For each grid, the network will predict a certain number of bounding boxes, and each bounding box corresponds to a potential object. The prediction of these bounding boxes includes position (center coordinates), size (width and height), and confidence score. The confidence score reflects the possibility that the bounding box contains the object; The training process of YOLOv8 includes the design of the loss function and the selection of the optimization algorithm. The loss function usually includes three parts: class loss, confidence loss, and position loss, which are used to measure the accuracy of class prediction, the accuracy of bounding box confidence prediction, and the accuracy of bounding box position prediction respectively. The optimization algorithm is used to minimize the loss function, thereby updating the parameters of the network. Commonly used optimization algorithms include Adam, SGD, etc. Finally, the trained model can perform object detection on new images and output the position and category information of the object; Improvement method of YOLOv8 in the embodiment of the present invention: (1) Frozen layer transfer learning: YOLOv8 trains a model through deep learning, which requires a large amount of data and self-defined parameters, consuming time and being costly. Therefore, the embodiments of the present invention integrate frozen layer transfer learning to optimize the training process of YOLOv8. Transfer learning is a machine learning method that applies the knowledge learned from one task (source task) to another related task (target task). The pre-trained model has learned general image features on a large dataset. Therefore, freezing the layers of the pre-trained model can prevent the destruction of these features at the initial stage of training, thus avoiding learning from scratch, significantly reducing the time required for training on the self-prepared dataset, reducing computing resources, and thus reducing costs. Especially in the case of a small dataset, frozen layer transfer learning can improve the generalization ability of the model, avoid overfitting, and thus obtain better performance; The embodiments of the present invention use a model pre-trained on a large dataset (COCO) as a starting point and then fine-tune it on the self-prepared dataset: select a pre-trained model yolov8n.pt similar to the fruit detection target. This model is suitable for object detection with low precision but high response speed; then prepare the labeled fruit dataset and perform frozen layer fine-tuning on the basis of the pre-trained model according to the self-prepared dataset. The lower layers (close to the input layer) learn more general features, and the higher layers (close to the output layer) learn more specific features. Therefore, the embodiments of the present invention freeze some layers of the Backbone and only train the remaining layers of the Backbone and the Head part to improve the learning efficiency. The flowchart of the frozen layer transfer learning in the embodiments of the present invention is as Figure 3 shown; (2) RCIoU Loss function: The original YOLOv8 model uses DFLLoss + CIoULoss as the regression loss. However, the angular penalty term of CIoU is redundant for circular targets, resulting in unstable convergence, and the aspect ratio constraint is not flexible enough to adapt to circular targets of different sizes. Therefore, the embodiments of the present invention introduce RCIoULoss to replace CIoULoss. By dynamically weakening the redundant angular penalty, radial difference measurement (combining center offset and radius consistency constraint), and dual-channel shape optimization (aspect ratio approaching 1 + precise size matching), the localization robustness of circular targets is significantly improved, the misdetection caused by angle sensitivity is reduced, and the convergence is faster and the edge fitting is more accurate in the fruit detection scenario; The RCIoU Loss function consists of two loss components: dynamically weighted geometric loss and adaptive angular loss. The structure of the RCIoU Loss function is as Figure 4 shown. The red box represents the ground truth box, and the green box represents the predicted box (for easier narration, the overlap between the drawn predicted box and the ground truth box is smaller than the actual situation). The width of the ground truth box is , the height is , the width of the predicted box is , with a height of , the coordinates of the center point of the ground truth box are , the coordinates of the center point of the predicted box are , the distance between the two center points is , the angle between the line connecting the two center points and the horizontal line is ; The geometric loss with dynamic weighting combines the center point offset, radius difference, aspect ratio constraint, and size error, and dynamically adjusts the weight through IoU; The dynamic weight factor of IoU is , indicating that the weight factor decreases as the intersection over union (IoU) increases; The penalty formula for the center point offset is: ; Where represents the horizontal and vertical offset of the center point of the predicted box from the center point of the ground truth box; The penalty formula for the radial difference: ; Where represents the average radius difference between the predicted box and the ground truth box by the absolute difference between the sum of the width and height of the predicted box and the sum of the width and height of the ground truth box; is the radius of the largest object in the dataset; The formula for the two-channel shape constraint is: ; which includes the aspect ratio constraint and the absolute size constraint ; Summary of the geometric loss formula with dynamic weighting: ; The adaptive angle loss combines the dynamic weight of the angle penalty and the original angle penalty term, and dynamically weakens the angle redundancy problem of circular objects; The formula for the dynamic weight of the angle penalty is: ; where the weight is close to 0 when the aspect ratio is close to 1, and the angle penalty is almost ignored; The original angle penalty term is:
[0024] where the penalty is maximum when is close to ; Summary of the adaptive angle loss formula: ; In summary, the RCIoULoss formula is: ; (3) Fireworks optimization algorithm: In the conventional process of YOLOv8, the network automatically extracts image features through convolutional layers and directly uses fully connected layers or detection heads to complete classification and localization. However, the surface texture and color of fruits vary complexly, and there are problems such as occlusion and environmental light flickering. Traditional feature extraction may lead to redundant or inefficient features interfering with the detection accuracy. Therefore, in the embodiments of the present invention, after the output layer of the Feature Pyramid Network (FPN) of YOLOv8, the Fireworks Algorithm (FAW) is introduced to dynamically screen the multi-dimensional feature matrix and retain the most discriminative feature combinations for fruit defect detection, thereby improving the classification accuracy: The input of FAW is the original feature matrix output from the FPN layer of YOLOv8 , where N is the number of samples and D is the feature dimension (such as 256 dimensions). The output of FAW is the optimized binary feature selection vector , marking whether each feature is selected (1 for retention, 0 for elimination); Define the feature subset evaluation function as F(S), and its formula is as follows: ; Among them, F(S) is used to measure the fitness of the feature vector S; α and β are parameters that balance the discriminability and redundancy of features; Discriminative(S) reflects the discriminative ability of the selected features in image classification; Redundancy(S) reflects the redundancy degree among the selected features; The feature selection process of the fireworks optimization algorithm is as follows: Step 1, Initialize the fireworks population: Generate n fireworks individuals, and each individual represents a continuous feature selection probability vector , and the initialization method is as follows: ; Among them, represents the selection probability of the i th fireworks individual for the j th feature; represents uniform random sampling from 0 to 1; Step 2, Convert the continuous vector X i of each fireworks individual into a binary vector S i , and calculate the fitness value of each fireworks: ; Step 3, Perform the explosion operation. Fireworks with high fitness generate more sparks, and fireworks with poor fitness have a larger explosion range: The formula for the number of explosion sparks is: ; Among them, The number of explosion sparks generated for each firework, m is the total number of explosion sparks, is the maximum fitness of the current population, is the fitness value of the i-th firework, is a very small value to prevent the denominator from being zero; The explosion radius formula is: ; Among them, is the explosion radius of the i -th firework, is the initial explosion amplitude, which determines the initial value of the search range, is the minimum fitness of the current population; That is, for each firework , generate explosion sparks. During the explosion process, the perturbation range of each dimension j is controlled by the explosion radius . The formula for generating new sparks is: ; Among them, is the new solution generated by the explosion; Step 4. Randomly select some explosion sparks for Gaussian mutation: ; Among them, is the new solution generated by the mutation, Gaussian(0,1) is the random sampling of the standard normal distribution, σ is the mutation intensity (decaying with iteration); Step 5. Perform population merging on fireworks, explosion sparks and mutated sparks, and select the next generation population according to the following probability: ; Among them, is the probability that an individual is retained, is the Euclidean distance sum of the individual and all other candidate individuals, and k is the total number of candidate individuals (including fireworks, explosion sparks and mutated sparks); Step 6. Determine whether the maximum number of iterations is reached. If not, return to Step 3. If so, output the optimal result, that is, the optimal binary selection vector S : Define the matrix X, where represents the j-th feature of the i-th sample. Using the firework optimization algorithm to obtain the feature selection vector S, where represents selecting the j-th feature, represents not selecting the j-th feature. With the help of the feature selection vector S, the optimized feature matrix Xopt can be obtained, and its calculation method is as follows: ; Using the Support Vector Machine (SVM) as a classifier, the screened feature matrix Xopt is used for image classification. The goal is to find a decision function f such that the predicted output of a given image sample matches the actual label as closely as possible. The formula is: .
[0025] As Figure 5 shown, it is a flowchart of a fruit sorting method based on improved YOLOv8 provided by an embodiment of the present invention. Using the above fruit sorting device, it includes the following steps: Place the fruits on the size classification conveyor shaft 2. During the rolling process of the fruits, they fall into different feeding bottom plates 1 and roll to the conveyor belt 3 on the feeding bottom plate 1. The fruits are conveyed by the conveyor belt 3 to the starting end of the conveyor belt 5. When the induction component detects that there are no fruits on the conveyor belt 5, the fruits are conveyed to the conveyor belt 5. When the induction component detects that there are fruits on the conveyor belt 5, it controls the conveyor belt baffle 4 to rotate and block between the conveyor belt 3 and the conveyor belt 5, and controls the conveyor belt 3 to stop conveying. The visual recognition component detects and collects data on the fruits on the conveyor belt 5, and controls the arc baffle 10 to rotate to block the conveying path, driving the fruits to rotate in place on the conveyor belt 5. When the visual recognition component finishes recognition, it controls the arc baffle 10 to rotate in the reverse direction. The intelligent sorting drive component receives the data collected by the visual recognition component for analysis and calculation, judges the state of the fruits, controls the rotation angle of the connecting plate 11, drives the connecting plate 11 to be connected to the channel 12 or the channel 13, and the fruits enter the channel 12 or the channel 13 to complete the sorting.
[0026] First, place the fruits on the size classification conveyor shaft 2. Under the action of gravity, the fruits roll down along the shaft. When the diameter of the fruit is smaller than the shaft spacing, the fruit falls onto the feeding bottom plate 1. The fruits are divided onto two different feeding bottom plates 1 according to their diameters. Since the feeding bottom plate 1 forms an angle with the horizontal, the fruits roll under the action of gravity and reach the first conveyor belt 3. When the sensor detects that a fruit is being conveyed to the starting end of the second conveyor belt 5, the servo 9 controls the conveyor belt baffle 4 to rotate, blocking the conveying path and controlling the first conveyor belt 3 to stop conveying. The second conveyor belt 5 is always in a moving state. When a fruit reaches the second conveyor belt 5, the arc baffle 10 is in a vertical state, blocking the conveying path and using its arc shape to make the fruit rotate in place, so that the camera can capture the shape of the fruit in all directions for more accurate identification and classification. After the visual recognition is completed, the arc baffle 10 rotates to the horizontal under the action of another servo 9. At the same time, according to the classification situation, the connecting plate 11 adjusts the corresponding angle under the action of another servo 9 to convey the fruit to the corresponding channel. And when the visual recognition of the fruit on the second conveyor belt 5 is completed, the conveyor belt baffle 4 rotates to the lower part, and the first conveyor belt 3 resumes the conveying mode to perform the identification and classification of the next fruit. This working method is continuously repeated until all the classification work is completed.
[0027] The accuracy of the fruit sorting device is detected. Three object detection models in the existing technologies, namely FasterR-CNN, YOLOv5, and YOLOV8, the improved YOLOv8 model (YOLOv8-R) that only introduces the RCIoU Loss function, the improved YOLOv8 model (YOLOv8-F) that only introduces the fireworks algorithm, and the improved YOLOv8 model (YOLOv8-RF) that introduces the RCIoU Loss function and the fireworks algorithm adopted in the embodiment of the present invention are selected for training using the standard fruit data set. The results are shown in Table 1: Table 1
[0028] It can be seen from Table 1 that the detection accuracy mAP@0.5 of the model adopted in the embodiment of the present invention is increased by 14.64, 7.64, and 4.23 percentage points compared with FasterR-CNN, YOLOv5, and YOLOV8 respectively. The detection accuracy mAP@0.5:0.95 is increased by 12.10, 9.00, and 2.40 percentage points compared with FasterR-CNN, YOLOv5, and YOLOV8 respectively. And the number of model parameters is only 11.95, taking into account both the detection accuracy and real-time performance, which proves the advantages of the improved YOLOv8 model that introduces the RCIoU Loss function and the fireworks algorithm in the embodiment of the present invention.
[0029] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A fruit sorting device based on improved YOLOv8, characterized in that, Including: A feeding bottom plate (1) is provided with a size classification conveyor shaft (2) thereon; A first conveyor belt (3) is connected to the feeding bottom plate (1), the other side of the first conveyor belt (3) is connected to a second conveyor belt (5), a conveyor belt baffle (4) is arranged between the first conveyor belt (3) and the second conveyor belt (5), and an arc baffle (10) is arranged on the other side of the second conveyor belt (5); A connecting plate (11) is connected to the second conveyor belt (5), and a first channel (12) and a second channel (13) are arranged on the other side of the connecting plate (11); An induction component is electrically connected to the conveyor belt baffle (4) and the first conveyor belt (3) for controlling the states of the first conveyor belt (3) and the conveyor belt baffle (4); A visual recognition component is electrically connected to the arc baffle (10) for collecting information of the fruits rolling on the second conveyor belt (5) and controlling the state of the arc baffle (10); An intelligent sorting drive component is connected to the visual recognition component and the connecting plate (11) for receiving and analyzing the data collected by the visual recognition component, controlling the state of the connecting plate (11), and driving the connecting plate (11) to be connected to the first channel (12) or the second channel (13).
2. The fruit sorting device based on the improved YOLOv8 according to claim 1, characterized in that, The induction component includes: A sensor is installed on a sensor base (6) for detecting whether there are fruits at the starting end of the second conveyor belt (5); A first servo drive component is connected to the conveyor belt baffle (4). The first servo drive component drives the conveyor belt baffle (4) to rotate based on the information detected by the sensor, drives the conveyor belt baffle (4) to block between the first conveyor belt (3) and the second conveyor belt (5), and at the same time, the first conveyor belt (3) is controlled to open and close based on the information detected by the sensor.
3. The fruit sorting device based on the improved YOLOv8 according to claim 2, characterized in that, The visual recognition component includes: A camera is installed on a camera base (7) for collecting information of the fruits rolling on the second conveyor belt (5); A second servo drive component is connected to the arc baffle (10). The second servo drive component drives the arc baffle (10) to rotate based on the information detected by the camera for restricting or releasing the restriction of the fruits rolling on the second conveyor belt (5).
4. The fruit sorting device based on the improved YOLOv8 according to claim 3, characterized in that, The intelligent sorting drive component includes: An analysis and calculation module is connected to the visual recognition component. The analysis and calculation module adopts an improved YOLOv8 model introducing the RCIoU Loss function and the fireworks algorithm for analyzing and judging the state of the fruits; A third servo drive component is connected to the connecting plate (11). The third servo drive component controls the rotation angle of the connecting plate (11) based on the result judged by the analysis and calculation module, and drives the connecting plate (11) to be connected to the first channel (12) or the second channel (13).
5. The fruit sorting device based on the improved YOLOv8 according to claim 4, characterized in that, The first servo drive component, the second servo drive component and the third servo drive component have the same structure but different positions, and each includes a servo motor (9) installed on a servo motor groove (8). The servo motor (9) is respectively connected to the conveyor belt baffle (4), the arc baffle (10) or the connecting plate (11) for driving the conveyor belt baffle (4), the arc baffle (10) or the connecting plate (11) to rotate.
6. A fruit sorting method based on improved YOLOv8, characterized in that, Using the fruit sorting device according to any one of claims 1-5, comprising the following steps: Place the fruits on the size classification conveyor shaft (2). During the rolling process, the fruits fall into different feeding bottom plates (1) and roll onto the first conveyor belt (3) in the feeding bottom plates (1). The fruits are conveyed by the first conveyor belt (3) to the starting end of the second conveyor belt (5). When the sensing component detects that there are no fruits on the second conveyor belt (5), the fruits are conveyed onto the second conveyor belt (5). When the sensing component detects that there are fruits on the second conveyor belt (5), control the conveyor belt baffle (4) to rotate and block between the first conveyor belt (3) and the second conveyor belt (5), and control the first conveyor belt (3) to stop conveying. The visual recognition component detects and collects data on the fruits on the second conveyor belt (5), and controls the arc baffle (10) to rotate to block the conveying path, driving the fruits to rotate in place on the second conveyor belt (5). When the visual recognition component finishes recognition, control the arc baffle (10) to rotate in the reverse direction. The intelligent sorting drive component receives the data collected by the visual recognition component for analysis and calculation, judges the state of the fruits, controls the rotation angle of the connecting plate (11), drives the connecting plate (11) to be connected to the first channel (12) or the second channel (13), and the fruits enter the first channel (12) or the second channel (13) to complete the sorting.
Citation Information
Patent Citations
Implementation method for SAR image rotation ship detection based on RCIoU loss
CN113033303A
Neural network model training method and multimedia information processing method and device
CN113642727A
Radiation source identification method and system for signal bandwidth dynamics
CN118864939A
Sorting and stacking system for sphere-like fruits and vegetables
CN119303843A
Fruit quality detects screening plant
CN206356274U