Citrus fruit identification method based on AI image identification

By applying the citrus fruit recognition method based on AI image recognition technology in the citrus industry, the YOLOv7 model is used to realize automatic recognition of citrus fruit features, which solves the problem of time-consuming and labor-intensive and error-prone traditional manual recognition, improves the recognition accuracy and efficiency, and improves the production efficiency and product quality of the industry.

CN119851265APending Publication Date: 2025-04-18衢州市数字乡村建设中心 +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411955147.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In the citrus industry, traditional manual identification of citrus fruits, such as size, maturity and variety, is time-consuming and labor-intensive and prone to errors, and cannot meet the industry's growing needs.

Method used

Using the citrus fruit recognition method based on AI image recognition technology, a citrus fruit recognition model based on YOLOv7 is constructed, and deep learning algorithms and large-scale data training are used to automatically recognize and classify citrus fruit features.

Benefits of technology

It improves the accuracy and efficiency of citrus fruit recognition, meets the needs of the citrus industry for fruit feature recognition, and improves the production efficiency and product quality of the industry.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119851265A_ABST
    Figure CN119851265A_ABST
Patent Text Reader

Abstract

The invention relates to the field of citrus planting, in particular to a citrus fruit recognition method based on AI image recognition, and the method comprises the steps: building a citrus image database of citrus fruit multi-scale feature parameters; performing image preprocessing on the data, fitting a fruit image, and constructing a citrus fruit identification model based on YOLOv7; and taking the target citrus live-action image as input, capturing input data characteristic parameters by the model, identifying the size, maturity and variety characteristics of the citrus fruits, and returning a target citrus fruit identification result. According to the method, the YOLOv7 deep learning model is improved, the ASPP module and the self-attention mechanism are combined, the citrus fruit recognition model based on YOLOv7 is constructed, features can be extracted from a large number of training samples, the inherent law of sample data is learned through multiple iterations, and the method has high recognition precision. And the improved model is deployed to a mobile terminal development board, so that the practice requirement of citrus fruit identification is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of citrus planting, and in particular to a citrus fruit recognition method based on AI image recognition technology. Background Art

[0002] In the citrus industry, accurately identifying the size, maturity, and variety of citrus fruits is a key issue in the production and sales process. Traditional manual recognition methods are time-consuming, labor-intensive, and error-prone, and cannot meet the growing needs of the citrus industry. Using AI image recognition technology, based on deep learning algorithms and large-scale data training, it is possible to automatically recognize and classify citrus fruit characteristics, thereby improving recognition accuracy and efficiency. At present, AI image recognition technology has been widely used in the agricultural field, such as the identification and prediction of crop diseases. Applying AI image recognition technology to the citrus industry can achieve rapid recognition and classification of citrus fruit-related characteristics, provide effective support for production decisions, and improve the production efficiency and market competitiveness of the citrus industry. Based on the above background, the present invention proposes a citrus fruit recognition method based on AI image recognition to meet the needs of the citrus industry for fruit feature recognition and improve industry production efficiency and product quality. Summary of the invention

[0003] The present invention aims to provide a citrus fruit recognition method based on AI image recognition technology to solve the problems raised in the above-mentioned background technology, identify the size, maturity, variety and other characteristics of citrus fruits, and improve industrial production efficiency and product quality.

[0004] To achieve the above object, the present invention provides the following solutions:

[0005] The citrus fruit recognition method based on AI image recognition is characterized by comprising:

[0006] Establish a citrus image database of multi-scale feature parameters of citrus fruits; wherein each feature parameter involves a citrus image dataset containing more than 50 images;

[0007] The data is fitted with a fruit image after image preprocessing to construct a citrus fruit recognition model based on YOLOv7;

[0008] Taking the target citrus real-life image as input, the model captures the input data feature parameters, identifies the size, maturity, and variety characteristics of the citrus fruit, and returns the target citrus fruit recognition result.

