Fruit maturity lossless classification method and system based on deep learning technology

Through deep learning technology and neural network models, combined with the appearance and chemical characteristics of fruits, non-destructive fruit maturity classification is achieved, solving the problems of low efficiency, high cost and low accuracy in the existing technology, and providing an efficient and accurate A method for rating fruit ripeness.

CN118865340AActive Publication Date: 2024-10-29HUAZHONG AGRI UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410901363.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-29
Estimated Expiration
2044-07-05

AI Technical Summary

Technical Problem

Existing fruit maturity classification methods are inefficient, costly and inaccurate. Manual judgment relies on experience and is prone to misjudgment. Chemical detection causes damage to the fruit, making it difficult to quickly respond to large-scale picking needs.

Method used

A non-destructive classification method for fruit maturity based on deep learning technology is adopted. By taking fruit images, collecting dry matter content and sugar content data, the Calinski–Harabasz score and Kmeans clustering algorithm are used to divide the maturity stages, and a neural network model based on MobileNetV3 is established for training. and prediction, enabling lossless maturity classification.

Benefits of technology

It achieves fast, low-cost, and accurate fruit maturity classification, improves classification accuracy and efficiency, reduces damage to fruits, and meets the fruit industry's demand for accurate and rapid maturity prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865340A_ABST
    Figure CN118865340A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of image recognition, and discloses a fruit maturity lossless classification method and system based on a deep learning technology, and the method comprises the steps: analyzing the dry matter content (%) and sugar degree of a fruit in different growth processes, dividing each maturity stage of the fruit through a clustering analysis algorithm, and obtaining a typical sample; by taking a typical sample as a reference, the maturity category of the fruit is automatically and accurately judged by using a deep learning technology, so that the method is suitable for a large-scale and efficient fruit maturity prediction scene. The method comprises the following steps: adjusting the size of an original image into a 224 * 314 complete fruit image through a bilinear interpolation algorithm, and taking the complete fruit image as model input; and dividing the appearance image set with the label into a training set and a test set, training, verifying and testing the constructed fruit maturity lossless classification model, and outputting a corresponding fruit maturity result by adopting the trained model and taking the size-adjusted image of the to-be-classified fruit as the input of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to, but is not limited to, the field of image recognition technology, and particularly relates to a non-destructive classification method and system for fruit maturity based on deep learning technology. Background Technology

[0002] During the growth process, the skin characteristics and size of fruits change, and different external features correspond to different growth stages, or maturity categories. Therefore, selecting the appropriate maturity category for harvesting fruits is of great importance.

[0003] Currently, there are two main methods for classifying fruit maturity: 1. Human judgment based on experience: This involves determining the current maturity level based on previous years' growth, but there is no unified standard for classifying maturity levels; 2. Chemical testing: This involves extracting juice from the fruit and conducting chemical analysis to determine the fruit's maturity by analyzing the content of substances in the juice. Both methods have drawbacks. On the one hand, manual judgment is costly, inefficient, and highly subjective, making it prone to misjudgment. On the other hand, chemical testing is time-consuming and can damage the fruit.

[0004] During fruit growth, the characteristics of its skin and the size of the fruit change significantly. Different external characteristics correspond to different growth stages, i.e., different maturity categories. Choosing the appropriate maturity category for harvesting fruit is of great importance. However, currently, the classification of fruit maturity mainly relies on two methods: one is human experience-based judgment, which determines the current maturity level based on previous years' growth conditions, but there is no unified standard for classifying maturity levels; the other is chemical testing, which involves extracting juice from the fruit and conducting chemical analysis to determine the fruit's maturity by analyzing the content of substances in the juice.

[0005] Both of the above-mentioned methods have their drawbacks. On the one hand, manual judgment is costly, inefficient, and highly subjective, making it prone to misjudgment. On the other hand, chemical testing has a long cycle and can damage the fruit. Therefore, existing methods for classifying fruit maturity have obvious limitations and shortcomings.

[0006] Based on the above analysis, the existing technology has the following problems and defects:

[0007] 1. Inefficiency: Both manual identification and chemical testing take a long time, making it difficult to respond quickly to large-scale harvesting needs.

[0008] 2. High cost: Manual judgment requires a lot of human resources, while chemical testing requires specialized equipment and consumables, resulting in high costs.

[0009] 3. Low accuracy: Manual judgment relies on experience and is highly subjective, which can easily lead to misjudgment; although chemical detection is accurate, its destructive effect on fruit affects the actual application of the detection.

[0010] In summary, existing technologies for fruit maturity identification are inefficient, costly, and inaccurate. There is an urgent need for a new method to overcome these problems and achieve rapid, low-cost, and accurate fruit maturity classification. Summary of the Invention

[0011] To address the problems existing in the prior art, this invention provides a non-destructive classification method for fruit maturity based on deep learning technology.

[0012] This invention is implemented as follows: A non-destructive fruit ripeness classification method based on deep learning technology includes:

[0013] S1, capture images of the fruit and collect data on the dry matter content and sugar content of the fruit;

[0014] S2, integrate the dry matter content and sugar content information of the fruit, use the Calinski-Harabasz score as the evaluation standard, use the Kmeans clustering algorithm to obtain the various maturity stages and typical examples of the fruit, and label the previously photographed fruit images.

[0015] S3, preprocess the fruit images with labels;

