Database-driven spectrum identification method and device, equipment and medium

By employing a database-driven spectral recognition method, baseline correction, scattering correction, and spectral alignment are performed on the cargo, and spectral features are extracted and stitched together. This solves the problem of inaccurate foreign object identification in cargo and achieves high accuracy and stable foreign object detection.

CN121558652AActive Publication Date: 2026-02-24INSPECTION & QUARANTINE TECH CENT SHANDONG ENTRY EXIT INSPECTION & QUARANTINE BUREAU +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202610076780.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-21
Publication Date
2026-02-24
Estimated Expiration
2046-01-21

AI Technical Summary

Technical Problem

Existing foreign object identification methods suffer from inaccurate identification of foreign objects in cargo, especially low-density foreign objects and foreign objects with similar colors, resulting in missed detections and false detections.

Method used

By establishing a database, the types and real-time spectra of the goods to be inspected are obtained. Baseline correction and scattering correction are performed according to particle size levels, and the real-time spectra are aligned with the reference spectra to extract peak features and calculate the absorbance ratio of key component bands. The spectral features are then spliced ​​together to identify foreign objects.

Benefits of technology

It significantly improves the accuracy and stability of foreign object identification, adapts to various cargo and dynamic detection needs, effectively offsets the interference caused by cargo particle heterogeneity and speed fluctuations, and enhances the characteristic differences between the cargo body and foreign objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121558652A_ABST
    Figure CN121558652A_ABST
Patent Text Reader

Abstract

The invention provides a database-driven spectrum identification method and device, equipment and a medium, and relates to the technical field of spectrum detection. The method comprises the following steps: acquiring the type and real-time spectrum of a to-be-detected cargo; according to the type, querying the particle size grade, the key component wave band and the reference spectrum of the to-be-detected cargo from a preset database; performing baseline correction and scattering correction on the real-time spectrum according to the particle size grade, and aligning the real-time spectrum according to the reference spectrum; extracting peak value characteristics from the real-time spectrum, calculating an absorbance proportional relation of the key component wave bands, and carrying out characteristic splicing on the peak value characteristics and the absorbance proportional relation of the key component wave bands to obtain spectrum characteristics; and identifying foreign matters in the to-be-detected goods based on the spectral features. The method can solve the problem that the foreign matter in the goods cannot be accurately identified by the existing method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spectral image processing technology, and in particular to a database-driven spectral recognition method, apparatus, device, and medium. Background Technology

[0002] During the production and transportation of goods (such as grain), foreign objects often get mixed in. The conventional method of foreign object identification is to identify foreign objects manually with the naked eye. This method has disadvantages such as large workload, strong subjectivity, low efficiency, high requirements for professional experience, and harm to human health.

[0003] Existing intelligent foreign object identification methods mainly include X-ray detection and computer vision. X-ray detection utilizes the property that X-rays produce different reflection intensities when passing through objects of different densities to detect foreign objects. When there is a difference in density between the food itself and the foreign object, their transmittance will also differ. This difference can be reflected in the image with different grayscale values, allowing for the detection of high-density foreign objects. However, it is not effective for detecting low-density foreign objects with low absorption, such as plastics and silicone. Computer vision detection mainly utilizes the color difference between the foreign object and the goods, combined with image segmentation technology to achieve foreign object detection. It has advantages such as speed, non-destructive nature, and ease of online processing, and has been widely used in the detection of foreign objects and defects on the surface of goods. However, this method heavily relies on the high color difference between the foreign object and the background. When the color of the foreign object is similar to or the same as the background, the detection effect of computer vision detection is greatly reduced, failing to accurately segment objects with low color difference from the background, leading to missed or false detections of foreign objects. Summary of the Invention

[0004] This invention provides a database-driven spectral identification method, apparatus, device, and medium to solve the problem of inaccurate identification of foreign objects in cargo by existing methods.

[0005] In a first aspect, embodiments of the present invention provide a database-driven spectral identification method, comprising: Obtain the type and real-time spectrum of the goods to be inspected; Based on the type, the particle size class, key component bands, and reference spectrum of the goods to be tested are retrieved from a preset database; Based on particle size classification, baseline and scattering corrections are performed on the real-time spectrum, and the real-time spectrum is aligned with the reference spectrum. Peak features are extracted from the real-time spectrum, and the absorbance ratio of key component bands is calculated. The peak features and the absorbance ratio of key component bands are then spliced ​​together to obtain the spectral features. Foreign objects in goods to be detected are identified based on spectral features.

