Rapid food sample quality detection method based on hyperspectral technology

The improved density peak clustering algorithm processed the hyperspectral information, which solved the problem of noise impact in food sample detection and achieved improved accuracy of food sample ingredient analysis.

CN119198645AInactive Publication Date: 2024-12-27DALIAN DEWANG TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411697513.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2024-12-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing hyperspectral technology in food sample quality detection due to noise, resulting in differences in the reflection spectrum and the reflection spectrum of substances, affecting the accuracy of the analysis results.

Method used

The improved density peak clustering algorithm (DPC algorithm) is used to process hyperspectral information, and the peak segmentation threshold of reflectivity waves, spectral vector construction, differential fluctuation coefficient calculation and histogram clustering are used to separate the peak value of the true reflected wave and noise, and improve the Accuracy of component analysis.

Benefits of technology

Effectively eliminate noise, improve the accuracy of food sample ingredient analysis, and ensure the accuracy and reliability of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119198645A_ABST
    Figure CN119198645A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of spectrum detection, in particular to a rapid food sample quality detection method based on a hyperspectral technology, which comprises the following steps: acquiring a plurality of reflection spectrums of a food sample, and analyzing and calculating to obtain an information amount; dividing into a real reflectivity crest value and a noise reflectivity crest value based on the information amount; constructing a spectral vector based on a real reflectivity crest value and the wavelength set to calculate difference, constructing a reflectivity sequence based on an information amount, calculating a difference fluctuation coefficient to construct a feature set, converting the feature set into a histogram, calculating a cutoff distance of the feature set based on the histogram, and calculating a reflection coefficient; clustering the feature set based on a truncation distance and a density peak clustering algorithm to obtain a plurality of clusters; the elemental composition of each cluster is determined based on the reflectance spectra of the various food sample elements to perform composition analysis of the food sample. According to the method, the hyperspectral information is processed by improving the DPC algorithm, so that the accuracy of food sample sorting is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of spectrum detection, and in particular to a method for rapid detection of food sample quality based on hyperspectral technology. Background Art

[0002] With the continuous improvement of living standards, food quality and safety issues have also attracted much attention. The increasing pollution of the natural environment will lead to the enrichment of harmful components in agricultural products themselves. At the same time, a certain amount of additives are usually added during the fine processing of food, making the food quality and safety issues more serious. Therefore, in order to ensure food quality, it is necessary to analyze and test food quality quickly and accurately.

[0003] Hyperspectral technology is usually used for rapid analysis of existing food samples. However, after the existing hyperspectral technology obtains the reflection spectrum of the food sample, due to the influence of various factors, the reflection spectrum will contain a lot of noise, resulting in a difference between the reflection spectrum of the food sample and the reflection spectrum of the substance corresponding to the food sample, affecting the analysis results of the substance corresponding to the food sample. Summary of the invention

[0004] In view of the above problems, the present application provides a method for rapid detection of food sample quality based on hyperspectral technology, which improves the accuracy of food sample component analysis by processing hyperspectral information through improving the DPC algorithm (density peak clustering algorithm).

[0005] The present application embodiment provides a method for rapid detection of food sample quality based on hyperspectral technology, including: Acquiring hyperspectral information of a food sample, wherein the hyperspectral information is a plurality of reflection spectra; Preprocessing each of the reflection spectra to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and performing information analysis and calculation on each reflectivity peak value to obtain the amount of information of each reflectivity peak value; For each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each of the reflectivity peak values, and the multiple reflectivity peak values ​​are divided into true reflectivity peak values ​​and noise reflectivity peak values ​​by using the reflectivity peak segmentation threshold; Constructing a wavelength set based on the wavelengths corresponding to the true reflectivity peak values ​​of all reflection spectra; constructing a spectrum vector for each reflection spectrum based on the true reflectivity peak value and the wavelength set; For each of the reflection spectrum, calculating the difference based on the spectrum vector, constructing a reflectivity sequence based on the information amount of a plurality of reflectivity peak values, and calculating a difference fluctuation coefficient based on the reflectivity sequence and the difference; Constructing a feature set based on the difference fluctuation coefficients of multiple reflection spectra, converting the feature set into a histogram, calculating a cutoff distance of the feature set based on the histogram, and clustering the feature set based on the cutoff distance and a density peak clustering algorithm to obtain a plurality of cluster clusters; The element composition of each cluster is determined based on the reflection spectrum of various elements in the food sample, and the food sample is subjected to component analysis according to the element composition of each cluster.

