Dragon fruit maturity detection method, device and equipment and storage medium

By constructing a dragon fruit detection model based on SVM classifier and convolutional neural network model, and combining with YOLOv4 network for real-time image recognition, the existing dragon fruit maturity detection problem is solved, and efficient and accurate maturity detection is achieved, avoiding fruit damage.

CN119723560APending Publication Date: 2025-03-28LINGNAN NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411707996.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing dragon fruit maturity detection technology is inefficient and cannot accurately judge the optimal picking time, resulting in poor yield and quality, and traditional testing methods may damage the fruit.

Method used

The dragon fruit detection model based on SVM classifier and convolutional neural network model is adopted, and the YOLOv4 network is combined for real-time image recognition and maturity detection to avoid physical damage to the fruit.

Benefits of technology

It improves the accuracy and efficiency of dragon fruit ripening, avoids the damage of fruits, ensures the integrity and quality of fruits, and provides efficient and reliable technical support for the picking, grading and quality control of dragon fruits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723560A_ABST
    Figure CN119723560A_ABST
Patent Text Reader

Abstract

The invention relates to the field of fruit detection, and discloses a pitaya maturity detection method, device and equipment and a storage medium, the method is used for accurately detecting the pitaya maturity, and meanwhile possible damage to pitaya caused by a traditional detection method is avoided. The method comprises the following steps: constructing a pitaya detection model based on an SVM classifier and a convolutional neural network model; acquiring a pitaya image, and identifying the acquired pitaya image by using a pitaya identification model based on a YOLOv4 network to obtain a region-of-interest image; and inputting the image of the region of interest into the pitaya detection model, and obtaining a pitaya maturity detection result output by the pitaya detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of fruit detection, and in particular to a pitaya maturity detection method, device, equipment and storage medium. Background Art

[0002] my country's pitaya industry has developed rapidly and has become the world's largest pitaya producer. With the continuous expansion of planting area, the industry is currently facing the following problems: First, the current manual fruit picking work is inefficient and it is impossible to accurately grasp the best picking time, which affects the yield and quality, resulting in low standardization and industrialization of production; second, with the shortage of domestic labor, labor costs are increasing year by year, seriously affecting the healthy development of the pitaya industry.

[0003] In terms of maturity detection, traditional detection technology mainly relies on experience or the use of tools such as sugar content detection analyzers, acidity detection analyzers, hardness testers, etc. to detect and judge the appearance, soluble sugar content, acidity, hardness or soluble solids of fruits, so as to determine the maturity level of fruits. However, traditional detection technology will damage fruit tissues, and non-destructive maturity detection technology based on machine vision has emerged. However, existing visual detection methods are difficult to achieve efficient real-time processing while ensuring high detection accuracy.

[0004] Therefore, the existing technology still needs to be improved and developed. Summary of the invention

[0005] The present invention provides a pitaya maturity detection method, device, equipment and storage medium, which are used to accurately detect the maturity of pitaya, while avoiding the damage to pitaya that may be caused by traditional detection methods.

[0006] The first aspect of the present invention provides a pitaya maturity detection method, which comprises: constructing a pitaya detection model based on a SVM classifier and a convolutional neural network model; collecting pitaya images, and using a pitaya recognition model based on a YOLOv4 network to identify the collected pitaya images to obtain a region of interest image; inputting the region of interest image into the pitaya detection model, and obtaining a pitaya maturity detection result output by the pitaya detection model.

[0007] Preferably, before constructing the meta-model based on the SVM classifier and the convolutional neural network model, it also includes: collecting images of pitaya with different degrees of maturity collected at multiple angles and distances under different time periods and different lighting conditions; preprocessing the collected pitaya images to obtain a sample data set; performing data enhancement on the sample data set to obtain a training data set, and saving the training data set to an image training database, wherein the training data set includes multiple training images.