[0016] S4. The labeled feature images are divided into two parts: a training set and a test set, with the ratio of the number of images in the two parts being 7:3.

[0017] S5. Establish a non-destructive classification model for fruit maturity based on neural networks. Train and test the non-destructive classification model for fruit maturity using training and test sets to obtain a well-trained non-destructive classification model for fruit maturity.

[0018] S6. Collect images of the fruit appearance to be classified, preprocess the fruit appearance images, and extract the features of the preprocessed images; input the feature images into the trained fruit maturity non-destructive classification model to obtain the maturity of the fruit to be classified.

[0019] Furthermore, the clustering algorithm derives the various maturity stages of the fruit, specifically including:

[0020] The CH score was used as an indicator to evaluate the quality of the clustering results. The K value corresponding to the highest score was selected as the final number of clusters for the maturity of kiwifruit. When the K value was 6, that is, when the K-means algorithm clustered the sample data into 6 clusters, the CH score reached the maximum value of 1231.80, and the clustering effect was the best. Therefore, the maturity of kiwifruit during the growth process was divided into six levels, from immature to mature, which were divided into stages one to six, with stage six being the mature stage.

[0021] Furthermore, the preprocessing of the labeled images specifically includes:

[0022] For the collected fruit images, the image size is converted. The original image is first manually cropped to a certain size, and then converted to a different size using bilinear interpolation. Then, the data volume is increased by methods such as rotation, cropping, and Gaussian blur. Finally, image segmentation technology is used to separate the fruit from the image.

[0023] Furthermore, the lossless classification model for fruit maturity based on neural networks is constructed using a convolutional neural network model based on MobileNetV3.

[0024] Furthermore, the fruit maturity non-destructive classification model is trained and optimized using the following steps:

[0025] First, the model is trained using fruit feature images from the training set. During each training round, the model’s loss value on the test set is closely monitored to evaluate whether the model has successfully learned the appearance features of the fruit.

[0026] Cross-validate the original dataset and select the best-performing model parameters, which represent the model's optimal learning state.

[0027] The selected best model is applied to the test set for final prediction; if the model still does not perform well on the test set, the initial parameters or learning rate of the model will be readjusted, and the training process will be restarted.

[0028] Another objective of this invention is to provide a non-destructive fruit ripeness classification system based on deep learning technology, comprising:

[0029] The data acquisition module is used to capture fruit images and collect data on the dry matter content and sugar content of the fruit.

[0030] The integration module is used to integrate the dry matter content and sugar content information of the fruit. The Calinski-Harabasz score is used as the evaluation standard. The K-means clustering algorithm is used to obtain the various maturity stages and typical examples of the fruit, and labels are affixed to the previously photographed fruit images.

[0031] The preprocessing module is used to preprocess fruit images with labels;

[0032] The partitioning module is used to divide the labeled feature images into two parts: a training set and a test set, with the ratio of the number of images in the two parts being 7:3.

[0033] The classification model building module is used to build a non-destructive classification model of fruit maturity based on neural networks. The non-destructive classification model of fruit maturity is trained and tested with training set and test set to obtain a trained non-destructive classification model of fruit maturity.

[0034] The maturity acquisition module is used to collect images of the fruit appearance to be classified, preprocess the fruit appearance images, and extract the features of the preprocessed images; the feature images are then input into the trained fruit maturity non-destructive classification model to obtain the maturity of the fruit to be classified.

[0035] Another object of the present invention is to provide a computer device including a memory and a processor, the memory storing a computer program, which, when executed by the processor, causes the processor to perform the steps of the fruit ripeness non-destructive classification method based on deep learning technology.

[0036] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the fruit ripeness non-destructive classification method based on deep learning technology.

[0037] Another objective of this invention is to provide an information data processing terminal for implementing the fruit maturity non-destructive classification system based on deep learning technology.

[0038] Based on the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solution to be protected by this invention are as follows:

[0039] First, traditional machine vision maturity grading techniques have problems. With the deepening of machine learning research, some researchers have used computer vision methods to predict fruit maturity in recent years. However, the fruit maturity categories are manually set before model training, which brings many problems. On the one hand, manually designing the appearance features of fruits requires extensive relevant knowledge, making it extremely difficult to accurately characterize the differences between fruits at different maturity levels. On the other hand, manual labeling is highly subjective, and the standards for distinguishing between different fruit maturity levels vary, resulting in low efficiency and low accuracy of the entire process.

[0040] This invention extracts the dry matter content and sugar content of fruits and uses the K-means clustering algorithm to classify fruits into various maturity categories. The whole process is highly efficient and non-subjective, and can provide a good data source for subsequent model training.

[0041] The present invention provides a lossless fruit maturity classification method based on deep learning. For each fruit, an appearance image is collected and its size is adjusted to a complete fruit image of 224×314 using a bilinear interpolation algorithm as the model input. The labeled appearance image set is divided into a training set and a test set to train, validate, and test the constructed lossless fruit maturity classification model. The trained model is then used with the resized image of the fruit to be classified as the model input to output the corresponding fruit maturity result.

[0042] Furthermore, this invention compares the performance of fruit maturity classification methods based on ResNet50 model, MobileNetV3Large model, MobileNetV3Small model and different machine learning algorithms with different loss functions. The experimental results show that the MobileNetV3Small model with focus loss performs excellently in the test process, with a classification Macro-F1 value of 0.9842 and a significant improvement in average response speed.

