Apple maturity identification system and method based on computer vision

Through a computer vision-based recognition system, combined with the SENet attention mechanism and the Yolo V8 model, the data volume and computing resources problems of Apple's maturity recognition in the existing technology are solved, and a more accurate and efficient recognition effect is achieved.

CN119478924APending Publication Date: 2025-02-18SOUTHEAST UNIV CHENGXIAN COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411540014.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art requires a large amount of labeled data, high computing resources and limited generalization capabilities in Apple's maturity recognition, resulting in poor identification results in different environments.

Method used

Using a computer vision-based recognition system, Apple image data is collected through network crawlers and on-site acquisition methods, and feature extraction and maturity recognition are used by SENet attention mechanism and Yolo V8 model. Combined with preprocessing and data annotation technology, the model is improved robustness. Sex and accuracy.

Benefits of technology

More accurate Apple maturity recognition is achieved, the training efficiency and recognition accuracy of the model are improved, and the good recognition performance is ensured in different environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478924A_ABST
    Figure CN119478924A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of fruit recognition, in particular to an apple maturity recognition system and method based on computer vision. Comprising the following steps: S1, data collection: collecting apple image data through a web crawler method and a field collection method; s2, data labeling: labeling all the collected apple image data, and dividing the apple image data into apple samples of three maturity levels; s3, constructing an algorithm model: selecting a proper algorithm model as a framework and configuring necessary software, libraries and tools; s4, feature extraction and model training: processing the picture by using openCV, and performing feature extraction on the apple image; model training is carried out based on the processed image; s5, establishing a UI interface; s6, inputting images: using the images of fruits with different maturity as input data; s7, image processing: the input image is transmitted to a SENet attention mechanism module for feature extraction and processing; s8, feature extraction: a feature vector output from the SENet module is introduced into the model for further feature extraction; s9, maturity identification: the model predicts and classifies the maturity state of the fruits based on the extracted features; the output results comprise mature apples, immature apples and semi-mature apples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of fruit recognition, and in particular to a computer vision-based apple maturity recognition system and method. Background Art

[0002] After most fruits are picked, they are prone to fruit loss during storage and transportation, mainly because fruits of different maturity levels are mixed together. Therefore, it is beneficial to improve the quality of fruits by classifying and selecting the corresponding operation procedures according to the maturity level of fruits. Experienced fruit and vegetable growers can identify the maturity level of fruits by observing their appearance.

[0003] For example, the outer skin of apples presents different colors and characteristics at different levels of maturity;

[0004] Unripe: Usually green or light green, lighter in color. The skin may be shiny.

[0005] Semi-mature: Begins to appear yellow or reddish, especially on sun-exposed parts. May have some spots or streaks on the surface.

[0006] Ripe: The color changes to bright red, orange or yellow, depending on the variety. The surface color is uniform and lacks green. Based on this feature, apples of different maturity can be well distinguished; large-scale image data is trained with deep learning models (such as convolutional neural networks) to achieve high-precision recognition of apple maturity, which can handle complex image features and has high accuracy and adaptability; however, the disadvantage is that a large amount of labeled data is required for training, the workload of data collection and labeling is large, and model training and inference may require high computing resources. In addition, the generalization ability of the model may be affected by the diversity of training data, resulting in poor recognition effect in different environments. Summary of the invention

[0007] The purpose of the present invention is to address the problems existing in the background technology and to propose an apple maturity recognition system and method based on computer vision.

[0008] The technical solution of the present invention is a method for identifying apple maturity based on computer vision, comprising the following specific steps:

[0009] S1. Data collection: Collect apple image data through web crawling and field collection methods;

[0010] S2. Data annotation: All collected apple image data are annotated and divided into three levels of apple samples with different maturity levels, including high-maturity apple-H, medium-maturity apple-M, and low-maturity apple-L.

[0011] S3. Build an algorithm model: Select a suitable algorithm model as a framework and configure necessary software, libraries, and tools;

[0012] S4, feature extraction and model training: Use openCV to process the image and extract features from the apple image; and perform model training based on the processed image;

[0013] S5. Establishing a UI interface: The user inputs content through the UI interface and obtains recognition results.