[0006] Further, the preprocessing of each of the reflection spectra to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and the information analysis and calculation of each reflectivity peak value to obtain the information amount of each reflectivity peak value include: Using a first-order difference method to detect the reflectivity peak of each of the reflection spectra, to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value; Information analysis and calculation are performed on each reflectivity peak value to obtain the information amount of each reflectivity peak value. The calculation formula of the information amount is as follows: in, For the The amount of information of the reflectivity peak value, For the The frequency of the reflectivity peak, is the number of reflectivity peaks in the reflection spectrum, is a natural constant.

[0007] Further, for each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each reflectivity peak value, and the multiple reflectivity peak values ​​are divided into true reflectivity peak values ​​and noise reflectivity peak values ​​by using the reflectivity peak segmentation threshold, including: For each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each reflectivity peak value. The calculation formula of the reflectivity peak segmentation threshold is as follows: in, is the reflectivity peak segmentation threshold of the reflection spectrum, For the The amount of information of the reflectivity peak value, is the number of reflectivity peaks in the reflection spectrum, For the The reflectivity peak value; The reflectivity peak value greater than the reflectivity peak segmentation threshold is classified as a true reflectivity peak value, and the reflectivity peak value less than the reflectivity peak segmentation threshold is classified as a noise reflectivity peak value.

[0008] Furthermore, the wavelength set is constructed based on the wavelengths corresponding to the peak values ​​of the true reflectivity of all reflection spectra as follows: The wavelengths corresponding to the peak values ​​of the true reflectivity of all reflection spectra are counted, and the wavelengths are arranged in a non-repetitive order from small to large to obtain the wavelength set.

[0009] Further, for each of the reflection spectrum, constructing a spectrum vector based on the true reflectivity peak value and the wavelength set includes: For each of the reflection spectra, a spectrum vector is constructed based on the true reflectivity peak value and the wavelength set, and the spectrum vector is constructed in the following manner: in, is the spectral vector of the reflection spectrum, The spectral vector Locations, The value is , is the number of wavelengths in the wavelength set, is the wavelength set The reflectivity corresponding to the wavelength at each position, Indicates the wavelength set The wavelength at that position is the wavelength of the true reflectivity peak value of the reflection spectrum. Indicates the wavelength set The wavelength at that position is not the wavelength of the true reflectivity peak value of the reflection spectrum.