[0043] This invention primarily utilizes a deep neural network derived from an improved MobileNetV3Small model to learn the appearance features of fruits and determine their ripeness. It offers an efficient, accurate, and objective classification method, overcoming the limitations and crudeness of traditional fruit grading methods, which result in low accuracy and reliability of the graded fruits. This provides a highly accurate, portable, and cost-effective method for the non-destructive classification of fruit ripeness using deep learning.

[0044] This deep learning-based non-destructive fruit maturity classification method combines fruit image features with fruit chemical features, resulting in more accurate and comprehensive fruit maturity classification. The following lists the significant technological advancements achieved at different stages:

[0045] 1) S1 and S2: In these two steps, images of the harvested fruit are first taken, and then the intrinsic characteristic variables of the fruit, sugar content and dry matter content, are collected to avoid the influence of extracting the intrinsic characteristics of the fruit on the images. Finally, based on sugar content and dry matter content, the K-means algorithm is used for clustering to obtain the various stages of fruit growth, and the training set data is labeled, reducing the subjectivity of the training set labels.

[0046] 2) S3: This step reduces the influence of other factors on the model through image preprocessing, ensuring that the trained model focuses on the key features of fruit ripeness and improves the accuracy of classification.

[0047] 4) S4: The training set and test set are divided in a 7:3 ratio to ensure the training effect of the model and provide a guarantee for the generalization of the model.

[0048] 5) S5: A lightweight neural network for classifying fruit maturity was constructed. While ensuring high model accuracy, the entire training framework was simplified and the response speed was effectively improved.

[0049] 6) S6: This step enables real-time, non-destructive ripeness prediction of new fruits. Based on the trained model, it outputs the ripeness category of the fruit to be tested, meeting the fruit industry's need for accurate and rapid fruit ripeness prediction and classification.

[0050] Second, the deep learning-based non-destructive fruit maturity rating method provided by this invention first performs chemical analysis on the fruit. Based on the dry matter content and sugar content dataset of the fruit, the K-means clustering algorithm is used to obtain the various maturity stages and typical examples of the fruit. Then, the appearance images of the fruit are collected. The images are converted to a size of 224×314 using bilinear interpolation. The labeled images are divided into training and test sets to train the constructed non-destructive fruit maturity prediction model. Finally, the images of the fruit to be rated are resized and input into the trained model to output the corresponding fruit maturity results.

[0051] In this invention, a control experiment was set up to compare the performance of the ResNet50 model, the MobileNetV3 model, and traditional machine learning methods in kiwifruit maturity classification. The results showed that the MobileNetV3 model significantly improved the accuracy of maturity prediction compared to machine learning methods.

[0052] This invention primarily utilizes a deep separable neural network built with the MobileNetV3 model to learn from fruit feature images to predict fruit maturity categories. This method offers high accuracy and fast response, achieving a scientific and objective classification of fruit maturity. It helps users apply different planting methods based on fruit maturity, thus increasing yield and economic benefits. Furthermore, this method overcomes the shortcomings of traditional classification methods, such as low accuracy, high prediction costs, and strong subjectivity. Based on corresponding fruit grading standards, it uses comprehensive information for automated fruit maturity prediction. This not only reduces manpower requirements and fruit maturity classification costs but also improves the accuracy and confidence of fruit maturity grading, effectively increasing fruit yield and economic benefits.

[0053] Third, the expected benefits and commercial value of the technical solution of this invention after transformation are as follows:

[0054] This invention utilizes a highly efficient and accurate automatic kiwifruit maturity classification technology to precisely control the maturity of kiwifruit and optimize its growth conditions, thereby improving fruit quality and yield. This not only meets domestic market demand but also enhances international market competitiveness and increases export volume.

[0055] With the intensification of global climate change, agricultural production faces numerous challenges. This technical solution can adjust the growing environment according to the ripeness of kiwifruit, improving its adaptability to climate change and reducing the impact of natural disasters on production. Currently, judging the ripeness of kiwifruit mainly relies on human experience, which is costly and inefficient. The automation technology of this invention can reduce reliance on human judgment, thereby reducing overall production costs.

[0056] Therefore, after the technical solution of this invention is commercialized, it is expected to bring significant economic benefits and market value, which is of great significance to promoting the development of my country's kiwifruit industry and even the entire agricultural industry.

[0057] Fourth, this invention provides a lossless fruit maturity classification method based on deep learning technology. First, in step S1, fruit images are captured and data on dry matter content and sugar content are collected as basic data. Then, in step S2, this data is integrated, and the different maturity stages of the fruit are classified using the Calinski-Harabasz (CH) score as the evaluation criterion, and the K-means clustering algorithm is applied. Corresponding labels are then assigned to the captured fruit images.

[0058] Next, in step S3, the labeled fruit images are preprocessed for subsequent model training. Then, in step S4, the labeled feature images are divided into training and testing sets in a 7:3 ratio for model building and validation. In step S5, a lossless classification model for fruit maturity is built based on a neural network. The model is trained and tested using the training and testing sets, ultimately obtaining the trained classification model.