[0014] S6, input image: use fruit images of different maturity as input data;

[0015] S7, image processing: the input image is passed to the SENet attention mechanism module for feature extraction and processing;

[0016] S8, feature extraction: The feature vector output from the SENet module is passed to the Yolo V8 model for further feature extraction;

[0017] S9. Maturity recognition: The Yolo V8 model predicts and classifies the maturity status of fruits based on the extracted features; the output results include ripe apples, unripe apples, and semi-ripe apples.

[0018] Preferably, in step S1, pictures of apples of different varieties and under different lighting conditions are collected.

[0019] Preferably, the different varieties of apples collected in step S1 include Red Fuji apples, Luochuan apples, Red Star apples and Gala apples.

[0020] Preferably, before data annotation in step S2, the image data needs to be preprocessed;

[0021] The preprocessing steps include:

[0022] a. Rotation: Randomly rotate the image, for example, choose 0°, 90°, 180°, or 270° to improve the robustness of the model to different directions.

[0023] b. Mirror symmetry: used to increase the diversity of the data set and prevent overfitting.

[0024] c. Flip: Horizontal flip: flip the image left and right; vertical flip: flip the image upside down (as needed) to adjust the viewing angle of the image data

[0025] Unify the input size of the image, using the common size of 224x224 pixels

[0026] Adjust brightness, height, contrast and sharpness; turn blurry images into recognizable ones, and adjust out-of-proportion images to normal size.

[0027] Adjusts brightness by increasing or decreasing the value of each pixel. Set a range from -50 (dark) to +50 (light).

[0028] Adjusts the contrast by multiplying it by a factor ranging from 1.0 (no change) to 3.0 (increased contrast).

[0029] Use a convolution kernel to enhance the edges of the image. Use a 3x3 sharpening kernel.

[0030] Make sure the image is resized in a 2:3 ratio.

[0031] Use the openmv library to rotate and symmetric the image in progress, and adjust the brightness, height, contrast and sharpness; the function is as follows:

[0032] img.rotation_corr()#Rotation processing

[0033] img.flip()#Mirror symmetry processing

[0034] img.brightness()#brightness adjustment

[0035] img.contrast()#contrast adjustment

[0036] img.sharpen()#Sharpness adjustment

[0037] Add Gaussian noise;

[0038] Adding Gaussian noise to the image can simulate the noise interference that may occur during the shooting process, which can enhance the model's robustness to noise and improve the accuracy and stability of recognition.

[0039] The preprocessed photos were annotated by labeimg; datasets were established for apple image samples of different maturity levels. All image data were shuffled to prevent overfitting, ensuring that the training, validation, and test sets contained sufficient numbers and coverage of samples of different maturity levels, improving the recognition performance of the model at each stage.

[0040] Preferably, in step S3, the Yolo algorithm is used as the algorithm framework, and Pycharm, Anaconda, pyQT, and openCV software are configured.

[0041] Preferably, in step S4, during the image extraction process, the geometric information of the low-level network of the image needs to be integrated with the semantic information of the high-level network to improve the detection and segmentation performance.

[0042] Preferably, in step S4, the extracted image features are trained, the images are classified based on a convolutional neural network (CNN) architecture, and predictions are made according to the maturity level; the parameters of the model are averaged using an exponential moving average method (EMA) to improve the test index and increase the robustness of the model; and cuda is used to accelerate the GPU;

[0043] Specifically, specify the learning rate lr0 to be 0.01, the learning rate decay lrf to be 0.01, the momentum to be 0.98, the weight decay weight_decay to be 0.001, the warmup training cycle warmup_epochs to be 5.0, the batch size to be 16, and the input image size imgsz to be 320.

[0044] The F1-score on the validation set (F1-score is the harmonic mean of precision and recall) is used as the main indicator. When this indicator reaches above 0.8, it can be considered that the model has been trained to a good enough state. F1-score is usually a better evaluation indicator because it can more comprehensively reflect the performance of the model.

[0045] When selecting validation set indicators, using F1-score can better guide the optimization direction of the model and ensure that the model has good recognition effects in each maturity category.

[0046] Preferably, the UI interface established in step S5 sets three recognition modes, including picture detection, video detection, and real-time detection, and directly outputs the recognition results.