[0006] In one possible implementation, baseline correction of the real-time spectrum is performed according to particle size levels, including: The window size range of the airPLS algorithm is determined based on the granularity level; the window size range is positively correlated with the granularity level. For each window size within the range, the airPLS algorithm is run to fit the baseline and the real-time spectrum is subtracted to obtain multiple corrected real-time spectra; Based on the baseline flatness and characteristic peak retention of each corrected real-time spectrum, the optimal corrected real-time spectrum is determined from among the corrected real-time spectra.

[0007] In one possible implementation, the optimal corrected real-time spectrum is determined from the various corrected real-time spectra based on the baseline flatness and characteristic peak retention rate of each corrected real-time spectrum, including: From each corrected real-time spectrum, determine the real-time spectra with a characteristic peak retention rate greater than the preset characteristic peak retention rate threshold. From the real-time spectra with characteristic peak retention rates greater than a preset characteristic peak retention rate threshold, the real-time spectrum with the smallest baseline flatness is determined as the optimal corrected real-time spectrum.

[0008] In one possible implementation, scattering correction of the real-time spectrum is performed according to the particle size order, including: Determine the preset scattering correction algorithm corresponding to the particle size level; wherein, the preset scattering correction algorithm includes: standard normal variable transformation algorithm, multivariate scattering correction algorithm, and hybrid algorithm of standard normal variable transformation + multivariate scattering correction; The real-time spectrum is scattered and corrected according to a preset scattering correction algorithm.

[0009] In one possible implementation, the particle size levels include: small particles, medium particles, and large particles; Determine the preset scattering correction algorithm corresponding to the particle size level, including: If the particle size class is small, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the standard normal variable transformation algorithm; If the particle size level is medium, then the preset scattering correction algorithm corresponding to the particle size level is determined to be a hybrid algorithm; If the particle size class is large, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the multivariate scattering correction algorithm.

[0010] In one possible implementation, determining the preset scattering correction algorithm corresponding to the particle size level further includes: If the preset scattering correction algorithm corresponding to the particle size level is determined to be a hybrid algorithm, then the weights of the standard normal variable transformation and multivariate scattering correction in the hybrid algorithm are determined according to the average particle size of the cargo to be detected. Among them, the weight of the standard normal variable transformation is negatively correlated with the average particle size, the weight of the multivariate scattering correction is positively correlated with the average particle size, and the sum of the weights of the standard normal variable transformation and the multivariate scattering correction is 1.

[0011] In one possible implementation, aligning the real-time spectrum according to a reference spectrum includes: Calculate the spectral similarity between each wavelength point in the real-time spectrum and each wavelength point in the reference spectrum to obtain a similarity comparison table; Based on the similarity comparison table, within the constraints of a matching window of a preset size, the optimal matching path for the wavelength points of the real-time spectrum and the reference spectrum is found. Based on the optimal matching path of wavelength points, the real-time spectrum is stretched or compressed.

[0012] In one possible implementation, before extracting the absorbance ratios of key component bands from the real-time spectrum, the following is also included: Obtain the actual moisture content of the goods to be tested, and query the database for the corresponding moisture content-spectral shift correlation model of the goods to be tested; Based on the actual moisture content and the moisture content-spectral shift correlation model, the shift of the real-time spectrum is determined, and the intensity of the real-time spectrum is corrected according to the shift.

[0013] Secondly, embodiments of the present invention provide a database-driven spectral recognition device, comprising: The acquisition module is used to acquire the type and real-time spectrum of the goods to be inspected; The query module is used to query the particle size class, key component bands, and reference spectrum of the goods to be tested from a preset database according to their type. The calibration module is used to perform baseline and scattering correction on the real-time spectrum according to the particle size level, and to align the real-time spectrum according to the reference spectrum. The identification module is used to extract peak features from the real-time spectrum and calculate the absorbance ratio of key component bands. The peak features and the absorbance ratio of key component bands are spliced ​​together to obtain spectral features, and foreign objects in the goods to be detected are identified based on the spectral features.

[0014] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect or any possible implementation thereof.