[0009] Furthermore, a citrus image database of multi-scale feature parameters of citrus fruits is established, and the establishment step comprises:

[0010] Feature extraction data collection: collecting citrus fruit image data including different types of citrus fruits, wherein the citrus fruit image data includes citrus fruits of different maturity levels, and the data collection uses a camera device to obtain citrus fruit images;

[0011] Data annotation: annotating the collected citrus fruit image data, annotating the multi-scale characteristic parameters of each fruit, including the size, shape, color, and texture of the fruit;

[0012] Data processing: performing data processing on the annotated citrus fruit image data, wherein the data processing includes data cleaning, deduplication, and format conversion operations;

[0013] Data analysis: using the processed citrus fruit image data to perform data analysis and extract the relationships and rules between characteristic parameters of different scales;

[0014] Model training: A multi-scale feature parameter prediction model for citrus fruit is established, and the multi-scale feature parameter prediction model is used to predict new citrus fruit images to achieve automatic recognition and extraction of fruit feature parameters.

[0015] Furthermore, a citrus fruit recognition model based on YOLOv7 is constructed, and the construction steps include:

[0016] S1, obtaining a citrus image database based on multi-scale feature parameters of citrus fruits and making an initial sample data set;

[0017] S2. Data labeling: Perform data enhancement on the initial sample data set to obtain the labeling file of the real frame of the target detection sample data set;

[0018] S3, divide the training set, test set and validation set: divide the target detection sample data set into a training set, a test set and a validation set;

[0019] S4, optimizing and improving the network structure of YOLOv7, and obtaining an improved citrus fruit recognition model based on YOLOv7;

[0020] S5. Train a citrus fruit recognition model based on YOLOv7 to obtain a trained model weight file;

[0021] S6, compressed model weight file;

[0022] S7. Test and improve the network performance of the YOLOv7-based citrus fruit recognition model.

[0023] Furthermore, the specific steps of step S2 are as follows: crop, rotate, scale, translate, add noise and other operations to the initial sample data set, adjust the contrast, brightness and saturation. Merge the processed data with the unprocessed data, expand the original data set, generate the target detection data set, and create a real box annotation file.

[0024] Furthermore, the specific steps of step S4 are as follows:

[0025] S4.1. Embedding the backbone network of YOLOv7 into the self-attention mechanism allows the model to dynamically learn the dependencies between different positions based on different parts of the input, thereby improving its ability to grasp global information.

[0026] S4.2. Add the ASPP module to the YOLOv7 network to increase the receptive field and improve the ability to extract multi-scale information.

[0027] Furthermore, the specific steps of step S5 are as follows:

[0028] S5.1. Load the annotation file of the real box of the target detection sample data set, calculate the intersection-and-union ratio of the real box and the prior box, and obtain the size of the prior box by performing K-means clustering on the intersection-and-union ratio;

[0029] S5.2. Input the size of the prior box and other hyperparameters into the model;

[0030] S5.3. Use the training set to train the model until convergence, and obtain the trained model weight file.

[0031] The beneficial technical effects of the present invention are as follows:

[0032] The present invention improves the YOLOv7 deep learning model, combines the ASPP module and the self-attention mechanism, and constructs a YOLOv7-based citrus fruit recognition model, which can extract features from a large number of training samples, learn the inherent laws of sample data after multiple iterations, and has high recognition accuracy. The improved model is deployed to the mobile terminal development board to meet the practical needs of citrus fruit recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a flow chart of the citrus fruit identification method of the present invention.

[0034] Figure 2 It is the ASPP module structure diagram of the present invention.

[0035] Figure 3 It is a structural diagram of the self-attention mechanism of the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below through embodiments. However, it should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the scope of the present application. In addition, in the following description, the description of known structures and technologies is omitted to avoid unnecessary confusion of the concepts of the present application.

[0037] The working process of the present invention is further described below in conjunction with the accompanying drawings.

