Spectral feature and artificial intelligence fused grain heavy metal detection method and system

By integrating spectral features with artificial intelligence, a grain heavy metal detection system was constructed, which solved the problems of low efficiency and low accuracy of existing detection methods and achieved rapid and accurate detection of heavy metals in grain.

CN121275686AInactive Publication Date: 2026-01-06SHENZHEN SINO ASSESSMENT GRP
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202511481148.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-01-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing methods for detecting heavy metals in grains are inefficient and inaccurate, making it difficult to achieve rapid screening and efficient detection.

Method used

By employing a method that integrates spectral features with artificial intelligence, near-infrared diffuse reflectance spectra, laser-induced breakdown spectra, and surface-enhanced Raman spectra of grain samples are obtained to construct a thermal map of matrix aggregation regions. The laser-induced breakdown spectra are optimized, and dual-channel spatiotemporal feature extraction and signal-to-noise ratio weighted fusion are performed. A pre-trained grain detection model is then used to adapt to new samples and identify heavy metal content.

Benefits of technology

It has improved the efficiency and accuracy of heavy metal detection in grains, enabling rapid and accurate on-site screening and meeting the timeliness and efficiency requirements of actual testing work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121275686A_ABST
    Figure CN121275686A_ABST
Patent Text Reader

Abstract

The invention relates to a data analysis technology, and discloses a spectral feature and artificial intelligence fused grain heavy metal detection method and system.The method comprises the steps that a near-infrared diffuse reflection spectrum, a laser-induced breakdown spectrum and a surface enhanced Raman spectrum of a grain sample are obtained, a matrix accumulation area thermodynamic diagram is constructed according to the near-infrared diffuse reflection spectrum, and the matrix accumulation area thermodynamic diagram is obtained; the method comprises the following steps: optimizing a laser-induced breakdown spectrum based on a thermodynamic diagram of a matrix accumulation area, carrying out dual-channel spatial-temporal feature extraction on a surface enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fusion feature vector, carrying out weighted fusion optimization on the fusion feature vector based on a signal-to-noise ratio of multispectral data to obtain an optimized fusion feature vector, and finally obtaining a fusion feature vector. And carrying out migration adaptation on a pre-trained grain detection model by using a pre-marked new grain sample, and carrying out heavy metal content identification on the grain sample by using the adaptive grain detection model according to the optimized fusion feature vector to obtain a heavy metal detection result. The precision of grain heavy metal detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data analysis technology, and in particular to a method and system for detecting heavy metals in grains that integrates spectral characteristics with artificial intelligence. Background Technology

[0002] In today's society, food security, as a major issue concerning the national economy and people's livelihood, has always occupied a crucial position. The threat of heavy metal pollution to food quality cannot be underestimated. Heavy metals such as lead, cadmium, mercury, and arsenic, once they infiltrate food crops through soil and water sources, not only cause a decline in food quality and yield, but also pose serious threats to human health. Long-term consumption of food containing excessive heavy metals may lead to serious consequences such as damage to the nervous system, kidney disease, and even cancer.

[0003] To effectively address the problem of heavy metal contamination in grains and ensure food quality and safety, numerous methods for detecting heavy metals in grains have emerged. Common traditional detection techniques include atomic absorption spectrometry, electrochemical analysis, optically addressed potential sensors, inductively coupled plasma mass spectrometry (ICP-MS), atomic fluorescence spectrometry, and ultraviolet spectrophotometry. Among these, ICP-MS, as a commonly used national standard method for the simultaneous detection of multiple elements in food in my country, has certain advantages in terms of detection accuracy. However, these conventional detection methods generally suffer from cumbersome sample pretreatment processes, requiring significant time and manpower. Furthermore, when dealing with large sample volumes, they are difficult to implement for rapid on-site screening, failing to meet the timeliness and efficiency requirements of practical testing work. Summary of the Invention

[0004] This invention provides a method and system for detecting heavy metals in grains that integrates spectral features and artificial intelligence. Its main purpose is to solve the problems of low efficiency and low accuracy of existing methods for detecting heavy metals in grains.

[0005] To achieve the above objectives, the present invention provides a method for detecting heavy metals in grains that integrates spectral characteristics and artificial intelligence, comprising: Near-infrared diffuse reflectance spectra, laser-induced breakdown spectra, and surface-enhanced Raman spectra of grain samples from multiple preset collection areas were obtained. A thermal map of the matrix aggregation region is constructed based on the near-infrared diffuse reflectance spectrum. The laser-induced breakdown spectrum is then optimized based on the thermal map of the matrix aggregation region to obtain the optimized laser-induced breakdown spectrum. Dual-channel spatiotemporal feature extraction is performed on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector; The signal-to-noise ratios (SNRs) of the near-infrared diffuse reflectance spectrum, the laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum are calculated to obtain a set of SNRs. Based on the set of SNRs, the fused feature vector is weighted and optimized to obtain an optimized fused feature vector. The pre-trained grain detection model is adapted to new grain samples by using pre-labeled new grain samples to obtain the adapted grain detection model. The adapted grain detection model is used to identify the heavy metal content of the grain sample based on the optimized fusion feature vector, and the heavy metal detection results are obtained.

[0006] Optionally, constructing a thermal map of the matrix aggregation region based on the near-infrared diffuse reflectance spectrum includes: Dark current correction is applied to the near-infrared diffuse reflectance spectrum to obtain the corrected spectrum; The corrected spectrum is normalized by reflectance processing to obtain the normalized spectrum; The normalized spectrum is subjected to feature band extraction to obtain the component intensity matrix; Obtain the surface scan coordinate table of the grain sample, and construct a matrix distribution heat map based on the surface scan coordinate table and the component intensity matrix; Interference regions are identified in the matrix distribution heatmap to obtain a binarized sampling mask image; A heat map of the matrix aggregation region is constructed based on the binarized sampling mask image and the matrix distribution heat map.

