Pear fruit maturity intelligent detection method
Through image recognition technology and deep learning models, the problem of low maturity detection accuracy and difficulty in large-scale detection of Korla fragrant pear has been solved, high-precision maturity detection and optimal picking time determination have been achieved, and post-processing and transportation costs have been reduced.
Patent Information
- Application Number
- CN202410835005.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-10
AI Technical Summary
The existing technology has problems in the maturity detection of Korla fragrant pear, such as low measurement accuracy and difficulty in large-scale detection. In particular, the short penetration distance of near-infrared spectroscopy cannot test the overall maturity.
Image recognition technology is used to collect pear fruit image data, construct a data set, perform data preprocessing and model training, and use the network model and LSTM network based on the YOLOv8 model to detect and predict pear fruit maturity, combining the spatial attention mechanism and Histogram equalization method to achieve semi-automatic detection.
It has achieved high-precision semi-automatic detection, which is suitable for large-scale detection. It can determine the best picking time, ensure the quality and yield of pears, and reduce storage and transportation costs.
Smart Images

Figure CN118628828A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of pear quality detection, and in particular relates to an intelligent detection method for pear fruit maturity. Background Art
[0002] Korla pear has a strong fragrance, delicate texture, sweet and juicy taste, and is rich in a variety of minerals, vitamins, amino acids and other trace nutrients. Its nutritional and health value is recognized by more and more people, and the market demand for the quality of Korla pear is also increasing. However, the development of Korla pear industry in my country currently faces problems such as low product quality and low industrialization level.
[0003] The maturity determination of Korla pear can help overcome the above problems, provide cultivation guidance and comprehensive monitoring, reduce the risk and losses of fruit farmers. At present, the main fruit maturity detection instruments at home and abroad are: near-infrared spectroscopy, which determines the characteristic wavelength of the fruit through experimental methods, and then performs absorption spectrum analysis at this characteristic wavelength to determine its sugar content, titratable acid content and other maturity indicators. However, due to the short penetration distance of near-infrared light, the overall maturity cannot be tested, the measurement accuracy is limited, and it is not easy to detect on a large scale. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes an intelligent detection method for the maturity of pear fruits to solve the problems existing in the above prior art.
[0005] To achieve the above object, the present invention provides a method for intelligently detecting the maturity of pear fruit, comprising the following steps:
[0006] Collecting pear fruit image data, constructing a pear fruit image dataset, and dividing the pear fruit image dataset to obtain a training set and a validation set;
[0007] Performing data preprocessing on the images in the training set to obtain an optimized training set;
[0008] Constructing an initial maturity detection model, training and verifying the initial maturity detection model through the optimized training set and verification set to obtain a maturity detection model;
[0009] The pear fruit is tested through the maturity detection model to determine the maturity of the pear fruit.
[0010] Preferably, the method for performing data preprocessing on the images in the training set includes: performing clearing processing on the images in the training set by a blind deconvolution method to obtain a cleared image, and then performing color correction on the cleared image by a histogram equalization method.
[0011] Preferably, the method for the sharpening process comprises: obtaining an initial blur kernel by estimating images in a training set through variational Bayesian estimation;
[0012] Iteratively optimizing the initial blur kernel by using a Richardson-Lucy algorithm to obtain a blur kernel;
[0013] Based on the blur kernel and the non-blind deconvolution method, the images in the training set are sharpened to obtain sharpened images.
[0014] Preferably, the initial maturity detection model is a network model based on the YOLOv8 model, and a spatial attention mechanism is inserted between the C2f module and the Conv module of the YOLOv8 model backbone network.
[0015] Preferably, the processing flow of the spatial attention mechanism includes:
[0016] Perform maximum pooling and mean pooling operations on the output of the C2f module to obtain the first pooling feature and the second pooling feature;
[0017] The first pooling feature and the second pooling feature are concatenated and then convolved to obtain a fused pooling feature;
[0018] The fused pooling features are activated by a Sigmoid function to obtain a third pooling feature, which is used as an output feature.
[0019] Preferably, the expression of the Sigmoid activation function is:
[0020]
[0021] In the formula, σ represents the Sigmoid activation function, and z represents the output of the node in the previous layer of the neural network.
[0022] Preferably, the detection method further comprises predicting the maturity of pear fruit based on an LSTM network, and the prediction method comprises:
[0023] The input unit receives the historical pear fruit growth data, natural environment characteristic indicators and the specified prediction time period, and transmits the processed data to the input layer of the LSTM network;
[0024] Import the data received by the input layer of the LSTM network into the LSTM network layer, and perform training and modeling to obtain the LSTM prediction model;
[0025] The LSTM prediction model is tested by using existing data, and the cumulative error is calculated. If the cumulative error is within the allowable range, the LSTM prediction model is retained;
[0026] The LSTM prediction model is used to predict the maturity of pear fruits in a specified time period to obtain a prediction result of the maturity of pear fruits;
[0027] The prediction results of pear fruit maturity at the specified time are output through the output unit.
[0028] Preferably, the memory unit of the LSTM network includes three control gates, which are an input gate, an output gate and a forget gate. The forget gate controls the LSTM network layer to forget information, the input gate controls the information update of the LSTM network layer, and the output gate controls the output of information.
[0029] Compared with the prior art, the present invention has the following advantages and technical effects:
[0030] The present invention provides an intelligent detection method for the maturity of pear fruit, comprising the following steps: collecting pear fruit image data, constructing a pear fruit image data set, and dividing the pear fruit image data set to obtain a training set and a verification set; performing data preprocessing on the images in the training set to obtain an optimized training set; constructing an initial maturity detection model, training and verifying the initial maturity detection model by optimizing the training set and the verification set to obtain a maturity detection model; detecting pear fruit by the maturity detection model to determine the maturity of the pear fruit. The present invention can realize semi-automatic detection through image recognition technology, is simple to operate, and is suitable for large-scale detection. Moreover, by monitoring the maturity of pear fruit, the optimal picking time can be determined to ensure the quality and yield of pears. Pears picked at the right time do not require too much post-processing, thereby reducing storage and transportation costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0032] Figure 1 This is a flow chart of the intelligent detection method for pear fruit maturity according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0034] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0035] Embodiment 1
[0036] like Figure 1 As shown, this embodiment provides a method for intelligent detection of pear fruit maturity, comprising the following steps:
[0037] Collecting pear fruit image data, constructing a pear fruit image dataset, and dividing the pear fruit image dataset to obtain a training set and a validation set;
[0038] Performing data preprocessing on the images in the training set to obtain an optimized training set;
[0039] Constructing an initial maturity detection model, training and verifying the initial maturity detection model through the optimized training set and verification set to obtain a maturity detection model;
[0040] The pear fruit is tested through the maturity detection model to determine the maturity of the pear fruit.
[0041] Furthermore, when collecting pear fruit image data, this embodiment uses a drone to perform multi-angle shooting, which can effectively improve the detection accuracy. A total of 510 original images of crisp pears are collected by the drone, and the collected images are uniformly adjusted to JPG format through an image format conversion algorithm.
[0042] The images were manually annotated by experts in the field of crisp pear maturity using LabelImg to manually annotate the bounding box loss and category of all pear fruit samples in the dataset. During the annotation, all samples were divided into three categories, namely "immature" samples, "initial maturity" samples, and "picking maturity" samples. The generated annotation files were saved in Pascal VOC data format and double-checked by farmers in the pear planting base to ensure the quality of the annotations. After obtaining the label file, the dataset was divided into a training set and a validation set in a ratio of 8:2.
[0043] The training set is expanded by randomly selecting 15% of the images to change the image brightness: randomly selecting 15% of the images in the range of [0.8:1.2] to change the image brightness and generate a new image. Image random rotation: randomly rotate the original image to [-30°:+30°] and generate a new image. Image flipping: randomly select 15% of the images and flip them once in the horizontal direction to generate a new image. The three newly generated images are added to the original training set to form a new training set. By expanding the training set samples, the training set can be expanded while collecting an appropriate amount of samples to make the training effect more accurate.
[0044] Furthermore, the method for performing data preprocessing on the images in the new training set includes: performing clearing processing on the images in the training set by a blind deconvolution method to obtain a cleared image, and then performing color correction on the cleared image by a histogram equalization method.
[0045] The method of sharpening includes: obtaining an initial blur kernel by estimating images in a training set through variational Bayesian estimation;
[0046] Iteratively optimizing the initial blur kernel by using a Richardson-Lucy algorithm to obtain a blur kernel;
[0047] Based on the blur kernel and the non-blind deconvolution method, the images in the training set are sharpened to obtain sharpened images.
[0048] The above processing can effectively solve the problem of unclear images caused by jitter when taking images by drones, and after color correction, it is more conducive to subsequent training and makes the obtained model more accurate.
[0049] Furthermore, the initial maturity detection model is a network model based on the YOLOv8 model, and a spatial attention mechanism is inserted between the C2f module and the Conv module of the YOLOv8 model backbone network.
[0050] The processing flow of the spatial attention mechanism includes:
[0051] Perform maximum pooling and mean pooling operations on the output of the C2f module to obtain the first pooling feature and the second pooling feature;
[0052] The first pooling feature and the second pooling feature are concatenated and then convolved to obtain a fused pooling feature;
[0053] The fused pooling features are activated by a Sigmoid function to obtain a third pooling feature, which is used as an output feature.
[0054] Furthermore, the expression of the Sigmoid activation function is:
[0055]
[0056] In the formula, σ represents the Sigmoid activation function, and z represents the output of the node in the previous layer of the neural network.
[0057] Furthermore, the detection method also includes predicting the maturity of pear fruit based on the LSTM network, and the prediction method includes:
[0058] The input unit receives historical pear fruit growth data, natural environment characteristic indicators and specified prediction time period, and passes the processed data to the input layer of the LSTM network; the natural environment characteristic indicators include climate conditions, geographical location and weather factors.
[0059] Import the data received by the input layer of the LSTM network into the LSTM network layer, and perform training and modeling to obtain the LSTM prediction model;
[0060] The LSTM prediction model is tested by using existing data, and the cumulative error is calculated. If the cumulative error is within the allowable range, the LSTM prediction model is retained;
[0061] The LSTM prediction model is used to predict the maturity of pear fruits in a specified time period to obtain a prediction result of the maturity of pear fruits;
[0062] The prediction results of pear fruit maturity at the specified time are output through the output unit.
[0063] The specific method for testing the LSTM prediction model with existing data is:
[0064] Set the number of training times, maximum error and iterative weight adjustment ratio of the system. In this example, the number of training times is set to 3000 times, and the maximum allowable error is ∑M=1e -6 , each time the weight adjustment ratio is γ=0.01.
[0065] After the training is completed, the pear fruit maturity results are analyzed and judged according to the existing data. If the predicted data is within the error range, the LSTM model is retained, otherwise it is modified iteratively. In this example, the weight_preh_h function is used to update the weight coefficient.
[0066] The error assessment of the prediction results is calculated using the cumulative error formula, namely:
[0067]
[0068] In this example, the number of training times is set to 3000. When the training stops, That is, the LSTM network model meets the requirements.
[0069] Furthermore, the memory unit of the LSTM network includes three control gates, which are an input gate, an output gate and a forget gate. The forget gate controls the LSTM network layer to forget information, the input gate controls the information update of the LSTM network layer, and the output gate controls the output of information.
[0070] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for intelligently detecting the maturity of pear fruit, characterized in that: The following steps are involved: Collecting pear fruit image data, constructing a pear fruit image dataset, and dividing the pear fruit image dataset to obtain a training set and a validation set; Performing data preprocessing on the images in the training set to obtain an optimized training set; Constructing an initial maturity detection model, training and verifying the initial maturity detection model through the optimized training set and verification set to obtain a maturity detection model; The pear fruit is tested through the maturity detection model to determine the maturity of the pear fruit.
2. The intelligent detection method for pear fruit maturity according to claim 1, characterized in that: The method for performing data preprocessing on the images in the training set includes: performing clearing processing on the images in the training set by a blind deconvolution method to obtain a cleared image, and then performing color correction on the cleared image by a histogram equalization method.
3. The intelligent detection method for pear fruit maturity according to claim 2, characterized in that: The method for the clarity processing comprises: obtaining an initial blur kernel by estimating images in a training set through variational Bayesian estimation; Iteratively optimizing the initial blur kernel by using a Richardson-Lucy algorithm to obtain a blur kernel; Based on the blur kernel and the non-blind deconvolution method, the images in the training set are sharpened to obtain sharpened images.
4. The intelligent detection method for pear fruit maturity according to claim 1, characterized in that: The initial maturity detection model is a network model based on the YOLOv8 model, and a spatial attention mechanism is inserted between the C2f module and the Conv module of the YOLOv8 model backbone network.
5. The intelligent detection method for pear fruit maturity according to claim 4, characterized in that: The processing flow of the spatial attention mechanism includes: Perform maximum pooling and mean pooling operations on the output of the C2f module to obtain the first pooling feature and the second pooling feature; The first pooling feature and the second pooling feature are concatenated and then convolved to obtain a fused pooling feature; The fused pooling features are activated by a Sigmoid function to obtain a third pooling feature, which is used as an output feature.
6. The intelligent detection method for pear fruit maturity according to claim 5, characterized in that: The expression of the Sigmoid activation function is: In the formula, σ represents the Sigmoid activation function, and z represents the output of the node in the previous layer of the neural network.
7. The intelligent detection method for pear fruit maturity according to claim 1, characterized in that: The detection method also includes predicting the maturity of pear fruit based on the LSTM network, and the prediction method includes: The input unit receives the historical pear fruit growth data, natural environment characteristic indicators and the specified prediction time period, and transmits the processed data to the input layer of the LSTM network; Import the data received by the input layer of the LSTM network into the LSTM network layer, and perform training and modeling to obtain the LSTM prediction model; The LSTM prediction model is tested by using existing data, and the cumulative error is calculated. If the cumulative error is within the allowable range, the LSTM prediction model is retained; The LSTM prediction model is used to predict the maturity of pear fruits in a specified time period to obtain a prediction result of the maturity of pear fruits; The prediction results of pear fruit maturity at the specified time are output through the output unit.
8. The intelligent detection method for pear fruit maturity according to claim 1, characterized in that: The memory unit of the LSTM network includes three control gates, which are an input gate, an output gate and a forget gate. The forget gate controls the LSTM network layer to forget information, the input gate controls the information update of the LSTM network layer, and the output gate controls the output of information.
Citation Information
Patent Citations
Blind deblurring algorithm based on natural image statistic property
CN102708550A
Motion blur removing method based on variational bayes estimation
CN108681995A
Tomato picking device based on shelf life prediction and maturity discrimination and use method thereof
CN113989594A
Training and using method of litchi maturity identification model
CN115100533A
Fruit maturity detection method and system
CN115359480A