[0008] Preferably, the preprocessing of the collected pitaya images to obtain a sample data set includes: converting the collected pitaya images to an HSI color space, extracting the brightness components of the collected pitaya images in the HSI color space, and calculating the brightness component mean; removing pitaya images whose brightness component mean is lower than a preset brightness value; and using histogram equalization or Retinex enhancement technology to enhance the contrast of the remaining pitaya images to obtain a sample data set.

[0009] Preferably, the construction of a meta-model based on an SVM classifier and a convolutional neural network model includes: obtaining multiple training images from the image training database, and dividing the multiple training images into a first data set, a second data set, and a third data set; using the first data set to train a pre-constructed SVM model to obtain three SVM classifiers, and the three SVM classifiers are used to predict immature fruit, semi-mature fruit, and ripe fruit, respectively; constructing a LeNet-5 neural network, improving the LeNet-5 neural network to obtain an improved LeNet-5 neural network, and using the second data set to train the improved LeNet-5 neural network to obtain a trained LeNet-5 neural network model; integrating the three SVM classifiers and the trained LeNet-5 neural network model to obtain a meta-model, and using the third data set to train the meta-model to obtain a pitaya detection model.

[0010] Preferably, the method uses the first data set to train the pre-constructed SVM model to obtain three SVM classifiers, which are respectively used to predict immature fruit, semi-mature fruit and ripe fruit, including: processing the training images in the first training set by an improved GrabCut segmentation algorithm to obtain the key fruit part in the training image as the target image; converting the target image to the HSV color space, extracting the hue component of the target image in the HSV color space, and calculating the mean of the hue component; clustering the target image based on the mean of the hue component of the target image using the K-means clustering algorithm to obtain three sub-training sets; and using the three sub-training sets to train the pre-constructed SVM model to obtain three SVM classifiers, which are respectively used to predict immature fruit, semi-mature fruit and ripe fruit.

[0011] Preferably, the LeNet-5 neural network includes an input layer, a first convolutional layer, a first pooling layer, a first convolutional layer, a second pooling layer, a first fully connected layer, a second fully connected layer and an output layer connected in sequence, the first convolutional layer and the second convolutional layer both use a 5*5 convolution kernel for convolution operations, the first pooling layer and the second pooling layer use a 2*2 pooling window for downsampling, and the improved LeNet-5 neural network adds a Flatten layer between the second pooling layer and the first fully connected layer.

[0012] Preferably, the process of collecting images of pitaya and identifying the collected images of pitaya using a pitaya recognition model based on a YOLOv4 network, before obtaining an image of a region of interest, further includes: using YOLOv4 as a basic model, using MobileNet as a feature extraction network of the basic model, and introducing a coordinate attention mechanism to construct an initial model; initializing the network parameters of the initial model using the pre-trained weights of the MobileNet network trained with a large-scale data set, and fine-tuning the network parameters of the initial model using an external data set related to pitaya; obtaining multiple training images from an image training database as a fourth data set, determining the number and size of Anchor Boxes using a k-means clustering algorithm according to the fourth data set, and training the fine-tuned initial model using the fourth data set to obtain a pitaya recognition model.

[0013] The second aspect of the present invention provides a pitaya maturity detection device, comprising: a construction module, which constructs a pitaya detection model based on an SVM classifier and a convolutional neural network model; a recognition module, which collects pitaya images and uses a pitaya recognition model based on a YOLOv4 network to recognize the collected pitaya images to obtain an image of a region of interest; a detection module, which inputs the image of the region of interest into the pitaya detection model and obtains the pitaya maturity detection result output by the pitaya detection model.

[0014] The third aspect of the present invention provides a pitaya maturity detection device, comprising: a memory and at least one processor, wherein the memory stores computer-readable instructions, and the memory and the at least one processor are interconnected through lines; the at least one processor calls the computer-readable instructions in the memory so that the pitaya maturity detection device performs each step of the pitaya maturity detection method as described above.

[0015] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, which, when executed on a computer, enable the computer to execute the various steps of the pitaya maturity detection method described above.