[0047] An apple maturity recognition system based on computer vision, which uses the above method to recognize the maturity of apples, includes a collection unit, a data processing unit, a model recognition unit and a UI unit;

[0048] The collection unit is used to collect pictures or video information of the apple and input it into the data processing unit;

[0049] The data processing unit processes the collected data and then inputs it into the model recognition unit;

[0050] The model recognition unit trains the recognition model according to steps S1-S4, and recognizes the corresponding result according to the input data;

[0051] The UI unit includes an input interface and an output interface; the user inputs information through the input interface and obtains recognition results on the output interface.

[0052] Preferably, the acquisition unit is a camera module based on openCV.

[0053] Compared with the prior art, the present invention has the following beneficial technical effects:

[0054] The invention has more accurate recognition efficiency and accuracy. The prediction accuracy of the model for highly mature apples (apple-H) is 82%, the prediction accuracy for medium-mature apples (apple-M) is 80%, and the prediction accuracy for unripe apples (apple-L) is 86%.

[0055] The present invention has faster training efficiency. By learning and drawing on the Transformer large model, an attention mechanism is added to the training algorithm; the SE module introduces Squeeze and Excitation operations, and adaptively learns the weight of each channel to enhance the expression ability and performance of the neural network, so that the network can more effectively learn and utilize the relationship between feature channels. It can automatically learn the weight and importance of each channel. Through the learned weights, the SE module can adaptively adjust the importance of the features of each channel in subsequent network layers. In this way, the network can pay more attention to important feature channels, improve the discrimination ability of features, and thus improve the performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 A schematic diagram of a system framework of an embodiment of the present invention;

[0057] Figure 2 This is one of the UI page schematic diagrams of an embodiment of the present invention;

[0058] Figure 3 This is one of the UI page schematic diagrams of an embodiment of the present invention;

[0059] Figure 4 The following are the results of the recognition experiment using the model trained by this method in the embodiment of the present invention;

[0060] Figure 5.1 The following are the results of the recognition experiment using the model trained by this method in the embodiment of the present invention;

[0061] Figure 5.2 The following are the results of the recognition experiment using the model trained by this method in the embodiment of the present invention;

[0062] Figure 6 It is the original image data of the training;

[0063] Figure 7 It is a feature heat map formed by visualizing the features of image data under the SENetAttention mechanism;

[0064] Figure 8This is a schematic diagram of how the model processes image features under multiple convolutional layers;

[0065] Fig. 9 These are the performance change curves of two different algorithms during the training process;

[0066] Fig.10 Schematic diagram of model recognition results of different varieties of apples in an embodiment of the present invention;

[0067] Fig.11 It is a principle framework diagram of SE-Net in an embodiment of the present invention;

[0068] Fig.12 4 is a flow chart of the Excitation operation in an embodiment of the present invention. DETAILED DESCRIPTION

[0069] Example 1

[0070] The present invention proposes a method for identifying apple maturity based on computer vision, which comprises the following specific steps:

[0071] S1. Data collection: Collect apple image data through web crawler method and field collection method; it is necessary to collect apple pictures of different varieties and under different lighting conditions. The different varieties of apples collected include Red Fuji apple, Luochuan apple, Red Star apple and Gala apple.

[0072] S2, data labeling: labeling all collected apple image data and dividing them into apple samples of three maturity levels, including high maturity apple-H, medium maturity apple-M and low maturity apple-L; before data labeling in step S2, the image data needs to be preprocessed;

[0073] The preprocessing steps include:

[0074] a. Rotation: Randomly rotate the image, for example, choose 0°, 90°, 180°, or 270° to improve the robustness of the model to different directions.

[0075] b. Mirror symmetry: used to increase the diversity of the data set and prevent overfitting.

[0076] c. Flip: Horizontal flip: flip the image left and right; vertical flip: flip the image upside down (as needed) to adjust the viewing angle of the image data

[0077] Unify the input size of the image, using the common size of 224x224 pixels

[0078] Adjust brightness, height, contrast and sharpness; turn blurry images into recognizable ones, and adjust out-of-proportion images to normal size.