[0059] Finally, in step S6, images of the fruits to be classified are collected and preprocessed to extract image features. These feature images are then input into a trained non-destructive fruit maturity classification model to obtain the maturity level of the fruits to be classified. This method solves the problem of inaccurate fruit maturity classification in existing technologies, achieves non-destructive classification of fruit maturity, and significantly improves the classification effect.

[0060] The technical solution of this invention utilizes the advantages of deep learning and clustering algorithms, and achieves accurate fruit maturity classification by comprehensively considering the physical and chemical characteristics of the fruit, which has great application prospects. Attached Figure Description

[0061] Figure 1 This is a flowchart of a non-destructive fruit maturity classification method based on deep learning technology provided in an embodiment of the present invention.

[0062] Figure 2 This is a structural block diagram of a fruit maturity non-destructive classification system based on deep learning technology provided in an embodiment of the present invention.

[0063] Figure 3 This is a schematic diagram of the fruit image capturing device provided in an embodiment of the present invention.

[0064] Figure 4 This is a schematic diagram of the fruit's appearance provided in an embodiment of the present invention.

[0065] Figure 5 This is a schematic diagram of the CH scores of different clusters using different clustering algorithms provided in the embodiments of the present invention.

[0066] Figure 6 These are typical examples of kiwifruit with six different maturity levels provided in the embodiments of the present invention. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0068] The following are two specific examples illustrating the application of the aforementioned lossless fruit maturity classification method based on deep learning technology:

[0069] Example 1: Apple Ripeness Classification

[0070] Step S1: Take images of apples at different stages of ripeness, including unripe, semi-ripe, ripe, and overripe. Collect corresponding apple dry matter content and sugar content datasets, and obtain them through laboratory analysis.

[0071] Step S2: Integrate dry matter content and sugar content information, use the K-means clustering algorithm, and divide apples into different ripeness stages based on CH score.

[0072] Label typical examples for each stage as "unripe", "semi-ripe", "mature", and "overripe".

[0073] Step S3: Preprocess the tagged apple images, including resizing, color correction, and noise reduction.

[0074] Step S4: Divide the preprocessed images into a training set and a test set in a ratio of 7:3.

[0075] Step S5: Establish a lossless classification model for apple ripeness based on convolutional neural networks (CNN).

[0076] The model is trained and tested using training and testing sets to obtain a well-trained model.

[0077] Step S6: Collect images of the apples to be classified, preprocess them, and extract features. Input the feature images into the trained model to obtain the maturity level of the apples to be classified.

[0078] Example 2: Banana Maturity Classification

[0079] Step S1: Take images of bananas at different stages of ripeness, including unripe, semi-ripe, ripe, and overripe. Collect the corresponding banana dry matter content and sugar content datasets.

[0080] Step S2: Using the K-means clustering algorithm, integrate dry matter content and sugar content information, and use the CH score as the evaluation criterion to classify bananas into different ripeness stages. Label typical examples for each stage.

[0081] Step S3: Preprocess the banana image with labels, including color space conversion, resizing, and contrast enhancement.

[0082] Step S4: Divide the preprocessed images into a training set and a test set in a ratio of 7:3.

[0083] Step S5: Establish a lossless banana maturity classification model based on a deep neural network (DNN). Train and test the model using the training and test sets to obtain a trained model.

[0084] Step S6: Collect images of the bananas to be classified, preprocess them, and extract features. Input the feature images into the trained model to obtain the maturity level of the bananas to be classified.

[0085] These two examples demonstrate how the above method can be applied to different types of fruit to achieve non-destructive classification of fruit maturity using deep learning technology.

[0086] like Figure 1 As shown in the figure, the non-destructive fruit maturity classification method based on deep learning technology provided by this invention includes the following steps:

[0087] S1, capture images of the fruit and collect data on the dry matter content and sugar content of the fruit;

[0088] S2 integrates the dry matter content and sugar content information of the fruit, using the Calinski-Harabasz (CH) score as the evaluation criterion. The CH score measures the compactness within a cluster by calculating the sum of squared distances between each point in the cluster and the cluster center, and measures the separation of the dataset by calculating the sum of squared distances between each cluster centroid and the centroids of the entire dataset. It is an effective indicator for evaluating clustering performance. The K-means clustering algorithm is used to obtain the various maturity stages of the fruit and typical examples, and labels are then added to the previously photographed fruit images.

[0089] S3, preprocess the fruit images with labels;

[0090] S4. The labeled feature images are divided into two parts: a training set and a test set, with the ratio of the number of images in the two parts being 7:3.

[0091] S5. Establish a non-destructive classification model for fruit maturity based on neural networks. Train and test the non-destructive classification model for fruit maturity using training and test sets to obtain a well-trained non-destructive classification model for fruit maturity.

[0092] S6. Collect images of the fruit appearance to be classified, preprocess the fruit appearance images, and extract the features of the preprocessed images; input the feature images into the trained fruit maturity non-destructive classification model to obtain the maturity of the fruit to be classified.

[0093] The clustering algorithm provided in this embodiment of the invention derives the various maturity stages of the fruit, specifically including:

[0094] The CH score was used as an indicator to evaluate the quality of the clustering results. The K value corresponding to the highest score was selected as the final number of clusters for the maturity of kiwifruit. When the K value was 6, that is, when the K-means algorithm clustered the sample data into 6 clusters, the CH score reached the maximum value of 1231.80, and the clustering effect was the best. Therefore, the maturity of kiwifruit during the growth process was divided into six levels, from immature to mature, which were divided into stages one to six, with stage six being the mature stage.