[0038] Reference Figure 1 The overall operation flow chart of the present invention is a citrus fruit recognition method based on AI image recognition, comprising the following steps:

[0039] Step 1: Establish a citrus fruit image database with multi-scale feature parameters of citrus fruits, where each feature parameter involves a citrus image dataset containing more than 50 images.

[0040] Specifically, for establishing a citrus image database of multi-scale feature parameters of citrus fruits, the establishing step includes:

[0041] Feature extraction data collection: collecting citrus fruit image data including different types of citrus fruits, wherein the citrus fruit image data includes citrus fruits of different maturity levels, and the data collection uses a camera device to obtain citrus fruit images.

[0042] Data annotation: annotating the collected citrus fruit image data, annotating the multi-scale feature parameters of each fruit, including the size, shape, color, and texture of the fruit.

[0043] Data processing: Data processing is performed on the labeled citrus fruit image data, and the data processing includes data cleaning, deduplication, and format conversion operations.

[0044] Data analysis: using the processed citrus fruit image data to perform data analysis and extract the relationships and rules between characteristic parameters of different scales;

[0045] Model training: A multi-scale feature parameter prediction model for citrus fruit is established, and the multi-scale feature parameter prediction model is used to predict new citrus fruit images to achieve automatic recognition and extraction of fruit feature parameters.

[0046] Step 2: After image preprocessing, the data is fitted with a fruit image, and a YOLOv7 deep learning model is constructed and trained.

[0047] Prepare a dataset of annotated and processed citrus fruit images and divide it into training, validation, and test sets. Select the YOLOv7 deep learning model as the basic model because of its fast and efficient detection characteristics. Input the training set into the YOLOv7 model for model training to learn the feature representation and detection capabilities of citrus fruits. During the training process, continuously adjust the model parameters and learning rate to optimize the model performance. Use the validation set to evaluate the model, calculate indicators such as accuracy, recall, and precision, and tune the model based on the evaluation results. Repeat the above training and evaluation steps until the model performance is optimal.

[0048] Step 3: Target citrus real-life image recognition.

[0049] Input the real-life image of the target citrus fruit into the trained YOLOv7 model. The model captures the feature parameters in the input image, including the size, shape, and color of the citrus fruit. Based on the captured feature parameters, the model identifies the maturity, variety, and other characteristics of the citrus fruit. Finally, the model returns the recognition result of the target citrus fruit, including the type and maturity of the fruit.

[0050] In view of the above-mentioned citrus fruit recognition method based on AI image recognition, this application prepares a citrus fruit recognition model based on YOLOv7, which specifically includes: a camera, a development board, a citrus image database based on multi-scale feature parameters of citrus fruits, and an improved YOLOv7 citrus fruit recognition model;

[0051] The camera is used to capture citrus fruit image data, construct a citrus image database based on multi-scale feature parameters of citrus fruits, and transmit the database to the development board.

[0052] The citrus image database of multi-scale feature parameters of citrus fruits: an input data set for the training, testing, and verification processes of the improved YOLOv7 citrus fruit recognition model.

[0053] The development board is used to deploy a YOLOv7-based citrus fruit recognition model, and use the YOLOv7-based citrus fruit recognition model to obtain features such as fruit size, maturity, variety, etc., and send the feature parameters and quality data to a PC.

[0054] The PC is used to display characteristic parameters and quality data in real time.

[0055] On the basis of the above embodiment, a citrus fruit recognition model based on YOLOv7 is constructed, and the construction steps include:

[0056] S1. Obtain a citrus image database based on multi-scale feature parameters of citrus fruits and create an initial sample data set.

[0057] S2. Data labeling: Perform data enhancement on the initial sample dataset to obtain the labeling file of the real frame of the target detection sample dataset.

[0058] S3, divide the training set, test set and validation set: divide the target detection sample data set into a training set, a test set and a validation set;