[0007] Optionally, optimizing the laser-induced breakdown spectrum based on the thermal map of the matrix aggregation region to obtain the optimized laser-induced breakdown spectrum includes: Read the recommended sampling coordinate list from the thermal map of the matrix aggregation area to obtain the optimized sampling coordinate set; The laser-induced breakdown spectrum of the grain sample was re-acquired based on the optimized sampling coordinate set to obtain the optimized sampling spectrum; The signal-to-noise ratio of the optimized sampling spectrum and the laser-induced breakdown spectrum is calculated to obtain the spectral signal-to-noise ratio; Determine whether the spectral signal-to-noise ratio is greater than or equal to a preset signal-to-noise ratio threshold; If it is less than, then select the adjacent coordinates of each coordinate in the optimized sampling coordinate set to obtain a new optimized sampling coordinate set, and then return to the step of re-collecting the laser-induced breakdown spectrum of the grain sample according to the optimized sampling coordinate set to obtain the optimized sampling spectrum; If it is greater than or equal to, then the optimized sampling spectrum is confirmed to be the optimized laser-induced breakdown spectrum.

[0008] Optionally, the step of performing dual-channel spatiotemporal feature extraction on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector includes: Extract the temporal features of the surface-enhanced Raman spectrum; Extract the temporal resolution features of the optimized laser-induced breakdown spectrum; Based on the thermal map of the matrix aggregation region, spatial feature embedding is performed on the temporal features and the temporal resolution features to obtain a spatially enhanced feature group; The spatial enhancement feature group is subjected to dual-channel feature fusion to obtain a primary fusion vector; Spatiotemporal feature compression is performed on the primary fusion vector to obtain the fusion feature vector.

[0009] Optionally, the step of weighted fusion optimization of the fused feature vector based on the signal-to-noise ratio set to obtain the optimized fused feature vector includes: The feature vectors of the near-infrared diffuse reflectance spectrum, the optimized laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum are extracted respectively to obtain the first feature vector, the second feature vector, and the third feature vector; The signal-to-noise ratio set is compressed and normalized to obtain a normalized signal-to-noise ratio set; Construct a differentiable weight matrix based on the normalized signal-to-noise ratio set; The first feature vector, the second feature vector, and the third feature vector are weighted and fused using the differentiable weight matrix to obtain an optimized fused feature vector.

[0010] Optionally, constructing a differentiable weight matrix based on the normalized signal-to-noise ratio set includes: Construct a signal-to-noise ratio diagonal matrix based on the normalized signal-to-noise ratio set; Multiply the signal-to-noise ratio diagonal matrix by the pre-constructed trainable parameter matrix to obtain the intermediate matrix; Perform softmax processing on each row of the intermediate matrix to obtain the basic weight matrix; Multiply the signal-to-noise ratio diagonal matrix by the elements at the same positions in the basic weight matrix to obtain the modulation matrix; Normalize each element in the modulation matrix to obtain the modulated weight matrix; A differentiable weight matrix is ​​constructed by performing gradient calculation on the modulated weight matrix.

[0011] Optionally, the step of adapting the pre-trained grain detection model to new samples using pre-labeled new grain samples to obtain an adapted grain detection model includes: The heavy metal content of the new grain sample was identified using the grain detection model, and the identification results were obtained. Obtain the standard labeling for the new grain sample; Calculate the loss value between the standard annotation and the recognition result; Determine whether the loss value is greater than or equal to a preset loss value threshold; If the value is greater than or equal to the loss value, then after adjusting the hyperparameters of the grain detection model based on the loss value, return to the step of using the grain detection model to identify the heavy metal content of the new grain sample and obtain the identification result. If the value is less than the specified value, then the grain detection model is confirmed to be the adapted grain detection model.

[0012] Optionally, the step of using the adapted grain detection model to identify the heavy metal content of the grain sample based on the optimized fusion feature vector, and obtaining the heavy metal detection result, includes: The convolutional layer in the grain detection model is used to perform depthwise separable convolution on the fused feature vector to obtain convolutional features; The convolutional features are recalibrated based on an attention mechanism to obtain calibrated features. The fully connected layer in the grain detection model outputs a predicted value of heavy metal concentration based on the calibration features. Repeat the step of using the fully connected layer in the grain detection model to output the predicted value of heavy metal concentration based on the calibration features until a preset number of times is reached to obtain a set of predicted values; Calculate the standard deviation of the predicted value set; Determine whether the standard deviation is greater than or equal to a preset standard deviation threshold; If it is less than, then after adjusting the weight parameters and bias terms in the fully connected layer, return to the step of using the fully connected layer in the grain detection model to output the predicted value of heavy metal concentration based on the calibration features; If the value is greater than or equal to the predicted value set, the mean of the predicted value set is calculated, and the calculated mean is used as the final heavy metal detection result.

[0013] Optionally, after using the adapted grain detection model to identify the heavy metal content of the grain sample based on the optimized fusion feature vector to obtain the heavy metal detection result, the method further includes: Acquire the area coordinate data corresponding to grain samples from multiple preset collection areas; A pollution concentration grid map is constructed based on the regional coordinate data and the heavy metal detection results. Calculate the concentration gradient values ​​of adjacent grids in the pollution concentration grid diagram to obtain the gradient vector field; Diffusion path tracing is performed along the gradient in the opposite direction of each grid in the gradient vector field to obtain a set of particle paths; Convergence point detection is performed based on the particle path set to obtain a pollution source probability heatmap.

[0014] To address the aforementioned problems, the present invention also provides a grain heavy metal detection system that integrates spectral characteristics with artificial intelligence, the system comprising: The data acquisition module is used to acquire near-infrared diffuse reflectance spectra, laser-induced breakdown spectra, and surface-enhanced Raman spectra of grain samples from multiple preset collection areas. The spectral optimization module is used to construct a thermal map of the matrix aggregation region based on the near-infrared diffuse reflectance spectrum, and optimize the laser-induced breakdown spectrum based on the thermal map of the matrix aggregation region to obtain the optimized laser-induced breakdown spectrum; The feature fusion module is used to perform dual-channel spatiotemporal feature extraction on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector. The feature optimization module is used to calculate the signal-to-noise ratio of the near-infrared diffuse reflectance spectrum, the laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum to obtain a signal-to-noise ratio set. Based on the signal-to-noise ratio set, the fused feature vector is weighted and optimized to obtain the optimized fused feature vector. The sample detection module is used to perform new sample transfer adaptation on the pre-trained grain detection model using pre-labeled new grain samples to obtain an adapted grain detection model. The adapted grain detection model is then used to identify the heavy metal content of the grain samples based on the optimized fusion feature vector to obtain heavy metal detection results.