[0095] The preprocessing of tagged images provided in this embodiment of the invention specifically includes:

[0096] For the collected fruit images, the image size is converted. The original image is first manually cropped to a certain size, and then converted to a different size using bilinear interpolation. Then, the data volume is increased by methods such as rotation, cropping, and Gaussian blur. Finally, image segmentation technology is used to separate the fruit from the image.

[0097] The lossless fruit maturity classification model based on neural networks provided in this embodiment of the invention is built using a convolutional neural network model based on MobileNetV3.

[0098] The fruit maturity non-destructive classification model provided in this embodiment of the invention is trained and optimized using the following steps:

[0099] First, the model is trained using fruit feature images from the training set. During each training round, the model’s loss value on the test set is closely monitored to evaluate whether the model has successfully learned the appearance features of the fruit.

[0100] Cross-validate the original dataset and select the best-performing model parameters, which represent the model's optimal learning state.

[0101] The selected best model is applied to the test set for final prediction; if the model still does not perform well on the test set, the initial parameters or learning rate of the model will be readjusted, and the training process will be restarted.

[0102] like Figure 2 As shown, an embodiment of the present invention provides a non-destructive fruit maturity classification system based on deep learning technology, comprising:

[0103] The data acquisition module is used to capture fruit images and collect data on the dry matter content and sugar content of the fruit.

[0104] The integration module is used to integrate the dry matter content and sugar content information of the fruit. The Calinski-Harabasz score is used as the evaluation standard. The K-means clustering algorithm is used to obtain the various maturity stages and typical examples of the fruit, and labels are affixed to the previously photographed fruit images.

[0105] The preprocessing module is used to preprocess fruit images with labels;

[0106] The partitioning module is used to divide the labeled feature images into two parts: a training set and a test set, with the ratio of the number of images in the two parts being 7:3.

[0107] The classification model building module is used to build a non-destructive classification model of fruit maturity based on neural networks. The non-destructive classification model of fruit maturity is trained and tested with training set and test set to obtain a trained non-destructive classification model of fruit maturity.

[0108] The maturity acquisition module is used to collect images of the fruit appearance to be classified, preprocess the fruit appearance images, and extract the features of the preprocessed images; the feature images are then input into the trained fruit maturity non-destructive classification model to obtain the maturity of the fruit to be classified.

[0109] Another object of the present invention is to provide a computer device including a memory and a processor, the memory storing a computer program, which, when executed by the processor, causes the processor to perform the steps of the fruit ripeness non-destructive classification method based on deep learning technology.

[0110] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the fruit ripeness non-destructive classification method based on deep learning technology.

[0111] Another objective of this invention is to provide an information data processing terminal for implementing the fruit maturity non-destructive classification system based on deep learning technology.

[0112] like Figure 1 The present invention illustrates a non-destructive fruit ripeness classification method based on deep learning, which specifically includes the following steps:

[0113] Step S1: Obtain fruit images and extract the dry matter content and sugar content information of the fruit.

[0114] In this step, the embodiment uses a constructed photography studio setup to capture images of the fruit. The fruit photography setup mainly includes a box, a top camera, a light strip, and a black light-absorbing cloth.

[0115] like Figure 3 As shown, the box is a square box with a circular opening at the top where the top camera is placed. When the fruit needs to be replaced, simply open the box to replace it.

[0116] In addition, LED strips were placed on the inner wall of the box to provide a light source for shooting. A black light-absorbing cloth was used to absorb the light source, creating a standard shooting environment and reducing the impact of uneven lighting inside the box on the footage. It is important to note that during fruit image shooting, the box must be closed to create a sealed darkroom environment before using the top camera for filming.

[0117] like Figure 4 As shown in the figure, this is a schematic diagram of the appearance of the kiwi fruit taken in this example.

[0118] After photographing the fruit, information on its sugar content and dry matter content was collected. The dry matter content was obtained by measuring the mass difference of the fruit slices before and after drying; while the sugar content was measured using a saccharimeter.

[0119] Step S2: Cluster the fruits based on their sugar content and dry matter content to obtain fruit maturity labels.

[0120] In clustering algorithms, the Calinski-Harabasz score is used as an indicator to evaluate the quality of clustering results. The Calinski-Harabasz score (CH score) considers both the cohesion within a single cluster and the distance between different clusters when evaluating the clustering analysis results. The distance calculation formula is as follows:

[0121]

[0122] This invention selected three methods—K-means, hierarchical clustering, and GMM clustering—to cluster the dry matter content and sugar content of kiwifruit and compared the results. The number of clusters ranged from 2 to 8, and the cluster scores are as follows: Figure 5 As shown in the image. The results show that when there are 6 clusters and the clustering algorithm is K-means, the CH score reaches 1231.80, indicating the best clustering effect. The clustering is divided into stages one through six, from immature to mature, with stage six representing the mature stage. Typical example images of the six maturity levels of kiwifruit are shown below. Figure 6 As shown.

[0123] like Figure 6 The image shown is a schematic diagram of the appearance of six different types of ripe fruits, captured by photographs of examples from this invention.

[0124] Step S3: Preprocess the fruit images with labels.

