Banana maturity identification method based on deep learning
Through the deep learning-based banana ripening method, the improved polarized self-attention mechanism and SiLU activation function are used to solve the problem of inconsistent traditional manual judgments, and the rapid and accurate banana ripening recognition is achieved, which improves detection accuracy and efficiency.
Patent Information
- Application Number
- CN202510269080.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-07-25
AI Technical Summary
Traditional banana ripening depends on manual subjective judgment, resulting in inconsistent results and inefficient efficiency, making it difficult to apply in large-scale production and supply chains.
Using a deep learning-based method, the activation function in the polarized self-attention mechanism module is improved by collecting and preprocessing the banana image dataset, and the improved polarized self-attention mechanism is introduced in the YOLOv8n model, and the SiLU activation function is used to replace the Sigmoid function to improve the model's attention to useful information on the image.
It realizes fast and accurate banana ripening, improves the sorting speed during transportation and sales, and improves detection accuracy and model training efficiency.
Smart Images

Figure CN120375033A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a method for identifying banana ripeness based on deep learning. Background Art
[0002] As one of the important fruits globally, bananas exhibit significant changes in appearance and texture at different ripening stages, from unripe green to ripe yellow and then to overripe brown. During storage, sorting, transportation, and sales, ripeness is a key criterion for banana grading and has a significant impact on its quality. Traditionally, ripeness has relied on subjective judgment by personnel, but this method is susceptible to individual differences, resulting in inconsistent results. In addition, manual inspection is time-consuming and laborious, especially in large-scale production and supply chains, which may lead to low efficiency and increased costs.
[0003] Therefore, a method for identifying banana ripeness based on deep learning is designed to provide another technical solution to the above technical problems. Summary of the Invention
[0004] Based on this, it is necessary to provide a method for identifying banana ripeness based on deep learning to solve the technical problems raised in the above background art.
[0005] To solve the above technical problems, the present invention adopts the following technical solutions:
[0006] A method for identifying banana ripeness based on deep learning, the steps are as follows:
[0007] S1: Collect banana images of various ripeness levels to form a dataset and perform preprocessing;
[0008] S2: Improve the activation function Sigmoid in the polarized self-attention mechanism module and introduce the improved polarized self-attention mechanism module into the backbone network of the model;
[0009] S3: Input the preprocessed images into the improved YOLOv8n network;
[0010] S4: Output the recognition result map, detection accuracy, and number of parameters of the improved model.
[0011] As a preferred embodiment of the method for identifying banana ripeness based on deep learning provided by the present invention, in the S1 step, the images in the dataset are 4,785 banana images.
[0012] As a preferred embodiment of the method for identifying banana ripeness based on deep learning provided by the present invention, in the S1 step, the collected dataset is sheared and the size of the dataset is adjusted to complete the preprocessing.
[0013] As a preferred embodiment of the banana ripeness recognition method based on deep learning provided by the present invention, in the step S1, the images in the preprocessed data set are classified into fresh unripe, unripe, fresh ripe, ripe, overripe and rotten.
[0014] As a preferred embodiment of the banana ripeness recognition method based on deep learning provided by the present invention, in the step S2, the Sigmoid activation function in the polarization self-attention module is improved, and the polarization self-attention module is introduced into the backbone network of the model. The steps are as follows:
[0015] The polarization self-attention mechanism is a dual attention mechanism for pixel-level regression tasks, which integrates spatial and channel attention and maintains high resolution;
[0016] Replace the original Sigmoid activation function with the SiLU activation function.
[0017] As a preferred embodiment of the banana ripeness recognition method based on deep learning provided by the present invention, the expression of the SiLU activation function is:
[0018] SiLU(x) = x·σ(x)
[0019] Wherein, x represents the input feature; σ(x) represents the sigmoid function.
[0020] It can be clearly seen that through the above technical solutions of the present application, the technical problems to be solved by the present application can surely be solved.
[0021] Meanwhile, through the above technical solutions, the present invention has at least the following beneficial effects:
[0022] The banana ripeness recognition method based on deep learning provided by the present invention can quickly and accurately recognize the ripeness of banana fruits, thereby greatly improving the sorting speed in the transportation and sales links;
[0023] The present invention introduces the polarization self-attention mechanism module into the backbone network of YOLOv8n and replaces the original activation function Sigmoid with SiLU, so as to improve the target detection accuracy without changing the computational complexity and the number of parameters, improve the attention of the model to the useful information of the image, effectively suppress the useless information of the image, and improve the model training accuracy. Description of the Drawings
[0024] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0025] Figure 1 This is the program flowchart for the recognition and detection of banana ripeness of the present invention. Specific embodiments
[0026] In order to make the objectives, technical solutions and advantages of the present invention more clear and understandable, the following further details the present invention in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0027] In order for those in the technical field to better understand the solution of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings.
[0028] It should be noted that, without conflict, the embodiments in the present invention and the features and technical solutions in the embodiments can be combined with each other.
[0029] Embodiment 1
[0030] Refer to Figure 1 , a method for identifying banana ripeness based on deep learning, the steps are as follows:
[0031] Collect images of bananas at different ripeness levels. A total of 4,785 banana images were collected, and the pictures were marked and the dataset was classified: fresh unripe, unripe, fresh ripe, ripe, overripe, and rotten.
[0032] Perform operations such as cropping and adjusting the dataset size on the marked pictures.
[0033] Introduce an improved planned self-attention mechanism module into the YOLOv8n model, and import the processed pictures into the improved model. Obtain the importance degree of channels through training and learning, and weight the extracted features to highlight important features.
[0034] Embodiment 2
[0035] Disclosed on the basis of the above Embodiment 1, a method for identifying banana ripeness based on deep learning, the steps are as follows:
[0036] Introduce an improved planned value attention mechanism module into the backbone network of the YOLOv8n model.
[0037] The polarized self-attention mechanism is a dual attention mechanism for pixel-level regression tasks, which integrates spatial and channel attention and maintains high resolution. This mechanism allows the model to pay more attention to important parts, significantly improving the model's computational accuracy.
[0038] Using the improved polarized self-attention mechanism module can enhance the model's attention to useful information in the image, effectively suppressing useless information in the image and improving the model training accuracy.
[0039] The SiLU function generates the final activation value by multiplying the input by the output of the Sigmoid function. Compared with the traditional Sigmoid function, it has a smoother gradient, which helps to alleviate the vanishing gradient problem, and a wider activation range, enabling the model to better adapt to different input distributions. In addition, the sparse activation property and numerical stability of the SiLU function also provide advantages in network training. Therefore, the Sigmoid activation function formula can be expressed as:
[0040] SiLU(x) = x·σ(x)
[0041] Where, x represents the input feature; σ(x) represents the sigmoid function.
[0042] Example Three
[0043] It is disclosed based on the above Example One and Example Two.
[0044] Table 1: Results after improvement
[0045]
[0046] Compared the improvement results of the model by introducing the planned self-attention module into the backbone network in YOLOv8n with the results before introduction.
[0047] Compared the results of introducing the polarized self-attention mechanism module into YOLOv8n and the improvement results of the model by the improved polarized self-attention mechanism.
[0048] Finally, the present invention uses three evaluation metrics: mean Average Precision (mAP), number of parameters, and computational cost. The mAP calculation formula is as follows
[0049]
[0050]
[0051] Among them, TP, FP, and FN represent the number of positive samples, the number of negative samples, and the number of missed detection samples respectively; P and R represent the accuracy rate and the recall rate respectively; AP represents the area enclosed by the P-R curve of a certain category and the coordinate axes; C represents the total number of categories.
[0052] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the present invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of this specification. These embodiments are selected and specifically described in this specification to better explain the principle and practical application of the present invention, so that those skilled in the art can understand and utilize the present invention well. The present invention is only limited by the claims and their full scope and equivalents.
Claims
1. A method for identifying the ripeness of bananas based on deep learning, characterized in that, The steps are as follows: S1: Collect banana images, form a dataset, and perform preprocessing; S2: Improve the Sigmoid activation function in the polarization self-attention mechanism module, and introduce the improved polarization self-attention mechanism module into the backbone network of the YOLOv8n model; S3: Input the preprocessed images into the improved YOLOv8n network; S4: Output the recognition result map, detection accuracy, number of parameters, etc. of the improved model.
2. The method for identifying the ripeness of bananas based on deep learning according to claim 1, wherein In the S1 step, there are 4785 banana maturity images in the dataset.
3. A method for identifying the ripeness of bananas based on deep learning according to claim 1, characterized in that, In the S1 step, the collected dataset is cropped and the dataset size is adjusted to complete the preprocessing.
4. A method for identifying the ripeness of bananas based on deep learning according to claim 1, characterized in that, In the S1 step, the images in the preprocessed dataset are classified as fresh unripe, unripe, fresh ripe, ripe, overripe, and rotten.
5. A method for banana ripeness based on deep learning according to claim 1, characterized in that, In the S2 step, the Sigmoid activation function in the polarization self-attention mechanism module is improved, and the improved polarization self-attention mechanism module is introduced into the backbone network of the model. The steps are as follows: The polarization self-attention mechanism is a dual attention mechanism for pixel-level regression tasks, which fuses spatial and channel attention and maintains high resolution; Replace the original Sigmoid activation function with the SiLU activation function.
6. The banana ripeness recognition method based on deep learning according to claim 5, characterized in that, The expression of the SilU activation function is: SiLU(x) = x · σ(x) where x represents the input feature; σ(x) represents the sigmoid function.