[0079] Adjusts brightness by increasing or decreasing the value of each pixel. Set a range from -50 (dark) to +50 (light).

[0080] Adjusts the contrast by multiplying it by a factor ranging from 1.0 (no change) to 3.0 (increased contrast).

[0081] Use a convolution kernel to enhance the edges of the image. Use a 3x3 sharpening kernel.

[0082] Make sure the image is resized in a 2:3 ratio.

[0083] Use the openmv library to rotate and symmetric the image in progress, and adjust the brightness, height, contrast and sharpness; the function is as follows:

[0084] img.rotation_corr()#Rotation processing

[0085] img.flip()#Mirror symmetry processing

[0086] img.brightness()#brightness adjustment

[0087] img.contrast()#contrast adjustment

[0088] img.sharpen()#Sharpness adjustment

[0089] Add Gaussian noise;

[0090] Adding Gaussian noise to the image can simulate the noise interference that may occur during the shooting process, which can enhance the model's robustness to noise and improve the accuracy and stability of recognition.

[0091] The preprocessed photos were annotated by labeimg; datasets were established for apple image samples of different maturity levels. All image data were shuffled to prevent overfitting, ensuring that the training, validation, and test sets contained sufficient numbers and coverage of samples of different maturity levels, improving the recognition performance of the model at each stage.

[0092] In this embodiment, different varieties: considering the maturity of different apple varieties, increasing diversity requires detailed classification of labels.

[0093] Grading labels: Add more subdivision levels to maturity (immature, semi-mature, mature) and provide more detailed information.

[0094] For general recognition systems, the maturity of some common apples can be well recognized, but the recognition rate is not satisfactory for some special apples, such as yellow apples and green snake apples. More attributes can be added to the label to divide apples into three categories. The first category is common apples, including Gala apples and Red Fuji apples; the second category is apples that are still yellow after maturity, recorded as yellow apples, such as Golden Crown apples and Venus Golden apples; the third category is apples that are still green after maturity, recorded as green apples, such as green apples and green snake apples.

[0095] Then, the algorithm can classify the types according to the characteristics of these different types of apples, and then classify and detect their maturity, and obtain the following: RedApple_Overripe, RedApple_High, RedApple_Mid, RedApple_Low, YellowApple_Overripe, YellowApple_High, YellowApple_Mid, YellowApple_Low, GreenApple_Overripe, GreenApple_High, GreenApple_Mid, GreenApple_Low. Through such label classification, the accuracy and robustness of classification can be significantly improved, and the same model can be adapted to the classification of apples on different production lines.

[0096] S3. Build an algorithm model: Select a suitable algorithm model as a framework and configure necessary software, libraries, and tools;

[0097] S4, feature extraction and model training: Use openCV to process the image and extract features from the apple image; and perform model training based on the processed image;

[0098] S5. Establishing a UI interface: The user inputs content through the UI interface and obtains recognition results. The established UI interface sets three recognition modes, including image detection, video detection, and real-time detection, and directly outputs recognition results.

[0099] S6, input image: use fruit images of different maturity as input data;

[0100] S7, image preprocessing: the input image is passed into the SENet attention mechanism module for feature extraction and preprocessing;

[0101] S8, feature extraction: The feature vector output from the SENet module is passed to the Yolo V8 model for further feature extraction;

[0102] S9. Maturity recognition: The Yolo V8 model predicts and classifies the maturity status of fruits based on the extracted features; the output results include ripe apples, unripe apples, and semi-ripe apples.

[0103] In an optional embodiment, in step S3, the Yolo algorithm is used as the algorithm framework, and Pycharm, Anaconda, pyQT, and openCV software are configured.

[0104] In step S4, the image extraction process needs to integrate the geometric information of the low-level network with the semantic information of the high-level network to improve the detection and segmentation performance. Integrate into the YOLO model:

[0105] In the feature extraction network of YOLO, the SENet attention module is added after each convolutional layer to enhance the feature representation. After each feature is extracted through the convolutional layer, SENet feeds these feature maps into the Squeeze and Excitation modules.

[0106] In the Squeeze stage, the feature map of each channel is compressed using global average pooling to obtain a global description of the channel. This process combines low-level geometric information with high-level semantic information, reflecting the importance of the channel in the entire image.