[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect or any possible implementation thereof.

[0016] Fifthly, embodiments of the present invention provide a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect or any possible implementation thereof.

[0017] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: This invention pre-establishes a database of various goods, quickly matching particle size levels, compositional characteristics, and reference spectra based on the type of goods to be detected. Dedicated baseline and scattering corrections are performed for particle size levels, effectively offsetting spectral interference caused by the heterogeneity of goods particles and reducing the masking of foreign object features by baseline drift and uneven scattering. Spectral alignment based on the reference spectrum eliminates spectral length differences and characteristic peak stretching / compression deformation caused by fluctuations in cargo flow velocity, avoiding misjudgment of foreign objects due to morphological distortion. Peak features are extracted from the real-time spectrum, and the absorbance ratio of key component bands is calculated and stitched together to obtain spectral features, enhancing the characteristic differences between the main cargo and foreign objects, significantly improving the distinguishability of foreign object identification. This invention significantly improves the accuracy and stability of foreign object identification, adapting to the practical application needs of multi-cargo, dynamic detection. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating the implementation of the database-driven spectral recognition method provided in this embodiment of the invention. Figure 2 This is a schematic diagram of the structure of the database-driven spectral recognition device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0019] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0020] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0021] This invention provides a database-driven spectral identification method, which is particularly suitable for grain detection. This method can accurately identify foreign objects such as stones, weed seeds, and moldy particles in grain through a closed-loop process of data acquisition, preprocessing, database construction, feature modeling, and matching identification.

[0022] See Figure 1 The document illustrates a flowchart of the implementation of the database-driven spectral recognition method provided in an embodiment of the present invention, which is described in detail below: Step S101: Obtain the type and real-time spectrum of the goods to be detected.

[0023] Here, the type of goods to be inspected can be input by staff, such as wheat or corn. Alternatively, a synchronous image acquisition system can be used to capture the shape, color, and other features of the goods particles, and a simple algorithm can be used to preliminarily determine the type. This embodiment does not limit this approach.

[0024] In this embodiment, goods are transported via a conveyor belt, with a platform placed on the conveyor belt. A hyperspectral camera is mounted on the platform to collect data on the flow of goods on the conveyor belt. The hyperspectral camera collects data using an external push-broom method, acquiring spectral data for one column of pixels per frame. The hyperspectral camera scans only a line equal to the width of the viewing angle. The conveyor belt moves at a constant speed below, and the product of the conveyor belt speed and the acquisition time is the actual length of the image acquisition range. Thus, when acquiring image data, hyperspectral image data within the image acquisition range enclosed by this length and the width of the viewing angle can be obtained. The hyperspectral image data contains all component information of the goods and any foreign matter that may be present, such as the characteristic peaks of starch and protein in grains, and the specific spectral signals of foreign matter, all recorded in the real-time spectrum.

[0025] Step S102: Based on the type, query the particle size class, key component bands and reference spectrum of the goods to be tested from the preset database.

[0026] The database in this embodiment contains data on various grain samples and foreign object samples.

[0027] Particle size classification is a standardized category based on the particle size of the goods to be tested. Its core purpose is to provide a basis for spectral preprocessing (such as baseline correction and scattering correction).

[0028] Key component wavelength bands are the core basis for distinguishing grains from foreign substances. For example, the core components of wheat, rice, and corn are starch and protein, which have clear characteristic absorption peaks. Starch has strong absorption at 1240nm and 1390nm, while protein has characteristic absorption at 1550nm and 1730nm.

[0029] The reference spectrum is a pure target grain variety spectrum collected under standard conditions, free of foreign matter and with uniform composition. It serves as a reference for subsequent spectral alignment and component comparison. Standard conditions include: standard speed, standard moisture content, pure grain variety, and no stacking of individual grains to ensure spectral interference-free operation.

[0030] Step S103: Based on the particle size level, perform baseline correction and scattering correction on the real-time spectrum, and align the real-time spectrum with the reference spectrum.

[0031] airPLS, short for Adaptive Iterative Reweighted Penalized Least Squares, is one of the most commonly used baseline correction algorithms in spectral analysis. Its core idea is to dynamically separate baseline drift from effective characteristic peaks in the spectrum by iteratively adjusting weights. During baseline correction, the number of adjacent wavelength points referenced in each fitting iteration depends on the window size: a smaller window provides a more focused fit, suitable for steep baselines; a larger window covers a wider range, suitable for gentler baselines. Because differences in grain particle thickness and stacking conditions cause unstable baseline drift, the existing fixed-window airPLS algorithm is modified to an adaptive-window airPLS. The baseline correction window is adjusted according to grain particle size to accurately eliminate baseline interference from particles of different thicknesses.