[0015] This invention acquires near-infrared diffuse reflectance spectra, laser-induced breakdown spectra, and surface-enhanced Raman spectra of grain samples from multiple preset collection areas. A matrix aggregation region heatmap is constructed based on the near-infrared diffuse reflectance spectra. The laser-induced breakdown spectrum is then optimized based on this heatmap to obtain an optimized laser-induced breakdown spectrum. Dual-channel spatiotemporal feature extraction is performed on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector. The signal-to-noise ratio (SNR) of the near-infrared diffuse reflectance spectrum, the laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum is calculated to obtain a SNR set. The fused feature vector is then weighted and optimized based on this SNR set to obtain an optimized fused feature vector. A pre-trained grain detection model is adapted to the new grain samples using pre-labeled new grain samples to obtain an adapted grain detection model. The adapted grain detection model is then used to identify the heavy metal content of the grain samples based on the optimized fused feature vector to obtain the heavy metal detection results. This method can solve the problems of low efficiency and low accuracy in existing grain heavy metal detection methods. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating a method for detecting heavy metals in grains that integrates spectral features and artificial intelligence, provided in an embodiment of the present invention. Figure 2 This is a functional block diagram of a grain heavy metal detection system that integrates spectral features and artificial intelligence, provided in an embodiment of the present invention.

[0017] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0018] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0019] This application provides a method for detecting heavy metals in grains by fusing spectral features with artificial intelligence. The execution entity of this method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the method for detecting heavy metals in grains by fusing spectral features with artificial intelligence can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0020] Reference Figure 1 The diagram shown is a flowchart illustrating a method for detecting heavy metals in grains that integrates spectral features and artificial intelligence, according to an embodiment of the present invention. In this embodiment, the method for detecting heavy metals in grains that integrates spectral features and artificial intelligence includes: S1. Obtain near-infrared diffuse reflectance spectra, laser-induced breakdown spectra, and surface-enhanced Raman spectra of grain samples from multiple preset collection areas.

[0021] In this embodiment of the invention, a dried and pulverized grain sample (such as wheat flour) can be pressed into a smooth circular disc and placed on a rotating sample stage. A halogen tungsten lamp light source (900–1700 nm) is used to illuminate the sample at a 45° angle. The detector receives the diffuse reflection signal vertically. The background is first corrected by scanning a standard ceramic plate, and then the sample reflectance spectrum and near-infrared diffuse reflectance spectrum are acquired.

[0022] In this embodiment of the invention, anhydrous ethanol can be used to clean the surface of grains. A Nd:YAG pulsed laser (energy 5 mJ) is focused to bombard the target point (spot size 100 μm). After the plasma is excited, the emission spectrum of 200–800 nm is collected by an ICCD detector (delay 1 μs). The characteristic peaks of Cd 228.8 nm and Pb 405.8 nm are monitored to obtain the laser-induced breakdown spectrum.

[0023] In this embodiment of the invention, heavy metals can be enriched by acid extraction (sonication with 0.1M HNO3 for 30 minutes) and APDC complexation treatment of grain powder, followed by dropwise addition to an Au@Ag core-shell nanosubstrate, and allowed to stand for 10 minutes to form a composite monolayer. A 785 nm laser (20 mW power) is used to focus on the "hot spot" region, and confocal Raman spectroscopy is used to collect data from 200–1800 cm⁻¹.-1 Signal (integrated 10 seconds x 5 times), recognizing the Cd-S key (620 cm) -1 Fingerprint peaks, such as those from fingerprints, were used to obtain surface-enhanced Raman spectra.

[0024] In this embodiment of the invention, the near-infrared diffuse reflectance spectrum is obtained by irradiating powder, particles or irregular solid samples with near-infrared light (780–2500 nm), causing photons to be scattered multiple times inside the sample and partially absorbed, and then returning from the surface in the form of "diffuse reflection" and being collected, thereby obtaining a spectrum related to the chemical composition.

[0025] In this embodiment of the invention, the laser-induced breakdown spectrum is achieved by focusing a high-energy pulsed laser (nanosecond / picosecond level) onto the sample surface to form a transient plasma; the atomic / ion emission characteristic spectral lines when the plasma cools can be collected by a spectrometer to achieve simultaneous multi-element analysis.

[0026] In this embodiment of the invention, the surface-enhanced Raman spectroscopy refers to the Raman scattering cross section being increased by 10% due to localized surface plasmon resonance when molecules approach or adsorb onto the surface of a rough metal (Ag, Au, Cu) nanostructure. 6 -10 15 This allows for the detection of "fingerprint" spectra at the single-molecule level.

[0027] S2. Construct a thermal map of the matrix aggregation region based on the near-infrared diffuse reflectance spectrum, and optimize the laser-induced breakdown spectrum based on the thermal map of the matrix aggregation region to obtain the optimized laser-induced breakdown spectrum.

[0028] In this embodiment of the invention, the matrix aggregation zone heat map is a type of visualized spatial distribution data. It visually presents the aggregation state and concentration gradient of organic components (such as starch and protein) on the surface of grain samples through color mapping. In this embodiment of the invention, constructing a thermal map of the matrix aggregation region based on the near-infrared diffuse reflectance spectrum includes: Dark current correction is applied to the near-infrared diffuse reflectance spectrum to obtain the corrected spectrum; The corrected spectrum is normalized by reflectance processing to obtain the normalized spectrum; The normalized spectrum is subjected to feature band extraction to obtain the component intensity matrix; Obtain the surface scan coordinate table of the grain sample, and construct a matrix distribution heat map based on the surface scan coordinate table and the component intensity matrix; Interference regions are identified in the matrix distribution heatmap to obtain a binarized sampling mask image; A heat map of the matrix aggregation region is constructed based on the binarized sampling mask image and the matrix distribution heat map.

[0029] In detail, the dark current correction of the near-infrared diffuse reflectance spectrum is performed by inputting the original near-infrared diffuse reflectance spectrum, acquiring the dark current background signal (mainly including electronic thermal noise and dark current) under no-light conditions, subtracting the background value from the original spectrum band by band, and outputting the corrected spectrum that eliminates the inherent noise of the device.