[0016] The technical solution provided by the present invention combines the robust classification capability of the SVM classifier and the deep feature extraction advantage of the convolutional neural network model, and uses the YOLOv4 network to achieve fast and accurate pitaya recognition. It can efficiently extract regions of interest from real-time images and accurately judge the maturity of pitaya. It not only improves the accuracy and efficiency of detection, but also avoids the damage that traditional detection methods may cause to pitaya, ensures the integrity and quality of the fruit, and provides efficient and reliable technical support for the picking, grading and quality control of pitaya. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A flow chart of a method for detecting the maturity of pitaya provided by an embodiment of the present invention;

[0018] Figure 2 A schematic diagram of the structure of a pitaya maturity detection device provided by an embodiment of the present invention;

[0019] Figure 3 A schematic diagram of the structure of a pitaya maturity detection device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0021] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 In an embodiment of the present invention, a method for detecting the maturity of pitaya comprises:

[0022] S101, constructing a pitaya detection model based on SVM classifier and convolutional neural network model;

[0023] S102, collecting dragon fruit images, and using the dragon fruit recognition model based on the YOLOv4 network to recognize the collected dragon fruit images to obtain an image of a region of interest;

[0024] S103, inputting the region of interest image into the pitaya detection model, and obtaining the pitaya maturity detection result output by the pitaya detection model.

[0025] It is understandable that the execution subject of the present invention may be a pitaya maturity detection device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0026] In this embodiment, in step S101, before constructing the pitaya detection model based on the SVM classifier and the convolutional neural network model, it also includes: collecting pitaya images of different maturity collected at multiple angles and distances under different time periods and different lighting conditions; preprocessing the collected pitaya images to obtain a sample data set; performing data enhancement on the sample data set to obtain a training data set, and saving the training data set to an image training database, wherein the training data set includes multiple training images.

[0027] In this embodiment, dragon fruit images of different maturity are collected from multiple angles and distances at different time periods and under different lighting conditions to ensure that the data set is diverse and representative and can cover various possible scenarios and conditions.

[0028] In this embodiment, the collected pitaya images are preprocessed to obtain a sample data set, including: converting the collected pitaya images to an HSI color space, extracting the brightness component of the collected pitaya images in the HSI color space, and calculating the mean of the brightness component; removing pitaya images whose brightness component mean is lower than a preset brightness value; and using histogram equalization or Retinex enhancement technology to enhance the contrast of the remaining pitaya images to obtain a sample data set.

[0029] In this embodiment, the HSI color space is composed of three components: hue, saturation, and intensity. In the HSI color space, the intensity component is the key information to describe the brightness of the image. The brightness component of the collected pitaya image in the HSI color space is extracted, and the mean of the brightness component of the entire image is calculated. This mean can be used to evaluate the overall brightness level of the image. Removing pitaya images whose brightness component mean is lower than the preset brightness value helps to reduce noise and interference in the data set and improve the accuracy and efficiency of subsequent processing.

[0030] In this embodiment, data expansion can be performed by brightness adjustment and scaling to enrich the pitaya features under different light and scales in the data set.

[0031] In this embodiment, in step S101, a meta-model based on an SVM classifier and a convolutional neural network model is constructed, specifically including: obtaining multiple training images from an image training database, and dividing the multiple training images into a first data set, a second data set, and a third data set; using the first data set to train a pre-constructed SVM model to obtain three SVM classifiers, and the three SVM classifiers are used to predict immature fruit, semi-mature fruit, and ripe fruit, respectively; constructing a LeNet-5 neural network, improving the LeNet-5 neural network to obtain an improved LeNet-5 neural network, and using the second data set to train the improved LeNet-5 neural network to obtain a trained LeNet-5 neural network model; integrating the three SVM classifiers and the trained LeNet-5 neural network model to obtain a meta-model, and using the third data set to train the meta-model to obtain a pitaya detection model.