[0059] S4. Optimize and improve the network structure of YOLOv7 to obtain an improved citrus fruit recognition model based on YOLOv7.

[0060] S5. Train a citrus fruit recognition model based on YOLOv7 to obtain a trained model weight file.

[0061] S6. Compress the model weight file.

[0062] S7. Test and improve the network performance of the YOLOv7-based citrus fruit recognition model.

[0063] The specific steps of step S2 are as follows:

[0064] The initial sample dataset is cropped, rotated, scaled, translated, and noise is added to adjust contrast, brightness, and saturation. The processed data is merged with the unprocessed data to expand the original dataset, generate the target detection dataset, and create a ground truth annotation file.

[0065] Based on the above technical solution, the specific steps of step S4 are as follows:

[0066] S4.1. See Figure 3 , embedding the backbone network of YOLOv7 into the self-attention mechanism, allowing the model to dynamically learn the dependencies between different positions according to different parts of the input, and improve its ability to grasp global information.

[0067] S4.2, see Figure 2 , the ASPP module is added to the YOLOv7 network to increase the receptive field and improve the ability to extract multi-scale information.

[0068] Based on the above technical solution, the self-attention mechanism involved in step S4.1 allows the model to dynamically learn the dependencies between different positions based on different parts of the input, thereby improving the ability to grasp global information; the self-attention mechanism includes calculating the attention score and the weighted feature. The attention mechanism calculation formula is:

[0069]

[0070] The weighted feature calculation formula is:

[0071] Output(q,k,v)=softmax(Attention(q,k))*v

[0072] Among them, q represents the query vector, k represents the key vector, v represents the value vector, and d k Indicates the key vector dimension.

[0073] Based on the above technical solution, the ASPP module involved in step S4.2 is a dilated spatial convolutional pooling pyramid. Its structure consists of a 1×1 convolution, three pooling pyramids, and ASPP Pooling. The difference between the dilated convolution layer and the general convolution is the dilation rate, which controls the padding and dilation during convolution. Through different padding and dilation, receptive fields of different scales can be obtained to extract multi-scale information.

[0074] The calculation formula of the dilated convolution involved in the above ASPP is: y[i] = ∑ k x[i+r*k]*w[k], where y[i] represents the i-th element of the output feature map, x[i+r*k] represents a certain position in the input feature map, w[k] represents the convolution kernel weight, and r represents the void rate.

[0075] Based on the above technical solution, the specific steps of step S5 are as follows:

[0076] S5.1. Load the annotation file of the real box of the target detection sample data set, calculate the intersection-and-union ratio of the real box and the prior box, and obtain the size of the prior box by performing K-means clustering on the intersection-and-union ratio.

[0077] S5.2. Input the size of the prior box and other hyperparameters into the model.

[0078] S5.3. Use the training set to train the model until convergence, and obtain the trained model weight file.

[0079] Based on the above embodiment, an improved citrus fruit recognition model based on YOLOv7 is deployed, and the model and the compressed model weight file are deployed to the development board.

[0080] Furthermore, the process of tuning the YOLOv7 deep learning model includes:

[0081] Introducing FPN structure: Enhance the ability of multi-scale target detection and improve the detection accuracy of YOLOv7 deep learning model for targets of different sizes. Through multi-scale feature fusion, targets of various sizes can be effectively detected;

[0082] Apply the ASPP module: increase the model's ability to extract features from different receptive fields, improve the accuracy of target positioning, better understand the background information around the target, and improve the accuracy of target detection;

[0083] Introducing category embedding vectors: Helps the YOLOv7 deep learning model better understand the relationship between different categories and improves the model's classification accuracy for targets of different categories;

[0084] Introducing the self-attention mechanism: Improve the YOLOv7 deep learning model's ability to grasp global information, enhance the recognition of target relevance, help the model better understand the relationship between targets, and improve the accuracy of target detection.