[0125] In an example of the present invention, the image of the kiwi fruit taken is 3024×4032 pixels. In order to reduce computing resources and time consumption, the image is resized before image processing. The original 3024×4032 image is first manually cropped to a 2000×2800 image, and then converted to a 224×314 image using bilinear interpolation.

[0126] To enable the model to focus more on the feature information of the fruit images, data augmentation techniques such as Gaussian blur, image rotation and inversion, and Gaussian noise were used to augment the kiwi fruit image data before the images were fed into the model for training. Subsequently, morphological processing was performed on the images to segment the kiwi fruit and its stem from the image background.

[0127] Step S4: Divide the fruit appearance images with maturity labels into two parts: a training set and a test set, with a segmentation ratio of 7:3.

[0128] It is important to note in this step that the instance partitioning in this invention is randomized, but this is not a limitation, and other relevant personnel can use other partitioning ratios. Furthermore, when partitioning the feature image dataset, a validation set was not created; instead, a 3-fold cross-validation method was used to validate the model.

[0129] Three-fold cross-validation is a method for evaluating the performance of machine learning models. It divides the dataset into three equal parts, or "folds." In three-fold cross-validation, the model training and validation process is repeated three times, each time using a different fold as the validation set, while the other two folds are used as the training set. The advantage of three-fold cross-validation is that every data point is used for both training and validation, which helps to fully utilize the available data and reduce the variance of model evaluation.

[0130] Step S5: Train a lossless fruit ripeness classification system based on neural network technology.

[0131] In this step, the lossless fruit maturity classification model of the embodiment is built using a MobileNetV3 model improved based on focus loss. The MobileNetV3 model is specifically divided into the following parts: feature extraction layer, depthwise separable convolutional layer, and Squeeze and Excitation (SE) module. Their main functions are as follows: First, the feature extraction layer: the early layers of the network typically consist of a series of convolutional layers responsible for extracting basic image features such as edges and textures. Second, depthwise separable convolution: MobileNetV3 extensively uses depthwise separable convolution, which first performs spatial convolution on each input channel, then uses 1x1 pointwise convolution to mix channel features, thereby reducing computation and model size. Inverted residuals and linear bottleneck: it optimizes network performance by introducing an inverted residual structure and a linear bottleneck. The inverted residual allows the network to learn more complex features, while the linear bottleneck helps control the dimensionality of the feature map. Third, the Squeeze and Excitation (SE) module: this is a channel attention mechanism that enhances the network's representational power by reweighting channel features. The SE module learns the importance of channels through global average pooling and fully connected layers, and then applies it to each channel to improve network performance.

[0132] Furthermore, to further improve model performance, this invention replaces the loss function in the model calculation process with a focus loss function, the calculation method of which is as follows:

[0133] FL(p t )=-α t (1-p t ) γ log(p t )#(2)

[0134] The focus loss has two main parameters, denoted as α and γ. Parameter α is used to balance the sample size of different classes; parameter γ adjusts the weights of samples that are difficult to classify. This mechanism makes the model pay more attention to those samples that are difficult to classify and those of classes that account for a smaller proportion of the total sample size, thereby improving the overall training effect.

[0135] In this invention, the final parameter α The values ​​of the parameter are shown in Table 1. γ When the value is set to 2, the Macro-F1 score of the MobileNetV3 model is 0.9842, and the average inference time is 4.5716 milliseconds, resulting in the maximum performance improvement.

[0136] Table 1 shows the focus loss corresponding to each maturity level. α Weight

[0137]

[0138] The above are the detailed steps of the training model of this invention. Those skilled in the art can make adjustments according to specific circumstances.

[0139] Step S6: Collect images of the fruits to be classified, perform preprocessing on the images, and then input them into the model trained in step S5 to obtain the maturity category label of the fruits to be predicted.

[0140] In the application examples of this invention, the characteristics of the MobileNet model were thoroughly understood, focusing on the advantages of the model such as its lightweight nature and portability. Improvements were made to the loss function to further enhance the model's performance, and the model was applied to the kiwifruit maturity classification problem.

[0141] To address the quality grading problem of kiwifruit, this study investigates and analyzes the structure of the MobileNet model, identifying its advantages and limitations. Specifically, the deep separable convolutional networks in MobileNet can reduce computational cost and model size while maintaining or even improving model performance. Secondly, MobileNet borrows from residual neural network models, employing an inverse residual structure, which allows the model to learn more image features. Finally, MobileNet introduces the SE model, an attention mechanism that enhances the network's representational power by reweighting channel features and then applying them to each channel to improve network performance. Regarding the loss function, the focus loss function is used instead of the cross-entropy loss function, effectively improving model performance.

[0142] Specifically, this invention relates to a kiwifruit image dataset and its application method in the automated classification of kiwifruit maturity. The dataset contains 2152 kiwifruit images for experimental testing, and the sample size for each maturity category is shown in Table 2.

[0143] Table 2 Sample size of kiwifruit at different maturity stages

[0144]

[0145] Furthermore, to better demonstrate the advantages of the models applied in this invention, a comprehensive performance analysis was conducted on the ResNet50 model, the improved MobileNet model, and a maturity classification method based on random forest machine learning. Through a series of experiments on kiwifruit maturity classification, the MobileNet model was demonstrated to have advantages such as high accuracy and fast response speed. Compared to methods based on fusion features, the MobileNet model achieved a significant performance improvement, further demonstrating its technical value in the field of kiwifruit maturity classification.