[0032] Optionally, the pre-constructed SVM model is trained using the first data set to obtain three SVM classifiers, which are respectively used to predict immature fruits, semi-mature fruits and ripe fruits, specifically comprising: processing the training images in the first training set by an improved Grab Cut segmentation algorithm to obtain the key fruit part in the training image as the target image; converting the target image to the HSV color space, extracting the hue component of the target image in the HSV color space, and calculating the mean of the hue component; clustering the target image using the K-means clustering algorithm based on the mean of the hue component of the target image to obtain three sub-training sets; using the three sub-training sets to train the pre-constructed SVM model respectively to obtain three SVM classifiers, which are respectively used to predict immature fruits, semi-mature fruits and ripe fruits.

[0033] In this embodiment, the traditional Grab Cut algorithm requires the user to manually draw a rectangular box containing the target object as an initial estimate. However, in a complex background, the manually drawn rectangular box may not be accurate enough, resulting in poor segmentation results.

[0034] The improved Grab Cut algorithm can adopt an intelligent initialization strategy, such as using the color, texture or shape features in the image to automatically select the initial rectangular box containing the dragon fruit, for example, using other image segmentation algorithms (such as threshold segmentation, region growing, graph cut algorithm, etc.) to perform preliminary segmentation on the image. Texture analysis algorithms (such as Gabor filter, local binary pattern LBP, etc.) can also be used to detect texture features in the image, and a rectangular box containing the dragon fruit texture area is automatically drawn based on the detected texture features.

[0035] In this embodiment, in the HSV color space, the hue component represents the type or type of color. For pitaya, fruits of different maturity may have different hue characteristics. The hue component of the target image in the HSV color space is extracted, and the mean of the hue components of all pixels in the target image is calculated. This mean can be used as an overall representation of the hue characteristics of the target image for subsequent cluster analysis.

[0036] In this embodiment, the target image is clustered using the K-means clustering algorithm based on the mean value of the hue component of the target image, where K is set to 3 to correspond to the three categories of immature fruit, semi-mature fruit and mature fruit.

[0037] In this embodiment, the LeNet-5 neural network includes an input layer, a first convolutional layer, a first pooling layer, a first convolutional layer, a second pooling layer, a first fully connected layer, a second fully connected layer and an output layer connected in sequence. The first convolutional layer and the second convolutional layer both use a 5*5 convolution kernel for convolution operations, and the first pooling layer and the second pooling layer use a 2*2 pooling window for downsampling. The improved LeNet-5 neural network adds a Flatten layer between the second pooling layer and the first fully connected layer.

[0038] In this embodiment, the input layer is used to receive an input image, which is usually a 32x32 grayscale image, or a color image, but each color channel needs to be processed or converted into a grayscale image separately.

[0039] The first convolution layer uses a 5x5 convolution kernel to perform a convolution operation. The first convolution layer includes multiple convolution kernels (for example, 6) to extract different features.

[0040] The first pooling layer uses a 2x2 pooling window for downsampling, usually average pooling or maximum pooling.

[0041] The second convolution layer again uses a 5x5 convolution kernel for convolution operation, and the second convolution layer also includes multiple convolution kernels (for example, 16) to further extract features.

[0042] The second pooling layer again uses a 2x2 pooling window for downsampling.

[0043] The Flatten layer is used to convert the multi-dimensional pooling layer output into a one-dimensional vector for input into the first fully connected layer.

[0044] The first fully connected layer receives the output of the Flatten layer and connects to a certain number of neurons (e.g. 120).

[0045] The second fully connected layer receives the output of the first fully connected layer and connects to another number of neurons (e.g., 84).

[0046] The output layer is a softmax layer, which is used for multi-classification tasks and outputs the probability distribution of categories.

[0047] In this embodiment, in step S102, a pitaya image is collected, and a pitaya recognition model based on a YOLOv4 network is used to identify the collected pitaya image. Before obtaining an image of a region of interest, the method further includes: using YOLOv4 as a basic model, using MobileNet as a feature extraction network of the basic model, and introducing a coordinate attention mechanism to construct an initial model; initializing the network parameters of the initial model using the pre-trained weights of the MobileNet network trained with a large-scale data set, and fine-tuning the network parameters of the initial model using an external data set related to pitaya; obtaining multiple training images from an image training database as a fourth data set, determining the number and size of the Anchor Box according to the fourth data set using a k-means clustering algorithm, and training the fine-tuned initial model using the fourth data set to obtain a pitaya recognition model.