[0030] In detail, the reflectance normalization processing of the corrected spectrum is performed by dividing the sample intensity of each band by the reflectance intensity of the standard ceramic white board in the same band (white board reflectance > 99%), and calculating the relative reflectance, outputting a normalized spectrum in the range of 0-1.0.

[0031] In detail, the extraction of characteristic bands from the normalized spectrum refers to obtaining starch intensity (corresponding to the third-order overtone absorption of CH bonds) by numerical integration in the 1180-1220nm band, obtaining protein intensity (corresponding to the NH bond combination frequency absorption) by integration in the 2150-2180nm band, and outputting an N×2-dimensional component intensity matrix composed of starch / protein intensity values ​​at each scanning point.

[0032] In detail, the process of obtaining the surface scan coordinate table of the grain sample and constructing a matrix distribution heatmap based on the surface scan coordinate table and the component intensity matrix involves using a Kriging spatial interpolation algorithm (based on a semi-variogram to determine spatial weights) to reconstruct discrete point chemical data into a continuous two-dimensional distribution. Subsequently, dual-channel pseudo-color rendering is performed—the red channel maps starch intensity (0→light red, 1.0→dark red), and the blue channel maps protein intensity (0→light blue, 1.0→dark blue). The layers are then overlaid to generate a georeferenced RGB heatmap, and the purple areas in the output image indicate areas of high starch and protein aggregation.

[0033] In detail, the interference region is identified in the matrix distribution heatmap to obtain a binary sampling mask image. A starch intensity threshold is set (usually 70% of the maximum value). Regions above the threshold are marked as high interference regions (marked as black regions), and regions below the threshold are marked as low interference regions (marked as white regions). A binary mask image is generated (black is the prohibited sampling region, and white is the allowed sampling region).

[0034] In detail, the process involves constructing a matrix aggregation region heatmap based on the binarized sampling mask image and the matrix distribution heatmap, extracting the pixel coordinates of the white areas of the mask and converting them into mechanical coordinates of the sample stage, and encapsulating the final output containing three core elements: a GeoTIFF format heatmap (for human visual decision-making), a binary mask bitmap (for machine obstacle avoidance instructions), and a recommended coordinate list (e.g., "[(x=1.2mm,y=0.8mm),...]"), which is used for subsequent optimization of the laser-induced breakdown spectrum.

[0035] In this embodiment of the invention, optimizing the laser-induced breakdown spectrum based on the thermal map of the matrix aggregation region to obtain the optimized laser-induced breakdown spectrum includes: Read the recommended sampling coordinate list from the thermal map of the matrix aggregation area to obtain the optimized sampling coordinate set; The laser-induced breakdown spectrum of the grain sample was re-acquired based on the optimized sampling coordinate set to obtain the optimized sampling spectrum; The signal-to-noise ratio of the optimized sampling spectrum and the laser-induced breakdown spectrum is calculated to obtain the spectral signal-to-noise ratio; Determine whether the spectral signal-to-noise ratio is greater than or equal to a preset signal-to-noise ratio threshold; If it is less than, then select the adjacent coordinates of each coordinate in the optimized sampling coordinate set to obtain a new optimized sampling coordinate set, and then return to the step of re-collecting the laser-induced breakdown spectrum of the grain sample according to the optimized sampling coordinate set to obtain the optimized sampling spectrum; If it is greater than or equal to, then the optimized sampling spectrum is confirmed to be the optimized laser-induced breakdown spectrum.

[0036] In detail, the step of re-acquiring the laser-induced breakdown spectrum of the grain sample based on the optimized sampling coordinate set to obtain the optimized sampling spectrum refers to inputting the optimized coordinate set, controlling the sample stage to move to the target position, synchronously adjusting the laser focusing lens to ensure that the spot diameter is ≤100μm, dynamically setting the laser energy according to the starch intensity at that point (using 3mJ low energy to avoid carbonization when starch intensity is ≤0.3, and using 5mJ when >0.3), triggering the Nd:YAG laser to bombard the surface and acquiring the 200-800nm ​​plasma spectrum (ICCD gate width 5μs, delay 0.5-1μs), repeating the bombardment 3 times at each coordinate point, and outputting an optimized sampling spectrum data package containing the original spectral intensity matrix.

[0037] In detail, the calculation of the signal-to-noise ratio (SNR) of the optimized sampling spectrum and the laser-induced breakdown spectrum is performed on the target heavy metal characteristic peak (e.g., Cd 228.8 nm): the peak intensity at 228.8 ± 0.2 nm is extracted as the signal, the standard deviation of the continuous background at 225-230 nm is selected as the noise, the ratio of signal to noise (signal ÷ noise) is first calculated, then the logarithm to base 10 is taken, and finally the result is multiplied by 20, i.e., "SNR (dB) = 20 × log 10 (Signal ÷ Noise) yields the spectral signal-to-noise ratio for each sampling point.

[0038] Specifically, the signal-to-noise ratio threshold can be 50.

[0039] S3. Perform dual-channel spatiotemporal feature extraction on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector.

[0040] In this embodiment of the invention, the step of performing dual-channel spatiotemporal feature extraction on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector includes: Extract the temporal features of the surface-enhanced Raman spectrum; Extract the temporal resolution features of the optimized laser-induced breakdown spectrum; Based on the thermal map of the matrix aggregation region, spatial feature embedding is performed on the temporal features and the temporal resolution features to obtain a spatially enhanced feature group; The spatial enhancement feature group is subjected to dual-channel feature fusion to obtain a primary fusion vector; Spatiotemporal feature compression is performed on the primary fusion vector to obtain the fusion feature vector.

[0041] In detail, the extraction of the time-domain features of the surface-enhanced Raman spectrum is performed by time-frequency decomposition using Morlet wavelet basis functions (scale 1-128) to extract heavy metal characteristic peaks (such as Cd-S bond at 620 cm⁻¹). -1 The time-domain evolution parameters of the wavelet coefficient matrix include the peak asymmetry (calculated by normalizing the third moment) and the instantaneous frequency drift, outputting a 64-dimensional time-domain feature vector.