[0032] Because grain particles are irregular in shape and size, the original uniform scattering correction algorithm has limited effectiveness. Here, a new particle size-based scattering correction is added, which matches specific scattering correction parameters to different particle sizes (e.g., a multivariate scattering correction algorithm is used for large particles, and a standard normal variable transformation algorithm is used for small particles).

[0033] During online detection, the speed of grain flow fluctuates as it passes through the conveyor belt due to variations in motor speed and grain accumulation. The spectrum of the same particle at different speeds exhibits inconsistencies in characteristic peak positions and widths due to differences in the number of data points and misalignment in scanning sequence (e.g., peak width narrows at 1 m / s and widens at 0.5 m / s). This is because the spectrometer's scanning frequency is fixed (e.g., 100 Hz); the faster the speed, the fewer spectral points are scanned per particle, leading to spectral feature compression / stretching. Directly using this for identification increases the false positive rate. Aligning the real-time spectrum with a reference spectrum can stretch / compress the spectra at different speeds to the standard speed's spectral dimensions, eliminating feature shifts caused by time differences and ensuring consistency in spectral composition characteristics.

[0034] Step S104: Extract peak features from the real-time spectrum and calculate the absorbance ratio of key component bands. Perform feature splicing on the peak features and the absorbance ratio of key component bands to obtain spectral features. Identify foreign objects in the goods to be detected based on the spectral features.

[0035] For example, peak characteristics may include peak intensity, peak position, peak area, etc., which are not limited in this embodiment. The key component wavelengths of starch are 1240nm and 1390nm, and the absorbance of these two wavelengths increases with increasing starch content. The key component wavelengths of protein are 1550nm and 1730nm, and the absorbance is positively correlated with protein content. The absorbance values ​​of the key component wavelengths can be extracted, and the absorbance ratio can be calculated according to the following formulas: Main ratio F1 = 1240nm absorbance / 1550nm absorbance; Auxiliary ratio F2 = 1390nm absorbance / 1730nm absorbance.

[0036] By concatenating peak features and absorbance ratios, a multidimensional spectral feature is constructed. This retains the direct basis for judging whether the peaks are normal, and also verifies the authenticity of components through the stability of the ratio, forming a double verification and avoiding the one-sidedness of a single feature. Specifically, the peak feature vector and the absorbance ratio feature vector are concatenated to form a higher-dimensional feature matrix. For example, assuming three peak features are extracted from the spectrum and two absorbance ratio features are calculated, concatenating them yields a multidimensional feature vector with dimensions 3 + 2 = 5.

[0037] Then, the spectral features are input into a pre-defined recognition model to identify foreign objects in the goods to be detected. Here, a hybrid model approach can be used for the pre-defined recognition model. The main model uses a support vector machine (SVM), suitable for high-dimensional, small-sample classification; the auxiliary model uses a random forest to handle similar foreign objects that the SVM struggles to distinguish, improving generalization ability. During training, the training, validation, and test sets are divided in a 7:2:1 ratio to ensure consistent data distribution. The SVM and random forest models are trained using the training set, and hyperparameters are optimized using a grid search method. The model performance is evaluated using the validation set. If the accuracy is lower than a set threshold, the process returns to the feature extraction stage to re-select features or supplement sample data. The results from the SVM and random forest models are then fused, and a weighted voting method is used to determine their weights, outputting the final classification model.

[0038] This invention pre-establishes a database of various goods, quickly matching particle size levels, compositional characteristics, and reference spectra based on the type of goods to be detected. Dedicated baseline and scattering corrections are performed for particle size levels, effectively offsetting spectral interference caused by the heterogeneity of goods particles and reducing the masking of foreign object features by baseline drift and uneven scattering. Spectral alignment based on the reference spectrum eliminates spectral length differences and characteristic peak stretching / compression deformation caused by fluctuations in cargo flow velocity, avoiding misjudgment of foreign objects due to morphological distortion. Peak features are extracted from the real-time spectrum, and the absorbance ratio of key component bands is calculated to obtain spectral features, enhancing the characteristic differences between the main cargo and foreign objects, and enabling the identification of mold, significantly improving the distinguishability of foreign object identification. This invention significantly improves the accuracy and stability of foreign object identification, adapting to the practical application needs of multi-cargo, dynamic detection.