[0048] In this embodiment, YOLOv4 is selected as the basic model for target detection. YOLOv4 is famous for its efficient target detection capability and real-time performance, and is suitable for target detection tasks in various complex scenarios. At the same time, MobileNet is used as the feature extraction network of YOLOv4 to replace its original Darknet feature extractor. In comparison, although the Darknet feature extractor has powerful performance, the model is more complex and the computational requirements are higher. MobileNet is characterized by its light weight and high efficiency. It uses technologies such as deep separable convolution to reduce the number of parameters and computational complexity of the model while maintaining a high feature extraction capability.

[0049] In addition, based on the MobileNet feature extraction network, a coordinate attention mechanism is introduced to enhance the model's ability to capture target position and shape information. The coordinate attention mechanism can focus on the specific position of the target in the image and emphasize features related to the target shape, thereby improving the recognition accuracy of the pitaya recognition model.

[0050] In this embodiment, the network parameters of the initial model are initialized using the pre-trained weights of the MobileNet network trained on a large-scale dataset, which helps the model converge faster on an external dataset related to pitaya. The network parameters of the initial model are fine-tuned using the external dataset related to pitaya, which helps the initial model learn a more robust and accurate feature representation. During the fine-tuning process, the training process of the initial model is controlled by adjusting parameters such as the learning rate and the optimizer to ensure that the initial model can achieve the best performance on the external dataset related to pitaya.

[0051] Specifically, external datasets related to pitaya include Fruit-360, FruitVeg-81 and other datasets.

[0052] In this embodiment, multiple training images are obtained from the image training database as the fourth data set, and the target boxes in the fourth data set are clustered using the k-means clustering algorithm to determine the number and size of the Anchor Box, which is an important parameter of the YOLOv4 model for predicting the target position and size, and the selection of its number and size has an important influence on the detection performance of the model. According to the clustering results, the most appropriate number and size of the Anchor Box are selected and applied to the fine-tuned initial model, and then the fine-tuned initial model is trained using the fourth data set to obtain a pitaya recognition model.

[0053] In this embodiment, in step S102, a camera or other image acquisition device is used to capture images of pitaya in real time in a pitaya planting area or picking site.

[0054] In this embodiment, the collected real-time image is preprocessed, such as denoising, color correction, size adjustment, etc., to ensure that the image quality meets the requirements of the dragon fruit recognition model input. The preprocessed image is input into the trained dragon fruit recognition model. The dragon fruit recognition model uses the MobileNet feature extraction network and the YOLOv4 detection framework, combined with the coordinate attention mechanism, to quickly and accurately identify the dragon fruit in the image. The recognition result includes the position (bounding box coordinates) and category (in this scenario, dragon fruit) of the dragon fruit. Finally, according to the bounding box coordinates output by the dragon fruit recognition model, the image of the region of interest containing the dragon fruit is cropped from the collected real-time image.

[0055] In this embodiment, in step S103, first, the pitaya detection model uses the LeNet-5 neural network model to extract features from the region of interest image. These features play a key role in distinguishing pitayas of different maturity levels. The extracted features are used as inputs for three SVM classifiers.

[0056] Next, the extracted features are input into three SVM classifiers, which are used to predict the immature, semi-mature, and ripe dragon fruits. The three SVM classifiers are trained on the training images corresponding to the immature, semi-mature, and ripe dragon fruits, respectively, and can capture the subtle differences between dragon fruits of different maturity. Each SVM classifier outputs a prediction result, which indicates the probability or confidence that the image to be tested belongs to that category.

[0057] Finally, the pitaya detection model receives the prediction results of the three SVM classifiers, and integrates these results according to the preset strategies (such as weighted average, voting, etc.), and outputs a final prediction result, which indicates the maturity category (immature, semi-ripe or ripe) of the pitaya to be detected.