[0042] In detail, the extraction of the temporal resolution features of the optimized laser-induced breakdown spectrum involves analyzing the characteristic peaks of the optimized laser-induced breakdown spectrum: First, the intensity of the characteristic peak as a function of time is reconstructed, denoted as I(t). The curve is then fitted with an exponential decay function “I0×e^(-t / τ)” (where I0 is the initial intensity, t is time, τ is the time constant, and e is the natural constant), and the time constant τ is obtained through fitting. The rate of change of intensity within the key time window (0.5-10μs) is calculated, i.e., “(intensity change) ÷ (time change)”, denoted as ΔI / Δt. The stability of the time constant τ obtained from multiple bombardments is calculated (expressed as standard deviation, denoted as τ_std). Finally, a 3-dimensional feature vector is output, containing three values: the average value of the time constant τ, the rate of change of intensity ΔI / Δt, and the standard deviation of the time constant τ_std.

[0043] In detail, the spatial feature embedding based on the thermal map of the matrix aggregation region for the temporal features and the temporal resolution features involves extracting the mean starch intensity and spatial gradient within a 250 μm radius centered on the coordinates (calculated using the Sobel operator), and then concatenating the spatial features with the spectral features into a 69-dimensional spatial enhancement feature set.

[0044] In detail, the dual-channel feature fusion of the spatial enhancement feature group can be performed by assigning a weight of 0.5 to each feature group and then performing weighted fusion.

[0045] In detail, the spatiotemporal feature compression of the primary fusion vector can be performed by dimensionality reduction using a preset variational autoencoder (VAE).

[0046] In detail, the variational autoencoder is a generative neural network that combines deep learning and probabilistic graphical models. Its core idea is to map input data to the latent space through probabilistic encoding and realize data reconstruction and generation.

[0047] S4. Calculate the signal-to-noise ratio of the near-infrared diffuse reflectance spectrum, the laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum to obtain a signal-to-noise ratio set. Based on the signal-to-noise ratio set, perform weighted fusion optimization on the fused feature vector to obtain the optimized fused feature vector.

[0048] In this embodiment of the invention, the signal-to-noise ratio (SNR) of the near-infrared diffuse reflectance spectrum is calculated based on the ratio of the peak intensity of the starch characteristic absorption peak (1200 nm) to the standard deviation of the noise-free region (1300-1350 nm); the SNR of the laser-induced breakdown spectrum is determined based on the ratio of the net peak intensity of the heavy metal element characteristic peak (e.g., Cd 228.8 nm) after background subtraction to the standard deviation of the adjacent peakless band (225-230 nm excluding characteristic peaks); the SNR of the surface-enhanced Raman spectrum is obtained through the heavy metal-ligand bonding characteristic peak (e.g., Cd-S bond 620 cm⁻¹). -1 The peak height and the baseline-corrected peakless region (600-1800 cm) -1 The ratio of the standard deviations of all characteristic peaks is used to obtain the result.

[0049] In this embodiment of the invention, the step of performing weighted fusion optimization on the fused feature vector based on the signal-to-noise ratio set to obtain the optimized fused feature vector includes: The feature vectors of the near-infrared diffuse reflectance spectrum, the optimized laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum are extracted respectively to obtain the first feature vector, the second feature vector, and the third feature vector; The signal-to-noise ratio set is compressed and normalized to obtain a normalized signal-to-noise ratio set; Construct a differentiable weight matrix based on the normalized signal-to-noise ratio set; The first feature vector, the second feature vector, and the third feature vector are weighted and fused using the differentiable weight matrix to obtain an optimized fused feature vector.

[0050] In detail, the extraction of feature vectors from the near-infrared diffuse reflectance spectrum, the optimized laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum is achieved using a dedicated feature extraction network (e.g., a one-dimensional CNN is used to extract 1200 / 2170nm amylose features for the near-infrared diffuse reflectance spectrum, an LSTM is used to analyze the plasma decay curve for the optimized laser-induced breakdown spectrum, and wavelet transform is used to capture the temporal characteristics of the 620cm⁻¹ isodynamic peak for the surface-enhanced Raman spectrum), and the output dimension is unified to d-dimensional feature vectors.

[0051] In detail, the compression and normalization of the signal-to-noise ratio set is performed by nonlinear compression using the hyperbolic tangent function, mapping the dynamic range of 70dB (e.g., 20-90dB) to the [0,1] interval.

[0052] In detail, the construction of a differentiable weight matrix based on the normalized signal-to-noise ratio set is achieved by constructing a 3×3 diagonal signal-to-noise ratio matrix S, simultaneously initializing two trainable parameter matrices U (3×k) and V (k×3) (k=2, which is the dimension of the latent factor), calculating the basic weight W_base=softmax(U·V), and finally generating the weight matrix W=S⊙W_base through the Hadamard product. This allows high signal-to-noise ratio spectra to automatically receive weight enhancement (e.g., a 37% weight increase when s_sers=0.98), and the matrix elements are differentiable to support gradient updates.

[0053] In this embodiment of the invention, constructing a differentiable weight matrix based on the normalized signal-to-noise ratio set includes: Construct a signal-to-noise ratio diagonal matrix based on the normalized signal-to-noise ratio set; Multiply the signal-to-noise ratio diagonal matrix by the pre-constructed trainable parameter matrix to obtain the intermediate matrix; Perform softmax processing on each row of the intermediate matrix to obtain the basic weight matrix; Multiply the signal-to-noise ratio diagonal matrix by the elements at the same positions in the basic weight matrix to obtain the modulation matrix; Normalize each element in the modulation matrix to obtain the modulated weight matrix; A differentiable weight matrix is ​​constructed by performing gradient calculation on the modulated weight matrix.

[0054] In detail, the step of constructing a signal-to-noise ratio (SNR) diagonal matrix based on the normalized SNR set involves inputting the normalized SNR set (three values ​​between 0 and 1, corresponding to the SNR of near-infrared diffuse reflectance spectrum, optimized laser-induced breakdown spectrum, and surface-enhanced Raman spectrum, respectively), and creating a 3×3 diagonal matrix: placing the first SNR value in the upper left corner of the matrix, the second in the center, and the third in the lower right corner, filling the remaining positions with zeros, and finally adding a small constant (10).-6 To avoid numerical calculation errors, the output is a strictly diagonalized signal-to-noise ratio matrix.