[0146] The embodiments of the present invention have achieved certain positive results in practical applications and have obvious advantages compared with traditional image recognition technology. The specific content will be described in conjunction with data, icons, etc.

[0147] In terms of machine learning methods, a random forest model was selected for kiwifruit maturity classification. The main fusion features chosen were fruit shape, color, and texture features from the fruit images. Specific feature information is as follows:

[0148] Fruit shape features are important indicators for measuring fruit quality and maturity, and can be divided into two sub-features: shape features and size features, mainly used to measure the shape and size of the fruit. Shape features are represented using Hu invariant matrices. The Hu invariant moments are calculated from the second and third center moments, resulting in seven invariant moments. Hu moments are invariant to rotation, translation, and scaling, thus having a wider range of applications when the image is rotated or scaled. Size features are mainly represented by the number of pixels in the fruit portion and the number of pixels in the fruit outline. Color features are another relatively intuitive feature, measuring the color distribution of the fruit's appearance, mainly obtained by statistically analyzing the pixel values ​​of the image. Fruit texture features refer to the texture structure of its skin, usually extracted using the LBP method. LBP is an operator used to describe local features of an image. LBP features have significant advantages such as grayscale invariance and rotation invariance. To avoid the influence of the background, only the fruit portion is extracted for texture features.

[0149] In the application embodiment of this invention, by gaining a deep understanding of the structural characteristics of the lightweight convolutional neural network MobileNetV3 model, a fruit maturity prediction model based on MobileNetV3 was constructed. This model was applied to solve the problem of kiwifruit maturity classification.

[0150] First, regarding the acquisition method of image tags, this invention uses the sugar content and dry matter content of kiwifruit as clustering criteria to classify the ripeness of kiwifruit into six categories, and obtains the corresponding ripeness categories and appearance images. Subsequently, by studying the architecture of the MobileNetV3 model, a lightweight kiwifruit ripeness prediction model was built, improving the accuracy and speed of non-destructive classification of kiwifruit.

[0151] Specifically, this invention relates to a kiwifruit image dataset and its application method in automated kiwifruit maturity rating. The dataset contains a total of 2152 kiwifruit images for experimental testing. Specifically, there are 520 images in stage one, 448 images in stage two, 416 images in stage three, 304 images in stage four, 240 images in stage five, and 224 images in stage six.

[0152] On the one hand, a series of comparative experiments were conducted on the construction of the MobileNetV3 model to compare the classification performance of the two loss functions. The experimental comparisons revealed that using the focal loss function throughout the model yielded the best results. This improvement further enhanced the model's accuracy and adaptability in classifying kiwifruit maturity.

[0153] On the other hand, a comprehensive performance analysis was conducted on the ResNet50 model, the improved MobileNetV3 model, and the machine learning maturity classification method based on random forest. Through a series of experiments on kiwifruit maturity classification, the advantages of the MobileNetV3 model in improving classification accuracy and reducing response time were demonstrated, further reflecting its technical value in the field of kiwifruit maturity classification.

[0154] Through the above embodiments, a deep separable convolutional neural network was successfully applied to the classification task of kiwifruit maturity. A MobileNetV3 model based on the focus loss function was constructed, and its innovative technological achievements in improving classification accuracy were verified through experiments. This model showed significant improvements in accuracy, robustness, and generalization ability. Compared with traditional ResNet and random forest algorithms, MobileNetV3 can more accurately identify key features when recognizing and classifying kiwifruit, thereby significantly improving the accuracy of classification and grading.

[0155] In an embodiment of the present invention, the dataset is re-divided into two parts, and 3-fold cross-validation is performed on the machine learning method and different deep learning models respectively. The training results of the models are all retained based on the best performance on the test set. The final experimental results are shown in Table 3.

[0156] Table 3 Comparison of cross-experiment results of the models

[0157]

[0158] The model evaluation metrics described above are commonly used for image classification problems. They are macroF1 and the time taken to classify a single image. The F1 score takes into account both precision and recall, and is a harmonic average of them. The calculation formula for the evaluation metrics is shown below:

[0159]

[0160] For the evaluation index MacroF1 shown in the table, the kiwi fruit samples are divided into 6 maturity stages. If samples from one maturity stage are considered positive, then the other samples are considered negative, resulting in multiple sets of evaluation indices, which is not conducive to evaluation. Therefore, macro-average is used to evaluate the overall performance of the classifier using F1 (MacroF1), and its calculation method is as follows.

[0161]

[0162] Based on the above embodiments, it can be demonstrated that the accuracy of classification using neural networks is significantly improved compared to kiwifruit maturity classification methods that use machine learning methods. ResNet50 achieves the highest accuracy with an F1 score of 0.9867, slightly higher than MobileNetV3's 0.9842 and 0.9837 (Samll / Large). However, the MobileNetV3 model offers faster response speed, fewer training parameters, and better portability. Therefore, overall, the MobileNetV3 model improves response speed by approximately 32% and significantly reduces the number of training parameters while maintaining an accuracy decrease of no more than 0.005. Thus, the MobileNetV3 model exhibits the best overall performance for kiwifruit maturity classification.