[0107] In the Excitation stage, the excitation weights for each channel are generated through two fully connected layers. The first fully connected layer reduces the number of channels (usually scaled down), and the second fully connected layer restores the original number of channels. The weights are normalized by the sigmoid function to between 0 and 1.

[0108] Apply the excitation weights to the original feature map to achieve feature recalibration. This process actually combines low-level geometric information with high-level semantic information, and makes important features more prominent through weight adjustment, while unimportant features are suppressed.

[0109] In step S4, the extracted image features are trained, the images are classified based on the convolutional neural network (CNN) architecture, and predictions are made according to the maturity level; the parameters of the model are averaged using the exponential moving average method EMA to improve the test index and increase the robustness of the model; and the GPU is accelerated using cuda;

[0110] Specifically, specify the learning rate lr0 to be 0.01, the learning rate decay lrf to be 0.01, the momentum momentum to be 0.98, the weight decay weight_decay to be 0.001, the warmup training cycle warmup_epochs to be 5.0, the batch size batch to be 16, and the input image size imgsz to be 320

[0111] The F1-score on the validation set (F1-score is the harmonic mean of precision and recall) is used as the main indicator. When this indicator reaches above 0.8, it can be considered that the model has been trained to a good enough state. F1-score is usually a better evaluation indicator because it can more comprehensively reflect the performance of the model.

[0112] When selecting validation set metrics, using F1-score can better guide the optimization direction of the model and ensure that the model has good recognition effects in each maturity category.

[0113] This embodiment adds an attention mechanism to the training algorithm by learning from the Transformer model. The attention mechanism is a data processing method in machine learning and is widely used in various types of machine learning tasks such as natural language processing, image recognition, and speech recognition. It is essentially similar to the human observation mechanism of external things. However, the field of machine vision is fundamentally different from natural language processing (NLP). Because object detection is actually to dig out the necessary object structure or position information in a picture, in this case, its input is a picture, and there is no very obvious order of precedence. From the perspective of the human brain, due to individual differences, it is difficult to find a universal method of observing pictures.

[0114] SE-Attention is used here. In the field of deep learning, the SE (Squeeze-and-Excitation) module is an attention mechanism that aims to improve the efficiency of information transmission between channels in convolutional neural networks (CNNs).

[0115] In traditional CNN architectures, convolutional layers and pooling layers are usually used to extract image features. However, this approach does not explicitly model the relationship between feature channels, resulting in some channels contributing relatively little to specific tasks, while other channels are more important. The SE module aims to solve this problem.

[0116] The SE module enhances the expressiveness and performance of the neural network by introducing Squeeze and Excitation operations and adaptively learning the weights of each channel, enabling the network to more effectively learn and utilize the relationship between feature channels. It can automatically learn the weights and importance of each channel. Through the learned weights, the SE module can adaptively adjust the importance of the features of each channel in subsequent network layers. In this way, the network can pay more attention to important feature channels, improve the discriminative ability of features, and thus improve the performance of the model. SENet can improve the interpretability of the model by visualizing the recalibrated feature maps, allowing users to better understand the areas that the model focuses on. SENet can effectively integrate features between different layers, improve the combination of low-level features and high-level features, and enhance the model's ability to capture details.

[0117] In the feature extraction process of this embodiment, the attention mechanism is often used in NPL to enhance the learning ability of the large model, which is applied to CV. Here, SE-NetAttention is used to make the large model imitate human vision.

[0118] like Fig.11 As shown in the figure, this is the principle of SE-Net: a feature map is transmitted, and the image is convolved to obtain a new feature map Ftr, which includes C feature channels with width and height of W and H respectively.

[0119] Each two-dimensional vector H*W is globally pooled to form a real value, which has a global receptive field to some extent, and the dimension of the output matches the number of feature channels of the input. It represents the global distribution of responses on the feature channels, and enables the layers close to the input to also obtain the global receptive field. This operation is called Squeeze.

[0120] The second is the Excitation operation, which is a mechanism similar to the gate in a recurrent neural network, based on the correlation between feature channels. The weight is generated for each feature channel through the parameter w, where the parameter w is learned to explicitly model the correlation between feature channels.