[0010] Further, for each of the reflection spectra, calculating the difference based on the spectral vector includes: Selecting one of the plurality of spectral vectors as a selected spectral vector; For each of the reflection spectra, the difference is calculated based on the selected spectral vector and the spectral vector of the reflection spectrum, and the calculation formula of the difference is as follows: in, Indicates the location in ( , The difference in the reflection spectrum of is the dimension of the spectral vector, represents the selected spectral vector, Indicates the location in ( , The spectral vector of the reflected spectrum, Represents the spectral vector Middle The reflectivity at each location, Represents the selected spectral vector Middle The reflectivity at each location, is the selected spectral vector No. The wavelength corresponding to the reflectivity at each position.

[0011] Furthermore, the step of constructing a reflectivity sequence based on the information amount of the plurality of reflectivity peak values ​​further includes: For each reflection spectrum, a reflectivity sequence is constructed based on the information amount of the multiple reflectivity peak values, and the reflectivity sequence is constructed as follows: in, Indicates the location in ( , ) reflectivity sequence, To indicate the position in ( , ) of the reflection spectrum The amount of information of the reflectivity peak value, Represents the number of reflectivity peaks of the reflectance spectrum.

[0012] Further, the calculating the difference fluctuation coefficient based on the reflectivity sequence and the difference includes: For each reflection spectrum, a difference fluctuation coefficient is calculated based on the reflectivity sequence and the difference. The calculation formula of the difference fluctuation coefficient is as follows: in, Indicates the location in ( , The difference fluctuation coefficient of the reflected spectrum, Denotes the calculation using the dynamic time warping algorithm and The shortest distance between two vectors, is the reflectivity sequence of the reflection spectrum corresponding to the selected spectral vector, Indicates the location in ( , The reflectivity sequence of the reflection spectrum, Indicates the location in ( , The difference in reflection spectra.

[0013] Further, the calculating the cutoff distance of the feature set based on the histogram, and clustering the feature set based on the cutoff distance and the density peak clustering algorithm to obtain a plurality of cluster clusters, includes: The cutoff distance of the feature set is calculated based on the histogram, and the calculation formula of the cutoff distance is: in, represents the cutoff distance of the feature set, Indicates the first The difference volatility coefficient, represents the variance of the histogram, represents the number of difference fluctuation coefficients in the histogram; The density peak clustering algorithm is improved by using the cutoff distance as the cutoff distance of the density peak clustering algorithm, and the feature set is clustered based on the improved density peak clustering algorithm to obtain a plurality of cluster clusters.

[0014] Further, the determining of the element composition of each cluster based on the reflection spectra of the elements of various food samples includes: Constructing spectral vectors of various food sample elements based on the reflection spectra of various food sample elements; Calculating similarities of the various food sample elements based on the spectral vectors of the various food sample elements and the selected spectral vector; The element composition of each cluster is determined according to the similarity of the elements of the various food samples.

[0015] The beneficial effects of the present application are: using hyperspectral technology to obtain hyperspectral information of food samples, the hyperspectral information is multiple reflection spectra of multiple pixels, calculating the reflectivity peak segmentation threshold of each reflection spectrum to divide the reflectivity peak of each reflection spectrum into a true reflectivity peak and a noise reflectivity peak; using the true reflectivity peak of each reflection spectrum and the corresponding wavelength to construct a spectral vector, and each reflection spectrum constructs a spectral vector; based on the information amount of the spectral vector and the reflectivity peak value, calculating the difference fluctuation coefficient of each reflection spectrum to construct a feature set and histogram it, calculating the truncation distance based on the histogram feature set to improve the truncation distance in the DPC algorithm, clustering the feature set using the improved DPC algorithm to obtain multiple clustering clusters, and finally, obtaining the clustering clusters of the substance type database according to the same method, and comparing the two clustering clusters to realize spectral analysis of food samples, determine the substance type of food samples, and improve the accuracy of substance type analysis of food samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flowchart of the steps of a method for rapid detection of food sample quality based on hyperspectral technology provided in an embodiment of the present application. DETAILED DESCRIPTION

[0017] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of this application.

[0018] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.

[0019] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0020] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0021] See also Figure 1 As shown, the embodiment of the present application discloses a method for rapid detection of food sample quality based on hyperspectral technology, including: Step S11, obtaining hyperspectral information of a food sample, wherein the hyperspectral information is a plurality of reflection spectra; Step S12, pre-processing each of the reflection spectra to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and performing information analysis and calculation on each reflectivity peak value to obtain the information content of each reflectivity peak value; Step S13, for each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each of the reflectivity peak values, and the multiple reflectivity peak values ​​are divided into true reflectivity peak values ​​and noise reflectivity peak values ​​by using the reflectivity peak segmentation threshold; Step S14, constructing a wavelength set based on the wavelengths corresponding to the true reflectivity peak values ​​of all reflection spectra; for each reflection spectrum, constructing a spectrum vector based on the true reflectivity peak value and the wavelength set; Step S15, for each of the reflection spectrum, calculating the difference based on the spectrum vector, constructing a reflectivity sequence based on the information amount of a plurality of reflectivity peak values, and calculating a difference fluctuation coefficient based on the reflectivity sequence and the difference; Step S16, constructing a feature set based on the difference fluctuation coefficients of the multiple reflection spectra, converting the feature set into a histogram, calculating a cutoff distance of the feature set based on the histogram, and clustering the feature set based on the cutoff distance and a density peak clustering algorithm to obtain a plurality of cluster clusters; Step S17, determining the element composition of each cluster based on the reflection spectra of the elements of the food samples, and performing component analysis on the food samples according to the element composition of each cluster.

[0022] Under natural conditions, food samples absorb and reflect different wavelengths of visible light. By collecting the reflectivity of food samples to light waves of different wavelengths (i.e., reflection spectra), hyperspectral information of food samples can be constructed. Each pixel of the hyperspectral spectrum has a reflection spectrum, so the hyperspectral information is multiple reflection spectra. The reflection spectrum is the law of how the reflectivity of an object changes with wavelength. The curve with wavelength as the horizontal coordinate and reflectivity as the vertical coordinate is the reflection spectrum characteristic curve of the object.

[0023] In the above-mentioned embodiment, firstly, the hyperspectral information of the food sample is obtained, and the hyperspectral information is a plurality of reflection spectra, and the hyperspectral information is a reflection spectrum composed of the reflectivity of the food sample to different wavelengths (step S11). Since the food sample is not composed of a single substance, the generated reflection spectrum will produce many false peaks; when comparing the hyperspectral information of a single element, it will produce many influences, so the operation of removing the false peaks is performed on the collected hyperspectral information, and at the same time, the reflectivity peaks of a single element are small in number and the reflectivity peak values ​​are not equal. Therefore, next, each of the reflection spectra is preprocessed to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and each reflectivity peak value is analyzed and calculated to obtain the information amount of each reflectivity peak value (step S12); for each of the reflection spectra, the reflectivity peak segmentation threshold is calculated based on the information amount of each reflectivity peak value, and the reflectivity peak segmentation threshold is used to divide the plurality of reflectivity peak values ​​into true reflectivity peak values ​​and noise reflectivity peak values ​​(step S13). Next, a wavelength set is constructed based on the wavelength corresponding to the true reflectivity peak value of all reflection spectra; for each reflection spectrum, a spectrum vector is constructed based on the true reflectivity peak value and the wavelength set (step S14); for each reflection spectrum, the difference is calculated based on the spectrum vector, a reflectivity sequence is constructed based on the information amount of multiple reflectivity peak values, and a difference fluctuation coefficient is calculated based on the reflectivity sequence and the difference (step S15). Finally, a feature set is constructed based on the difference fluctuation coefficients of multiple reflection spectra, the feature set is converted into a histogram, the cutoff distance of the feature set is calculated based on the histogram, and the feature set is clustered based on the cutoff distance and the density peak clustering algorithm to obtain multiple clusters (step S16); the element composition of each cluster is determined based on the reflection spectrum of various food sample elements, and the food sample is analyzed according to the element composition of each cluster (step S17), that is, the food sample is analyzed in combination with the known reflection spectrum of various food sample elements and multiple clusters, so as to improve the accuracy of the food sample component analysis.

[0024] In an optional embodiment of the present application, the preprocessing of each of the reflection spectra to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and the information analysis and calculation of each reflectivity peak value to obtain the information amount of each reflectivity peak value include: Using a first-order difference method to detect the reflectivity peak of each of the reflection spectra, to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value; Information analysis and calculation are performed on each reflectivity peak value to obtain the information amount of each reflectivity peak value. The calculation formula of the information amount is as follows: in, For the The amount of information of the reflectivity peak value, For the The frequency of the reflectivity peak, is the number of reflectivity peaks in the reflection spectrum, and e is a natural constant.

[0025] In the above embodiment, the first-order difference method is used to detect the reflectivity peak of each reflection spectrum to obtain multiple reflectivity peak values ​​and the frequency of each reflectivity peak value. The peak values ​​of the wavelength reflectivity obtained from the reflection spectrum and the corresponding number are processed, and the minimum reflectivity peak value is recorded as , the minimum reflectivity peak The frequency of occurrence is ; The second smallest reflectivity peak value is , the second smallest reflectivity peak The frequency of occurrence is ;…;Remember The peak reflectivity of , the peak value of the reflectivity of the ith The frequency of occurrence is ; and so on, until all the reflectivity peak values ​​are recorded, and the maximum reflectivity peak value is recorded as , the maximum reflectivity peak The frequency of occurrence is recorded as Since there can only be one different reflectivity peak value for the elements in pure food samples, in the reflectivity spectrum of the hyperspectral information, if a certain reflectivity peak value appears more frequently, it is more likely to be caused by noise, and the information content of the reflectivity peak value is smaller; therefore, information analysis and calculation are performed on each reflectivity peak value to obtain the information content of each reflectivity peak value.

[0026] It should be noted that is the peak value of all reflectivity waves The sum of the occurrence frequencies, Indicates the peak value of each reflectivity wave Probability of occurrence information. Peak value of reflectivity Frequency of occurrence The larger the value, the reflectivity peak value is Amount of information The smaller it is, the less information the peak value of the reflectivity wave contains, which means that the peak value of the reflectivity wave is more likely to be caused by noise points.

[0027] In an optional embodiment of the present application, for each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each reflectivity peak value, and the multiple reflectivity peak values ​​are divided into true reflectivity peak values ​​and noise reflectivity peak values ​​by using the reflectivity peak segmentation threshold, including: For each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each reflectivity peak value. The calculation formula of the reflectivity peak segmentation threshold is as follows: in, is the reflectivity peak segmentation threshold of the reflection spectrum, For the The amount of information of the reflectivity peak value, is the number of reflectivity peaks in the reflection spectrum, For the The reflectivity peak value; The reflectivity peak value greater than the reflectivity peak segmentation threshold is classified as a true reflectivity peak value, and the reflectivity peak value less than the reflectivity peak segmentation threshold is classified as a noise reflectivity peak value.

[0028] In the above embodiment, in order to eliminate the influence of noise, for each reflection spectrum, the reflectivity peak value segmentation threshold is calculated based on the information amount of each reflectivity peak value, and the reflectivity peak value greater than the reflectivity peak value segmentation threshold is divided into the true reflectivity peak value, and the reflectivity peak value less than the reflectivity peak value segmentation threshold is divided into the noise reflectivity peak value. Each reflection spectrum will generate a , the corresponding position in the reflection spectrum ( , The calculated reflectivity peak segmentation threshold is recorded as .

[0029] It should be noted that represents the sum of the information of all reflectivity peaks, For the The information degree of a reflectivity peak value is the weight of the sum of the information degrees of all reflectivity peak values. The larger the reflectivity peak value and the greater the weight of its information degree, the larger the reflectivity peak segmentation threshold is.

[0030] In an optional embodiment of the present application, the wavelength set is constructed based on the wavelengths corresponding to the peak values ​​of the true reflectivity of all reflection spectra in the following manner: The wavelengths corresponding to the peak values ​​of the true reflectivity of all reflection spectra are counted, and the wavelengths are arranged in a non-repetitive order from small to large to obtain the wavelength set.

[0031] Each reflection spectrum is segmented using the above-mentioned adaptive threshold segmentation method to obtain the true reflectivity peak value of each reflection spectrum. In the above embodiment steps, the wavelengths of the true reflectivity peak values ​​of all reflection spectra are counted, and these wavelengths are arranged in a non-repeating, ascending order, and recorded as wavelength set A.

[0032] In an optional embodiment of the present application, for each of the reflection spectrum, constructing a spectrum vector based on the true reflectivity peak value and the wavelength set includes: For each of the reflection spectra, a spectrum vector is constructed based on the true reflectivity peak value and the wavelength set, and the spectrum vector is constructed in the following manner: in, is the spectral vector of the reflection spectrum, The spectral vector Locations, The value is , is the number of wavelengths in the wavelength set, is the wavelength set The reflectivity corresponding to the wavelength at each position, Indicates the wavelength set The wavelength at that position is the wavelength of the true reflectivity peak value of the reflection spectrum. Indicates the wavelength set The wavelength at that position is not the wavelength of the true reflectivity peak value of the reflection spectrum.

[0033] In the above embodiment, the position of each reflection spectrum with the same wavelength as the wavelength set A is taken out to determine whether this wavelength is the wavelength of the true reflectivity peak value. If it is, it is marked as 1, and if not, it is marked as 0, and the marking symbol is t. The reflectivity at different wavelengths is recorded as , the number of wavelengths in set A is recorded as m. Generate a spectral vector with dimension m for each reflection spectrum of the hyperspectral information. The elements of the spectral vector represent the reflectivity of the wavelength. Determine whether this wavelength is the wavelength of the true reflectivity peak value. If so, the reflectivity value of the wavelength is Assign a value to the element; if not, set the value of this element to 0. Perform the above operation on all reflection spectra, and each reflection spectrum will get a spectral vector. Record the corresponding position in the reflection spectrum ( , The constructed spectral vector is .

[0034] In an optional embodiment of the present application, for each of the reflection spectra, calculating the difference based on the spectral vector includes: Selecting one of the plurality of spectral vectors as a selected spectral vector; For each of the reflection spectra, the difference is calculated based on the selected spectral vector and the spectral vector of the reflection spectrum, and the calculation formula of the difference is as follows: in, Indicates the location in ( , The difference in the reflection spectrum of is the dimension of the spectral vector, represents the selected spectral vector, Indicates the location in ( , The spectral vector of the reflected spectrum, Represents the spectral vector Middle The reflectivity at each location, Represents the selected spectral vector Middle The reflectivity at each location, is the selected spectral vector No. The wavelength corresponding to the reflectivity at each position.

[0035] In the above embodiment steps, one of the multiple spectral vectors is selected as the selected spectral vector, and the spectral vector of each reflection spectrum is used as the calculated spectral vector; for each reflection spectrum, the difference is calculated based on the selected spectral vector and the spectral vector of the reflection spectrum.

[0036] It should be noted that Indicates the location in ( , The Euclidean distance between the spectral vector of the reflectance spectrum and the selected spectral vector at the same wavelength. The larger the value, the higher the position. , The greater the difference between the spectral vector of the reflected spectrum and the selected spectral vector.

[0037] In an optional embodiment of the present application, the constructing a reflectivity sequence based on the information amount of the multiple reflectivity peak values ​​further includes: For each reflection spectrum, a reflectivity sequence is constructed based on the information amount of the multiple reflectivity peak values, and the reflectivity sequence is constructed as follows: in, Indicates the location in ( , ) reflectivity sequence, To indicate the position in ( , ) of the reflection spectrum The amount of information of the reflectivity peak value, Represents the number of reflectivity peaks of the reflectance spectrum.

[0038] In the above embodiment, for each reflection spectrum, a reflectivity sequence is constructed based on the information of multiple reflectivity peak values ​​to obtain multiple reflectivity sequences. , located at ( , The reflectivity series of the reflection spectrum It should be noted that Represents the number of reflectivity peaks of the reflection spectrum. It may be different.

[0039] In an optional embodiment of the present application, the calculating the difference fluctuation coefficient based on the reflectivity sequence and the difference includes: For each reflection spectrum, a difference fluctuation coefficient is calculated based on the reflectivity sequence and the difference. The calculation formula of the difference fluctuation coefficient is as follows: in, Indicates the location in ( , The difference fluctuation coefficient of the reflected spectrum, Denotes the calculation using the dynamic time warping algorithm and The shortest distance between two vectors, is the reflectivity sequence of the reflection spectrum corresponding to the selected spectral vector, Indicates the location in ( , The reflectivity sequence of the reflection spectrum, Indicates the location in ( , The difference in reflection spectra.

[0040] In the above-mentioned embodiment steps, for each reflection spectrum, a difference fluctuation coefficient is calculated based on the reflectivity sequence and the difference. Two reflectivity sequences can be calculated by existing technology, such as a dynamic time warping algorithm (DTW algorithm), to obtain the closest distance between the nearest reflectivity peak values ​​between the reflectivity sequences. The difference fluctuation coefficient can be calculated by combining the shortest distance between the reflectivity peak values ​​between the reflectivity sequences and the difference between the reflection spectra. The greater the difference between the shortest distance between the reflectivity peak values ​​between the calculated reflectivity sequences and the reflection spectra, the greater the difference fluctuation coefficient of the reflection spectra.

[0041] In an optional embodiment of the present application, the calculating the cutoff distance of the feature set based on the histogram, and clustering the feature set based on the cutoff distance and a density peak clustering algorithm to obtain a plurality of cluster clusters, including: The cutoff distance of the feature set is calculated based on the histogram, and the calculation formula of the cutoff distance is: in, represents the cutoff distance of the feature set, Indicates the first The difference volatility coefficient, represents the variance of the histogram, represents the number of difference fluctuation coefficients in the histogram; The density peak clustering algorithm is improved by using the cutoff distance as the cutoff distance of the density peak clustering algorithm, and the feature set is clustered based on the improved density peak clustering algorithm to obtain a plurality of cluster clusters.

[0042] First, based on the difference fluctuation coefficient of multiple reflection spectra Construct a feature set and convert the feature set into a histogram. The value of the abscissa of the histogram is the difference fluctuation coefficient of the sequence, which is recorded from left to right as , , ..., Then in the above embodiment, the cutoff distance of the feature set is calculated based on the histogram. It should be noted that the cutoff distance of the feature set represents the fluctuation between the difference fluctuation coefficients of the feature set; when the difference between adjacent difference fluctuation coefficients of the histogram is large, it leads to ( ) value increases, thereby increasing the cutoff distance The value of increases.

[0043] According to the traditional density peak clustering (DPC) algorithm, it is necessary to calculate the local density ,and The calculation requires setting the cutoff distance , this application uses the cutoff distance of the feature set As the cutoff distance for the Density Peak Clustering (DPC) algorithm The density peak clustering algorithm is improved, and the feature set is clustered based on the improved density peak clustering algorithm to obtain multiple cluster clusters, which are recorded as , , ..., ( represents the number of clusters).

[0044] In an optional embodiment of the present application, determining the element composition of each cluster based on the reflection spectra of various food sample elements includes: Constructing spectral vectors of various food sample elements based on the reflection spectra of various food sample elements; Calculating similarities of the various food sample elements based on the spectral vectors of the various food sample elements and the selected spectral vector; The element composition of each cluster is determined according to the similarity of the elements of the various food samples.

[0045] In the above-mentioned embodiment, the reflectivity curves (i.e., reflection spectra) of various food sample elements at different wavelengths are known in the prior art. The set of reflectivity curves of all food sample elements at different wavelengths is recorded as a substance type database. The spectrum vectors of various food sample elements in the substance type database are constructed by using the above-mentioned steps to construct spectrum vectors. These spectrum vectors are recorded as , , ..., ( is the number of selected standard ions). Compare the spectral vectors of various food sample elements in the substance type database with the selected spectral vectors in the above steps. Calculate the similarity of the various food sample elements, and compare the obtained spectral vectors of the various food sample elements with the selected spectral vector The similarity of . judge Belongs to multiple clusters , , ..., Which cluster in the cluster, and then infer which element the corresponding cluster is. If the cluster contains two , then this cluster is a mixture of two elements (a cluster may be a mixture of multiple elements). Finally, the reflection spectra of various known food sample elements and multiple clusters are combined to realize spectral analysis of food samples and determine the substance types of food samples.

[0046] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0047] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0048] The above is a detailed introduction to the rapid detection method for food sample quality based on hyperspectral technology provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for rapid detection of food sample quality based on hyperspectral technology, characterized in that: include: Acquiring hyperspectral information of a food sample, wherein the hyperspectral information is a plurality of reflection spectra; Preprocessing each of the reflection spectra to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and performing information analysis and calculation on each reflectivity peak value to obtain the amount of information of each reflectivity peak value; For each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each of the reflectivity peak values, and the multiple reflectivity peak values ​​are divided into true reflectivity peak values ​​and noise reflectivity peak values ​​by using the reflectivity peak segmentation threshold; Construct a wavelength set based on the wavelengths corresponding to the peak values ​​of the true reflectivity of all reflection spectra; For each of the reflection spectrum, constructing a spectrum vector based on the true reflectivity peak value and the wavelength set; For each of the reflection spectrum, calculating the difference based on the spectrum vector, constructing a reflectivity sequence based on the information amount of a plurality of reflectivity peak values, and calculating a difference fluctuation coefficient based on the reflectivity sequence and the difference; Constructing a feature set based on the difference fluctuation coefficients of multiple reflection spectra, converting the feature set into a histogram, calculating a cutoff distance of the feature set based on the histogram, and clustering the feature set based on the cutoff distance and a density peak clustering algorithm to obtain a plurality of cluster clusters; The element composition of each cluster is determined based on the reflection spectrum of various elements in the food sample, and the food sample is subjected to component analysis according to the element composition of each cluster.

2. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1, characterized in that: The preprocessing of each of the reflection spectra to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value, and the information analysis and calculation of each reflectivity peak value to obtain the information amount of each reflectivity peak value include: Using a first-order difference method to detect the reflectivity peak of each of the reflection spectra, to obtain a plurality of reflectivity peak values ​​and the frequency of each reflectivity peak value; Information analysis and calculation are performed on each reflectivity peak value to obtain the information amount of each reflectivity peak value. The calculation formula of the information amount is as follows: in, For the The amount of information of the reflectivity peak value, For the The frequency of the reflectivity peak, is the number of reflectivity peaks in the reflection spectrum, is a natural constant.

3. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1 is characterized in that: The step of calculating a reflectivity peak segmentation threshold for each of the reflection spectrum based on the amount of information of each reflectivity peak value, and dividing the multiple reflectivity peak values ​​into true reflectivity peak values ​​and noise reflectivity peak values ​​by using the reflectivity peak segmentation threshold, comprises: For each of the reflection spectrum, a reflectivity peak segmentation threshold is calculated based on the information amount of each reflectivity peak value. The calculation formula of the reflectivity peak segmentation threshold is as follows: in, is the reflectivity peak segmentation threshold of the reflection spectrum, For the The amount of information of the reflectivity peak value, is the number of reflectivity peaks in the reflection spectrum, For the The reflectivity peak value; The reflectivity peak value greater than the reflectivity peak segmentation threshold is classified as a true reflectivity peak value, and the reflectivity peak value less than the reflectivity peak segmentation threshold is classified as a noise reflectivity peak value.

4. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1 is characterized in that: The method for constructing a wavelength set based on the wavelength corresponding to the peak value of the true reflectivity of all reflection spectra is as follows: The wavelengths corresponding to the peak values ​​of the true reflectivity of all reflection spectra are counted, and the wavelengths are arranged in a non-repetitive order from small to large to obtain the wavelength set.

5. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1 is characterized in that: For each of the reflection spectrum, constructing a spectrum vector based on the true reflectivity peak value and the wavelength set, comprising: For each of the reflection spectra, a spectrum vector is constructed based on the true reflectivity peak value and the wavelength set, and the spectrum vector is constructed in the following manner: in, is the spectral vector of the reflection spectrum, The spectral vector Locations, The value is , is the number of wavelengths in the wavelength set, is the wavelength set The reflectivity corresponding to the wavelength at each position, Indicates the wavelength set The wavelength at that position is the wavelength of the true reflectivity peak value of the reflection spectrum. Indicates the wavelength set The wavelength at that position is not the wavelength of the true reflectivity peak value of the reflection spectrum.

6. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1, characterized in that: The step of calculating the difference of each of the reflection spectra based on the spectral vector comprises: Selecting one of the plurality of spectral vectors as a selected spectral vector; For each of the reflection spectra, the difference is calculated based on the selected spectral vector and the spectral vector of the reflection spectrum, and the calculation formula of the difference is as follows: in, Indicates the location in ( , The difference in the reflection spectrum of is the dimension of the spectral vector, represents the selected spectral vector, Indicates the location in ( , The spectral vector of the reflected spectrum, Represents the spectral vector Middle The reflectivity at each location, Represents the selected spectral vector Middle The reflectivity at each location, is the selected spectral vector No. The wavelength corresponding to the reflectivity at each position.

7. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1 is characterized in that: The step of constructing a reflectivity sequence based on the information amount of the plurality of reflectivity peak values ​​further includes: For each reflection spectrum, a reflectivity sequence is constructed based on the information amount of the multiple reflectivity peak values, and the reflectivity sequence is constructed as follows: in, Indicates the location in ( , ) reflectivity sequence, To indicate the position in ( , ) of the reflection spectrum The amount of information of the reflectivity peak value, Represents the number of reflectivity peaks of the reflectance spectrum.

8. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1 is characterized in that: The calculating the difference fluctuation coefficient based on the reflectivity sequence and the difference includes: For each reflection spectrum, a difference fluctuation coefficient is calculated based on the reflectivity sequence and the difference. The calculation formula of the difference fluctuation coefficient is as follows: in, Indicates the location in ( , The difference fluctuation coefficient of the reflected spectrum, Denotes the calculation using the dynamic time warping algorithm and The shortest distance between two vectors, is the reflectivity sequence of the reflection spectrum corresponding to the selected spectral vector, Indicates the location in ( , The reflectivity sequence of the reflection spectrum, Indicates the location in ( , The difference in reflection spectra.

9. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1, characterized in that: The calculating the cutoff distance of the feature set based on the histogram, and clustering the feature set based on the cutoff distance and a density peak clustering algorithm to obtain a plurality of cluster clusters, comprises: The cutoff distance of the feature set is calculated based on the histogram, and the calculation formula of the cutoff distance is: in, represents the cutoff distance of the feature set, Indicates the first The difference volatility coefficient, represents the variance of the histogram, represents the number of difference fluctuation coefficients in the histogram; The density peak clustering algorithm is improved by using the cutoff distance as the cutoff distance of the density peak clustering algorithm, and the feature set is clustered based on the improved density peak clustering algorithm to obtain a plurality of cluster clusters.

10. The method for rapid detection of food sample quality based on hyperspectral technology according to claim 1, characterized in that: The determining of the element composition of each cluster based on the reflection spectrum of various food sample elements comprises: Constructing spectral vectors of various food sample elements based on the reflection spectra of various food sample elements; Calculating similarities of the various food sample elements based on the spectral vectors of the various food sample elements and the selected spectral vector; The element composition of each cluster is determined according to the similarity of the elements of the various food samples.

Citation Information

Cited By

  • Method, device and system for monitoring and early warning cyanobacterial bloom

    CN120352359A

  • A method, device and system for monitoring and early warning of cyanobacteria blooms

    CN120352359B

  • Spectral determination method, system and equipment for chemical industrial wastewater

    CN121540695A

  • A method, system and device for spectral determination of chemical production wastewater

    CN121540695B