[0163] It should be noted that embodiments of the present invention can be implemented using hardware, software, or a combination of both. The hardware portion can be implemented using dedicated logic; the software portion can be stored in memory and executed by a suitable instruction execution system, such as a microprocessor or dedicated hardware. Those skilled in the art will understand that the above-described devices and methods can be implemented using computer-executable instructions and / or included in processor control code, for example, such code provided on a carrier medium such as a disk, CD, or DVD-ROM, a programmable memory such as read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The devices and modules of the present invention can be implemented using hardware circuitry such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field-programmable gate arrays, programmable logic devices, etc., or using software executed by various types of processors, or using a combination of the above-described hardware circuitry and software, such as firmware. The above descriptions are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions, and improvements made by those skilled in the art within the scope of the technology disclosed in the present invention, and within the spirit and principles of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A lossless classification method for fruit maturity based on deep learning technology, characterized in that: The following steps are involved: S1, taking fruit images and collecting fruit dry matter content and sugar content datasets; S2, integrating the dry matter content and sugar content information of the fruit, using the Calinski–Harabasz score as the evaluation criterion, using the Kmeans clustering algorithm to obtain the various maturity stages and typical examples of the fruit, and labeling the previously taken fruit pictures; S3, preprocessing the labeled fruit images; S4, the labeled feature images are divided into two parts: training set and test set, and the ratio of the number of images in the two parts is 7:3; S5, establishing a lossless classification model for fruit maturity based on a neural network, training and testing the lossless classification model for fruit maturity using a training set and a test set, and obtaining a trained lossless classification model for fruit maturity; S6, collecting the appearance images of the fruits to be classified, preprocessing the appearance images of the fruits, and extracting features of the preprocessed images; The feature image is input into the trained lossless classification model of fruit maturity to obtain the maturity of the fruit to be classified.

2. The method for lossless classification of fruit maturity based on deep learning technology as claimed in claim 1, characterized in that: The clustering algorithm obtains various maturity stages of the fruit, specifically including: The CH score is used as an indicator to evaluate the quality of clustering results, and the K value corresponding to the highest score is selected as the final number of kiwifruit fruit maturity clustering clusters; when the K value is 6, that is, when the Kmeans algorithm clusters the sample data into 6 clusters, the CH score reaches a maximum value of 1231.80, and the clustering effect is the best. Therefore, the maturity of kiwifruit fruit during the growth process is divided into six levels, from unripe to mature, respectively, stage one to stage six, and stage six is ​​the mature stage.

3. The method for lossless classification of fruit maturity based on deep learning technology as claimed in claim 1, characterized in that: The preprocessing of the labeled image specifically includes: For the collected fruit images, the image size is converted. The original image is first manually cropped into an image, and then converted into an image using the bilinear interpolation method; the data volume is then increased through rotation, cropping, Gaussian blur and other methods; finally, image segmentation technology is used to separate the fruit from the image.

4. The method for lossless classification of fruit maturity based on deep learning technology as claimed in claim 1, characterized in that: The neural network-based lossless classification model for fruit maturity is built using a convolutional neural network model based on MobileNetV3.

5. The method for lossless classification of fruit maturity based on deep learning technology as claimed in claim 1, characterized in that: The fruit maturity lossless classification model is trained and optimized using the following steps: First, the model is trained using the fruit feature images in the training set. During each round of training, the loss value of the model on the test set is closely monitored to evaluate whether the model has successfully learned the appearance features of the fruit. Cross-validate the original data set and select the best performing model parameters, which represent the best learning state of the model. Apply the selected best model to the test set and make final predictions; If the model still does not perform well on the test set, the initial parameters or learning rate of the model will be readjusted and the training process will be restarted.

6. A fruit maturity lossless classification system based on deep learning technology that implements the fruit maturity lossless classification method based on deep learning technology as claimed in any one of claims 15, characterized in that: The fruit maturity lossless classification system based on deep learning technology includes: A data acquisition module is used to capture fruit images and collect fruit dry matter content and sugar content data sets; The integration module is used to integrate the dry matter content and sugar content information of the fruit, use the Calinski–Harabasz score as the evaluation criterion, use the Kmeans clustering algorithm to obtain the various maturity stages and typical examples of the fruit, and label the previously taken fruit pictures; A preprocessing module, used for preprocessing the labeled fruit images; The partitioning module is used to divide the labeled feature images into two parts: a training set and a test set, with the ratio of the number of images in the two parts being 7:3; A classification model building module is used to build a lossless classification model for fruit maturity based on a neural network, train and test the lossless classification model for fruit maturity with a training set and a test set, and obtain a trained lossless classification model for fruit maturity; The maturity acquisition module is used to collect the appearance images of fruits to be classified, preprocess the appearance images of fruits, and extract the features of the preprocessed images; input the feature images into the trained lossless classification model of fruit maturity to obtain the maturity of the fruits to be classified.

7. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the fruit maturity lossless classification method based on deep learning technology as claimed in any one of claim 15.

8. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the method for lossless classification of fruit maturity based on deep learning technology as claimed in any one of claim 15.

9. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the fruit maturity lossless classification system based on deep learning technology as described in claim 6.

Citation Information

Patent Citations

  • Tomato maturity detection method based on lightweight improved YOLO

    CN114943697A

  • Fruit quality lossless rating method and system based on deep learning, and terminal

    CN117037146A

  • Data communication system and radiation image capturing system

    US20130279660A1