[0058] In this embodiment, the robust classification ability of the SVM classifier and the deep feature extraction advantage of the convolutional neural network model are integrated, and the YOLOv4 network is used to achieve fast and accurate dragon fruit recognition. The region of interest can be efficiently extracted from the real-time image, and the maturity of the dragon fruit can be accurately judged. This not only improves the accuracy and efficiency of detection, but also avoids the damage that traditional detection methods may cause to the dragon fruit, ensures the integrity and quality of the fruit, and provides efficient and reliable technical support for the picking, grading and quality control of dragon fruit.

[0059] The above describes the method for detecting the maturity of pitaya in the embodiment of the present invention. The following describes the device in the embodiment of the present invention. Figure 2 , the implementation of the pitaya maturity detection device in the embodiment of the present invention includes:

[0060] Building module 201, building a pitaya detection model based on SVM classifier and convolutional neural network model;

[0061] The recognition module 202 collects the pitaya image and uses the pitaya recognition model based on the YOLOv4 network to recognize the collected pitaya image to obtain an image of the region of interest;

[0062] The detection module 203 inputs the region of interest image into the dragon fruit detection model, and obtains the dragon fruit maturity detection result output by the dragon fruit detection model.

[0063] In this embodiment, the robust classification ability of the SVM classifier and the deep feature extraction advantage of the convolutional neural network model are integrated, and the YOLOv4 network is used to achieve fast and accurate dragon fruit recognition. The region of interest can be efficiently extracted from the real-time image, and the maturity of the dragon fruit can be accurately judged. This not only improves the accuracy and efficiency of detection, but also avoids the damage that traditional detection methods may cause to the dragon fruit, ensures the integrity and quality of the fruit, and provides efficient and reliable technical support for the picking, grading and quality control of dragon fruit.

[0064] Figure 2 The structure of the pitaya maturity detection device shown does not constitute a limitation of the pitaya maturity detection device, and can implement the steps of the pitaya maturity detection method provided by the above-mentioned method embodiments.

[0065] above Figure 2The pitaya maturity detection device in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The pitaya maturity detection device in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0066] Figure 3 : is a schematic diagram of the structure of a pitaya maturity detection device provided by an embodiment of the present invention. The device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 310 (for example, one or more processors) and a memory 320, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 333 or data 332. Among them, the memory 320 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown), and each module may include a series of instruction operations in the device 300. Furthermore, the processor 310 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium on the device 300.

[0067] The device 300 may also include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input and output interfaces 360, and / or one or more operating systems 331, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc.

[0068] An embodiment of the present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the pitaya maturity detection method.

[0069] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0070] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0071] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting the maturity of pitaya, characterized in that: The pitaya maturity detection method comprises: Construct a pitaya detection model based on SVM classifier and convolutional neural network model; Collect dragon fruit images, and use the dragon fruit recognition model based on the YOLOv4 network to recognize the collected dragon fruit images to obtain images of the region of interest; The region of interest image is input into the dragon fruit detection model, and the dragon fruit maturity detection result output by the dragon fruit detection model is obtained.

2. The method for detecting the maturity of pitaya according to claim 1, wherein Before constructing the meta-model based on the SVM classifier and the convolutional neural network model, the method further includes: Collect images of dragon fruits of different maturity from multiple angles and distances at different times and under different lighting conditions; Preprocess the collected dragon fruit images to obtain a sample data set; The sample data set is enhanced to obtain a training data set, and the training data set is saved in an image training database, wherein the training data set includes a plurality of training images.

3. The method for detecting the maturity of pitaya according to claim 2, wherein: The collected dragon fruit images are preprocessed to obtain a sample data set, including: The collected pitaya image is converted into the HSI color space, and the brightness component of the collected pitaya image in the HSI color space is extracted, and the mean value of the brightness component is calculated; Remove the dragon fruit images whose average brightness component is lower than the preset brightness value; The contrast of the remaining dragon fruit images is enhanced using histogram equalization or Retinex enhancement technology to obtain a sample data set.