[0121] The last step is the Reweight operation, which regards the weight of Excitation’s output as the importance of each feature channel after feature selection, and then weights it channel by channel to the previous features to complete the recalibration of the original features in the channel dimension.

[0122] like Fig.12 As shown in the figure, after global pooling, the FC module reduces the channel from C to C / r, where r is the attenuation factor, thereby reducing the amount of calculation. After ReLU processing, it is restored to C by FC, and finally the value is converted into an output value of 0 to 1 through the Sigmoid function.

[0123] like Figure 4 -5, the results of the recognition experiment using the model trained by this method show that the model has an accuracy of 82% in predicting highly ripe apples (apple-H), an accuracy of 80% in predicting moderately ripe apples (apple-M), and an accuracy of 86% in predicting unripe apples (apple-L).

[0124] from Figure 5.1 It can be seen that the curve is very close to the point (1, 1), that is, the area of ​​the mAP curve is as close to 1 as possible, indicating that under the premise of high accuracy, the neural network can detect all categories as much as possible.

[0125] F1 score is a measurement indicator for classification problems. It is the harmonic mean of precision and recall, with a maximum of 1 and a minimum of 0.

[0126]

[0127] Depend on Figure 5.2 It can be seen that the F1 scores of all apple species recognition are around 0.8 when the confidence level is in the range of 0.1-0.9. It can be concluded that the performance of the neural network model is excellent and in line with expectations.

[0128] like Fig. 9 As shown in the figure, the performance change curves of two different algorithms during the training process are shown, one is the algorithm after adding SE-Net (red), and the other is the algorithm before improvement (blue).

[0129] Figure 6 is the original image data for training, Figure 7 This is a feature heat map formed by visualizing the features of image data under the SENetAttention mechanism. The more red the color is, the more the model pays attention to this area, and it is considered to be most relevant to the final prediction result. The more blue the color is, the less attention the model pays, and it is considered that this area has little impact on the decision. Figure 8 This shows how the model processes image features under multiple convolutional layers.

[0130] From the curve trend, the overall performance of the algorithm after adding SE-Net is better than the algorithm before improvement. SENet enhances the response to important features and suppresses unimportant features by adaptively recalibrating feature channels. This feature selection can improve the sensitivity of the model to maturity recognition. In the early stage of training, the performance gap between the two algorithms is small, but with the increase of training rounds, the advantages of the SE-Net algorithm gradually emerge, and finally reach a better performance level. SENet can help the model better distinguish between background and target and reduce false alarm rate, especially in complex background. Better generalization ability. The adaptive characteristics of SENet enable the model to perform better on different data sets and tasks, enhance the generalization ability of the model, and have strong adaptability. From the frequency and amplitude of the curve fluctuation, the curve of the SE-Net algorithm is relatively smooth and the fluctuation amplitude is small, indicating that the algorithm is more stable and less susceptible to changes in training data. The curve fluctuation of the algorithm before improvement is more violent, indicating that its performance is more susceptible to external interference. By focusing on more representative features, the classification and positioning performance of the improved model is expected to improve, resulting in higher accuracy and recall. As the training data gradually increases, the final mAP_0.5 (mean average precision) is higher than the curve before improvement.

[0131] The attention mechanism can improve the training efficiency of the model, speed up the convergence speed, and enable the model to achieve better performance with fewer training rounds. As can be seen from the figure, the model curve before the improvement converges when epochs reaches around 40, while the model with the attention mechanism has begun to converge when epochs is around 30, which improves the stability of training.

[0132] Example 2

[0133] This embodiment provides an apple maturity recognition system based on computer vision, which uses the method of Embodiment 1 to recognize the maturity of apples, including a collection unit, a data processing unit, a model recognition unit, and a UI unit;

[0134] The collection unit is used to collect pictures or video information of the apple and input it into the data processing unit;

[0135] The data processing unit processes the collected data and then inputs it into the model recognition unit;

[0136] The model recognition unit trains the recognition model according to steps S1-S4, and recognizes the corresponding result according to the input data;

[0137] The UI unit includes an input interface and an output interface; the user inputs information through the input interface and obtains the recognition result on the output interface. The acquisition unit is a camera module based on openCV.