[0055] In detail, the softmax processing of each row of the intermediate matrix involves performing a softmax transformation on each row element independently—first calculating the natural exponent value of each row element, then dividing by the sum of the row's exponent values ​​(e.g., row element [a,b,c] is transformed into [e...]). a / (e a +e b +e c ), e b / (e a +e b +e c ), e c / (e a +e b +e c The output basic weight matrix ensures that the sum of the elements in each row is 1. Its technical significance lies in transforming the matrix multiplication result into a probability distribution form, reflecting the relative importance of the three spectra in feature representation.

[0056] In detail, the normalization process for each element in the modulation matrix is ​​performed by calculating the sum of the elements in each column and then dividing each element in a column by the sum of the elements in that column.

[0057] In detail, the construction of a differentiable weight matrix by performing gradient calculation on the modulated weight matrix is ​​achieved by registering the modulated weight matrix as a computable node in the deep learning framework and establishing a gradient propagation path through an automatic differentiation mechanism: when the loss function value propagates back, the system automatically calculates the partial derivative of the loss with respect to the weight matrix (loss change / weight change), and further calculates the gradient of the loss with respect to the underlying parameter matrices U and V through the chain rule (specifically: partial derivative of loss with respect to weights × partial derivative of weights with respect to the intermediate matrix × partial derivative of the intermediate matrix with respect to U / V). Finally, the gradient value is stored in the grad attribute of the parameter matrix, so that the entire weight matrix has the differentiable property of dynamically adjusting with training.

[0058] S5. Use pre-labeled new grain samples to perform new sample transfer adaptation on the pre-trained grain detection model to obtain the adapted grain detection model.

[0059] In this embodiment of the invention, the pre-labeled new grain sample may refer to a sample of the same type of grain as the grain sample, and the heavy metal content is labeled. By using the pre-labeled new grain sample to perform new sample transfer adaptation on the pre-trained grain detection model, the detection accuracy of the model for the grain sample can be improved.

[0060] In this embodiment of the invention, the step of using pre-labeled new grain samples to perform new sample transfer adaptation on the pre-trained grain detection model to obtain an adapted grain detection model includes: The heavy metal content of the new grain sample was identified using the grain detection model, and the identification results were obtained. Obtain the standard labeling for the new grain sample; Calculate the loss value between the standard annotation and the recognition result; Determine whether the loss value is greater than or equal to a preset loss value threshold; If the value is greater than or equal to the loss value, then after adjusting the hyperparameters of the grain detection model based on the loss value, return to the step of using the grain detection model to identify the heavy metal content of the new grain sample and obtain the identification result. If the value is less than the specified value, then the grain detection model is confirmed to be the adapted grain detection model.

[0061] Specifically, the step of using the grain detection model to identify the heavy metal content of the new grain sample refers to obtaining the new grain sample's... Specifically, the standard labeling refers to the labeling of the heavy metal content of the new grain sample.

[0062] In detail, adjusting the hyperparameters of the grain detection model based on the loss value means multiplying the loss value by a preset weight coefficient (which can be 0.1) to obtain the adjustment step size, and then using the obtained adjustment step size to adjust the model's weight parameters and learning rate.

[0063] S6. Using the adapted grain detection model, the heavy metal content of the grain sample is identified based on the optimized fusion feature vector to obtain the heavy metal detection result.

[0064] In this embodiment of the invention, the step of using the adapted grain detection model to identify the heavy metal content of the grain sample based on the optimized fusion feature vector, and obtaining the heavy metal detection result, includes: The convolutional layer in the grain detection model is used to perform depthwise separable convolution on the fused feature vector to obtain convolutional features; The convolutional features are recalibrated based on an attention mechanism to obtain calibrated features. The fully connected layer in the grain detection model outputs a predicted value of heavy metal concentration based on the calibration features. Repeat the step of using the fully connected layer in the grain detection model to output the predicted value of heavy metal concentration based on the calibration features until a preset number of times is reached to obtain a set of predicted values; Calculate the standard deviation of the predicted value set; Determine whether the standard deviation is greater than or equal to a preset standard deviation threshold; If it is less than, then after adjusting the weight parameters and bias terms in the fully connected layer, return to the step of using the fully connected layer in the grain detection model to output the predicted value of heavy metal concentration based on the calibration features; If the value is greater than or equal to the predicted value set, the mean of the predicted value set is calculated, and the calculated mean is used as the final heavy metal detection result.

[0065] In detail, in the fully connected layer, each element w of the weight matrix W... ij denoted as "the influence of the j-th input neuron on the i-th output neuron", with positive weights enhancing and negative weights suppressing, and the larger the absolute value, the stronger the effect; the bias term b provides an independent and learnable "baseline offset" for each output neuron, which is equivalent to adding an intercept to the linear transformation, so that even when all inputs are zero, the neuron can output a non-zero value, thereby expanding the expression range of the network and allowing the activation function to perform non-linear mapping of features at a more appropriate position.

[0066] In this embodiment of the invention, after using the adapted grain detection model to identify the heavy metal content of the grain sample based on the optimized fusion feature vector and obtaining the heavy metal detection result, the method further includes: Acquire the area coordinate data corresponding to grain samples from multiple preset collection areas; A pollution concentration grid map is constructed based on the regional coordinate data and the heavy metal detection results. Calculate the concentration gradient values ​​of adjacent grids in the pollution concentration grid diagram to obtain the gradient vector field; Diffusion path tracing is performed along the gradient in the opposite direction of each grid in the gradient vector field to obtain a set of particle paths; Convergence point detection is performed based on the particle path set to obtain a pollution source probability heatmap.

[0067] In detail, the construction of the pollution concentration grid map based on the regional coordinate data and the heavy metal detection results is achieved by using an inverse distance-weighted interpolation method to convert the sample point concentrations into regular grid data. Using a 1km × 1km grid unit (adjustable), the concentration value at the center point of each grid is calculated (grid concentration = ∑(sample concentration / distance)). 2 ) / ∑(1 / distance 2 )).