[0085] The above are only specific embodiments of the present application, but the technical features of the present application are not limited thereto. Any simple changes, equivalent replacements or modifications made based on the present application to solve basically the same technical problems and achieve basically the same technical effects are all included in the protection scope of the present application.

Claims

1. A citrus fruit recognition method based on AI image recognition, characterized in that: include: Establish a citrus image database of multi-scale feature parameters of citrus fruits; wherein each feature parameter involves a citrus image dataset containing more than 50 images; The data is fitted with a fruit image after image preprocessing to construct a citrus fruit recognition model based on YOLOv7; Taking the real-life image of the target citrus as input, the model captures the characteristic parameters of the input data, identifies the size, maturity, and variety characteristics of the citrus fruit, and returns the recognition result of the target citrus fruit.

2. The citrus fruit recognition method based on AI image recognition according to claim 1, characterized in that: Establishing a citrus image database of multi-scale feature parameters of citrus fruits, the establishing steps include: Feature extraction data collection: collecting citrus fruit image data including different types of citrus fruits, wherein the citrus fruit image data includes citrus fruits of different maturity levels, and the data collection uses a camera device to obtain citrus fruit images; Data annotation: annotating the collected citrus fruit image data, annotating the multi-scale characteristic parameters of each fruit, including the size, shape, color, and texture of the fruit; Data processing: performing data processing on the annotated citrus fruit image data, wherein the data processing includes data cleaning, deduplication, and format conversion operations; Data analysis: using the processed citrus fruit image data to perform data analysis and extract the relationships and rules between characteristic parameters of different scales; Model training: A multi-scale feature parameter prediction model for citrus fruit is established, and the multi-scale feature parameter prediction model is used to predict new citrus fruit images to achieve automatic recognition and extraction of fruit feature parameters.

3. The citrus fruit recognition method based on AI image recognition according to claim 2, characterized in that: Constructing a citrus fruit recognition model based on YOLOv7, the construction steps include: S1, obtaining a citrus image database based on multi-scale feature parameters of citrus fruits and making an initial sample data set; S2. Data annotation: Perform data enhancement on the initial sample data set to obtain the annotation file of the real frame of the target detection sample data set; S3, divide the training set, test set and validation set: divide the target detection sample data set into a training set, a test set and a validation set; S4, optimizing and improving the network structure of YOLOv7, and obtaining an improved citrus fruit recognition model based on YOLOv7; S5. Train a citrus fruit recognition model based on YOLOv7 to obtain a trained model weight file; S6, compressed model weight file; S7. Test and improve the network performance of the YOLOv7-based citrus fruit recognition model.

4. The citrus fruit recognition method based on AI image recognition according to claim 3, characterized in that: The specific steps of step S2 are as follows: perform operations such as cropping, rotating, scaling, translating, adding noise, etc. on the initial sample data set, and adjust the contrast, brightness, and saturation. Merge the processed data with the unprocessed data, expand the original data set, generate the target detection data set, and create a real box annotation file.

5. The citrus fruit recognition method based on AI image recognition according to claim 3, characterized in that: The specific steps of step S4 are as follows: S4.

1. Embedding the backbone network of YOLOv7 into the self-attention mechanism allows the model to dynamically learn the dependencies between different positions based on different parts of the input, thereby improving its ability to grasp global information. S4.

2. Add the ASPP module to the YOLOv7 network to increase the receptive field and improve the ability to extract multi-scale information.

6. The citrus fruit recognition method based on AI image recognition according to claim 3, characterized in that: The specific steps of step S5 are as follows: S5.

1. Load the annotation file of the real box of the target detection sample data set, calculate the intersection-and-union ratio of the real box and the prior box, and obtain the size of the prior box by performing K-means clustering on the intersection-and-union ratio; S5.

2. Input the size of the prior box and other hyperparameters into the model; S5.

3. Use the training set to train the model until convergence, and obtain the trained model weight file.