Spectroscopic detection method and system for residual pesticides in cross-border e-commerce exported agricultural products
Patent Information
- Application Number
- CN202610709982.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-22
- Publication Date
- 2026-08-18
AI Technical Summary
在上述情形下,传统预处理方法扣除基底干扰的过程中,有时会将百菌清等农药的弱吸收信号误处理为非特征变化,导致低浓度残留的检出结果出现一定波动
本发明通过蒙特卡洛模拟光子在农产品非均匀生物介质中的多重散射轨迹,动态计算并补偿组织自身散射与吸收背景,可有效剔除蜡质层、水分、纤维素、细胞结构等内源性基底干扰,避免对低浓度农药弱吸收信号的削弱或误判,提升微量、痕量农药残留的检出准确性。去耦合净光谱分离,特征信号更纯净从原始光谱中精准剥离动态基底补偿向量,得到无背景耦合的净吸收光谱序列,使农药分子官能团的特征吸收峰得以清晰呈现,降低信号混叠与基线漂移对检测结果的干扰,提升光谱特征辨识度。共振锚点智能识别,自适应区分信号与干扰通过定位主吸收峰、干扰峰与基线拐点三类共振锚点,自动区分农药有效特征信号与农产品内源性干扰信号,无需人工干预即可实现信号与干扰自适应判别。拓扑结构动态构建,解决峰位混叠难题针对农药特征峰与干扰峰易重叠的问题,自适应构建三角拓扑映射域或矢量辐射锥体,实现混叠信号的有效隔离与干扰能量范围精准表征,从结构上分离有效信号与干扰成分。几何特征指数化,检测结果量化稳定基于拓扑结构计算农药残留特征响应指数,以几何不变矩、体积模量等参数实现特征信号的归一化量化表达,结果不受平移、旋转、缩放影响,检测一致性与重复性更强。跨境合规闭环判定,支撑出口溯源与风控将检测指数直接映射至跨境出口合规决策空间,合格信息自动上链存证形成不可篡改溯源标识,不合格即时触发预警并启动复检,形成快速检测、合规判定、区块链存证以及异常预警全闭环。
Smart Images

