Kiwi fruit multi-scale bruise detection method and readable storage medium
By employing a multi-scale modeling strategy based on spectral and image data, combined with adaptive wavelet transform, polar coordinate transform, and deep learning models, the problem of rapid and accurate identification of bruises in kiwifruit was solved, achieving efficient and automated detection of kiwifruit.
Patent Information
- Application Number
- CN202510761511.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-10-21
AI Technical Summary
Existing technologies struggle to quickly and accurately identify internal bruises in kiwifruit. Traditional detection methods are inefficient, and machine vision technology models are complex to train, limiting their large-scale application.
A multi-scale modeling strategy based on spectrum and image is adopted. By acquiring the spectral dataset of kiwifruit, adaptive wavelet transform and polar coordinate transform are performed to generate a two-dimensional image dataset. The YOLOv8n model and Stacking model are combined to identify bruises.
This technology enables rapid and accurate identification of bruises in kiwifruit, improving detection efficiency and accuracy, and providing theoretical support for intelligent grading and automatic sorting systems for post-harvest fruits.
Smart Images

Figure CN120820499A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a multi-scale bruise detection method for kiwifruit and a readable storage medium, belonging to the field of kiwifruit damage detection. Background Art
[0002] Actinidia arguta is a perennial deciduous vine of the Actinidia family, widely distributed in Northeast, North China, and Northwest my country. Unlike traditional kiwifruit, its skin is smooth and its flesh is green. It has a unique flavor and high nutritional value, and has been favored by the market in recent years. However, during the picking and transportation process, Actinidia arguta is easily bruised by external forces. Bruising not only accelerates fruit metabolism, causing browning and shrinkage of the skin, and loss of nutrients such as sugar and acid, but also increases the risk of microbial infection. Damaged tissue provides an invasion channel for pathogens (such as bacteria and fungi), causing fermentation and mildew during storage, and then infecting healthy fruits, causing serious economic losses. Therefore, early identification and intervention of bruises are of great significance to improving the post-harvest quality of Actinidia arguta and reducing losses.
[0003] Damage detection for kiwifruit presents numerous challenges, primarily due to the smooth skin and concealed nature of the damage, which poses significant challenges to traditional inspection methods. Manual inspections are subject to significant limitations and subjectivity, with varying judgment criteria applied by different inspectors, leading to significant discrepancies in results. Furthermore, they are inefficient and difficult to adapt to large-scale inspection needs. Furthermore, while machine vision technology can automate inspections, it only captures surface information, significantly reducing its effectiveness for fruits like kiwifruit, where internal damage is often hidden. While hyperspectral imaging technology holds promise, complex data processing and challenging model training limit its widespread application. Summary of the Invention
[0004] In view of this, the present application provides a multi-scale bruise detection method for kiwifruit and a readable storage medium. The multi-scale modeling strategy based on spectrum and image proposed in the embodiment of the present application can provide new ideas for the rapid and accurate identification of the degree of bruise of soft-fleshed kiwifruit, and provide a theoretical basis and technical support for the construction of an intelligent grading and automatic sorting system for post-harvest fruits.
[0005] The first aspect of the embodiments of the present application discloses a multi-scale bruise detection method for kiwifruit, the method comprising:
[0006] Get the kiwifruit spectral dataset;
[0007] decomposing the spectral data set according to an adaptive wavelet transform;
[0008] encoding the spectral dataset according to polar coordinate transformation to generate a two-dimensional image dataset with structural features;
[0009] A first kiwifruit bruise discrimination model is constructed based on the two-dimensional image data set to detect kiwifruit bruises.
[0010] A second aspect of the embodiments of the present application discloses a multi-scale bruise detection method for kiwifruit, the method comprising:
[0011] Get the kiwifruit spectral dataset;
[0012] decomposing the spectral data set according to an adaptive wavelet transform;
[0013] A second kiwifruit bruise discrimination model is constructed based on the spectral data set to detect kiwifruit bruises.
[0014] A third aspect of an embodiment of the present application discloses a computer-readable storage medium, which includes a stored program, wherein when the program is run, the processor of the device where the program is located controls the execution of the kiwi fruit multi-scale bruise detection method of the above embodiment. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without any creative work.
[0016] Figure 1 This is a flow chart of a multi-scale bruise detection method for kiwifruit provided in an embodiment of the present application.
[0017] Figure 2 This is a schematic diagram of Actinidia arguta samples with different bruising times provided in an embodiment of the present application.
[0018] Figure 3 A schematic diagram of a hyperspectral image acquisition method provided in an embodiment of the present application.
[0019] Figure 4 A schematic diagram of a wavelet decomposition process provided in an embodiment of the present application.
[0020] Figure 5 A schematic diagram of a YOLOv8n classification model architecture provided in an embodiment of the present application.
[0021] Figure 6 A signal amplitude diagram of detail coefficients and approximate coefficients of the first and third layers provided in an embodiment of the present application.
[0022] Figure 7This is a schematic diagram of the comparison of spectral curves before and after wavelet transformation provided in an embodiment of the present application.
[0023] Figure 8 A schematic diagram of a YOLOv8n training process based on GAF images provided in an embodiment of the present application.
[0024] Figure 9 This is a flow chart of a multi-scale bruise detection method for kiwifruit provided in an embodiment of the present application.
[0025] Figure 10 A schematic diagram of a 1D-CNN network structure provided in an embodiment of the present application.
[0026] Figure 11 A schematic diagram of an LSTM structure provided in an embodiment of the present application.
[0027] Figure 12 A schematic diagram of a Stacking model architecture provided in an embodiment of the present application.
[0028] Figure 13 A schematic diagram of a Grad-CAM visualization result provided in an embodiment of the present application.
[0029] Figure 14 A schematic diagram of the t-SNE dimensionality reduction visualization results of a base learner A. SVM, B. LSTM, C. 1D-CNN and D. Stacking integration model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the description 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 numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Example 1:
[0033] Figure 1 This is a flow chart of a multi-scale bruise detection method for kiwifruit provided in an embodiment of the present application. Figure 1 As shown, the method includes:
[0034] S101 obtains a spectral dataset of kiwi fruit.
[0035] The experimental material was "Longcheng No. 1" soft-fleshed kiwifruit, harvested from a plantation in Dandong City, Liaoning Province, on September 6, 2024. The fruits were immediately pre-cooled after harvest and transported to the laboratory within 2 hours. From these, 180 fruits of uniform maturity, no mechanical damage, and uniform size were selected and stored in a constant temperature and humidity chamber at 4°C and 80% relative humidity. One hour before the experiment, the samples were brought to room temperature (25°C) to equilibrate the temperature and ensure consistency of experimental conditions.
[0036] Samples were bruised using a TA.XTC-18 texture analyzer (Shanghai BosinTech) equipped with a TA / 0.5S spherical probe. Instrument height and force calibration were completed before testing. Parameters were set as follows: 3mm displacement, 1mm / s test speed, and 2g trigger force, ensuring the peel was intact but the flesh was damaged. Three independent indentations were performed on each sample on the same surface, with the indentations adjusted so that they did not overlap.
[0037] After bruising, the samples were stored at 25°C and 66% relative humidity for 2, 4, 6, and 8 hours. The samples were divided into five groups based on storage time: intact and bruised (2, 4, 6, and 8 hours). After the experiment, the bruised area was marked by hand pressure and marked with a black marker. Observation revealed no significant changes in the appearance of the fruit during the initial bruising period. With extended storage, the bruised area gradually browned, forming a distinct dark bruise ring 8 hours after bruising. However, the bruise characteristics of adjacent time periods were difficult to distinguish visually. Figure 2The RGB images of fruits at different bruise times are shown.
[0038] Spectral data in the 400–1000 nm band were collected using a push-broom hyperspectral imaging system (ISUZU OPTICS, Shanghai, China). The system was equipped with a spectrometer (V10E), a CCD camera (IGV-B1410M-KCO), a darkroom, a motorized translation stage, two halogen lamps (LG-150), and a computer.
[0039] After the system was powered on and preheated for 30 minutes, the lens height was adjusted to 32 cm, the maximum digital quantization value was 1600, and the platform moving speed was 1.85 m / s. 8 kiwifruit samples were placed on the translation stage in 2 rows and 4 columns ( Figure 3 ) for hyperspectral image acquisition.
[0040] In order to eliminate the effects of instrument dark current and uneven light source on the image, the hyperspectral imaging system needs to be calibrated with a black and white plate. First, scan the white calibration plate with a reflectivity close to 100% to obtain a full white calibration image R w , then cover the lens to obtain the all-black calibration image R b , calculate according to formula (1) to obtain the corrected hyperspectral image R c .
[0041]
[0042] Where R represents the original hyperspectral image of Actinidia arguta.
[0043] After image correction, a 10×10 pixel region of interest (ROI) was selected from the three bruise areas of each sample. The spectral mean was calculated to obtain a local representative spectrum. Subsequently, the spectral means of the three ROIs for the same sample were averaged to obtain the overall characteristic spectrum for that sample. Finally, a dataset consisting of 900 spectra, representing 180 samples and 5 bruise time points, was constructed, thus obtaining the spectral dataset for step S101.
[0044] S102 decomposes the spectral data set according to adaptive wavelet transform.
[0045] It should be noted that during the acquisition of hyperspectral data, instrument noise and experimental random factors often cause jagged fluctuations and irrelevant information interference in the original spectral curve. To eliminate these interferences, this embodiment uses adaptive wavelet transform to pre-process the spectrum. This method converts spectral data into approximate coefficients (characterizing low-frequency baselines) and detail coefficients (reflecting high-frequency noise) through multi-scale decomposition ( Figure 4 ), effectively achieving the synchronous suppression of high-frequency noise and low-frequency drift.
[0046] As a preferred embodiment, in order to suppress noise of different scales and retain key spectral features as much as possible, this embodiment adopts an improved adaptive threshold method for wavelet denoising. This method dynamically calculates the threshold t of each decomposition layer. j .
[0047]
[0048] Where, d j,k represents the kth detail coefficient of the jth layer wavelet, M(|d j,k |) represents the detail coefficient d j,k Median of absolute values, N j Indicates the number of detail coefficients in the jth layer.
[0049] After obtaining the thresholds of each layer, the soft threshold function is used to shrink the detail coefficients:
[0050]
[0051] Finally, the approximate coefficients and the processed detail coefficients are subjected to inverse wavelet transform to obtain the denoised spectrum curve.
[0052] Optionally, to quantitatively evaluate the denoising effect, the signal-to-noise ratio (SNR) and mean squared error (MSE) are used as evaluation indicators, and the calculation formula is as follows:
[0053]
[0054] Where x(n) represents the original spectral data, represents the spectral data after denoising, and N represents the total number of spectral bands.
[0055] S103 encodes the spectral dataset according to polar coordinate transformation to generate a two-dimensional image dataset with structural features.
[0056] It should be noted that the GAF method encodes the spectral sequence through polar coordinate transformation to generate a two-dimensional image with structural characteristics. Due to the continuity of the visible-near-infrared spectrum and the high correlation between bands, this method can effectively characterize the intrinsic relationship between reflectivity and wavelength.
[0057] Specifically, the GAF conversion process includes three key steps:
[0058] (1) Data normalization: The original spectral data X = {x1, x2, x3, ..., x n}Normalize to the interval [0,1] to eliminate amplitude differences and enhance feature sensitivity.
[0059]
[0060] (2) Polar coordinate conversion: Map the normalized data to the polar coordinate system and calculate the argument of each point to encode the spectral time series characteristics. The conversion formula is:
[0061]
[0062] (3) Constructing the GASF matrix: The Gramian Angular Summation Fields (GASF) matrix is generated based on the cosine function of the angle sum to capture the global correlation characteristics of the spectral sequence. The calculation formula is as follows:
[0063]
[0064] Finally, the GASF matrix is converted into an RGB image and used as the input of the deep learning model to achieve visual expression and efficient recognition of spectral information.
[0065] S104 constructs a first kiwifruit bruise discrimination model according to the two-dimensional image data set, thereby detecting kiwifruit bruises.
[0066] It should be noted that YOLOv8n is a lightweight target detection architecture launched by Ultralytics in 2023, which significantly reduces computational costs while maintaining high accuracy. Its core structure mainly consists of two core modules, Conv and C2f, such as Figure 5 The C2f module employs a multi-stage feature extraction structure: it first performs a convolution operation on the input feature map, then introduces multiple series-connected Bottleneck modules to achieve layer-by-layer feature extraction. The input feature map is then concatenated with the output features of each Bottleneck module through a Concat operation. Finally, another convolution is performed to achieve channel compression, outputting a feature map that matches the target dimension. This structure not only enhances the model's ability to extract and fuse multi-scale features, but also alleviates the vanishing gradient problem in deep networks through residual connections, thereby improving the model's stability and expressiveness.
[0067] Optionally, in order to further explore the focus area of the YOLOv8n model in GAF image discrimination, the gradient-weighted class activation mapping (Grad-CAM) method is used to visualize its last layer of convolutional feature maps.
[0068] Optionally, to comprehensively evaluate the model performance, we use a combination of five indicators: accuracy, recall, precision, F1 score, and model runtime. The calculation formulas for each evaluation indicator are as follows:
[0069]
[0070] In the formula, TP represents the number of positive samples correctly identified, TN represents the number of negative samples correctly identified, FN represents the number of positive samples incorrectly predicted, and FP represents the number of negative samples misclassified.
[0071] Main results and analysis:
[0072] 1) Spectral preprocessing
[0073] This embodiment uses adaptive wavelet transform to denoise the original spectrum. To determine the optimal number of decomposition layers, a healthy sample is taken as an example, and the wavelet basis function "db4" is selected. The signal-to-noise ratio (SNR) and mean square error (MSE) performance are compared at 1 to 5 decomposition levels. The results are shown in Table 1. Some decomposition coefficients are shown in Table 1. Figure 6 shown.
[0074] Table 1 Comparison of denoising effects with different decomposition layers
[0075]
[0076] As shown in Table 1, both 1-layer and 3-layer decompositions have higher SNR and lower MSE. Figure 6 As can be seen from A and B, its separation effect on high-frequency noise is limited; in contrast, Figure 6 The three-layer decomposition in C and D achieves more effective noise suppression while maintaining feature information. Therefore, considering the denoising effect and feature retention ability, the three-layer wavelet decomposition was finally selected as the optimal solution for spectral data preprocessing.
[0077] Figure 7 The data shows the changes in the spectral curve before and after wavelet transformation. After processing, the overall distribution of the spectral curve is more compact, the minor noise is significantly reduced, and the locations of characteristic peaks and troughs are clearer, which significantly improves the data quality and lays a good foundation for subsequent modeling and analysis.
[0078] 2) Model training and verification
[0079] This example uses the conventional GAF method to convert a one-dimensional spectral sequence into a two-dimensional image, capturing the local patterns, global trends, and nonlinear relationships between wavelengths in the spectrum from a spatial perspective. A total of 900 images were obtained through GAF conversion and divided into training, validation, and test sets in a 3:1:1 ratio. Subsequently, training was performed based on the YOLOv8n model with a batch size of 8 and 150 training rounds. The final model runtime was 25 minutes and 22 seconds.
[0080] Figure 8 This article demonstrates the training process of the YOLOv8n model on GAF images, including training set loss curves, validation set loss curves, and Top-1 accuracy curves. The results show that the training loss steadily decreases and converges; the validation loss also continues to decrease, demonstrating the model's good generalization ability. Furthermore, the Top-1 accuracy, which represents the proportion of predicted classes with the highest probability that match the correct class, remains stable at around 0.9. Despite some fluctuation, it demonstrates strong overall classification capability, further validating the effectiveness of the YOLOv8n model on GAF images. Table 2 shows the evaluation metrics of the YOLOv8n model on the validation and test sets.
[0081] Table 2 Evaluation indicators on the validation set and test set
[0082]
[0083] As can be seen from Table 2, the classification accuracy and recall rates of the two sets of data are both 97.22%, the precision rates are 97.35% and 97.32% respectively, and the F1 scores are both 0.97, which verifies the robustness and effectiveness of the GAF image combined with the YOLOv8n model in five different bruise time discrimination tasks.
[0084] 3) Visualization results
[0085] The results are as follows Figure 13As shown. The red area in the figure represents the image area that contributes more to the classification decision, and the blue area represents the area where the model pays less attention. Through the analysis of the Grad-CAM results of the five categories, it was found that the model's attention areas (marked with black dotted lines) are mainly concentrated in the 540-625nm and 709-952nm bands, which are consistent with the areas where the reflectance differences in the spectral curves of samples of different categories are significant. Among them, 540-625nm is in the visible light range, covering the main absorption area of chlorophyll, which can reflect the pigment content of the peel and the changes in its optical properties caused by the development of bruises; while 709-952nm belongs to the near-infrared region, which mainly characterizes the integrity of the internal tissue structure of the fruit. The reflectance of this band shows a downward trend with the passage of bruise time. This shows that the YOLOv8n model can accurately locate the image area corresponding to the key bands and effectively capture the subtle spectral changes in the evolution of fruit bruises.
[0086] In summary, the GAF method effectively enhances the spatial structure of spectral information, while the YOLOv8n model accurately identifies key feature regions at the image level. The combination of the two significantly improves the accurate identification of different degrees of bruises in Actinidia arguta, further validating the potential and value of GAF images in fruit bruise detection.
[0087] Example 2:
[0088] Figure 9 This is a flow chart of a multi-scale bruise detection method for kiwifruit provided in an embodiment of the present application. Figure 9 As shown, the method includes:
[0089] S901 obtains a spectral dataset of kiwi fruit.
[0090] S902 decomposes the spectral data set according to adaptive wavelet transform.
[0091] S903 constructs a second kiwifruit bruise discrimination model based on the spectral data set to detect kiwifruit bruises.
[0092] The initial model of the second kiwifruit bruise discrimination model includes one of: SVM, CNN, LSTM and Stacking model.
[0093] a. As a nonlinear supervised classification method, the core of SVM is to map the input data to a high-dimensional feature space through a kernel function and find the optimal classification hyperplane in this space to maximize the class interval to achieve effective classification.
[0094] b. CNN is a deep learning model that can simulate the human brain's feature learning mechanism and can automatically learn key features from raw data and achieve classification. CNN extracts local features through the convolution layer, downsamples the pooling layer to reduce the data dimension, and finally maps the learned features to the label space through the fully connected layer to complete the classification. The CNN model architecture constructed in this embodiment is as follows: Figure 10 As shown in Figure 2, the network consists of 8 layers: 1 input layer, 3 convolutional layers, 2 pooling layers, 1 fully connected layer, and 1 output layer. Each convolutional layer uses the ReLU activation function. To optimize the training process, batch normalization (BN) is performed on the outputs of all convolutional layers to accelerate convergence and mitigate internal covariate shift.
[0095] c. LSTM is a typical recurrent neural network structure, such as Figure 11 As shown in Figure 2, this network effectively captures the temporal correlation characteristics of spectral data by introducing a gating mechanism, demonstrating significant advantages in processing sequence-based tasks. The LSTM uses a forget gate to filter out redundant information, an input gate to introduce new key information, and an output gate to control the output of current information. The cell state unit is responsible for transferring long-term memory across time periods, enabling dynamic feature updates.
[0096] d. Stacking is an integrated learning strategy that combines the advantages of multiple base learners and has higher classification robustness and accuracy than a single model. The Stacking model architecture constructed in this embodiment is as follows Figure 12 As shown, three heterogeneous models, SVM, 1D-CNN, and LSTM, were selected as base learners. Each model was trained independently and output prediction probabilities. Partial Least Squares Discriminant Analysis (PLS-DA) was used as a meta-learner to fuse the outputs of the base learners. The final classification decision was made through linear projection optimization of feature combinations. This model architecture fully leverages the complementary advantages of each model in feature extraction and pattern recognition, significantly improving the model's classification performance and generalization capabilities.
[0097] 1) Model training and verification
[0098] The spectral data preprocessed in Example 1 were divided into five categories based on bruise duration: intact, bruises of 2 hours, 4 hours, 6 hours, and 8 hours. The sample order was shuffled and the SPXY algorithm was used to divide the training and test sets in a 4:1 ratio, resulting in a training set of 720 samples and a test set of 180 samples. Using the spectral data as input, four kiwifruit bruise discrimination models were constructed: SVM, LSTM, 1D-CNN, and Stacking. Their evaluation metrics on the validation and test sets are shown in Table 3.
[0099] Table 3 Comparison of evaluation indicators of each model on the test set
[0100]
[0101] Table 3 shows that among the four bruise discrimination models constructed based on full-band spectral information, the Stacking model achieves the best overall performance, with accuracy, recall, and precision reaching 97.75%, 97.78%, and 98.00%, respectively, an F1 score of 0.98, and a runtime of 49 seconds. By integrating multiple base learners, the Stacking model significantly improves its ability to recognize complex spectral features, demonstrating strong robustness and generalization. The 1D-CNN model performs second best, with accuracy, recall, and precision of 95.53%, 95.54%, and 95.71%, respectively, an F1 score of 0.96, and a runtime of 18 seconds. These results demonstrate that the convolutional architecture has a strong advantage in capturing local features in spectral data, but overall performance is still slightly lower than the Stacking model. The LSTM model demonstrates robustness in time series modeling, with an accuracy of 90.66% and a runtime of 14 seconds, significantly improving over the SVM but slightly lagging behind the 1D-CNN. In comparison, the performance of the SVM model is relatively weak. Although it only takes 3 seconds to run and has certain computational efficiency advantages, its test set accuracy is only 86.11%, the recall rate and precision rate are 86.11% and 85.92% respectively, and the F1 score is 0.86, indicating that the model has limited modeling capabilities when processing high-dimensional, nonlinear spectral data.
[0102] 2) Visualization results
[0103] To further verify the ability of each model to discriminate samples of different bruise times, this example uses the t-SNE dimensionality reduction method to perform two-dimensional visualization on the output results of each base learner and the Stacking ensemble model. The results are as follows: Figure 14 shown.
[0104] from Figure 14 It can be seen that the models have different abilities to distinguish the five types of samples (intact, 2h, 4h, 6h, 8h). Figure 14 In Figure 1, the visualization results of the SVM model show obvious overlap between classes, especially between adjacent time periods. The samples are not clearly clustered and it is difficult to form clear boundaries. This shows that its mapping mechanism based on the maximum interval is difficult to capture the dynamic characteristics of the time series and cannot effectively capture the subtle differences in the spectra of adjacent time periods of bruises. Figure 14 In B, the LSTM model shows a better clustering structure than the SVM. Most samples initially form discrete clusters, especially the integral classification is clear. However, there is still some confusion between adjacent categories such as 2h, 4h and 6h, which verifies the LSTM's gating mechanism's ability to extract temporal features, but the decision boundary is constrained by a single gradient direction. Figure 14The 1D-CNN model shown in C significantly improves the ability to distinguish. The samples in each time period form clusters with clear structures and clear boundaries. The samples in most sample classes are compactly distributed, and only a small number of samples have crossover phenomena, indicating that the convolutional structure has obvious advantages in capturing local features. Figure 14 The visualization results of the Stacking model in D are the most ideal. Samples of each category form highly separated independent clusters in two-dimensional space. The samples within the cluster are highly aggregated and the inter-class intervals are significant. In particular, they show strong separability and stability in the intact, 2h, and 8h categories, proving that its strategy of fusing multi-model feature expressions significantly improves the classification ability of complex spectral data.
[0105] In summary, the one-dimensional spectral model focuses on the efficient extraction of statistical features, has fast computing speed, and is suitable for rapid detection; while the two-dimensional image model has more advantages in feature expression richness and discrimination mechanism analysis, which helps to deeply understand the spatial distribution characteristics of bruises.
[0106] Example 3:
[0107] An embodiment of the present application further provides an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the methods of various embodiments of the present invention when running.
[0108] The above-mentioned memory may refer to a device inside a computer for storing data and programs, and may include memory, hard disk, etc., wherein the memory may be used to temporarily store running programs and data, the hard disk may be used to store programs and data for a long time, and the memory may be used to enable the computer to read and write data, as well as execute programs; the above-mentioned processor may be responsible for executing instructions in computer programs and performing data processing, and may be responsible for controlling and executing various operations, including arithmetic operations, logical operations, data transmission, etc.
[0109] Example 4:
[0110] An embodiment of the present application further provides a computer-readable storage medium, which includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in various embodiments of the present invention.
[0111] The above-mentioned computer storage medium may refer to a medium in a computer memory used to store certain discontinuous physical quantities. Computer storage media mainly include semiconductors, magnetic cores, magnetic drums, magnetic tapes, laser disks, etc. The stored program included in the computer-readable storage medium may be a set of instructions that can be recognized and executed by a computer, running on an electronic computer, and serving as an information tool to meet certain needs of people.
[0112] Example 5:
[0113] An embodiment of the present application further provides a computer program product, including a computer program, which implements the methods in various embodiments of the present invention when executed by a processor.
[0114] The above-mentioned computer program product may refer to a software program that has been written, tested and released, which can be run on a computer or other device. The computer program product may include an application, an operating system, tool software, etc., which is used to implement specific functions or solve specific problems.
[0115] Example 6:
[0116] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0117] The above-mentioned non-volatile computer-readable storage medium may refer to a medium for storing data. The non-volatile computer-readable storage medium can keep the data from being lost when the power is off, and can be used to store long-term data, such as operating systems, applications and user files. The non-volatile storage medium may include hard disk drives, solid-state drives, optical disks and flash memory storage devices, etc.
[0118] Example 7:
[0119] The embodiments of the present application further provide a computer program, which implements the methods in the above-mentioned embodiments of the present invention when executed by a processor.
[0120] The above-mentioned computer program may refer to a collection of instructions used to tell a computer to perform a specific task or operation. A computer program may be written by a programmer using a specific programming language and may include algorithms, data structures, logic, and control flows. Computer programs may be used for a variety of purposes, including application software, operating systems, and the like.
[0121] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0122] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0123] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0124] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0125] 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, 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 and includes several instructions for enabling a computer device (which can be a personal computer, server or 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, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0126] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A multi-scale bruise detection method for kiwifruit, characterized in that: include: Get the kiwifruit spectral dataset; decomposing the spectral data set according to an adaptive wavelet transform; encoding the spectral dataset according to polar coordinate transformation to generate a two-dimensional image dataset with structural features; A first kiwifruit bruise discrimination model is constructed based on the two-dimensional image data set to detect kiwifruit bruises.
2. The multi-scale bruise detection method for kiwifruit according to claim 1, characterized in that: The spectral data set includes a plurality of spectral data; and decomposing the spectral data set according to the adaptive wavelet transform includes: The spectral data is converted into approximate coefficients and detail coefficients through multi-scale decomposition to obtain a spectral curve, wherein the approximate coefficients represent the low-frequency baseline and the detail coefficients reflect the high-frequency noise.
3. The multi-scale bruise detection method for kiwifruit according to claim 2, characterized in that: The spectrum data is decomposed to include multiple decomposition layers, each of which corresponds to at least one approximation coefficient and at least one detail coefficient. The spectrum data is converted into the approximation coefficient and the detail coefficient by multi-scale decomposition to obtain a spectrum curve, including: According to the threshold value of the decomposition layer, a soft threshold function is used to shrink the detail coefficients corresponding to the decomposition layer; Based on the multiple decomposition layers, inverse wavelet transform is performed on the approximate coefficients corresponding to the decomposition layers and the detail coefficients corresponding to each processed decomposition layer to obtain a denoised spectrum curve.
4. The multi-scale bruise detection method for kiwifruit according to claim 3, characterized in that: The threshold value is calculated as follows: Where, d j,k represents the kth detail coefficient of the jth layer wavelet, M(|d j,k |) represents the detail coefficient d j,k Median of absolute values, N j Indicates the number of detail coefficients in the jth layer.
5. The multi-scale bruise detection method for kiwifruit according to claim 3, characterized in that: The soft threshold function is used to shrink the detail coefficients corresponding to the decomposition layer, as shown in the following formula: Where, d j,k represents the kth detail coefficient of the jth layer wavelet, t j Represents the dynamic threshold of the j-th decomposition layer.
6. The multi-scale bruise detection method for kiwifruit according to claim 1, characterized in that: The spectral dataset includes a plurality of spectral data; encoding the spectral dataset according to polar coordinate transformation to generate a two-dimensional image dataset with structural features includes: Normalizing the spectral data, mapping it to a polar coordinate system, and calculating the argument of each point; Generate the Gram angle sum field matrix based on the cosine function of the angle sum and convert it to an RGB image.
7. The multi-scale bruise detection method for kiwifruit according to claim 1, characterized in that: The initial model of the first kiwifruit bruise discrimination model is the YOLOv8n model.
8. A multi-scale bruise detection method for kiwifruit, characterized in that: include: Get the kiwifruit spectral dataset; decomposing the spectral data set according to an adaptive wavelet transform; A second kiwifruit bruise discrimination model is constructed based on the spectral data set to detect kiwifruit bruises.
9. The multi-scale bruise detection method for kiwifruit according to claim 8, characterized in that: The initial model of the second kiwifruit bruise discrimination model includes one of: SVM, CNN, LSTM and Stacking model.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is run, the kiwifruit multi-scale bruise detection method according to any one of claims 1 to 9 is executed in a processor of a device where the program is controlled.
Citation Information
Patent Citations
Method and device for detecting slight bruises of persimmons based on hyperspectral imaging
CN114965486A
Nondestructive testing method for early recessive damage of kiwi fruit based on structured hyperspectral system
CN118583789A
Kiwi fruit disease identification method, device and equipment based on hyperspectrum and medium
CN119741599A