Fruit nondestructive testing method and system
By denoising the fruit spectral curve and extracting characteristic wavelengths, the influence of noise and irrelevant bands on detection accuracy in fruit non-destructive detection is solved, and higher detection accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202411638399.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-17
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In fruit non-destructive testing, the influence of noise and irrelevant bands on detection accuracy leads to abnormal fluctuations and offsets in the spectral data curve, affecting the accuracy of the detection results.
By collecting the spectral curves at different positions of the fruit, the average spectral curve is calculated, and the sub-average spectral curves within the preset range are intercepted from them for modal decomposition to obtain the eigenmodal component. Each spectral curve is denoised based on the intrinsic modal component and the average spectral curve, and the denoised average spectral curve is used as the characteristic curve of the fruit, and the characteristic wavelength is extracted to identify the quality of the fruit.
The impact of noise on the spectral curve is reduced, the accuracy of detection is improved, and the impact of no dry wavelength is reduced when selecting characteristic wavelengths is reduced, and the calculation amount is reduced.
Smart Images

Figure CN119510327A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of agriculture, and in particular to a fruit nondestructive detection method and system. Background Art
[0002] Traditional quality inspection methods usually rely on physical destruction or chemical testing, which requires cutting the fruit or extracting samples for analysis, which is not only time-consuming and labor-intensive, but also causes the fruit to be unable to continue to circulate or sell. In contrast, non-destructive testing methods quickly measure the internal and external quality of fruits through non-invasive means, and realize the detection of indicators such as maturity, sugar content, acidity, moisture content and hardness without destroying the fruit. In recent years, with the development of spectral technology, spectral analysis has become an important non-destructive testing method. By collecting spectral information on the surface and inside of the fruit, the physiological and chemical properties of the fruit can be quickly evaluated. Spectral non-destructive testing not only saves time and cost, but also greatly improves the detection efficiency and accuracy. Through non-destructive testing methods, the quality control of fruits is more accurate and reliable.
[0003] Since the measurement process is affected by many factors such as ambient light, noise, and instrument stability, the collected spectral data often contains a lot of noise, which can cause abnormal fluctuations and deviations in the spectral data curve, causing the collected spectral curve to deviate from the actual situation. In addition, when using hyperspectral to detect fruit quality, due to the large number of bands, some bands are useless for quality identification and may even cause errors, which requires finding characteristic bands that are highly correlated with fruit quality. Summary of the invention
[0004] In view of the influence of noise and incoherent bands on the detection accuracy in the current non-destructive detection of fruits, a first aspect provides a non-destructive detection method for fruits, the method comprising: Collect spectral curves at different positions of the fruit, calculate the average spectral curve of all spectral curves; intercept a sub-average spectral curve within a preset range from the average spectral curve, perform modal decomposition on the sub-average spectral curve to obtain an eigenmode component, and denoise each spectral curve based on the eigenmode component and the average spectral curve; The average spectral curve of all spectral curves after denoising is used as the characteristic curve of the fruit, the characteristic curve is annotated according to the quality of the fruit to obtain a training sample set, and the characteristic wavelength is extracted from the training sample set; The characteristic wavelength of the fruit to be tested is obtained, and the value of the characteristic wavelength is used to identify the quality of the fruit.
[0005] Preferably, the denoising of each spectral curve based on the intrinsic mode component and the average spectral curve of the spectral curve is specifically as follows: Calculating the absolute difference between the entropy values of the first eigenmode component of the sub-spectral curve of the spectral curve and the first eigenmode component of the sub-average spectral curve; Calculate the ratio of the absolute difference to the entropy value when the wavelength reflectivity is not within the preset range, obtain the Gaussian white noise intensity added when the spectrum curve is modally decomposed based on the ratio, and use the Gaussian white noise intensity to perform modal decomposition on the spectrum curve to obtain the eigenmode component of the spectrum curve; The mean square error between the spectral curve and the average spectral curve is obtained, and the target eigenmode component and the weight of the target eigenmode component are determined from the eigenmode components based on the mean square error. The spectral curve is denoised using the target eigenmode component and the weight of the target eigenmode component.
[0006] Preferably, the determining of the target eigenmode component and the weight of the target eigenmode component from the eigenmode components based on the mean square error is specifically: Determine the interval to which the mean square error belongs, and determine the number of target intrinsic mode components corresponding to the interval and the weight of each target intrinsic mode component.
[0007] Preferably, the extracting characteristic wavelengths from the training sample set is specifically: Obtain the number of annotated labels in the training sample set, and cluster the reflectances of the same wavelength in the training sample set into clusters of the number of annotated labels; Calculate the number of samples of the same annotation type in each cluster, and take the annotation type with the largest number of samples as the type of the cluster; if the types of each cluster in the cluster are different, calculate the proportion of the number of samples with the same cluster type in the cluster, and determine whether to use the wavelength as the characteristic wavelength based on the proportion of all clusters in the cluster; if there are two or more clusters of the same type in the cluster, do not use the wavelength as the characteristic wavelength.
[0008] Preferably, the determining whether to use the wavelength as a characteristic wavelength based on the proportion of all clusters in the clustering is specifically: The sum of the proportions of all clusters in the cluster is calculated to obtain the characteristic value of the cluster. If the characteristic value of the cluster is greater than the average of the characteristic values of all clusters, the wavelength is taken as the characteristic wavelength.
[0009] In a second aspect, a fruit non-destructive detection system is provided, characterized in that the system comprises: A denoising module is used to collect spectral curves at different positions of the fruit, calculate the average spectral curve of all spectral curves; and intercept a sub-average spectral curve within a preset range from the average spectral curve, perform modal decomposition on the sub-average spectral curve to obtain an eigenmode component, and denoise each spectral curve based on the eigenmode component and the average spectral curve; A feature extraction module is used to take the average spectral curve of all spectral curves after denoising as the characteristic curve of the fruit, annotate the characteristic curve according to the quality of the fruit to obtain a training sample set, and extract characteristic wavelengths from the training sample set; The quality identification module is used to obtain the characteristic wavelength of the fruit to be tested and identify the quality of the fruit using the value of the characteristic wavelength.
[0010] Preferably, the denoising of each spectral curve based on the intrinsic mode component and the average spectral curve of the spectral curve is specifically as follows: Calculating the absolute difference between the entropy values of the first eigenmode component of the sub-spectral curve of the spectral curve and the first eigenmode component of the sub-average spectral curve; Calculate the ratio of the absolute difference to the entropy value when the wavelength reflectivity is not within the preset range, obtain the Gaussian white noise intensity added when the spectrum curve is modally decomposed based on the ratio, and use the Gaussian white noise intensity to perform modal decomposition on the spectrum curve to obtain the eigenmode component of the spectrum curve; The mean square error between the spectral curve and the average spectral curve is obtained, and the target eigenmode component and the weight of the target eigenmode component are determined from the eigenmode components based on the mean square error. The spectral curve is denoised using the target eigenmode component and the weight of the target eigenmode component.
[0011] Preferably, the determining of the target eigenmode component and the weight of the target eigenmode component from the eigenmode components based on the mean square error is specifically: Determine the interval to which the mean square error belongs, and determine the number of target intrinsic mode components corresponding to the interval and the weight of each target intrinsic mode component.
[0012] Preferably, the extracting characteristic wavelengths from the training sample set is specifically: Obtain the number of annotated labels in the training sample set, and cluster the reflectances of the same wavelength in the training sample set into clusters of the number of annotated labels; Calculate the number of samples of the same annotation type in each cluster, and take the annotation type with the largest number of samples as the type of the cluster; if the types of each cluster in the cluster are different, calculate the proportion of the number of samples with the same cluster type in the cluster, and determine whether to use the wavelength as the characteristic wavelength based on the proportion of all clusters in the cluster; if there are two or more clusters of the same type in the cluster, do not use the wavelength as the characteristic wavelength.
[0013] Preferably, the determining whether to use the wavelength as a characteristic wavelength based on the proportion of all clusters in the clustering is specifically: The sum of the proportions of all clusters in the cluster is calculated to obtain the characteristic value of the cluster. If the characteristic value of the cluster is greater than the average of the characteristic values of all clusters, the wavelength is taken as the characteristic wavelength.
[0014] In a third aspect, a computer program is provided, which, when executed by a processor, implements the method according to the first aspect.
[0015] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0016] The present invention utilizes the intrinsic mode classification of the sub-average spectral curve within a preset range in the spectral curve and the average spectral curve of the same fruit to denoise each spectral curve, and then uses the average spectral curve of all denoised spectral curves as the characteristic curve of the fruit, thereby reducing the influence of noise on the spectral curve; in addition, when selecting the characteristic wavelength, a clustering method is used to judge the influence of the wavelength on the distinction of different qualities, thereby selecting the characteristic wavelength with greater influence, reducing the influence of the irrelevant wavelength, reducing the amount of calculation, and improving the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of Embodiment 1; Figure 2 is a schematic diagram of the fruit spectrum curve; Figure 3 Schematic diagram of the average spectral curve of fruits. DETAILED DESCRIPTION
[0018] In order to enable persons skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only one or more partial embodiments of this specification, rather than all embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0019] It should be noted that, in the absence of conflict, one or more embodiments and features in the embodiments in this specification can be combined with each other. One or more embodiments of this specification will be described in detail below with reference to the drawings and in combination with the embodiments.
[0020] The first implementation is Figure 1 As shown, this embodiment provides a fruit non-destructive detection method, the method comprising: S1, collecting spectral curves at different positions of the fruit, calculating the average spectral curve of all spectral curves; and intercepting a sub-average spectral curve within a preset range from the average spectral curve, performing modal decomposition on the sub-average spectral curve to obtain an eigenmode component, and denoising each spectral curve based on the eigenmode component and the average spectral curve; When performing nondestructive testing on fruit quality, a hyperspectral method is used to obtain spectral curves at different positions of the fruit. Each position corresponds to a spectral curve. When there are multiple positions, multiple spectral curves are obtained. Figure 2 A schematic diagram showing hyperspectral curves collected at different positions of a fruit. Figure 2 Each curve is a spectral curve at a position, and the reflectivity corresponding to each wavelength in the spectral curve is the reflectivity when the fruit is illuminated with this wavelength. The average spectral curve of all positions of a fruit is calculated to obtain the average spectral curve of the fruit, such as Figure 3 As shown. For the average spectral curve of this fruit, the curve within the preset range is intercepted to obtain a sub-average spectral curve, wherein the sub-average spectral curve is a part of the average spectral curve. In one embodiment, the preset range is an area centered on 500nm, and more specifically, a preset range is [450-550]. In another embodiment, the preset range is [400-500] or [400-550]. The difference between the curves within the preset range in all spectral curves is relatively small, and the average spectral curve of the sub-spectral curve can eliminate a part of the white noise. Then, the sub-average spectral curve is modally decomposed to obtain the intrinsic mode component (IMF), and each spectral curve is denoised according to the intrinsic mode component and the average spectral curve of the spectral curve. Wherein, the average spectral curve is calculated by adding and averaging the reflectances of the same wavelength to obtain the reflectance corresponding to the wavelength on the average spectral curve.
[0021] In one embodiment, the denoising of each spectral curve based on the intrinsic mode component and the average spectral curve of the spectral curve is specifically as follows: The absolute difference between the entropy values of the first eigenmode component of the sub-spectral curve of the spectral curve and the first eigenmode component of the sub-average spectral curve is calculated; wherein the sub-spectral curve of the spectral curve is a curve portion of the spectral curve within a preset range.
[0022] Calculate the ratio of the absolute difference to the entropy value when the wavelength reflectivity is not within the preset range, obtain the Gaussian white noise intensity added when the spectrum curve is modally decomposed based on the ratio, and use the Gaussian white noise intensity to perform modal decomposition on the spectrum curve to obtain the eigenmode component of the spectrum curve; The mean square error between the spectral curve and the average spectral curve is obtained, and the target eigenmode component and the weight of the target eigenmode component are determined from the eigenmode components based on the mean square error. The spectral curve is denoised using the target eigenmode component and the weight of the target eigenmode component.
[0023] For each spectral curve, extract the first intrinsic mode component (IMF1) of its sub-spectral curve and calculate its entropy value. Similarly, extract the first intrinsic mode component (IMF1) of the sub-average spectral curve and calculate its entropy value, and calculate the absolute difference between the entropy values of the two. The first intrinsic mode component (IMF1) usually contains higher-frequency components in the signal, which is more noise. Since the sub-average spectral curve is calculated by averaging multiple sub-spectra, some white noise can be eliminated. Comparing the entropy values of the two can quantify the difference between a single spectral curve and the overall characteristics. If the difference is large, it means that the spectral curve contains more white noise. When decomposing the mode, add more or stronger white noise to eliminate the white noise.
[0024] Calculate the ratio of the absolute difference to the entropy value when the reflectance of wavelengths in the preset range is different, wherein the entropy value when the reflectance of different wavelengths in the preset range is different is the maximum value of the entropy value possible in the preset range, when the values in the preset range are different, the entropy value is the largest, for example, when the five data are the same, the entropy value is 0, when they are different, the entropy value is the largest. The specific calculation method of the entropy value when the reflectance of different wavelengths in the preset range is different is to assign a different reflectance to each wavelength in the preset range, and the reflectance of all wavelengths in the preset range is different, and then calculate the entropy value to obtain the entropy value when the reflectance of different wavelengths in the preset range is different.
[0025] Then, based on the ratio, the Gaussian white noise intensity added when the spectrum curve is subjected to modal decomposition is obtained. For example, if the ratio is 0.2 and the default Gaussian white noise intensity is A, the Gaussian white noise intensity added to the spectrum curve is 0.2A, wherein the Gaussian white noise intensity is the size of the Gaussian white noise value. In another embodiment, the variance in the Gaussian white noise calculation formula is used as the Gaussian white noise intensity. For example, the original variance is A, and the recalculated variance is 0.2A. If the ratio is larger, it means that the spectrum curve is more complex, and modal aliasing is more likely to occur in modal decomposition. By increasing the Gaussian white noise intensity, the modal components are more independent and the decomposition effect is better.
[0026] After the modal decomposition of the spectrum curve, the mean square error (MSE) between each spectrum curve and the average spectrum curve is calculated. If the mean square error is large, it means that there may be more noise components in the modal components of this spectrum curve, and the deviation from the overall trend is large. In the modal components, the first few modal components often contain more noise. If the mean square error is large, more modal components are selected, otherwise the modal components can be reduced. In one embodiment, the interval to which the mean square error belongs is determined, and the number of target intrinsic modal components corresponding to the interval and the weight of each target intrinsic modal component are determined. More specifically, it is divided into three intervals. The mean square error of the first interval is small, the number of target intrinsic modal components is 1, and the weight is 1; the mean square error of the second interval is medium, the number of target intrinsic modal components is 2, and the weights are 1 and 0.5 respectively; the mean square error of the third interval is large, the number of target intrinsic modal components is 2, and the weights are all 1. Among them, when the number of target intrinsic mode components is 1, the first intrinsic mode component (IMF1) is selected as the target intrinsic mode component; when the number of target intrinsic mode components is 2, IMF1 and IMF2 are selected as the target intrinsic mode components, and the weight of IMF1 is 1, and the weight of IMF2 is 0.5 in the second interval and 1 in the third interval.
[0027] The determination of the above target intrinsic mode components and weights is only an example. In another example, the target intrinsic mode components and the weights of the target intrinsic mode components are used to denoise the spectral curve. Specifically, IMF1 is used as the target intrinsic mode component, and the weight is determined according to the mean square error. If the mean square error is large, the weight is large, otherwise the weight is small.
[0028] After obtaining the target intrinsic mode component and weight, the denoised spectral curve is obtained by subtracting the product of the target intrinsic mode component and the weight from the curve.
[0029] S2, taking the average spectral curve of all spectral curves after denoising as the characteristic curve of the fruit, annotating the characteristic curve according to the quality of the fruit to obtain a training sample set, and extracting characteristic wavelengths from the training sample set; After the spectral curves at different positions of a fruit are denoised, the average spectral curve is calculated and used as the characteristic curve of the fruit. In the above manner, each fruit has a characteristic curve. For example, if the above operation is performed on 20 apples, each of the 20 apples will have a characteristic curve. Different apples have different qualities, such as good, medium, or poor, or sweet, sour, etc. The characteristic curve can be marked according to the quality of the fruit. For example, if an apple is actually very sweet, the characteristic curve of this apple is marked as sweet.
[0030] The hyperspectral spectrum contains many bands, some of which are helpful for identifying fruit quality, while some are not helpful or even counterproductive. In addition, different varieties of fruits have different reflectivities at different wavelengths, so characteristic wavelengths are further extracted based on the training sample set.
[0031] In an optional embodiment, the extracting characteristic wavelengths from the training sample set is specifically: Obtain the number of annotated labels in the training sample set, and cluster the reflectances of the same wavelength in the training sample set into clusters of the number of annotated labels; Calculate the number of samples with the same label in each cluster, and take the label with the largest number of samples as the type of the cluster; if the types of each cluster in the cluster are different, calculate the proportion of the number of samples with the same cluster type in the cluster, and determine whether to use the wavelength as the characteristic wavelength based on the proportion of all clusters in the cluster; if there are two or more clusters with the same type in the cluster, the wavelength will not be used as the characteristic wavelength.
[0032] Extract the number of annotated label types from the training sample set. For example, if the fruit quality is divided into excellent, medium and poor, the number of label types is 4. Cluster the reflectance of different samples but the same wavelength in the training sample set into clusters equal to the number of label types. For example, if there are 4 label types, the reflectance value of this wavelength is clustered into 4 clusters. In each cluster cluster, count the number of samples belonging to different label types, and select the label type with the largest number as the type of the cluster. For example, a cluster contains 7 excellent, 2 good, and 1 medium, then the type of the cluster is excellent. If the type corresponding to each cluster of the cluster is not repeated, that is, the type of each cluster is different, calculate the proportion of samples in each cluster belonging to the cluster type. For example, a cluster is of excellent type and contains 10 samples, of which 8 samples are marked as excellent, accounting for 80%. Calculate the proportion of each cluster, and then obtain the wavelength clustering situation, and determine whether to use the wavelength as a characteristic wavelength according to the proportion of all clusters in the cluster. However, if two or more clusters in a cluster have the same type, it means that the wavelength is not good at distinguishing different types, and this wavelength is not used as a characteristic wavelength.
[0033] In yet another embodiment, the determining whether to use the wavelength as a characteristic wavelength based on the proportion of all clusters in the clustering is specifically: The sum of the proportions of all clusters in the cluster is calculated to obtain the characteristic value of the cluster. If the characteristic value of the cluster is greater than the average of the characteristic values of all clusters, the wavelength is taken as the characteristic wavelength.
[0034] The proportion of each cluster in the cluster is accumulated, and the total proportion of all clusters is calculated as the cluster characteristic value. For example, if there are 3 clusters, their proportions are 80%, 90%, and 70% respectively, and the cluster characteristic value is 2.4. The better the clustering effect, the larger the cluster characteristic value. If the type of each cluster in a wavelength cluster is different, the cluster characteristic value will be calculated in the above way, that is, only when the type of each cluster in the cluster is different, the cluster characteristic value of this wavelength will be calculated, and the average value of the cluster characteristic values of all wavelengths with cluster characteristic values will be calculated. If the cluster characteristic value is greater than the average value of the characteristic values of all clusters, the wavelength will be used as the characteristic wavelength. For example, there are 10 bands, and after 7 bands are clustered as described above, the type of each cluster is different, then the cluster characteristic values of the clusters of these 7 bands are calculated and averaged. The bands with cluster characteristic values greater than the average among these 7 bands are used as characteristic bands.
[0035] S3, obtaining the characteristic wavelength of the fruit to be tested, and identifying the quality of the fruit using the value of the characteristic wavelength.
[0036] After determining the characteristic band, the characteristic vector of the training sample set is obtained for each extracted characteristic band value in the training sample set, and the model is trained using the characteristic vector and the sample annotation. Then, the characteristic wavelength of the fruit to be tested is extracted in the same way and input into the trained model to obtain the quality of the fruit to be tested. The model includes but is not limited to logistic regression, MLP, decision tree, random forest, etc. The training and use of the model belong to the existing technology and will not be repeated here.
[0037] In a second aspect, a fruit non-destructive detection system is provided, characterized in that the system comprises: A denoising module is used to collect spectral curves at different positions of the fruit, calculate the average spectral curve of all spectral curves; and intercept a sub-average spectral curve within a preset range from the average spectral curve, perform modal decomposition on the sub-average spectral curve to obtain an eigenmode component, and denoise each spectral curve based on the eigenmode component and the average spectral curve; A feature extraction module is used to take the average spectral curve of all spectral curves after denoising as the characteristic curve of the fruit, annotate the characteristic curve according to the quality of the fruit to obtain a training sample set, and extract characteristic wavelengths from the training sample set; The quality identification module is used to obtain the characteristic wavelength of the fruit to be tested and identify the quality of the fruit using the value of the characteristic wavelength.
[0038] Preferably, the denoising of each spectral curve based on the intrinsic mode component and the average spectral curve of the spectral curve is specifically as follows: Calculating the absolute difference between the entropy values of the first eigenmode component of the sub-spectral curve of the spectral curve and the first eigenmode component of the sub-average spectral curve; Calculate the ratio of the absolute difference to the entropy value when the wavelength reflectivity is not within the preset range, obtain the Gaussian white noise intensity added when the spectrum curve is modally decomposed based on the ratio, and use the Gaussian white noise intensity to perform modal decomposition on the spectrum curve to obtain the eigenmode component of the spectrum curve; The mean square error between the spectral curve and the average spectral curve is obtained, and the target eigenmode component and the weight of the target eigenmode component are determined from the eigenmode components based on the mean square error. The spectral curve is denoised using the target eigenmode component and the weight of the target eigenmode component.
[0039] Preferably, the determining of the target eigenmode component and the weight of the target eigenmode component from the eigenmode components based on the mean square error is specifically: Determine the interval to which the mean square error belongs, and determine the number of target intrinsic mode components corresponding to the interval and the weight of each target intrinsic mode component.
[0040] Preferably, the extracting characteristic wavelengths from the training sample set is specifically: Obtain the number of annotated labels in the training sample set, and cluster the reflectances of the same wavelength in the training sample set into clusters of the number of annotated labels; Calculate the number of samples of the same annotation type in each cluster, and take the annotation type with the largest number of samples as the type of the cluster; if the types of each cluster in the cluster are different, calculate the proportion of the number of samples with the same cluster type in the cluster, and determine whether to use the wavelength as the characteristic wavelength based on the proportion of all clusters in the cluster; if there are two or more clusters of the same type in the cluster, do not use the wavelength as the characteristic wavelength.
[0041] Preferably, the determining whether to use the wavelength as a characteristic wavelength based on the proportion of all clusters in the clustering is specifically: The sum of the proportions of all clusters in the cluster is calculated to obtain the characteristic value of the cluster. If the characteristic value of the cluster is greater than the average of the characteristic values of all clusters, the wavelength is taken as the characteristic wavelength.
[0042] Embodiment 3: This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in Embodiment 1 is implemented.
[0043] Embodiment 4: This embodiment provides a computer program, which implements the method described in Embodiment 1 when executed by a processor.
[0044] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, playback end, image acquisition end, executable program code, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0045] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0046] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A fruit nondestructive testing method, characterized in that: The method comprises: Collect spectral curves at different positions of the fruit, calculate the average spectral curve of all spectral curves; intercept a sub-average spectral curve within a preset range from the average spectral curve, perform modal decomposition on the sub-average spectral curve to obtain an eigenmode component, and denoise each spectral curve based on the eigenmode component and the average spectral curve; The average spectral curve of all spectral curves after denoising is used as the characteristic curve of the fruit, the characteristic curve is annotated according to the quality of the fruit to obtain a training sample set, and the characteristic wavelength is extracted from the training sample set; The characteristic wavelength of the fruit to be tested is obtained, and the value of the characteristic wavelength is used to identify the quality of the fruit.
2. The method according to claim 1, characterized in that The denoising of each spectral curve based on the intrinsic mode component and the average spectral curve of the spectral curve is specifically as follows: Calculating the absolute difference between the entropy values of the first eigenmode component of the sub-spectral curve of the spectral curve and the first eigenmode component of the sub-average spectral curve; Calculate the ratio of the absolute difference to the entropy value when the wavelength reflectivity is not within the preset range, obtain the Gaussian white noise intensity added when the spectrum curve is modally decomposed based on the ratio, and use the Gaussian white noise intensity to perform modal decomposition on the spectrum curve to obtain the eigenmode component of the spectrum curve; The mean square error between the spectral curve and the average spectral curve is obtained, and the target eigenmode component and the weight of the target eigenmode component are determined from the eigenmode components based on the mean square error. The spectral curve is denoised using the target eigenmode component and the weight of the target eigenmode component.
3. The method according to claim 2, characterized in that The method of determining the target eigenmode component and the weight of the target eigenmode component from the eigenmode components based on the mean square error is specifically as follows: Determine the interval to which the mean square error belongs, and determine the number of target intrinsic mode components corresponding to the interval and the weight of each target intrinsic mode component.
4. The method according to claim 1, characterized in that The extracting of characteristic wavelengths from the training sample set is specifically as follows: Obtain the number of annotated labels in the training sample set, and cluster the reflectances of the same wavelength in the training sample set into clusters of the number of annotated labels; Calculate the number of samples of the same annotation type in each cluster, and take the annotation type with the largest number of samples as the type of the cluster; If the types of each cluster in the cluster are different, the proportion of the number of samples with the same cluster type in the cluster is calculated, and whether to use the wavelength as the characteristic wavelength is determined based on the proportion of all clusters in the cluster; If there are two or more clusters of the same type in the clustering, the wavelength is not used as the characteristic wavelength.
5. The method according to claim 4, characterized in that The determining whether to use the wavelength as a characteristic wavelength based on the proportion of all clusters in the clustering is specifically as follows: The sum of the proportions of all clusters in the cluster is calculated to obtain the characteristic value of the cluster. If the characteristic value of the cluster is greater than the average of the characteristic values of all clusters, the wavelength is taken as the characteristic wavelength.
6. A fruit non-destructive testing system, characterized in that: The system comprises: A denoising module is used to collect spectral curves at different positions of the fruit, calculate the average spectral curve of all spectral curves; and intercept a sub-average spectral curve within a preset range from the average spectral curve, perform modal decomposition on the sub-average spectral curve to obtain an eigenmode component, and denoise each spectral curve based on the eigenmode component and the average spectral curve; A feature extraction module is used to take the average spectral curve of all spectral curves after denoising as the characteristic curve of the fruit, annotate the characteristic curve according to the quality of the fruit to obtain a training sample set, and extract characteristic wavelengths from the training sample set; The quality identification module is used to obtain the characteristic wavelength of the fruit to be tested and identify the quality of the fruit using the value of the characteristic wavelength.
7. The system according to claim 6, characterized in that The denoising of each spectral curve based on the intrinsic mode component and the average spectral curve of the spectral curve is specifically as follows: Calculating the absolute difference between the entropy values of the first eigenmode component of the sub-spectral curve of the spectral curve and the first eigenmode component of the sub-average spectral curve; Calculate the ratio of the absolute difference to the entropy value when the wavelength reflectivity is not within the preset range, obtain the Gaussian white noise intensity added when the spectrum curve is modally decomposed based on the ratio, and use the Gaussian white noise intensity to perform modal decomposition on the spectrum curve to obtain the eigenmode component of the spectrum curve; The mean square error between the spectral curve and the average spectral curve is obtained, and the target eigenmode component and the weight of the target eigenmode component are determined from the eigenmode components based on the mean square error. The spectral curve is denoised using the target eigenmode component and the weight of the target eigenmode component.
8. The system according to claim 7, characterized in that The method of determining the target eigenmode component and the weight of the target eigenmode component from the eigenmode components based on the mean square error is specifically as follows: Determine the interval to which the mean square error belongs, and determine the number of target intrinsic mode components corresponding to the interval and the weight of each target intrinsic mode component.
9. The system according to claim 6, characterized in that The extracting of characteristic wavelengths from the training sample set is specifically as follows: Obtain the number of annotated labels in the training sample set, and cluster the reflectances of the same wavelength in the training sample set into clusters of the number of annotated labels; Calculate the number of samples of the same annotation type in each cluster, and take the annotation type with the largest number of samples as the type of the cluster; If the types of each cluster in the cluster are different, the proportion of the number of samples with the same cluster type in the cluster is calculated, and whether to use the wavelength as the characteristic wavelength is determined based on the proportion of all clusters in the cluster; If there are two or more clusters of the same type in the clustering, the wavelength is not used as the characteristic wavelength.
10. A computer program, characterized in that When the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 5.