[0039] In some embodiments, baseline correction of the real-time spectrum based on particle size levels may include: The window size range of the airPLS algorithm is determined based on the granularity level; the window size range is positively correlated with the granularity level. For each window size within the range, the airPLS algorithm is run to fit the baseline and the real-time spectrum is subtracted to obtain multiple corrected real-time spectra; Based on the baseline flatness and characteristic peak retention of each corrected real-time spectrum, the optimal corrected real-time spectrum is determined from among the corrected real-time spectra.

[0040] In this embodiment, grain particle size can be classified into: small particles (<1mm), medium particles (1-3mm), and large particles (>3mm). Other parameters of the airPLS algorithm (such as penalty factor and number of iterations) are fixed, and only the window size is adjusted: the window for small particles is set to 5-7 points (to prevent over-smoothing of the drift curve), for medium particles to 7-9 points, and for large particles to 9-11 points (to ensure a smooth drift curve and accurate baseline fitting of the large window).

[0041] In this embodiment, baseline flatness (peak-valley difference) reflects whether the baseline of the corrected spectrum is stable, without residual drift or noise fluctuations. Characteristic peak retention rate reflects whether the shape, intensity, and position of the characteristic peaks of the grain core components and foreign matter in the corrected spectrum are complete, without over-correction. Therefore, from each corrected real-time spectrum, the real-time spectrum with a characteristic peak retention rate greater than a preset characteristic peak retention rate threshold can be determined; and from the real-time spectra with a characteristic peak retention rate greater than the preset characteristic peak retention rate threshold, the real-time spectrum with the smallest baseline flatness can be determined as the optimal corrected real-time spectrum.

[0042] In some embodiments, scattering correction of the real-time spectrum based on particle size levels may include: Determine the preset scattering correction algorithm corresponding to the particle size level; wherein, the preset scattering correction algorithm includes: standard normal variable transformation algorithm, multivariate scattering correction algorithm, and hybrid algorithm of standard normal variable transformation + multivariate scattering correction; The real-time spectrum is scattered and corrected according to a preset scattering correction algorithm.

[0043] In this embodiment, the scattering effect of grain particles is positively correlated with particle size: large particles scatter light strongly and at uneven scattering angles, resulting in an overall increase in spectral intensity and blurred characteristic peaks; small particles scatter weakly, with low spectral intensity but clear characteristic peaks. The standard normal variable transformation algorithm is suitable for reducing the systematic error of weak scattering, while the multivariate scattering correction algorithm is suitable for correcting the spectral distortion caused by strong scattering. This algorithm addresses the scattering problem of different particle sizes by selecting an appropriate correction strategy.

[0044] For example: If the particle size class is small, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the standard normal variable transformation algorithm.

[0045] If the particle size class is medium, then the preset scattering correction algorithm corresponding to the particle size class is determined to be a hybrid algorithm; and based on the average particle size of the goods to be detected, the weights of the standard normal variable transformation and the multivariate scattering correction in the hybrid algorithm are determined; wherein, the weight of the standard normal variable transformation is negatively correlated with the average particle size, the weight of the multivariate scattering correction is positively correlated with the average particle size, and the sum of the weights of the standard normal variable transformation and the multivariate scattering correction is 1.

[0046] If the particle size class is large, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the multivariate scattering correction algorithm.

[0047] In some embodiments, aligning the real-time spectrum according to a reference spectrum may include: Calculate the spectral similarity between each wavelength point in the real-time spectrum and each wavelength point in the reference spectrum to obtain a similarity comparison table; Based on the similarity comparison table, within the constraints of a matching window of a preset size, the optimal matching path for the wavelength points of the real-time spectrum and the reference spectrum is found. Based on the optimal matching path of wavelength points, the real-time spectrum is stretched or compressed.