Figure CN122591583A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural product quality and safety testing technology, and in particular to a method and system for the spectral detection of pesticide residues in agricultural products exported through cross-border e-commerce. Background Technology
[0002] In the quality and safety testing of agricultural products exported through cross-border e-commerce, the spectral detection method for pesticide residues has received considerable attention. However, existing spectral detection technologies may have shortcomings in certain application scenarios. For example, the surface and internal tissues of some agricultural products (such as cherry tomatoes and leafy vegetables) have non-uniform biological media characteristics. The collected spectral signals may simultaneously contain interference information from the sample substrate (such as chlorophyll, water, and cell structure). This interference information may couple with the characteristic spectra of pesticide residues in certain bands. Traditional spectral correction methods (such as standard normal transformation or multivariate scattering correction) may weaken or misjudge the weak characteristics of some pesticide residues as background noise when subtracting background signals, thus affecting the accuracy of detecting low-concentration pesticide residues.
[0003] Taking a batch of cherry tomatoes from a southern production area as an example, this batch of tomatoes underwent pesticide residue screening using near-infrared spectroscopy before export. While the tomato skin is smooth, the internal tissue has a high water content, and the surface may contain trace amounts of natural wax. Under these circumstances, traditional pretreatment methods, during the subtraction of matrix interference, sometimes misprocess weak absorption signals of pesticides such as chlorothalonil as non-characteristic changes, leading to fluctuations in the detection results for low-concentration residues. If such situations are not detected in time before export, the goods may face the risk of being returned or destroyed upon arrival at the destination port, potentially causing economic losses to the company and impacting its international market reputation. Summary of the Invention
[0004] This invention provides a method and system for the spectral detection of pesticide residues in agricultural products exported through cross-border e-commerce, improving the accuracy of pesticide residue detection under the interference of complex biological tissues.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: Firstly, a method for the spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce, the method comprising: Step 1: Perform radiometric correction and dark current subtraction on the high-dimensional spectral data tensor of the surface of the agricultural product to be tested to generate a standardized spectral feature matrix; based on the standardized spectral feature matrix, simulate the multiple scattering trajectory of virtual photon packets in a non-uniform biological medium, and calculate the mean free path distribution of virtual photon packets at different tissue depths to obtain a dynamic substrate compensation vector. Step 2: Extract the dynamic basis compensation vector from the standardized spectral feature matrix to obtain the decoupled net absorption spectral sequence, and calculate the local curvature change rate of the decoupled net absorption spectral sequence in the preset feature band to obtain the spectral gradient field. Step 3: Identify the first, second, and third resonant anchor points in the spectral gradient field; determine whether the projected distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, construct a triangular topological mapping domain with the first resonant anchor point as the vertex and the projected points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints; otherwise, construct a vector radiation cone pointing to the third resonant anchor point with the second resonant anchor point as the origin. Step 4: Obtain the first and second pesticide residue characteristic response indices based on the triangular topological mapping domain and the vector radiation cone; Step 5: Map the first or second pesticide residue characteristic response index to the pre-built cross-border export compliance decision space. If it is within the safe confidence interval, a qualified traceability mark is obtained and written into the blockchain ledger; otherwise, an abnormal warning instruction is triggered.
[0006] Secondly, a spectral detection system for pesticide residues in agricultural products exported through cross-border e-commerce includes: The standardization module is used to perform radiometric correction and dark current subtraction on the high-dimensional spectral data tensor of the surface of the agricultural product under test, and generate a standardized spectral feature matrix. Based on the standardized spectral feature matrix, the multiple scattering trajectory of virtual photon packets in non-uniform biological media is simulated, and the mean free path distribution of virtual photon packets in different tissue depths is calculated to obtain a dynamic substrate compensation vector. The calculation module is used to extract the dynamic basis compensation vector from the normalized spectral feature matrix, obtain the decoupled net absorption spectral sequence, and calculate the local curvature change rate of the decoupled net absorption spectral sequence in the preset feature band to obtain the spectral gradient field. The judgment module is used to identify the first, second, and third resonant anchor points in the spectral gradient field; it determines whether the projected distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, a triangular topological mapping domain is constructed with the first resonant anchor point as the vertex and the projected points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints; if not, a vector radiation cone pointing to the third resonant anchor point is constructed with the second resonant anchor point as the origin. The acquisition module is used to acquire the first and second pesticide residue characteristic response indices based on the triangular topological mapping domain and the vector radiation cone; The detection module is used to map the first or second pesticide residue characteristic response index to the pre-built cross-border export compliance decision space. If it is within the safe confidence interval, a qualified traceability mark is obtained and written into the blockchain ledger; otherwise, an abnormal warning instruction is triggered.
[0007] The above-described solution of the present invention has at least the following beneficial effects: This invention utilizes Monte Carlo simulation to model the multiple scattering trajectories of photons in the non-uniform biological media of agricultural products. It dynamically calculates and compensates for the tissue's own scattering and absorption background, effectively eliminating interference from endogenous substrates such as wax layers, moisture, cellulose, and cell structures. This avoids weakening or misjudging weak absorption signals from low-concentration pesticides, improving the detection accuracy of trace pesticide residues. Decoupling and net spectral separation result in purer characteristic signals. The dynamic substrate compensation vector is precisely extracted from the original spectrum to obtain a background-free net absorption spectral sequence, clearly revealing the characteristic absorption peaks of pesticide molecule functional groups. This reduces the interference of signal aliasing and baseline drift on the detection results, improving spectral feature recognition. Intelligent resonance anchor point identification adaptively distinguishes signals from interference. By locating three types of resonance anchor points—main absorption peak, interference peak, and baseline inflection point—it automatically distinguishes effective pesticide characteristic signals from endogenous interference signals in agricultural products, achieving adaptive signal and interference discrimination without manual intervention. Dynamic topology construction solves the problem of peak aliasing. Addressing the issue of pesticide characteristic peaks and interference peaks easily overlapping, a triangular topological mapping domain or vector radiation cone is adaptively constructed to effectively isolate aliased signals and accurately characterize the interference energy range, structurally separating the effective signal from the interference components. Geometric feature indexation ensures stable quantitative detection results. The pesticide residue characteristic response index is calculated based on the topological structure, using parameters such as geometric invariant moments and bulk modulus to achieve normalized quantitative expression of the characteristic signal. The results are unaffected by translation, rotation, or scaling, resulting in stronger detection consistency and repeatability. A closed-loop judgment for cross-border compliance supports export traceability and risk control. The detection index is directly mapped to the cross-border export compliance decision space. Qualified information is automatically stored on the blockchain, forming an immutable traceability identifier. Unqualified information triggers immediate warnings and initiates re-inspection, forming a complete closed loop of rapid detection, compliance judgment, blockchain storage, and anomaly warning. Attached Figure Description
[0008] Figure 1 This is a schematic flowchart of a method for spectral detection of pesticide residues in agricultural products exported through cross-border e-commerce, provided by an embodiment of the present invention.
[0009] Figure 2 This is a schematic diagram of a spectral detection system for pesticide residues in agricultural products exported through cross-border e-commerce, provided in an embodiment of the present invention.
[0010] Figure 3 This is a comparison chart of the original spectrum and the net absorption spectrum after decoupling provided in an embodiment of the present invention.
[0011] Figure 4 This is a curve showing the change of curvature value with wavelength within a characteristic band, provided by an embodiment of the present invention. Detailed Implementation
[0012] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0013] like Figure 1 As shown, embodiments of the present invention propose a spectral detection method for pesticide residues in agricultural products exported through cross-border e-commerce, the method comprising the following steps: Step 1: Perform radiometric correction and dark current subtraction on the high-dimensional spectral data tensor of the surface of the agricultural product to be tested to generate a standardized spectral feature matrix; based on the standardized spectral feature matrix, simulate the multiple scattering trajectory of virtual photon packets in a non-uniform biological medium, and calculate the mean free path distribution of virtual photon packets at different tissue depths to obtain a dynamic substrate compensation vector. Step 2: Extract the dynamic basis compensation vector from the standardized spectral feature matrix to obtain the decoupled net absorption spectral sequence, and calculate the local curvature change rate of the decoupled net absorption spectral sequence in the preset feature band to obtain the spectral gradient field. Step 3: Identify the first, second, and third resonant anchor points in the spectral gradient field; determine whether the projected distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, construct a triangular topological mapping domain with the first resonant anchor point as the vertex and the projected points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints; otherwise, construct a vector radiation cone pointing to the third resonant anchor point with the second resonant anchor point as the origin. Step 4: Obtain the first and second pesticide residue characteristic response indices based on the triangular topological mapping domain and the vector radiation cone; Step 5: Map the first or second pesticide residue characteristic response index to the pre-built cross-border export compliance decision space. If it is within the safe confidence interval, a qualified traceability mark is obtained and written into the blockchain ledger; otherwise, an abnormal warning instruction is triggered.
[0014] In this embodiment of the invention, by simulating the multiple scattering trajectories of photons in the non-uniform biological medium of agricultural products using Monte Carlo simulation, the scattering and absorption background of the tissue itself is dynamically calculated and compensated. This effectively eliminates interference from endogenous substrates such as waxy layers, moisture, cellulose, and cell structures, avoiding weakening or misjudgment of weak absorption signals from low-concentration pesticides, and improving the detection accuracy of trace and minor pesticide residues. Decoupling and net spectral separation result in purer feature signals. The dynamic substrate compensation vector is precisely extracted from the original spectrum to obtain a net absorption spectral sequence without background coupling. This allows the characteristic absorption peaks of pesticide molecule functional groups to be clearly presented, reducing the interference of signal aliasing and baseline drift on the detection results and improving the spectral feature recognition. Intelligent identification of resonance anchor points adaptively distinguishes signals from interference. By locating three types of resonance anchor points—main absorption peak, interference peak, and baseline inflection point—the effective feature signals of pesticides and endogenous interference signals of agricultural products can be automatically distinguished without manual intervention, achieving adaptive discrimination of signals and interference. Dynamic topology construction solves the problem of peak aliasing. Addressing the issue of pesticide characteristic peaks and interference peaks easily overlapping, a triangular topological mapping domain or vector radiation cone is adaptively constructed to effectively isolate aliased signals and accurately characterize the interference energy range, structurally separating the effective signal from the interference components. Geometric feature indexation ensures stable quantitative detection results. The pesticide residue characteristic response index is calculated based on the topological structure, using parameters such as geometric invariant moments and bulk modulus to achieve normalized quantitative expression of the characteristic signal. The results are unaffected by translation, rotation, or scaling, resulting in stronger detection consistency and repeatability. A closed-loop judgment for cross-border compliance supports export traceability and risk control. The detection index is directly mapped to the cross-border export compliance decision space. Qualified information is automatically stored on the blockchain, forming an immutable traceability identifier. Unqualified information triggers immediate warnings and initiates re-inspection, forming a complete closed loop of rapid detection, compliance judgment, blockchain storage, and anomaly warning.
[0015] In a preferred embodiment of the present invention, step 1 includes: Step 100a: Acquire the original high-dimensional spectral data tensor of the surface of the agricultural product to be tested. The original high-dimensional spectral data tensor contains pixel coordinate information in the spatial dimension and wavelength reflectance information in the spectral dimension. Obtain the dark current noise matrix output by the sensor under no-light conditions, and remove the dark current noise matrix from the original high-dimensional spectral data tensor to obtain the denoised spectral data tensor. Specifically, this includes: A hyperspectral imaging device is used to perform a full-area area scan of the surface of the agricultural product under test. The device continuously acquires spectral signals row by row in the horizontal direction and column by column in the vertical direction. Spatial location information and spectral information are simultaneously acquired through the area array detection unit. Finally, the original high-dimensional spectral data tensor of the surface of the agricultural product under test is obtained. This original high-dimensional spectral data tensor is a three-dimensional tensor, specifically represented as I(x, y, ... ), where x represents the pixel number in the horizontal direction and y represents the pixel number in the vertical direction. The wavelength represents the acquisition wavelength. Each data point in this tensor is the original photoelectric response intensity value at the corresponding pixel position and wavelength, which fully records the spatial position and full-band spectral reflectance information of the surface of the agricultural product under test.
[0016] After completing the initial data acquisition, the sensor's integration time, signal gain, operating temperature, and other operating parameters are kept completely consistent with the acquisition state. All lighting sources in the detection environment are turned off, creating a completely dark environment. The dark current noise matrix output by the sensor under this condition is then acquired. This dark current noise matrix is represented as D(x, y, ... ), and the original high-dimensional spectral data tensor I(x, y, The matrix contains elements with identical dimensions, sizes, wavelength sequences, and pixel arrangement. Each element represents the dark current output value generated by the sensor under no-light conditions solely through thermal excitation by its internal circuitry, characterizing the sensor's inherent noise distribution. The dark current noise matrix and the original high-dimensional spectral data tensor are mapped to the same x-coordinate, y-coordinate, and wavelength. Element-wise subtraction is performed at each position to eliminate dark current noise interference generated by thermal excitation of the sensor's internal circuitry. After dark current noise removal, a denoised spectral data tensor I'(x, y, ...) is obtained, free from the sensor's inherent noise. ).
[0017] Step 101a: Radiometric calibration is performed on the denoised spectral data tensor using standard whiteboard reference spectral data to obtain a relative reflectance spectral data cube; the relative reflectance spectral data cube is then smoothed and filtered to obtain a standardized spectral feature matrix, specifically including: The standard white board reference spectrum data calibrated by a metrology institution was used as the radiometric calibration reference data. The spectral reflectance of this standard white board was 99.0% ± 0.5% across the entire wavelength range of 400 nm to 1000 nm. The standard white board reference spectrum is expressed as W( The denoised spectral data tensor I'(x, y, ...) will be used to denoise the spectral data tensor. The response value corresponding to each wavelength channel in ) is compared with the reference spectrum W of the standard white board. The reference response values at the same wavelength are used for point-to-point calculation to complete the radiometric calibration process. This transforms the original denoised spectral data tensor in electrical signal form into a relative reflectance spectral data cube R(x, y, ...) that truly reflects the optical reflectance properties of the material surface. Radiation calibration uses relative reflectivity calculation, i.e., R(x, y, ...). )=I'(x, y, )÷W( In obtaining the relative reflectance spectral data cube R(x, y, ... Afterwards, a sliding window mean filtering algorithm is used to smooth the relative reflectance spectral data cube. Centered on each wavelength point, a fixed window width of 9 consecutive wavelength points is selected. The data of all adjacent wavelength points within the window are weighted and averaged. This filtering process removes high-frequency random noise with an amplitude less than 3% of the relative reflectance, as well as single-point anomalous jump points with a difference from the mean of the neighboring wavelengths greater than 10% of the relative reflectance. This makes the spectral data curve more stable and continuous. After the smoothing filtering process, a standardized spectral feature matrix with uniform dimensions, stable data, and controllable noise is finally formed.
[0018] Step 100b: Based on the optical properties of the biological tissues of agricultural products, set the scattering and absorption coefficients of photons in the medium, and construct a Monte Carlo photon transmission simulation environment; set the initial emission position, incident angle, and initial energy value of the virtual photon packet, and initiate a random walk process in the Monte Carlo photon transmission simulation environment; in each scattering event, based on the scattering and absorption coefficients of the current medium layer, use a random number generator to determine the free path length and scattering direction cosine of the virtual photon packet for the next scattering; update the spatial coordinate displacement vector of the virtual photon packet, and calculate the virtual photon packet... Record the updated remaining energy value based on the energy decay within the current step size; determine whether the remaining energy of the virtual photon packet is lower than the preset energy threshold or whether it has escaped from the surface of the agricultural product. If so, terminate the simulation trajectory of the corresponding virtual photon packet and save the complete path history data; if not, continue to execute the simulation of the next scattering event until all initialized virtual photon packets have completed trajectory simulation; statistically analyze the dwell probability distribution of all virtual photon packets at different tissue depths, and calculate the mean free path probability density function of photons at each depth layer by combining the displacement vector and energy decay, specifically including: Based on the type and multi-layered structure of the agricultural product to be tested, the optical characteristic parameters corresponding to the three typical media layers—wax layer, intercellular space, and vacuoles—were determined. Scattering and absorption coefficients specific to photon transmission were assigned to each media layer, with the scattering coefficient for the wax layer set to 18.5. The absorption coefficient is taken as 0.8. The waxy layer of agricultural product skins is dense and has many optical interfaces, resulting in strong photon scattering and weak absorption. This value is consistent with the measured optical characteristics of fruit and vegetable skins; the intercellular scattering coefficient is taken as 9.2. The absorption coefficient is taken as 1.6. The intercellular spaces are a porous, water-containing medium with moderate scattering and slightly high water absorption, consistent with the optical propagation laws of thin-walled tissues; the vacuolar scattering coefficient is taken as 3.5. The absorption coefficient is taken as 2.9. The vacuole is mainly composed of cell sap, which has weak scattering and strong absorption. This value matches the absorption characteristics of tissues with high water content.
[0019] Using the aforementioned optical parameters as the simulation boundary conditions and physical operating rules, a Monte Carlo photon transmission simulation environment that perfectly matches the real optical propagation characteristics of agricultural products is constructed. Within this simulation environment, the initial emission position of the virtual photon packet is set based on the center of the incident light spot acquired via hyperspectral acquisition; the initial incident angle is set to 0° based on the perpendicular incident condition of the equipment illumination; and the initial energy value is set to 1.0 standard energy units based on the light source output energy. After initialization, a random walk process of the virtual photon packet within a multi-layered simulation medium is initiated. In each scattering event of the random walk, the scattering coefficient of the current medium layer in which the virtual photon packet is located is used as the basis for the simulation. With absorption coefficient Call the random number generator to generate random numbers that follow a uniform distribution in the interval [0, 1]. Based on the Monte Carlo algorithm, the free path length of the virtual photon packet before the next scattering occurs is calculated and determined according to the following formula. ,Right now Simultaneously, based on the scattering phase function and random sampling results, the azimuth angle φ and polar angle θ after scattering are calculated, and the three-dimensional direction cosine values (μx, μy, μz) are further solved, where φ = 2π , θ=arccos(2 -1), and Let μx be a uniformly distributed random number in the interval [0,1], where μx = sinθcosφ, μy = sinθsinφ, and μz = cosθ.
[0020] At the same time, the system updates the coordinate displacement vector of the virtual photon packet in three-dimensional space according to the current three-dimensional direction cosine, and obtains the updated spatial position coordinates; and based on the absorption coefficient of the current dielectric layer... With free path length Calculate the energy decay of the virtual photon packet within the current step size, update and record the remaining energy value in real time, and calculate the energy decay as E0 × 100%. × E0 is the initial energy value of the virtual photon packet, which is 1.0 standard energy units.
[0021] After completing each step of spatial position update and remaining energy calculation, the system immediately enters a dual-condition judgment process. First, it checks whether the remaining energy of the virtual photon packet is lower than a preset energy threshold, which is 0.5% of the initial energy value of the virtual photon packet. Simultaneously, it checks whether the spatial coordinates of the virtual photon packet exceed the spatial range of the agricultural product surface defined by the original high-dimensional spectral data tensor. This spatial range is set based on the actual detection area of hyperspectral imaging, taking the value as a closed two-dimensional plane region with horizontal coordinates 0≤x≤1024 and vertical coordinates 0≤y≤1024. Exceeding this range indicates photon escape. If the remaining energy is lower than the preset energy threshold, or the virtual photon packet has escaped the aforementioned agricultural product surface spatial range, the simulation termination condition is met. The system immediately stops the random walk process of the virtual photon packet and completely stores all historical data of the photon packet's position, direction, energy, and path from initialization to termination. If neither condition is met, the system continues to the next scattering event loop, repeating the free path calculation, direction update, displacement update, energy decay, and condition judgment process sequentially until all initialized virtual photon packets have completed a complete trajectory simulation.
[0022] After all virtual photon packet simulations have terminated, the system, following a 0.1mm equal-interval tissue depth stratification rule, counts the number of times each virtual photon packet stays and its coordinates within each depth layer, obtaining the dwell probability distribution for different tissue depth layers. Combining the displacement vector and cumulative energy attenuation data of each virtual photon packet, the system calculates the mean free path probability density function of photons within each depth layer, i.e., mean free path probability density = number of times virtual photon packets stay within a unit depth layer ÷ (total path length of the layer × total number of virtual photon packets), ultimately obtaining the mean free path probability density function corresponding to each tissue depth.
[0023] Step 101b involves fitting the background scattering spectral curve caused by the agricultural product's own tissue structure based on the mean free path distribution probability density function, and mapping the background scattering spectral curve to a dynamic basis compensation vector with the same dimension as the standardized spectral feature matrix. Specifically, this includes: Let the discrete fitting data points be a wavelength sequence. The corresponding dimensionless relative mean free path distribution probability density ,index , The total number of wavelength bands in the range of 400nm to 1000nm, where the original mean free path probability density is... (Unit is) This was obtained through Monte Carlo simulation statistics. = ,in, Indicates the number of times a virtual photon packet resides within a unit depth layer; Indicates the total path length per unit depth layer; This represents the total number of virtual photon packets. To eliminate the influence of dimensions, it is dimensionless. dimensionless The value ranges from 0 to 1, serving as the fitting target. A nonlinear fitting model is constructed with wavelength as the independent variable and background scattering spectrum as the dependent variable. A multi-exponential superposition model (Gaussian superposition model) is used as the fitting function, i.e. In the formula The background scattering spectrum curve at wavelength The spectral response value at that location (dimensionless). It is the detection wavelength (ranging from 400nm to 1000nm). These are the indices of the Gaussian components. It is the total number of Gaussian components (with a value of 4, corresponding to the four interference components: wax layer scattering, cellulose skeleton scattering, intercellular space absorption, and vacuole absorption). It is the first The magnitude of each Gaussian component (dimensionless). It is the first The center wavelength (nm) of each Gaussian component. It is the first The width coefficient of each Gaussian component (with a fixed value of 15nm).
[0024] A weighted error function is constructed using the scattering and absorption coefficients of photons at each depth layer as weighting factors. First, a residual sequence is constructed. = In the formula For the first The fitting residuals (dimensionless) at each wavelength point. Construct the nonlinear least squares objective function: ; In the formula It is the objective function. It is the first The weights of each wavelength point are fixed at 0.8; the Gauss-Newton iterative method is used to minimize the objective function, continuously updating parameters such as the amplitude, center wavelength, and width coefficient of each Gaussian component during the iteration process, until the difference between the objective functions of two adjacent iterations is less than the convergence threshold. The iteration stops when the convergence condition is met. This iterative optimization ensures that the final continuous curve fully characterizes the combined effects of internal light scattering and intrinsic absorption interference generated by the multi-layered structure of the agricultural product's waxy layer, cellulose skeleton, intercellular spaces, and vacuoles. Ultimately, this results in a continuous, smooth, full-band-coverage background scattering spectrum curve. After fitting the background scattering spectrum curve, the curve is dimensionally matched and mapped point-by-point to the standardized spectral feature matrix. Following the order of the standardized spectral feature matrix (total rows 1024, total columns 1024, total bands N, and wavelength distribution across the entire 400nm to 1000nm band), the individual background scattering spectrum curves are copied and filled row by row, column by column, and band by band, ensuring that the spectral dimension corresponding to each spatial coordinate (x,y) is loaded with the same background scattering spectrum curve. This mapping method forms a background compensation data volume with dimensions completely consistent with the standardized spectral feature matrix. ,in This represents the mapped background compensation data volume, where x is the horizontal pixel coordinate and y is the vertical pixel coordinate. λ is the wavelength.
[0025] For the aforementioned background compensation data Numerical normalization is performed; the normalization formula is as follows: ; In the formula This is the normalized background compensation data volume, with values ranging from 0 to 1. Normalization maps all background compensation values to the standard range of 0 to 1, eliminating numerical magnitude differences between different depth layers and different bands, and ensuring that the background compensation data and the standardized spectral feature matrix can be directly subtracted. After a complete processing flow of discrete data fitting, full-dimensional point-by-point mapping, and numerical normalization, a dynamic basis compensation vector is finally generated that can accurately match the standardized spectral feature matrix, align band by band, and be directly used for spectral stripping operations.
[0026] This embodiment, through a combination of dark current subtraction and radiometric calibration with smoothing filtering, effectively eliminates inherent sensor noise and systematic errors caused by the lighting environment, improving the accuracy and stability of the standardized spectral feature matrix. Constructing a Monte Carlo photon transmission simulation environment based on the real optical parameters of agricultural products accurately recreates the propagation behavior of photons in non-uniform biological media, realistically reflecting the scattering and absorption interference generated by the agricultural product's own tissue structure. Through virtual photon packet random walk simulation and mean free path distribution calculation, the background interference intensity at different tissue depths can be quantitatively characterized, avoiding over-correction of the signal. A dynamic basis compensation vector is generated and mapped, which can be matched with the standardized spectral feature matrix to achieve dynamic and accurate compensation for background interference, effectively preserving the weak characteristic signals of pesticide residues and improving the reliability of low-concentration residue detection.
[0027] In a preferred embodiment of the present invention, step 2 includes: Step 200a involves extracting the dynamic basis compensation vector from the normalized spectral feature matrix to obtain the decoupled net absorption spectral sequence. Specifically, this includes: based on the dynamic basis compensation vector generated in step 101b... With the normalized spectral feature matrix generated in step 101a The process involves performing spectral stripping to extract the dynamic basis compensation vector from the standardized spectral feature matrix, removing background scattering and intrinsic absorption interference caused by the agricultural product's own tissue structure, and obtaining a decoupled net absorption spectral sequence containing only pesticide residue characteristic signals. The calculation formula is: = - ; In the formula To decouple the net absorption spectral sequence, characterizing the spatial coordinates of the surface of the agricultural product under test after removing background interference. ), each wavelength The net absorption spectral signal at the location. During the calculation, ensure that the normalized spectral feature matrix and the dynamic basis compensation vector are aligned in spatial coordinates ( ) and wavelength By achieving complete dimensional alignment and performing subtraction operations point by point, signal distortion caused by dimensional misalignment is avoided, ultimately resulting in a decoupled net absorption spectrum sequence covering the entire domain and all bands.
[0028] Step 200b involves selecting a preset characteristic wavelength range corresponding to the vibrational frequencies of the chemical bonds in the target pesticide molecule, and truncating the decoupled net absorption spectral sequence. Within this preset characteristic wavelength range, a second-order differential operation is performed on the decoupled net absorption spectral sequence to calculate the curvature value at each wavelength point. The curvature value characterizes the sharpness of the spectral absorption peak shape and the intensity of energy level transitions. Specifically, this includes determining the corresponding preset characteristic wavelength range based on the vibrational frequencies of the chemical bonds in the target pesticide molecule. This preset characteristic wavelength range is a unique absorption band of the target pesticide molecule, selected within the detection wavelength range of 400 nm to 1000 nm, corresponding to the vibrational frequencies of the functional groups (such as hydroxyl, carbonyl, and amino groups) of the pesticide molecule. This ensures that the range contains only the characteristic absorption signal of pesticide residues and does not contain interfering absorption signals from the agricultural product's own tissues. Based on the determined preset characteristic wavelength range, the decoupled net absorption spectral sequence obtained in step 200a is processed... The spectral data is truncated, retaining the spectral data within the preset characteristic band range and removing irrelevant spectral data outside the range, resulting in the truncated decoupled net absorption spectral sequence. ,in The value range is all wavelength points within the preset characteristic band interval.
[0029] Within a preset characteristic band range, the extracted decoupled net absorption spectrum sequence Perform second-order differential operations to eliminate spectral baseline drift and weak background interference from residues, enhance the identification of pesticide residue characteristic absorption peaks, and calculate the curvature value at each wavelength point. The curvature value characterizes the sharpness of the spectral absorption peak shape and the intensity of energy level transitions in pesticide molecules. A larger curvature value indicates a steeper and sharper peak profile at that wavelength, corresponding to more intense chemical bond vibrations in the pesticide molecule and higher, more intense energy level transitions. Conversely, a smaller curvature value indicates a smoother and more diffuse peak profile at that wavelength, corresponding to gentler chemical bond vibrations in the pesticide molecule and lower, more gradual energy level transitions. The second-order differential operation and curvature value calculation process are as follows: First, a first-order differential operation is performed on the decoupled net absorption spectrum sequence along the wavelength dimension to obtain the first-order differential spectrum sequence. The calculation formula is: ; In the formula, For the decoupled net absorption spectral sequence at wavelength The minute change at a point is dimensionless; This represents a small change in wavelength. For a first-order differential spectral sequence... Performing differentiation again along the wavelength dimension yields the second-order differential spectral sequence. The calculation formula is: ; The curvature value at each wavelength point was calculated based on the second-order differential spectral sequence. The calculation formula is: .
[0030] Step 201b: Extract the relative reflectance intensity value or energy attenuation coefficient corresponding to the preset characteristic band interval from the standardized spectral feature matrix as the third-dimensional information; combine the wavelength value, curvature value, and third-dimensional information to construct a three-dimensional spectral feature space, forming a spectral gradient field that reflects the local variation trend and intensity distribution of spectral energy, specifically including: The normalized spectral feature matrix generated in step 101a In step 200b, the relative reflectance intensity value corresponding to the preset characteristic band interval is extracted as the third dimension information. , and wavelength value curvature value One-to-one correspondence, constructing a three-dimensional spectral feature space ( ; This three-dimensional spectral feature space reflects the spectral characteristics within a preset characteristic band range through three dimensions working together, where the first dimension is the wavelength value. The second dimension, curvature value, is determined by the vibrational frequency of the chemical bonds in the target pesticide molecule. A characteristic wavelength range of 400nm to 1000nm is selected to pinpoint the detection location and clarify the wavelength position of the spectral signal. The numerical value represents the sharpness of the spectral absorption peak, the intensity of the energy level transition of pesticide molecules, and the local variation trend of spectral energy. The larger the value, the sharper the spectral absorption peak and the more intense the energy level transition of pesticide molecules. The third dimension, the relative reflectance intensity value, is determined by extracting preset band data from the standardized spectral feature matrix. The numerical value represents the strength of the spectral signal and the spatial intensity distribution of spectral energy at each wavelength and spatial coordinate. The larger the value, the stronger the spectral signal at the corresponding position.
[0031] The three dimensions mentioned above work together to achieve a comprehensive and accurate reflection of the local variation trend and intensity distribution of spectral energy within the preset characteristic band interval. Based on this three-dimensional spectral feature space, a spectral gradient field is further generated. The gradient direction of the spectral gradient field is determined by the trend of curvature value change. The difference in curvature values between adjacent wavelength points is calculated. If the difference is positive, the gradient direction points towards increasing wavelength; if the difference is negative, the gradient direction points towards decreasing wavelength. The larger the absolute value of the difference, the more defined the gradient direction, which is used to characterize the direction of local variation in spectral energy. The gradient amplitude is determined by the rate of change of relative reflectance intensity value, i.e., by performing a first-order differential operation on the relative reflectance intensity value along the wavelength dimension. The absolute value of the differential result is the gradient amplitude. The larger the amplitude, the more drastic the change in spectral energy intensity. By determining the gradient direction and gradient amplitude through the above methods, a spectral gradient field that can accurately characterize the distribution of pesticide residue characteristic signals is finally formed.
[0032] This embodiment employs a point-by-point subtraction method to strip the dynamic substrate compensation vector, effectively removing background scattering and intrinsic absorption interference from the waxy layer, cellulose, and cell structure of agricultural products. This process effectively preserves the weak characteristic signals of pesticide residues, solving the technical challenge of coupling and indistinguishable background interference with pesticide residue signals in spectral detection, and improving the purity of the decoupled net absorption spectral sequence. By pre-selecting characteristic band intervals, the system focuses on the characteristic absorption bands of the target pesticide molecules, avoiding interference from irrelevant spectral data. Simultaneously, second-order differential operations and curvature value calculations eliminate baseline drift, enhancing the distinctiveness of pesticide residue characteristic absorption peaks and characterizing the sharpness of spectral absorption peaks and molecular energy level transition characteristics. The constructed three-dimensional spectral feature space integrates information from three dimensions: wavelength, curvature value, and relative reflectance intensity value. The resulting spectral gradient field comprehensively reflects the local variation trend and intensity distribution of spectral energy, overcoming the limitation of two-dimensional spectroscopy, which can only characterize a single dimension of information.
[0033] In a preferred embodiment of the present invention, step 3 includes: Step 300a: Identify the first, second, and third resonance anchor points in the spectral gradient field. The first, second, and third resonance anchor points include: First resonance anchor point: In the spectral gradient field, search for the positive extremum point with the largest curvature value. The positive extremum point corresponds to the main absorption peak position of the functional group in the target pesticide molecule, characterizing the main characteristic signal intensity of pesticide residues; Second resonance anchor point: In the spectral gradient field, search for the negative extremum point located in the long-wavelength direction of the first resonance anchor point and whose curvature value reaches a local maximum. The negative extremum point corresponds to the macromolecular absorption interference peak position of endogenous water or sugar in agricultural products; Third resonance anchor point: In the spectral gradient field, search for the baseline inflection point located in the short-wavelength direction. The baseline inflection point corresponds to the turning point of the scattering baseline caused by the cellulose skeleton of agricultural products, characterizing the baseline level of background scattering, specifically including: Based on the spectral gradient field generated in step 201b, resonance anchor point identification is performed, sequentially identifying the first, second, and third resonance anchor points. The preset characteristic band range is 400nm to 1000nm, focusing on the characteristic sub-regions corresponding to the functional groups of the target pesticide molecule (specifically adjusted according to the type of target pesticide; for example, 600nm to 750nm for organophosphate pesticides and 500nm to 650nm for pyrethroid pesticides). In the spectral gradient field, the curvature values corresponding to all wavelength points within this preset characteristic band range are traversed. The search and selection process identifies the positive extrema with the largest curvature value. This positive extrema is the first resonance anchor point. The criteria for a positive extrema are that its curvature value is greater than that of its two adjacent wavelengths, and the curvature value is positive. It corresponds to the main absorption peak position of the functional groups (such as hydroxyl and carbonyl groups) in the target pesticide molecule. The magnitude of its curvature value directly characterizes the intensity of the main characteristic signal of pesticide residues; the larger the curvature value, the stronger the main characteristic signal of pesticide residues. In the spectral gradient field, using the wavelength corresponding to the first resonance anchor point as a reference, within a preset characteristic band range in its longer wavelength direction (wavelength greater than the wavelength of the first resonance anchor point), the search and selection process identifies negative extrema where the curvature value reaches a local maximum. This negative extrema is the second resonance anchor point. The criteria for a negative extrema are that its curvature value is less than that of its two adjacent wavelengths, and the curvature value is negative. It corresponds to the macromolecular absorption interference peak position of endogenous water or sugar in agricultural products, used to characterize the core position of macromolecular absorption in background interference. In the spectral gradient field, taking the wavelength corresponding to the first resonance anchor point as the reference, the baseline inflection point is searched and screened in the preset characteristic band interval (400nm to 1000nm, the characteristic sub-interval corresponding to the focused target pesticide) in its short-wave direction (wavelength less than the wavelength of the first resonance anchor point). This baseline inflection point is the third resonance anchor point. The criteria for determining the baseline inflection point are that the first-order differential spectral value of the wavelength point changes from negative to positive or from positive to negative, and the second-order differential spectral value is zero. This corresponds to the turning point of the scattering baseline caused by the cellulose skeleton of agricultural products, and characterizes the reference level of background scattering.
[0034] Step 300b: Calculate the Euclidean distance between the first and second resonant anchor points on the wavelength axis, and compare the Euclidean distance with a preset neighborhood threshold. When the Euclidean distance is less than the preset neighborhood threshold, it is determined that the pesticide characteristic peak and the interference peak have spectral aliasing. At this time, the amplitude of the first resonant anchor point is used as the vertex height. Within the wavelength interval between the second and third resonant anchor points, calculate the difference in curvature values of adjacent wavelength points sequentially, and identify the position where the absolute value of the difference exceeds a preset abrupt change threshold as the curvature abrupt change point. Using the curvature abrupt change point as the dividing boundary, divide the band between the second and third resonant anchor points into several sub-intervals. Select the longest continuous sub-interval containing the projections of the second and third resonant anchor points, and determine the projection points of the starting and ending wavelength points of the longest continuous sub-interval on the wavelength axis as the two endpoints of the bottom edge. Connect the first resonant anchor point with the two bottom edge endpoints through linear interpolation to construct a closed triangular topological mapping domain. The triangular topological mapping domain is used to isolate the effective components in the aliased signal, specifically including: The Euclidean distance between the first and second resonant anchor points on the wavelength axis is calculated to determine whether spectral aliasing occurs between pesticide characteristic peaks and interfering peaks; the calculated Euclidean distance is then used to... Compared with the preset neighborhood threshold The comparison is performed using a preset neighborhood threshold. The value is determined based on the typical wavelength interval between the characteristic peak of the target pesticide and the endogenous interference peak of agricultural products, and is set to 5 nm (adapted to the detection band of 400 nm to 1000 nm). When it is determined that the pesticide characteristic peak and the interference peak have spectral aliasing, the curvature amplitude of the first resonance anchor point is taken as the vertex height of the triangular topological mapping domain, and the vertex coordinates are ( ),in The wavelength corresponding to the first resonant anchor point. The curvature value of the first resonant anchor point. This represents the relative reflectivity intensity value corresponding to the first resonant anchor point. The wavelength range between the second and third resonant anchor points ( ,in Within the wavelength corresponding to the third resonant anchor point, this interval falls within a preset characteristic wavelength range (400nm to 1000nm). The difference in curvature values between adjacent wavelengths is calculated sequentially to identify curvature abrupt change points. The absolute value of the calculated curvature difference is then used… |With preset mutation threshold The comparison is performed, with a preset mutation threshold. The value is determined based on the fluctuation range of the curvature value of the spectral gradient field, and is set to 0.02. When | |> At that wavelength point This is the point of curvature abrupt change, which serves as the boundary for band segmentation.
[0035] Using all curvature abrupt change points as dividing boundaries, the band between the second and third resonant anchor points is divided into several sub-intervals. The values of each sub-interval are determined by combining the preset characteristic sub-intervals and the anchor point wavelength (for example, if the wavelength of the second resonant anchor point...). =680nm, wavelength of the third resonant anchor point =620nm, after division, the sub-intervals can take values of 620nm to 635nm, 635nm to 650nm, 650nm to 665nm, 665nm to 680nm). The wavelength span of each sub-interval is counted one by one, and the longest continuous sub-interval including the projection of the second resonant anchor point and the projection of the third resonant anchor point is selected. The starting wavelength point of the longest continuous sub-interval is... and termination wavelength point The projection points on the wavelength axis are defined as the two endpoints of the base of the triangular topological mapping domain, with the coordinates of the endpoints being ( ). )and( ),in These are the relative reflectivity intensity values corresponding to the starting and ending wavelength points, respectively.
[0036] By connecting the first resonant anchor point with the two bottom endpoints using linear interpolation, a closed triangular topological mapping domain is constructed. The linear interpolation formula is as follows: ; In the formula, For the interpolation wavelength point, The curvature value is the interpolated value. The wavelength corresponding to the bottom endpoint ( or ), The curvature value corresponding to the bottom endpoint (takes a value of 0) is used to isolate the effective components in the aliased signal, that is, to separate the aliased part of the pesticide characteristic peak and the endogenous interference peak, and retain the effective characteristic signal of pesticide residue.
[0037] Step 301b: When the Euclidean distance is greater than or equal to a preset neighborhood threshold, it is determined that the pesticide characteristic peak and the interference peak are well separated. At this time, taking the second resonance anchor point as the geometric origin, the three-dimensional coordinates of multiple discrete sampling points located within the neighborhood radius of the second resonance anchor point and extending to the direction of the third resonance anchor point in the spectral gradient field are collected. The three-dimensional coordinates correspond to the wavelength value, curvature value, and energy attenuation in the third dimension information, respectively. The three-dimensional coordinates are used to form a point cloud matrix. The covariance matrix of the point cloud matrix is calculated, and the eigenvalues and eigenvectors of the covariance matrix are solved. The eigenvector corresponding to the largest eigenvalue is taken as the principal direction. Starting from the second resonance anchor point, a vector radiation cone is constructed along the principal direction to the depth plane where the third resonance anchor point is located, starting from the second resonance anchor point and pointing to the third resonance anchor point. The sidewall of the vector radiation cone is generated by rotating the spectral slope envelope from the second resonance anchor point to the third resonance anchor point around the principal direction axis. The vector radiation cone is used to characterize the energy diffusion range of the background interference, specifically including: When the Euclidean distance between the first and second resonant anchor points on the wavelength axis is greater than or equal to a preset neighborhood threshold At that time, it was determined that the pesticide characteristic peak and the interference peak were well separated, and no aliasing isolation was required. A vector radiation cone was constructed to characterize the energy diffusion range of the background interference. First, the second resonance anchor point was taken as the geometric origin, and its coordinates were ( ),in This represents the energy attenuation amount corresponding to the second resonance anchor point (replacing the relative reflectivity intensity value in the third-dimensional information, consistent with the previous detection logic, prioritizing the use of energy attenuation to characterize background interference energy). A neighborhood radius is then set. The value is set to 3nm (to adapt to the preset characteristic band range of 400nm to 1000nm, ensuring coverage of background interference signals around the second resonance anchor point). Multiple discrete sampling points are collected from the spectral gradient field located within this neighborhood radius and extending to the direction of the third resonance anchor point (shortwave direction). The number of sampling points is no less than 50, ensuring uniform point cloud distribution. The three-dimensional coordinates of each discrete sampling point are... ,in The sampling point wavelength is within a preset characteristic wavelength range (400nm to 1000nm). The curvature value at the sampling point. This represents the energy attenuation at the sampling point.
[0038] The three-dimensional coordinates of all discrete sampling points are organized into a point cloud matrix X, with the dimension of point cloud matrix X being... ×3, where The number of discrete sampling points is expressed in matrix form as follows: ; Calculate the point cloud matrix covariance matrix It is used to characterize the distribution characteristics of the three-dimensional data of the sampling points and solve the covariance matrix. Given the eigenvalues and corresponding eigenvectors, firstly, based on the calculated 3×3 covariance matrix... Construct the characteristic equation ,in Let be the eigenvalues to be solved. Given a 3×3 identity matrix, by expanding the characteristic equation, we obtain a value about... cubic polynomial equation (in The coefficients are polynomials, derived from the covariance matrix. (The elements are calculated), and the polynomial equation is solved using Newton's iteration method. The iteration terminates when the difference between the eigenvalues of two adjacent iterations is less than 1. Ultimately, three eigenvalues can be obtained, denoted as follows: And sort the three feature values by numerical value to obtain For each eigenvalue, substitute it into the homogeneous linear equation system. Solving the non-zero solutions of this homogeneous linear system of equations yields the eigenvectors corresponding to each eigenvalue, denoted as . And the eigenvectors Corresponding to the largest eigenvalue eigenvectors Corresponding eigenvalues eigenvectors Corresponding eigenvalues Finally, the largest eigenvalue is taken. corresponding feature vector As the main direction, this main direction characterizes the main distribution trend of discrete sampling points, that is, the main diffusion direction of background interference energy.
[0039] Starting from the second resonance anchor point, along the main direction Extending to the depth plane where the third resonant anchor point is located (the depth plane is determined by the energy attenuation of the third resonant anchor point) Determined, that is A vector radiation cone is constructed, starting from the second resonant anchor point and pointing towards the third resonant anchor point. The sidewalls of this cone are generated by rotating the spectral slope envelope from the second to the third resonant anchor point around the principal axis. This spectral slope envelope is obtained by linearly fitting the curvature values between the second and third resonant anchor points. First, the wavelength of the second resonant anchor point is extracted. curvature value ) and the third resonant anchor point (wavelength) curvature value The coordinate data of all wavelength points between () are denoted as ( ),in Let the wavelength points within this interval be indexed; construct a linear fitting model. ,in The fitted slope, The fitting intercept is used; the fitting parameters are solved using the least squares method. and The objective function is: ; in, This represents the total number of wavelength points within this interval. Let be the objective function, representing the sum of squared residuals between the fitted values and the true values. By solving for the minimum value of this objective function, the fitted parameters are obtained. and The specific values are then used to determine the linear fitting equation, and the straight line corresponding to this equation is the spectral slope envelope; this spectral slope envelope is then rotated around the principal direction. The axis is rotated 360° while maintaining the relative position of the envelope line and the main direction axis. The resulting vector radiation cone is used to characterize the energy diffusion range of background interference.
[0040] This embodiment identifies three resonance anchor points, corresponding to the main characteristic peak of pesticides, the endogenous interference peak, and the inflection point of the background scattering baseline, respectively. This clarifies the core locations of pesticide characteristics and background interference, solving the problem of distinguishing between pesticide characteristics and background interference during detection. By determining spectral aliasing through Euclidean distance and combining curvature difference to identify abrupt change points and construct a triangular topological mapping domain, the effective pesticide characteristics in aliased signals can be effectively isolated, preventing endogenous interference peaks from masking pesticide characteristic signals and improving the identification accuracy of low-concentration pesticide residue characteristic signals. For scenarios where characteristic peaks and interference peaks are well separated, the principal direction is solved using the point cloud matrix and covariance matrix to construct a vector radiation cone, accurately characterizing the energy diffusion range of background interference. This efficiently removes background interference while avoiding the accidental deletion of effective pesticide characteristic signals, ensuring detection accuracy.
[0041] In a preferred embodiment of the present invention, step 4 includes: Step 400: When constructing a triangular topological mapping domain, perform bidirectional staggered meshing on the triangular topological mapping domain, dividing it into several rhombic micro-element sub-regions; calculate the spectral energy density integral value within each rhombic micro-element sub-region; calculate and normalize the central moment of the entire triangular topological mapping domain to obtain seven geometric moment values that are invariant to translation, rotation, and scaling; multiply the energy density integral value of each rhombic micro-element sub-region with the centroid distance weight within the triangular topological mapping domain, and then perform a weighted summation with the corresponding order moment values among the seven geometric moment values to obtain the first pesticide residue characteristic response index, specifically including: For the scenario in step 300b where pesticide characteristic peaks and interference peaks are determined to have spectral aliasing and a triangular topological mapping domain has been constructed, the first pesticide residue characteristic response index is extracted according to the following process: First, the triangular topological mapping domain is divided into bidirectional staggered grids, with the division directions parallel to the two base edges of the triangular topological mapping domain. The grid density is determined based on the wavelength span of the triangular topological mapping domain, and the grid step size is set to 1 nm (adapting to the preset characteristic band range of 400 nm to 1000 nm, ensuring that the divided micro-element sub-regions can accurately capture spectral energy changes). Through this bidirectional staggered division, the triangular topological mapping domain is divided into several rhombic micro-element sub-regions, where the side length of each rhombic micro-element sub-region is equal to the grid step size. Each rhombic micro-element sub-region is denoted as... ( This represents the sequence number of the micro-element sub-region. , (This represents the total number of rhombic micro-element sub-regions). Next, calculate the number of rhombic micro-element sub-regions. Integral value of spectral energy density within The spectral energy density is determined by the curvature value within this region. With relative reflectivity intensity value The product is represented by the integral, which covers the entire wavelength range encompassed by the rhombic micro-element sub-region. The integral calculation formula is as follows: , It is a tiny change in wavelength. This represents a tiny change in the relative reflectivity intensity value. This integral can be used to quantify the energy of the effective pesticide characteristic signal in each micro-element sub-region.
[0042] Calculate the standard two-dimensional geometric moments of the entire triangular topological mapping domain, and derive seven from these moments. Invariant moments. Let the geometric center of the triangular topological mapping domain be the origin, and let the coordinates of the geometric center be... ,in The center wavelength, This is the central curvature value. (Definition) The first central moment is: ; In the formula, yes The central moment of the first order, It is a non-negative integer. For the entire triangular topological mapping domain, The curvature value, It is the differential element of the curvature value. The following seven lower-order central moments are calculated as a basis: ,in Because of centering. Then calculate the normalized central moments: ; Seven pairs of equations are calculated based on normalized central moments, which are invariant to translation, rotation, and scaling. Rectangle: ; ; ; ; ; ; ; These seven invariant moment values serve as geometric moment features that remain invariant to translation, rotation, and scaling.
[0043] To calculate the first pesticide residue characteristic response index F1, firstly, calculate the centroid coordinates of each rhomboid micro-element sub-region, and then calculate the centroid distance from the centroid to the geometric center of the triangular topological mapping domain. The centroid distance is normalized to obtain the centroid distance weight. The normalization calculation formula is as follows: ; In the formula, For the first The centroid distance weights of the rhombic micro-element sub-regions (dimensionless, ranging from 0 to 1). This represents the maximum distance between the centroids of all rhombic micro-element sub-regions. It is the minimum distance between the centroids of all rhombic micro-element regions.
[0044] The energy density integral value of each rhombic micro-element sub-region Distance weights from corresponding centroids Multiplication is performed to obtain weighted energy values. Then, all weighted energy values are summed with the corresponding order moments of the seven normalized geometric moments to obtain the first pesticide residue characteristic response index F1. The value of F1 is positively correlated with the intensity of the effective pesticide residue characteristics in the aliased signal. That is, the larger the F1 value, the stronger the effective pesticide residue characteristic signal in the aliased signal, and vice versa. This achieves accurate characterization of the intensity of the effective pesticide residue characteristics in the aliased signal.
[0045] Step 401: When constructing a vector radiation cone, select 5 sampling points on the surface of the vector radiation cone, i.e., take the vertex of the vector radiation cone as the first sampling point; take 4 sampling points evenly distributed on the circumference of the bottom surface of the vector radiation cone as the second, third, fourth, and fifth sampling points, with azimuth angles of 0°, 90°, 180°, and 270° respectively. The spatial coordinates of each bottom surface sampling point are determined by the radius of the bottom surface of the vector radiation cone and the corresponding azimuth angle, specifically including: The basic parameters of the vector radiation cone are defined, with the vertex of the vector radiation cone being the second resonant anchor point, and its coordinates being... ,in The wavelength corresponding to the second resonant anchor point. The curvature value of the second resonance anchor point. This represents the energy attenuation at the second resonant anchor point; the bottom surface of the vector radiation cone is circular, and the plane containing the bottom surface is the depth plane where the third resonant anchor point is located. = , (wavelength corresponding to the third resonant anchor point), base radius The length of the spectral slope envelope from the second resonance anchor point to the third resonance anchor point is determined and is set to 2nm (to adapt to the preset characteristic band range and ensure coverage of the background interference energy diffusion range).
[0046] Five sampling points are selected on the surface of the vector radiation cone. The vertex of the vector radiation cone (the second resonance anchor point) is taken as the first sampling point, denoted as P1, and its spatial coordinates are P1. Four sampling points evenly distributed on the circumference of the base of the vector radiation cone are selected as the second, third, fourth, and fifth sampling points, denoted as P2, P3, P4, and P5, respectively. The azimuth angles of each sampling point on the base are set to 0°, 90°, 180°, and 270°, respectively, with the azimuth angles relative to the principal direction of the vector radiation cone. Based on the baseline, calculate clockwise.
[0047] The spatial coordinates of each bottom surface sampling point are determined by the radius of the bottom surface of the vector radiation cone and the corresponding azimuth angle. The coordinate reference of the plane containing the bottom surface is determined to be... To unify the dimensions, a curvature scale factor is introduced. =1 The formula for calculating the spatial coordinates of the bottom sampling points is: ; In the formula, The spatial coordinates of the bottom sampling point, The wavelength of the sampling point, The curvature value at the sampling point. The curvature value of the third resonance anchor point. The wavelength corresponding to the third resonant anchor point. This represents the energy attenuation (dimensionless) at the third resonance anchor point. The four bottom sampling points P2, P3, P4, and P5 differ only in their azimuth angles. By substituting their respective azimuth angles (0°, 90°, 180°, and 270°) into the above formula, their specific spatial coordinates can be calculated.
[0048] Step 402: Calculate the cosine values C1 to C5 of the angles between the first and second, second and third, third and fourth, fourth and fifth, and fifth and second normal vectors, and the Euclidean distances D1 to D4 between the second to fifth sampling points and the first sampling point, respectively; concatenate them in the order of C1 to C5 and D1 to D4 to construct the global feature vector of the vector radiation cone, specifically including: First, the point cloud data is Z-score normalized to eliminate the influence of dimensions, and the three-dimensional coordinates of the five sampling points P1 to P5 are... Construct a point cloud matrix, respectively for wavelength curvature Energy decay Calculate the mean and standard deviation from three dimensions. ,in It is the standardized dimensionless wavelength value. It is the standardized dimensionless curvature value. It is the standardized dimensionless energy decay. It is the first The original wavelength values of each sampling point The wavelengths of all sampling points (P1 to P5) arithmetic mean It is the standard deviation of the wavelengths at all sampling points. It is the first The original curvature values of each sampling point It is the curvature of all sampling points average value It is the standard deviation of the curvature of all sampling points. It is the first Original energy attenuation at each sampling point It is the energy attenuation at all sampling points. average value It is the standard deviation of energy attenuation at all sampling points; the standardized three-dimensional coordinates. All are dimensionless quantities with a mean of 0 and a standard deviation of 1.
[0049] Calculate the normal vector (based on standardized coordinates) of the surface containing each sampling point. The normal vector calculation uses a plane fitting method with adjacent sampling points; each sampling point is combined with its two adjacent sampling points to construct a plane, and the normal vector is solved using the plane equation. The plane equation is as follows: Where (x, y, z) corresponds to Specifically, the normal vector of P1 The normal vector of P2 is obtained by fitting the planes P1, P2, and P5. The normal vector of P3 is obtained by fitting the planes P2, P1, and P3. The normal vector of P4 is obtained by fitting the planes P3, P2, and P4. The normal vector of P5 is obtained by fitting the planes P4, P3, and P5. The normal vectors are obtained by fitting planes P5, P4, and P2 and normalized to unit vectors (magnitude 1).
[0050] Calculate the cosine of the angle between specified normal vectors. ; calculate separately and , and , and , and , and The cosine values of the included angles are denoted as C1, C2, C3, C4, and C5, respectively. At the same time, the Euclidean distances between the second to fifth sampling points and the first sampling point are calculated and denoted as D1, D2, D3, and D4, respectively, where D1 is the distance between P2 and P1, D2 is the distance between P3 and P1, D3 is the distance between P4 and P1, and D4 is the distance between P5 and P1. By concatenating all feature parameters in the order of C1 to C5 and D1 to D4, a global feature vector of the vector radiation cone is constructed. C1 to C5 in this global feature vector are the cosine values of the angle between the normal vectors of each sampling point, which can reflect the spatial geometry of the surface of the vector radiation cone. The magnitude of the cosine value corresponds to the size of the angle between the normal vectors, thus characterizing the curvature, spatial orientation, and other geometric features of the cone surface. The closer the cosine value is to 1, the more consistent the direction of the normal vectors of the surfaces where the corresponding two sampling points are located, and the smoother the cone surface. Conversely, the more obvious the surface undulations are. D1 to D4 in the vector are the Euclidean distances between the four sampling points on the bottom surface and the sampling points at the top, which can indirectly reflect the overall spatial scale and bottom distribution range of the vector radiation cone. At the same time, the distance parameter is related to the distribution of background interference energy inside the cone. The uniformity of the distance distribution can reflect the uniformity of the diffusion of background interference energy in the cone space. Combining the synergistic effect of the two types of feature parameters, this global feature vector characterizes the spatial geometric features and background interference energy distribution features of the vector radiation cone.
[0051] Step 403: Based on the distance components D1 to D4 in the global feature vector and the height parameter of the vector radiation cone, calculate the weighted sum to characterize the spectral bulk modulus enclosed within the vector radiation cone; based on the spectral bulk modulus and the vertex angle radian value of the vector radiation cone, obtain the normalized second pesticide residue characteristic response index, specifically including: The distance components D1 to D4 are extracted from the global feature vector, and a weighted sum is calculated by combining them with the height parameter Hg of the vector radiation cone to characterize the spectral bulk modulus of the area enclosed within the vector radiation cone. To eliminate the influence of dimensions, a reference height Hg0 = 1 nm is introduced as a normalization factor, where Hg is the vertical distance from the first sampling point P1 to the depth plane containing the bottom surface. The weighted summation formula for the spectral bulk modulus Vm is: ; In the formula, The distance component in the global feature vector. Assign weights to the distance components (each value is 0.25 to ensure uniform weighting of the four distance components); calculate the vertex radian value of the vector radiation cone. The vertex angle is the angle between the two generatrices (lines connecting the vertex to the two endpoints of the base diameter) at the vertex of the vector radiation cone. The formula for calculating this angle is: ; In the formula, The radius of the base; based on the spectral bulk modulus and vertex radian value Calculate the normalized second pesticide residue characteristic response index F2. The normalization calculation formula is: ; In the formula, The minimum value (taking values of) (To avoid a denominator of 0), after normalization The value range is from 0 to 10. The larger the value, the more pesticide residue characteristic signal energy is contained inside the cone; The smaller the value, the more concentrated the characteristic signal energy, the less interference, and the more prominent the characteristic signal. After normalization to eliminate the influence of dimensions, the value of F2 is positively correlated with the intensity of the pesticide residue characteristic signal under well-separated scenarios. That is, the closer the F2 value is to 10, the stronger the pesticide residue characteristic signal, the less interference, and the more obvious the feature; the closer the F2 value is to 0, the weaker the pesticide residue characteristic signal and the relatively stronger the interference. This achieves accurate quantitative characterization of the intensity of pesticide residue characteristic signals under well-separated scenarios.
[0052] This embodiment, targeting spectral aliasing scenarios, constructs a first pesticide residue characteristic response index through bidirectional staggered grid partitioning, spectral energy density integration, normalized central moment calculation, and weighted summation. This effectively isolates interference components in aliased signals and quantifies the effective characteristic intensity of pesticide residues, solving the technical challenge of difficulty in quantifying pesticide characteristic signals caused by spectral aliasing. For scenarios with good separation between characteristic peaks and interference peaks, a global feature vector is constructed by uniformly selecting sampling points, calculating the cosine of the angle between the normal vectors and the Euclidean distance. A second pesticide residue characteristic response index is calculated by combining the spectral bulk modulus and vertex radian value. This comprehensively captures the background interference energy distribution characteristics, characterizes the pesticide residue signal intensity, and avoids the influence of background interference on the detection results. The design of the two characteristic response indices is adapted to both aliasing and separation scenarios, covering different detection conditions. Both are implemented through quantization calculations, achieving a high degree of automation. They seamlessly integrate with the anchor point identification and interference characterization processes described earlier, using standardized terminology to ensure the consistency and reliability of detection results, thus meeting the precise detection needs of low-concentration pesticide residues.
[0053] In a preferred embodiment of the present invention, step 5 includes: Step 500: Obtain the corresponding set of pesticide residue limit thresholds and construct a multi-dimensional cross-border export compliance decision space; use the first pesticide residue characteristic response index or the second pesticide residue characteristic response index as an input vector and map it into the cross-border export compliance decision space to obtain the mapped index value, specifically including: Collect pesticide residue limits for this type of agricultural product from the target exporting countries or regions, and combine them with domestic export testing regulations to compile a set of pesticide residue limit thresholds. ={ 1, 2, ..., },in The specific values for each threshold, based on the number of pesticide types, are set in conjunction with the testing requirements for common agricultural products exported through cross-border trade (such as vegetables and fruits). For example, 1 (chlorpyrifos) = 0.02 mg / kg 2 (imidacloprid) = 0.05 mg / kg 3 (chlorothalonil) = 0.1 mg / kg 4 (Carbendazim) = 0.2 mg / kg. The thresholds for other pesticides are set according to the standards of the corresponding export regions. This threshold set covers all pesticide types required for export compliance, ensuring the comprehensiveness of the decision-making basis. A multi-dimensional cross-border export compliance decision space is constructed, the dimensions of which are consistent with the dimensions of the pesticide residue limit threshold set, totaling [number missing]. Dimension , each dimension corresponds to the residue limit threshold of a pesticide, and the coordinate range of the decision space is [0, 0, ..., 0. (corresponding compliance range) and ( (+∞) (corresponding to non-compliant range), and at the same time, associate the first pesticide residue characteristic response index F1 obtained in step 400 or the second pesticide residue characteristic response index F2 obtained in step 403 with the pesticide residue limit threshold to establish the correspondence between the index value and the actual pesticide residue amount: = × + ; In the formula, The mapped exponent value, It is the response index for the first or second pesticide residue characteristics. The mapping coefficient (with a value of 0.85) This is the mapping constant (with a value of 0.01, used to correct for systematic errors). Substituting F1 or F2 into this formula yields the mapped exponent value. This index value directly corresponds to the actual pesticide residue in agricultural products.
[0054] Step 501: Determine whether the mapped index value falls within a preset safety confidence interval. If it falls within the safety confidence interval, a qualified traceability identifier containing the detection time, location, value, and batch information is obtained and encrypted before being written into the blockchain distributed ledger. If it does not fall within the safety confidence interval, an anomaly warning instruction is generated and sent to the quality control terminal to trigger the re-inspection process, specifically including: A preset safety confidence interval is set, which is determined based on the set of pesticide residue limit thresholds. The safety confidence interval is [0, ..., ... [×0.9], where It is the minimum value in the set of pesticide residue limit thresholds, combined with the threshold set mentioned above. Specific values ( 1 = 0.02 mg / kg 2 = 0.05 mg / kg 3 = 0.1 mg / kg 4 = 0.2 mg / kg), The specific value is 0.02 mg / kg; multiplying by 0.9 is to reserve a safety margin and avoid compliance judgment errors due to detection errors. At this time, the safety confidence interval is [0, 0.02 × 0.9], which is [0, 0.018 mg / kg].
[0055] Determine the exponent value after mapping Whether it falls within the safe confidence interval, if ∈[0, If the value is ×0.9, then the pesticide residue of the batch of agricultural products is determined to meet the compliance requirements for cross-border export, and an index value including the detection time, detection location, and mapped value is generated. The product batch information includes a qualified traceability label. This label is encrypted using a hash encryption algorithm and then written into a blockchain distributed ledger to ensure the traceability information is tamper-proof and traceable, facilitating quality verification during cross-border export. [0, If the pesticide residue of the batch of agricultural products is found to be less than 0.9%, it is determined that the pesticide residue does not meet the compliance requirements for cross-border export. An abnormal warning instruction is generated, which includes key information such as the abnormal batch, abnormal index value, detection time and location. The abnormal warning instruction is sent to the quality control terminal through a wireless transmission module, triggering the re-inspection process. The re-inspection process requires the collection of samples of the batch of agricultural products again and the repetition of all detection processes from steps 100 to 500 to ensure the accuracy of the test results and avoid the export of unqualified agricultural products.
[0056] This embodiment constructs a multi-dimensional decision space by combining cross-border export compliance standards, establishing a mapping relationship between characteristic response indices and actual pesticide residue levels. This allows test results to directly align with cross-border export compliance requirements, resolving the disconnect between test results and export standards and reducing the risk of returns due to mismatched testing standards for agricultural products exported through cross-border e-commerce. Compliance is determined through a safe confidence interval, reserving safety redundancy to reduce misjudgments caused by testing errors. The qualified traceability identifier is encrypted and written to the blockchain, ensuring the immutability and traceability of testing information, meeting the quality verification needs of cross-border exports. Anomaly warnings trigger a re-inspection process, promptly correcting testing deviations, preventing the export of substandard agricultural products, and ensuring the quality and safety of exported agricultural products.
[0057] like Figure 2 As shown, embodiments of the present invention also provide a spectral detection system for pesticide residues in agricultural products exported through cross-border e-commerce, comprising: The standardization module is used to perform radiometric correction and dark current subtraction on the high-dimensional spectral data tensor of the surface of the agricultural product under test, and generate a standardized spectral feature matrix. Based on the standardized spectral feature matrix, the multiple scattering trajectory of virtual photon packets in non-uniform biological media is simulated, and the mean free path distribution of virtual photon packets in different tissue depths is calculated to obtain a dynamic substrate compensation vector. The calculation module is used to extract the dynamic basis compensation vector from the normalized spectral feature matrix, obtain the decoupled net absorption spectral sequence, and calculate the local curvature change rate of the decoupled net absorption spectral sequence in the preset feature band to obtain the spectral gradient field. The judgment module is used to identify the first, second, and third resonant anchor points in the spectral gradient field; it determines whether the projected distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, a triangular topological mapping domain is constructed with the first resonant anchor point as the vertex and the projected points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints; if not, a vector radiation cone pointing to the third resonant anchor point is constructed with the second resonant anchor point as the origin. The acquisition module is used to acquire the first and second pesticide residue characteristic response indices based on the triangular topological mapping domain and the vector radiation cone; The detection module is used to map the first or second pesticide residue characteristic response index to the pre-built cross-border export compliance decision space. If it is within the safe confidence interval, a qualified traceability mark is obtained and written into the blockchain ledger; otherwise, an abnormal warning instruction is triggered.
[0058] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0059] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
[0060] Experimental example: Experimental materials and equipment: Samples to be tested: 20 samples of cherry tomatoes exported through cross-border e-commerce, of which 15 were sprayed with different concentrations of chlorpyrifos (0.01 to 0.5 mg / kg) and 5 were blank controls.
[0061] Detection equipment: 400 to 1000 nm hyperspectral imaging system (spectral resolution 1 nm, spatial resolution 0.5 mm / pixel).
[0062] Reference standard: Assuming the export standard chlorpyrifos residue limit threshold .
[0063] Experimental steps and results analysis: Spectral preprocessing and dynamic basis compensation: High-dimensional spectral data tensor I(x, y, ...) was collected from the surface of cherry tomatoes. After dark current subtraction and radiometric calibration, the normalized spectral feature matrix is obtained. Based on the tomato's waxy layer (scattering coefficient 18.5) ), intercellular spaces (9.2) ) and vacuoles (3.5) The optical parameters of the virtual photon packet were analyzed using Monte Carlo simulation (simulating the number of photons). (Number of units), calculate the mean free path distribution of different tissue depths, and fit to obtain the dynamic basement compensation vector. .
[0064] Experimental data: The mean of the dark current noise matrix is 0.12 (in units of relative reflectance), and the signal-to-noise ratio is improved by 42% after subtraction.
[0065] Monte Carlo simulations show that the mean free path of photons is 0.08 mm in the wax layer and 0.32 mm in the vacuole layer.
[0066] from Middle stripping The decoupled net absorption spectrum sequence was obtained. The characteristic wavelength range of chlorpyrifos (600 to 750 nm) was selected to calculate the second-order differential curvature value. A three-dimensional spectral gradient field is constructed by combining relative reflectance.
[0067] Experimental data: After substrate stripping, the curvature value of the chlorpyrifos characteristic peak (680 nm) increased from 0.15 to 0.38, and the signal-to-noise ratio improved by 2.5 times (e.g., Figure 3 (As shown).
[0068] In the spectral gradient field, the three-dimensional distribution of wavelength-curvature-energy shows that the curvature difference between the interfering peak (720 nm) and the characteristic peak reaches 0.22 (e.g., Figure 4 (As shown).
[0069] Identifying three types of resonance anchors in the spectral gradient field: First resonance anchor point (chlorpyrifos main absorption peak): =680 nm, =0.38; Second resonance anchor point (moisture interference peak): =720 nm, = -0.24; Third resonance anchor point (cellulose baseline inflection point): =620 nm, =0.05; calculate and Euclidean distance =40nm ≥ Preset neighborhood threshold =5nm, the characteristic peak and interference peak were well separated, and a vector radiation cone was constructed.
[0070] Experimental data: The vertex of the vector radiation cone The center of the base circle is Base radius =2nm.
[0071] Based on five sampling points (P1 to P5) on the surface of the vector radiation cone, the cosine values of the angle between the normal vectors (C1 to C5) and the Euclidean distance (D1 to D4) are calculated to construct a global feature vector. This is combined with the cone height. =100nm, the second pesticide residue characteristic response index F2 was calculated to be 3.2 (corresponding to a chlorpyrifos concentration of 0.025 mg / kg).
[0072] Experimental data: The range of cosine values for the angle between the normal vectors: C1=0.92, C2=0.88, C3=0.95, C4=0.91, C5=0.89 Euclidean distances: D1=15.2nm, D2=14.8nm, D3=15.5nm, D4=14.9nm.
[0073] Mapping F2=3.2 to the compliance decision space yields the mapped index value. If the concentration exceeds the safety confidence interval [0, 0.018] mg / kg, an anomaly warning is triggered. For qualified samples (such as blank controls, F2=0.8), a traceability identifier is generated and written to the blockchain.
[0074] Experimental data: Of the 20 samples, 12 were qualified (F2<1.2), and 8 exceeded the standard (F2>2.5), with an early warning accuracy rate of 95%. The traceability identifier stored on the blockchain includes the testing time, location, and batch number.
[0075] This experimental example fully demonstrates the entire process of this method from sample collection to compliance determination. Through dynamic basis compensation, it effectively overcomes the masking of weak pesticide signals by the high moisture content and strong scattering background of cherry tomatoes. By intelligently identifying signals and interference and adaptively constructing geometric structures for quantification, it solves the problem of overlapping characteristic peaks and interference peaks at low concentrations, ultimately obtaining stable and quantifiable characteristic indices. Furthermore, by connecting the technical detection results to cross-border trade practices, and through the combination of confidence intervals with safety redundancy and blockchain traceability, it improves detection reliability while achieving proactive control and traceability of quality and safety risks.
Claims
1. A method for the spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce, characterized in that, The method includes: Step 1: Perform radiometric correction and dark current subtraction on the high-dimensional spectral data tensor of the surface of the agricultural product to be tested to generate a standardized spectral feature matrix; based on the standardized spectral feature matrix, simulate the multiple scattering trajectory of virtual photon packets in a non-uniform biological medium, and calculate the mean free path distribution of virtual photon packets at different tissue depths to obtain a dynamic substrate compensation vector. Step 2: Extract the dynamic basis compensation vector from the standardized spectral feature matrix to obtain the decoupled net absorption spectral sequence, and calculate the local curvature change rate of the decoupled net absorption spectral sequence in the preset feature band to obtain the spectral gradient field. Step 3: Identify the first, second, and third resonant anchor points in the spectral gradient field; determine whether the projection distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, construct a triangular topological mapping domain with the first resonant anchor point as the vertex and the projection points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints; otherwise, construct a vector radiation cone pointing to the third resonant anchor point with the second resonant anchor point as the origin. Step 4: Obtain the first and second pesticide residue characteristic response indices based on the triangular topological mapping domain and the vector radiation cone; Step 5: Map the first or second pesticide residue characteristic response index to the pre-built cross-border export compliance decision space. If it is within the safe confidence interval, a qualified traceability mark is obtained and written into the blockchain ledger; otherwise, an abnormal warning instruction is triggered.
2. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 1, characterized in that, Radiometric correction and dark current subtraction are performed on the high-dimensional spectral data tensor of the surface of the agricultural product to be tested, generating a standardized spectral feature matrix, including: The original high-dimensional spectral data tensor of the surface of the agricultural product to be tested is collected. The original high-dimensional spectral data tensor contains pixel coordinate information in the spatial dimension and wavelength reflectance information in the spectral dimension. Obtain the dark current noise matrix of the sensor output under no-light conditions, and remove the dark current noise matrix from the original high-dimensional spectral data tensor to obtain the denoised spectral data tensor. Radiometric calibration of the denoised spectral data tensor was performed using standard whiteboard reference spectral data to obtain a relative reflectance spectral data cube. The relative reflectance spectral data cube is smoothed and filtered to obtain a standardized spectral feature matrix.
3. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 2, characterized in that, Based on the normalized spectral feature matrix, the multiple scattering trajectories of virtual photon packets in non-homogeneous biological media are simulated, and the mean free path distribution of virtual photon packets at different tissue depths is calculated to obtain the dynamic substrate compensation vector, including: Based on the optical properties of the biological tissues of agricultural products, the scattering coefficient and absorption coefficient of photons in the medium are set, and a Monte Carlo photon transmission simulation environment is constructed. In the Monte Carlo photon transport simulation environment, virtual photon packets are initialized, and the multiple scattering trajectories of each virtual photon packet in the waxy layer, intercellular spaces, and vacuoles of agricultural products are simulated. The displacement vector and energy decay of each virtual photon packet after each scattering event are recorded. The probability distribution of all virtual photon packets at different tissue depths was statistically analyzed, and the mean free path distribution probability density function of photons at each depth was calculated by combining the displacement vector and energy attenuation. Based on the probability density function of the mean free path distribution, the background scattering spectrum curve caused by the tissue structure of agricultural products is fitted, and the background scattering spectrum curve is mapped to a dynamic basis compensation vector with the same dimension as the standardized spectral feature matrix.
4. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 3, characterized in that, In the Monte Carlo photon transport simulation environment, virtual photon packets are initialized, and the multiple scattering trajectories of each virtual photon packet in the waxy layer, intercellular spaces, and vacuoles of agricultural products are simulated. The displacement vector and energy attenuation of each virtual photon packet after each scattering event are recorded, including: Set the initial emission position, incident angle, and initial energy value of the virtual photon packet, and initiate a random walk process in the Monte Carlo photon transmission simulation environment; In each scattering event, the path length and scattering direction cosine of the virtual photon packet for the next scattering are determined by a random number generator based on the scattering coefficient and absorption coefficient of the current medium layer. Update the spatial coordinate displacement vector of the virtual photon packet, calculate the energy decay of the virtual photon packet within the current step size, and record the updated remaining energy value; determine whether the remaining energy of the virtual photon packet is lower than the preset energy threshold or whether it has escaped from the surface of the agricultural product. If so, terminate the simulation trajectory of the corresponding virtual photon packet and save the complete path history data; if not, continue to execute the simulation of the next scattering event until all initialized virtual photon packets have completed trajectory simulation.
5. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 4, characterized in that, The rate of change of local curvature of the decoupled net absorption spectral sequence within a preset characteristic band is calculated to obtain the spectral gradient field, including: Select a preset characteristic band interval corresponding to the vibrational frequency of the chemical bonds in the target pesticide molecule, and then truncate the decoupled net absorption spectrum sequence. Within a preset characteristic band range, a second-order differential operation is performed on the decoupled net absorption spectrum sequence to calculate the curvature value at each wavelength point. The curvature value characterizes the sharpness of the shape of the spectral absorption peak and the intensity of the energy level transition. The relative reflectance intensity value or energy attenuation coefficient corresponding to the preset characteristic band interval in the standardized spectral feature matrix is extracted as the third dimension information. The wavelength value, curvature value and the third dimension information are combined to construct a three-dimensional spectral feature space, forming a spectral gradient field that reflects the local variation trend and intensity distribution of spectral energy.
6. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 5, characterized in that, The first, second, and third resonant anchor points include: First resonance anchor point: In the spectral gradient field, search for the positive extreme point with the largest curvature value. The positive extreme point corresponds to the position of the main absorption peak of the functional group in the target pesticide molecule, which characterizes the intensity of the main characteristic signal of pesticide residue. Second resonance anchor point: In the spectral gradient field, search for negative extreme points located in the long-wavelength direction of the first resonance anchor point and whose curvature value reaches a local maximum. The negative extreme points correspond to the positions of macromolecular absorption interference peaks of endogenous moisture or sugar in agricultural products. The third resonance anchor point: In the spectral gradient field, search for the baseline inflection point located in the short-wavelength direction. The baseline inflection point corresponds to the turning point of the scattering baseline caused by the cellulose skeleton of agricultural products, and characterizes the reference level of background scattering.
7. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 6, characterized in that, Determine whether the projected distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, construct a triangular topological mapping domain with the first resonant anchor point as the vertex and the projected points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints. If not, construct a vector radiation cone pointing to the third resonant anchor point with the second resonant anchor point as the origin, including: The Euclidean distance between the first and second resonant anchor points on the wavelength axis is calculated and compared with a preset neighborhood threshold. When the Euclidean distance is less than the preset neighborhood threshold, it is determined that the pesticide characteristic peak and the interference peak have spectral aliasing. At this time, the amplitude of the first resonant anchor point is used as the vertex height. Within the wavelength interval between the second and third resonant anchor points, the difference in curvature values of adjacent wavelength points is calculated sequentially. The position where the absolute value of the difference exceeds the preset abrupt change threshold is identified as the curvature abrupt change point. Using the curvature abrupt change point as the dividing boundary, the band between the second and third resonant anchor points is divided into several sub-intervals. The longest continuous sub-interval containing the projections of the second and third resonant anchor points is selected. The projection points of the starting and ending wavelength points of the longest continuous sub-interval on the wavelength axis are determined as the two endpoints of the bottom edge. The first resonant anchor point is connected to the two bottom edge endpoints by linear interpolation to construct a closed triangular topological mapping domain. The triangular topological mapping domain is used to isolate the effective components in the aliased signal. When the Euclidean distance is greater than or equal to a preset neighborhood threshold, it is determined that the pesticide characteristic peak and the interference peak are well separated. At this time, taking the second resonance anchor point as the geometric origin, the three-dimensional coordinates of multiple discrete sampling points located within the neighborhood radius of the second resonance anchor point and extending to the direction of the third resonance anchor point in the spectral gradient field are collected. The three-dimensional coordinates correspond to the wavelength value, curvature value, and energy attenuation in the third dimension information, respectively. The three-dimensional coordinates are used to form a point cloud matrix. The covariance matrix of the point cloud matrix is calculated, and the eigenvalues and eigenvectors of the covariance matrix are solved. The eigenvector corresponding to the largest eigenvalue is taken as the principal direction. Starting from the second resonance anchor point, a vector radiation cone is constructed along the principal direction to the depth plane where the third resonance anchor point is located. The sidewall of the vector radiation cone is generated by rotating the spectral slope envelope from the second resonance anchor point to the third resonance anchor point around the principal direction axis. The vector radiation cone is used to characterize the energy diffusion range of the background interference.
8. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 7, characterized in that, Step 4 includes: When constructing a triangular topological mapping domain, a bidirectional staggered mesh is performed on the triangular topological mapping domain to divide it into several rhombic micro-element sub-regions; the spectral energy density integral value in each rhombic micro-element sub-region is calculated; the central moment of the entire triangular topological mapping domain is calculated and normalized to obtain seven geometric moment values that are invariant to translation, rotation, and scaling; the energy density integral value of each rhombic micro-element sub-region is multiplied by the centroid distance weight in the triangular topological mapping domain, and then weighted and summed with the corresponding order moment values among the seven geometric moment values to obtain the first pesticide residue characteristic response index; When constructing a vector radiation cone, select 5 sampling points on the surface of the vector radiation cone, that is, take the vertex of the vector radiation cone as the first sampling point; take 4 sampling points evenly distributed on the circumference of the bottom surface of the vector radiation cone as the second, third, fourth and fifth sampling points, and the azimuth angles of each bottom surface sampling point are 0°, 90°, 180° and 270° respectively. The spatial coordinates of each bottom surface sampling point are determined by the radius of the bottom surface of the vector radiation cone and the corresponding azimuth angle. Calculate the cosine values of the angles between the first and second, second and third, third and fourth, fourth and fifth, and fifth and second normal vectors, C1 to C5, and the Euclidean distances between the second to fifth sampling points and the first sampling point, respectively, D1 to D4; concatenate them in the order of C1 to C5 and D1 to D4 to construct the global feature vector of the vector radiation cone; Based on the distance components D1 to D4 in the global feature vector and the height parameter of the vector radiation cone, a weighted sum is calculated to characterize the spectral bulk modulus enclosed inside the vector radiation cone; based on the spectral bulk modulus and the vertex radian value of the vector radiation cone, the normalized second pesticide residue characteristic response index is obtained.
9. The method for spectroscopic detection of pesticide residues in agricultural products exported through cross-border e-commerce according to claim 8, characterized in that, Step 5 includes: Obtain the corresponding pesticide residue limit threshold set and construct a multi-dimensional cross-border export compliance decision space; use the first pesticide residue characteristic response index or the second pesticide residue characteristic response index as the input vector and map it to the cross-border export compliance decision space to obtain the mapped index value; The system determines whether the mapped index value falls within a preset safety confidence interval. If it does, a qualified traceability identifier containing the detection time, location, value, and batch information is obtained and encrypted before being written into the blockchain distributed ledger. If it does not fall within the safety confidence interval, an abnormal warning instruction is generated and sent to the quality control terminal to trigger the re-inspection process.
10. A spectral detection system for pesticide residues in agricultural products exported through cross-border e-commerce, wherein the system implements the method as described in any one of claims 1 to 9, characterized in that, include: The standardization module is used to perform radiometric correction and dark current subtraction on the high-dimensional spectral data tensor of the surface of the agricultural product to be tested, and generate a standardized spectral feature matrix. Based on the standardized spectral feature matrix, the multiple scattering trajectory of virtual photon packets in non-uniform biological media is simulated, and the mean free path distribution of virtual photon packets at different tissue depths is calculated to obtain the dynamic substrate compensation vector. The calculation module is used to extract the dynamic basis compensation vector from the normalized spectral feature matrix, obtain the decoupled net absorption spectral sequence, and calculate the local curvature change rate of the decoupled net absorption spectral sequence in the preset feature band to obtain the spectral gradient field. The judgment module is used to identify the first, second, and third resonant anchor points in the spectral gradient field; it determines whether the projected distance between the first and second resonant anchor points on the wavelength axis is less than a preset neighborhood threshold. If so, a triangular topological mapping domain is constructed with the first resonant anchor point as the vertex and the projected points of the second and third resonant anchor points on the wavelength axis as the bottom endpoints; if not, a vector radiation cone pointing to the third resonant anchor point is constructed with the second resonant anchor point as the origin. The acquisition module is used to acquire the first and second pesticide residue characteristic response indices based on the triangular topological mapping domain and the vector radiation cone; The detection module is used to map the first or second pesticide residue characteristic response index to the pre-built cross-border export compliance decision space. If it is within the safe confidence interval, a qualified traceability mark is obtained and written into the blockchain ledger; otherwise, an abnormal warning instruction is triggered.