[0138] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited thereto, and various changes can be made within the knowledge scope of technicians in the relevant technical field without departing from the purpose of the present invention.

Claims

1. A method for identifying apple maturity based on computer vision, characterized in that: The specific steps include: S1. Data collection: Collect apple image data through web crawling and field collection methods; S2. Data annotation: All collected apple image data are annotated and divided into three levels of apple samples with different maturity levels, including high-maturity apple-H, medium-maturity apple-M, and low-maturity apple-L. S3. Build an algorithm model: Select a suitable algorithm model as a framework and configure necessary software, libraries, and tools; S4, feature extraction and model training: Use openCV to process the image and extract features from the apple image; and perform model training based on the processed image; S5. Establishing a UI interface: The user inputs content through the UI interface and obtains recognition results; S6, input image: use fruit images of different maturity as input data; S7, image processing: the input image is passed to the SENet attention mechanism module for feature extraction and processing; S8, feature extraction: The feature vector output from the SENet module is passed to the Yolo V8 model for further feature extraction; S9. Maturity recognition: The Yolo V8 model predicts and classifies the maturity status of fruits based on the extracted features; the output results include ripe apples, unripe apples, and semi-ripe apples.

2. The method for identifying apple maturity based on computer vision according to claim 1, characterized in that: In step S1, apple images of different varieties and under different lighting conditions are collected.

3. The method for identifying apple maturity based on computer vision according to claim 2, characterized in that: The different varieties of apples collected in step S1 include Red Fuji apples, Luochuan apples, Red Star apples and Gala apples.

4. The method for identifying apple maturity based on computer vision according to claim 1, characterized in that: Before data annotation in step S2, the image data needs to be preprocessed; The preprocessing steps include: Rotational and mirror symmetry; Adjust brightness, height, contrast and sharpness; Add Gaussian noise; The preprocessed photos are annotated by labeimg; data sets are established for apple image samples of different maturity levels.

5. The method for identifying apple maturity based on computer vision according to claim 1, characterized in that: In step S3, the Yolo algorithm is used as the algorithm framework, and Pycharm, Anaconda, pyQT, and openCV software are configured.

6. The method for identifying apple maturity based on computer vision according to claim 1, characterized in that: In step S4, during the image extraction process, the geometric information of the low-level network of the image needs to be integrated with the semantic information of the high-level network to improve the detection and segmentation performance.

7. The method for identifying apple maturity based on computer vision according to claim 1, characterized in that: In step S4, the extracted image features are trained by first dividing the data set into a training set and a validation set, classifying the images based on the convolutional neural network (CNN) architecture, and predicting them according to the maturity level; using the exponential moving average method (EMA) to average the model parameters, improve the test index and increase the model robustness; using cuda to accelerate the GPU; Specifically, specify the learning rate lr0 to be 0.01, the learning rate decay lrf to be 0.01, the momentum momentum to be 0.98, the weight decay weight_decay to be 0.001, the warmup training cycle warmup_epochs to be 5.0, the batch size batch to be 16, and the input image size imgsz to be 320; The F1-score on the validation set is used as the main indicator. When this indicator reaches above 0.8, it can be considered that the model has been trained to a good enough state; the training is completed.

8. The method for identifying apple maturity based on computer vision according to claim 1, characterized in that: The UI interface established in step S5 sets three recognition modes, including picture detection, video detection, and real-time detection, and directly outputs the recognition results.

9. A computer vision-based apple maturity recognition system, using the method according to any one of claims 1 to 8 to recognize the maturity of apples, characterized in that: It includes a collection unit, a data processing unit, a model recognition unit and a UI unit; The collection unit is used to collect pictures or video information of the apple and input it into the data processing unit; The data processing unit processes the collected data and then inputs it into the model recognition unit; The model recognition unit trains the recognition model according to steps S1-S4, and recognizes the corresponding result according to the input data; The UI unit includes an input interface and an output interface; The user inputs information through the input interface and obtains the recognition results on the output interface.

10. The computer vision-based apple maturity recognition system according to claim 9, characterized in that: The acquisition unit is a camera module based on openCV.