[0048] In this embodiment, the single-particle spectrum acquired at a standard velocity (e.g., 0.8 m / s) serves as the baseline sequence (length N, e.g., 60 wavelength points). Spectra acquired in real-time at different velocities constitute the alignment sequence of length M, which varies with velocity. Each wavelength point (e.g., 48 points) of the alignment spectrum is compared one by one with each wavelength point (60 points) of the baseline spectrum, and their similarity is calculated (the closer the values, the higher the similarity), forming a similarity comparison table. In the similarity comparison table, starting from the first wavelength point, a path is found that runs through the entire table: the points of the alignment spectrum must correspond sequentially to the points of the baseline spectrum, and should ideally pass through highly similar positions (this can be achieved using a dynamic time warping algorithm, which will not be discussed in detail in this embodiment). Finally, based on the found optimal path, the wavelength points of the spectrum to be aligned are stretched or compressed: if the spectrum to be aligned is short (e.g., 48 points), some points are split into multiple points corresponding to multiple points in the reference spectrum (e.g., one point is split into two, and the median value is used to supplement); if the spectrum to be aligned is long (e.g., 96 points), multiple adjacent points are merged into one, and the average value is used to correspond to one point in the reference spectrum; ultimately, the length of the spectrum to be aligned is made completely consistent with the reference spectrum. Through the above steps, the difference in spectral length caused by velocity fluctuations can be eliminated, providing a consistent feature basis for subsequent foreign object identification.

[0049] In some embodiments, before extracting the absorbance ratio of key component bands from the real-time spectrum, the method may further include: Obtain the actual moisture content of the goods to be tested, and query the database for the corresponding moisture content-spectral shift correlation model of the goods to be tested; Based on the actual moisture content and the moisture content-spectral shift correlation model, the shift of the real-time spectrum is determined, and the intensity of the real-time spectrum is corrected according to the shift.

[0050] In this embodiment, considering that changes in grain moisture content may cause spectral shift, a moisture content-spectral shift correlation model is established to compensate for the shift, thereby specifically offsetting the interference of moisture on the grain spectrum. This ensures that the grain spectra with different moisture contents tend to be consistent in reflecting the characteristics of core components such as starch and protein, and avoids the difference in moisture being misjudged as foreign matter characteristics.

[0051] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0052] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.

[0053] Figure 2A schematic diagram of the database-driven spectral recognition device provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown.

[0054] like Figure 2 As shown, the database-driven spectral recognition device 2 includes: The acquisition module 21 is used to acquire the type and real-time spectrum of the goods to be inspected; The query module 22 is used to query the particle size class, key component bands and reference spectrum of the goods to be tested from a preset database according to the type. The correction module 23 is used to perform baseline correction and scattering correction on the real-time spectrum according to the particle size level, and to align the real-time spectrum according to the reference spectrum. The identification module 24 is used to extract peak features from the real-time spectrum and calculate the absorbance ratio of key component bands. It performs feature splicing on the peak features and the absorbance ratio of key component bands to obtain spectral features, and identifies foreign objects in the goods to be detected based on the spectral features.

[0055] In one possible implementation, the correction module 23 is used for: The window size range of the airPLS algorithm is determined based on the granularity level; the window size range is positively correlated with the granularity level. For each window size within the range, the airPLS algorithm is run to fit the baseline and the real-time spectrum is subtracted to obtain multiple corrected real-time spectra; Based on the baseline flatness and characteristic peak retention of each corrected real-time spectrum, the optimal corrected real-time spectrum is determined from among the corrected real-time spectra.

[0056] In one possible implementation, the correction module 23 is used for: From each corrected real-time spectrum, determine the real-time spectra with a characteristic peak retention rate greater than the preset characteristic peak retention rate threshold. From the real-time spectra with characteristic peak retention rates greater than a preset characteristic peak retention rate threshold, the real-time spectrum with the smallest baseline flatness is determined as the optimal corrected real-time spectrum.

[0057] In one possible implementation, the correction module 23 is used for: Determine the preset scattering correction algorithm corresponding to the particle size level; wherein, the preset scattering correction algorithm includes: standard normal variable transformation algorithm, multivariate scattering correction algorithm, and hybrid algorithm of standard normal variable transformation + multivariate scattering correction; The real-time spectrum is scattered and corrected according to a preset scattering correction algorithm.

[0058] In one possible implementation, the particle size levels include: small particles, medium particles, and large particles; the correction module 23 is used for: If the particle size class is small, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the standard normal variable transformation algorithm; If the particle size level is medium, then the preset scattering correction algorithm corresponding to the particle size level is determined to be a hybrid algorithm; If the particle size class is large, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the multivariate scattering correction algorithm.

[0059] In one possible implementation, the correction module 23 is further used for: If the preset scattering correction algorithm corresponding to the particle size level is determined to be a hybrid algorithm, then the weights of the standard normal variable transformation and multivariate scattering correction in the hybrid algorithm are determined according to the average particle size of the cargo to be detected. Among them, the weight of the standard normal variable transformation is negatively correlated with the average particle size, the weight of the multivariate scattering correction is positively correlated with the average particle size, and the sum of the weights of the standard normal variable transformation and the multivariate scattering correction is 1.