4. The method for detecting the maturity of pitaya according to claim 2, wherein: The meta-model based on the SVM classifier and the convolutional neural network model includes: Acquire a plurality of training images from the image training database, and divide the plurality of training images into a first data set, a second data set, and a third data set; Using the first data set to train the pre-built SVM model, three SVM classifiers are obtained, and the three SVM classifiers are used to predict immature fruit, semi-mature fruit and mature fruit respectively; Constructing a LeNet-5 neural network, improving the LeNet-5 neural network to obtain an improved LeNet-5 neural network, and training the improved LeNet-5 neural network using the second data set to obtain a trained LeNet-5 neural network model; The three SVM classifiers and the trained LeNet-5 neural network model are integrated to obtain a meta-model, and the meta-model is trained using the third data set to obtain a pitaya detection model.

5. The method for detecting the maturity of pitaya according to claim 4, wherein: The pre-constructed SVM model is trained using the first data set to obtain three SVM classifiers, which are used to predict immature fruit, semi-mature fruit and mature fruit, respectively, including: The training images in the first training set are processed by using the improved Grab Cut segmentation algorithm to obtain the key fruit part in the training image as the target image; Convert the target image to the HSV color space, extract the hue component of the target image in the HSV color space, and calculate the mean of the hue component; Based on the mean value of the hue component of the target image, the target image is clustered using a K-means clustering algorithm to obtain three sub-training sets; The pre-constructed SVM models were trained using the three sub-training sets to obtain three SVM classifiers, which were used to predict immature fruits, semi-mature fruits and mature fruits, respectively.

6. The method for detecting the maturity of pitaya according to claim 4, wherein: The LeNet-5 neural network includes an input layer, a first convolutional layer, a first pooling layer, a first convolutional layer, a second pooling layer, a first fully connected layer, a second fully connected layer and an output layer connected in sequence. The first convolutional layer and the second convolutional layer both use a 5*5 convolution kernel for convolution operations, and the first pooling layer and the second pooling layer use a 2*2 pooling window for downsampling. The improved LeNet-5 neural network adds a Flatten layer between the second pooling layer and the first fully connected layer.

7. The method for detecting the maturity of pitaya according to claim 2, wherein: The method further includes collecting the dragon fruit image, and using the dragon fruit recognition model based on the YOLOv4 network to recognize the collected dragon fruit image, and obtaining the image of the region of interest: Use YOLOv4 as the base model, use MobileNet as the feature extraction network of the base model, and introduce the coordinate attention mechanism to build the initial model; Initialize the network parameters of the initial model using the pre-trained weights of the MobileNet network trained with a large-scale data set, and fine-tune the network parameters of the initial model using an external data set related to pitaya; A plurality of training images are obtained from an image training database as a fourth data set, the number and size of the Anchor Box are determined using a k-means clustering algorithm according to the fourth data set, and the fine-tuned initial model is trained using the fourth data set to obtain a pitaya recognition model.

8. A pitaya maturity detection device, characterized in that: include: Building modules, building a pitaya detection model based on SVM classifier and convolutional neural network model; The recognition module collects images of dragon fruits and uses a dragon fruit recognition model based on the YOLOv4 network to recognize the collected images of dragon fruits to obtain images of regions of interest; The detection module inputs the region of interest image into the dragon fruit detection model, and obtains the dragon fruit maturity detection result output by the dragon fruit detection model.

9. A pitaya maturity detection device, characterized in that: comprising a memory and at least one processor, wherein the memory has computer-readable instructions stored therein; The at least one processor calls the computer-readable instructions in the memory to execute the various steps of the pitaya maturity detection method as described in any one of claims 1-7.

10. A computer-readable storage medium having computer-readable instructions stored thereon, characterized in that: When the computer-readable instructions are executed by a processor, the various steps of the pitaya maturity detection method as described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Citrus sugar degree prediction model training method based on lightweight RGB reconstruction HSI

    CN121169928A