[0068] In detail, the concentration gradient values ​​of adjacent grids in the pollution concentration grid are calculated to obtain a gradient vector field. The Sobel operator is then applied to the pollution concentration grid for spatial gradient detection. The east-west gradient and the north-south gradient are calculated separately.

[0069] In detail, the diffusion path tracing along the gradient in the opposite direction of each grid in the gradient vector field refers to iterative particle tracing starting from each grid point and simulating pollution migration in reverse.

[0070] In detail, the process involves detecting convergence points based on the particle path set to obtain a pollution source probability heatmap. Based on the distribution of particle path termination points, kernel density estimation (KDE) is used to calculate the spatial probability density. High-probability regions (>0.8) are marked as candidate pollution sources, and low-probability regions are identified as diffusion ends. A heatmap overlaid with satellite imagery is then output.

[0071] like Figure 2 The diagram shown is a functional block diagram of a grain heavy metal detection system that integrates spectral features and artificial intelligence, provided in an embodiment of the present invention.

[0072] The grain heavy metal detection system 100, which integrates spectral features and artificial intelligence, as described in this invention, can be installed in an electronic device. Depending on the functions implemented, the grain heavy metal detection system 100 may include a data acquisition module 101, a spectral optimization module 102, a feature fusion module 103, a feature optimization module 104, and a sample detection module 105. The module described in this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, and which are stored in the memory of the electronic device.

[0073] In this embodiment, the functions of each module / unit are as follows: The data acquisition module 101 is used to acquire near-infrared diffuse reflectance spectra, laser-induced breakdown spectra, and surface-enhanced Raman spectra of grain samples from multiple preset collection areas. The spectral optimization module 102 is used to construct a thermal map of the matrix aggregation region based on the near-infrared diffuse reflectance spectrum, and optimize the laser-induced breakdown spectrum based on the thermal map of the matrix aggregation region to obtain the optimized laser-induced breakdown spectrum. The feature fusion module 103 is used to perform dual-channel spatiotemporal feature extraction on the surface-enhanced Raman spectrum and the optimized laser-induced breakdown spectrum to obtain a fused feature vector. The feature optimization module 104 is used to calculate the signal-to-noise ratio of the near-infrared diffuse reflectance spectrum, the laser-induced breakdown spectrum, and the surface-enhanced Raman spectrum to obtain a signal-to-noise ratio set, and to perform weighted fusion optimization on the fused feature vector based on the signal-to-noise ratio set to obtain the optimized fused feature vector; The sample detection module 105 is used to perform new sample transfer adaptation on the pre-trained grain detection model using pre-labeled new grain samples to obtain an adapted grain detection model. The adapted grain detection model is then used to identify the heavy metal content of the grain sample based on the optimized fusion feature vector to obtain the heavy metal detection result.

[0074] In detail, the modules of the grain heavy metal detection system 100 that integrates spectral features and artificial intelligence as described in this embodiment of the invention employ the same methods as those described above. Figure 1 The spectral characteristics described herein are the same technical means as the artificial intelligence-integrated method for detecting heavy metals in grains, and can produce the same technical effect, so they will not be elaborated here.

[0075] In the embodiments provided by this invention, it should be understood that the disclosed devices, systems, and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0076] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0077] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0078] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0079] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0080] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0081] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or systems stated in a system claim may also be implemented by a single unit or system through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0082] Finally, it should be noted that 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 preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A grain heavy metal detection method combining spectral features and artificial intelligence, characterized in that, The method comprises: acquiring near-infrared diffuse reflectance spectra, laser-induced breakdown spectra and surface-enhanced Raman spectra of a plurality of grain samples in preset collection areas; constructing a matrix aggregation area thermal map according to the near-infrared diffuse reflectance spectra, and optimizing the laser-induced breakdown spectra based on the matrix aggregation area thermal map to obtain optimized laser-induced breakdown spectra; performing double-channel space-time feature extraction on the surface-enhanced Raman spectra and the optimized laser-induced breakdown spectra to obtain a fusion feature vector; calculating signal-to-noise ratios of the near-infrared diffuse reflectance spectra, the laser-induced breakdown spectra and the surface-enhanced Raman spectra to obtain a signal-to-noise ratio set, and performing weighted fusion optimization on the fusion feature vector based on the signal-to-noise ratio set to obtain an optimized fusion feature vector; performing new sample migration adaptation on a pre-trained grain detection model using a pre-labeled new grain sample to obtain an adapted grain detection model; using the adapted grain detection model to identify heavy metal content of the grain sample according to the optimized fusion feature vector to obtain a heavy metal detection result.

2. The method for detecting heavy metals in grain by fusing spectral features and artificial intelligence according to claim 1, wherein, The method comprises: performing dark current correction on the near-infrared diffuse reflectance spectra to obtain corrected spectra; performing reflectivity normalization processing on the corrected spectra to obtain normalized spectra; performing feature band extraction on the normalized spectra to obtain a component intensity matrix; obtaining a surface scanning coordinate table of the grain sample, and constructing a matrix distribution thermal map according to the surface scanning coordinate table and the component intensity matrix; performing interference area identification on the matrix distribution thermal map to obtain a binary sampling mask image; constructing a matrix aggregation area thermal map according to the binary sampling mask image and the matrix distribution thermal map.

3. The method of claim 1, wherein the method is characterized by, The method comprises: reading a recommended sampling coordinate list in the matrix aggregation area thermal map to obtain an optimized sampling coordinate set; recollecting laser-induced breakdown spectra of the grain sample according to the optimized sampling coordinate set to obtain optimized sampling spectra; calculating a spectrum signal-to-noise ratio of the optimized sampling spectra and the laser-induced breakdown spectra; determining whether the spectrum signal-to-noise ratio is greater than or equal to a preset signal-to-noise ratio threshold; if not, selecting adjacent coordinates of each coordinate in the optimized sampling coordinate set to obtain a new optimized sampling coordinate set, and returning to the step of recollecting laser-induced breakdown spectra of the grain sample according to the new optimized sampling coordinate set to obtain optimized sampling spectra; if yes, confirming that the optimized sampling spectra are the optimized laser-induced breakdown spectra.