[0060] In one possible implementation, the correction module 23 is used for: Calculate the spectral similarity between each wavelength point in the real-time spectrum and each wavelength point in the reference spectrum to obtain a similarity comparison table; Based on the similarity comparison table, within the constraints of a matching window of a preset size, the optimal matching path for the wavelength points of the real-time spectrum and the reference spectrum is found. Based on the optimal matching path of wavelength points, the real-time spectrum is stretched or compressed.

[0061] In one possible implementation, before extracting the absorbance ratio of key component bands from the real-time spectrum, the correction module 23 is further configured to: Obtain the actual moisture content of the goods to be tested, and query the database for the corresponding moisture content-spectral shift correlation model of the goods to be tested; Based on the actual moisture content and the moisture content-spectral shift correlation model, the shift of the real-time spectrum is determined, and the intensity of the real-time spectrum is corrected according to the shift.

[0062] This invention pre-establishes a database of various goods, quickly matching particle size levels, compositional characteristics, and reference spectra based on the type of goods to be detected. Dedicated baseline and scattering corrections are performed for particle size levels, effectively offsetting spectral interference caused by the heterogeneity of goods particles and reducing the masking of foreign object features by baseline drift and uneven scattering. Spectral alignment operations using the reference spectrum eliminate spectral length differences and characteristic peak stretching / compression deformation caused by fluctuations in cargo flow velocity, avoiding misjudgment of foreign objects due to morphological distortion. Peak features are extracted from the real-time spectrum, and the absorbance ratio of key component bands is calculated and stitched together to obtain spectral features, enhancing the characteristic differences between the main cargo and foreign objects, significantly improving the distinguishability of foreign object identification. This invention significantly improves the accuracy and stability of foreign object identification, adapting to the practical application needs of multi-cargo, dynamic detection.

[0063] Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. For example... Figure 3 As shown, the electronic device 3 in this embodiment includes a processor 30 and a memory 31. The memory 31 stores a computer program 32. When the processor 30 executes the computer program 32, it implements the steps in the various method embodiments described above. Alternatively, when the processor 30 executes the computer program 32, it implements the functions of each module in the various device embodiments described above.

[0064] For example, computer program 32 may be divided into one or more modules / units, which are stored in memory 31 and executed by processor 30 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 32 in electronic device 3.

[0065] Electronic device 3 may include, but is not limited to, processor 30 and memory 31. Those skilled in the art will understand that... Figure 3 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 3 may also include input / output devices, network access devices, buses, etc.

[0066] The processor 30 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0067] The memory 31 can be an internal storage unit of the electronic device 3, such as a hard disk or memory of the electronic device 3. The memory 31 can also be an external storage device of the electronic device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 3. Furthermore, the memory 31 can include both internal and external storage units of the electronic device 3. The memory 31 is used to store the computer program 32 and other programs and data required by the electronic device 3. The memory 31 can also be used to temporarily store data that has been output or will be output.

[0068] For the sake of simplicity and clarity, only the above-described functional modules / units are used as examples. In practical applications, the functions described above can be assigned to different functional modules / units as needed. These modules / units can be implemented in hardware, software, or a combination of both.

[0069] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the methods described in the above-described method embodiments.

[0070] This invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the methods described in the above-described method embodiments.

[0071] Computer programs include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0072] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not detailed or described in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Unless otherwise specified or in conflict with logic, the terminology and / or descriptions between different embodiments are consistent and can be referenced interchangeably. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.

[0073] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A database-driven spectral recognition method, characterized in that, include: Obtain the type and real-time spectrum of the goods to be inspected; Based on the type, the particle size class, key component bands, and reference spectrum of the cargo to be tested are queried from a preset database; Based on the particle size classification, the real-time spectrum is subjected to baseline correction and scattering correction, and aligned with the reference spectrum. Peak features are extracted from the real-time spectrum, and the absorbance ratio of the key component bands is calculated. The peak features and the absorbance ratio of the key component bands are then spliced ​​together to obtain the spectral features. Foreign objects in the goods to be detected are identified based on the spectral features.