4. The method for grain heavy metal detection by fusing spectral features and artificial intelligence according to claim 1, wherein, The method comprises: extracting time-domain features of the surface-enhanced Raman spectra; extracting time resolution features of the optimized laser-induced breakdown spectra; spatial feature embedding is performed on the time domain feature and the time resolution feature based on the matrix cluster thermal map, to obtain a spatial enhanced feature group; two-channel feature fusion is performed on the spatial enhanced feature group, to obtain a primary fusion vector; spatio-temporal feature compression is performed on the primary fusion vector, to obtain a fusion feature vector.

5. The method of claim 1, wherein the method is characterized by, The fusion feature vector is weighted and fused based on the SNR set, to obtain an optimized fusion feature vector, including: feature vectors of the near-infrared diffuse reflectance spectrum, the optimized laser-induced breakdown spectrum and the surface enhanced Raman spectrum are extracted respectively, to obtain a first feature vector, a second feature vector and a third feature vector; compression and normalization processing is performed on the SNR set, to obtain a normalized SNR set; a differentiable weight matrix is constructed according to the normalized SNR set; the first feature vector, the second feature vector and the third feature vector are weighted and fused by using the differentiable weight matrix, to obtain an optimized fusion feature vector.

6. The method for grain heavy metal detection by fusing spectral features and artificial intelligence according to claim 5, characterized in that, The differentiable weight matrix is constructed according to the normalized SNR set, including: an SNR diagonal matrix is constructed according to the normalized SNR set; the SNR diagonal matrix is multiplied by a pre-constructed trainable parameter matrix, to obtain an intermediate matrix; softmax processing is performed on each row of the intermediate matrix, to obtain a basic weight matrix; elements at the same positions in the SNR diagonal matrix and the basic weight matrix are multiplied, to obtain a modulation matrix; each element in the modulation matrix is normalized, to obtain a modulated weight matrix; the differentiable weight matrix is constructed by gradient calculation on the modulated weight matrix.

7. The method of claim 1, wherein the method is characterized by, The pre-trained grain detection model is adapted to new samples by using the pre-labeled new grain samples, to obtain an adapted grain detection model, including: heavy metal content of the new grain samples is identified by using the grain detection model, to obtain an identification result; a standard label of the new grain samples is obtained; a loss value of the standard label and the identification result is calculated; it is judged whether the loss value is greater than or equal to a preset loss value threshold; if greater than or equal to, after adjusting hyperparameters of the grain detection model based on the loss value, the step of identifying heavy metal content of the new grain samples by using the grain detection model is returned to obtain an identification result; if less than, the grain detection model is confirmed as the adapted grain detection model.

8. The method for grain heavy metal detection by fusing spectral features and artificial intelligence according to claim 1, wherein, Heavy metal content of the grain samples is identified according to the optimized fusion feature vector by using the adapted grain detection model, to obtain a heavy metal detection result, including: a convolution feature is obtained by performing depth separable convolution on the fusion feature vector by using a convolution layer in the grain detection model; a calibration feature is obtained by recalibrating the convolution feature based on an attention mechanism; a prediction value of heavy metal concentration is output by using a full connection layer in the grain detection model according to the calibration feature; repeating the step of outputting the predicted value of the heavy metal concentration from the full connection layer in the grain detection model according to the calibration feature until a preset number of times is reached, to obtain a set of predicted values; calculating the standard deviation of the set of predicted values; determining whether the standard deviation is greater than or equal to a preset standard deviation threshold value; if less than, adjusting the weight parameters and bias terms in the full connection layer, and returning to the step of outputting the predicted value of the heavy metal concentration from the full connection layer in the grain detection model according to the calibration feature; if greater than or equal to, calculating the mean of the set of predicted values, and taking the calculated mean as the final heavy metal detection result.

9. The method of claim 1, wherein the method is characterized by, After the heavy metal content of the grain sample is identified according to the optimized fusion feature vector by using the adapted grain detection model to obtain a heavy metal detection result, the method further comprises: obtaining regional coordinate data corresponding to the grain samples in a plurality of preset collection regions; constructing a pollution concentration grid map according to the regional coordinate data and the heavy metal detection result; calculating the concentration gradient value of adjacent grids in the pollution concentration grid map to obtain a gradient vector field; performing diffusion path tracking in the reverse direction of the gradient of each grid in the gradient vector field to obtain a set of particle paths; performing convergence point detection according to the set of particle paths to obtain a pollution source probability heat map.

10. A grain heavy metal detection system integrating spectral features and artificial intelligence, characterized in that, The system comprises: a data acquisition module configured to acquire near-infrared diffuse reflectance spectra, laser-induced breakdown spectroscopy, and surface-enhanced Raman spectroscopy of grain samples in a plurality of preset collection regions; a spectrum optimization module configured to construct a matrix aggregation area heat map according to the near-infrared diffuse reflectance spectra, and optimize the laser-induced breakdown spectroscopy based on the matrix aggregation area heat map to obtain optimized laser-induced breakdown spectroscopy; a feature fusion module configured to perform double-channel spatiotemporal feature extraction on the surface-enhanced Raman spectroscopy and the optimized laser-induced breakdown spectroscopy to obtain a fusion feature vector; a feature optimization module configured to calculate the signal-to-noise ratios of the near-infrared diffuse reflectance spectra, the laser-induced breakdown spectroscopy, and the surface-enhanced Raman spectroscopy to obtain a set of signal-to-noise ratios, and perform weighted fusion optimization on the fusion feature vector based on the set of signal-to-noise ratios to obtain an optimized fusion feature vector; a sample detection module configured to perform new sample transfer adaptation on a pre-trained grain detection model by using a pre-labeled new grain sample to obtain an adapted grain detection model, and identify the heavy metal content of the grain sample according to the optimized fusion feature vector by using the adapted grain detection model to obtain a heavy metal detection result.

Citation Information

Cited By

  • Raman spectrum myocardial infarction screening method, system, equipment and medium

    CN121856237A

  • Water antibiotic pollution detection method and system based on spectral characteristics

    CN121902066A

  • A method and system for detecting antibiotic pollution in water bodies based on spectral characteristics

    CN121902066B