2. The database-driven spectral recognition method according to claim 1, characterized in that, Based on the particle size classification, baseline correction is performed on the real-time spectrum, including: Based on the granularity level, the window size range of the airPLS algorithm is determined; wherein, the window size range is positively correlated with the granularity level. For each window size within the range of window sizes, the airPLS algorithm is run to fit the baseline and the baseline is subtracted from the real-time spectrum to obtain multiple corrected real-time spectra; Based on the baseline flatness and characteristic peak retention of each corrected real-time spectrum, the optimal corrected real-time spectrum is determined from among the corrected real-time spectra.

3. The database-driven spectral recognition method according to claim 2, characterized in that, The step of determining the optimal corrected real-time spectrum from among the corrected real-time spectra based on the baseline flatness and characteristic peak retention rate of each corrected real-time spectrum includes: From each corrected real-time spectrum, determine the real-time spectra in which the characteristic peak retention rate is greater than the preset characteristic peak retention rate threshold. From the real-time spectra with characteristic peak retention rates greater than a preset characteristic peak retention rate threshold, the real-time spectrum with the smallest baseline flatness is determined as the optimal corrected real-time spectrum.

4. The database-driven spectral recognition method according to claim 1, characterized in that, Based on the particle size classification, the real-time spectrum is subjected to scattering correction, including: A preset scattering correction algorithm corresponding to the particle size level is determined; wherein, the preset scattering correction algorithm includes: a standard normal variable transformation algorithm, a multivariate scattering correction algorithm, and a hybrid algorithm of standard normal variable transformation + multivariate scattering correction; The real-time spectrum is scattered and corrected according to the preset scattering correction algorithm.

5. The database-driven spectral recognition method according to claim 4, characterized in that, The particle size classification includes: small particles, medium particles, and large particles; The preset scattering correction algorithm for determining the particle size level includes: If the particle size level is small particles, then the preset scattering correction algorithm corresponding to the particle size level is determined to be the standard normal variable transformation algorithm; If the particle size level is medium particle, then the preset scattering correction algorithm corresponding to the particle size level is determined to be a hybrid algorithm; If the particle size class is large, then the preset scattering correction algorithm corresponding to the particle size class is determined to be the multivariate scattering correction algorithm.

6. The database-driven spectral recognition method according to claim 5, characterized in that, The preset scattering correction algorithm for determining the particle size level further includes: If the preset scattering correction algorithm corresponding to the particle size level is determined to be a hybrid algorithm, then the weights of the standard normal variable transformation and the multivariate scattering correction in the hybrid algorithm are determined according to the average particle size of the cargo to be detected. Wherein, the weight of the standard normal variable transformation is negatively correlated with the average particle size, the weight of the multivariate scattering correction is positively correlated with the average particle size, and the sum of the weights of the standard normal variable transformation and the multivariate scattering correction is 1.

7. The database-driven spectral recognition method according to claim 1, characterized in that, The step of aligning the real-time spectrum according to the reference spectrum includes: Calculate the spectral similarity between each wavelength point in the real-time spectrum and each wavelength point in the reference spectrum to obtain a similarity comparison table; Based on the similarity comparison table, within the constraints of a matching window of a preset size, the optimal matching path for the wavelength points of the real-time spectrum and the reference spectrum is found. Based on the optimal matching path of the wavelength point, the real-time spectrum is stretched or compressed.

8. A database-driven spectral recognition device, characterized in that, include: The acquisition module is used to acquire the type and real-time spectrum of the goods to be inspected; The query module is used to query the particle size class, key component bands and reference spectrum of the goods to be tested from a preset database according to the type. The correction module is used to perform baseline correction and scattering correction on the real-time spectrum according to the particle size level, and to align the real-time spectrum according to the reference spectrum. The identification module is used to extract peak features from the real-time spectrum, calculate the absorbance ratio of the key component bands, perform feature splicing on the peak features and the absorbance ratio of the key component bands to obtain spectral features, and identify foreign objects in the goods to be detected based on the spectral features.

9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for detecting content of flavone in red bayberries based on near infrared hyper-spectrum technology without loss

    CN106885782A

  • Spectrophotometric method for identifying pterocarpus santalinus and pterocarpus tinctorius

    CN115615940A

  • Regenerated plastic particle solid waste identification method, device and equipment and storage medium

    CN116959643A

  • Foreign matter identification method and device, equipment and storage medium

    CN119723218A

  • Method for carrying out corn quality seed selection by using hyperspectral imaging technology

    CN120468040A