Veterinary drug residue detection method and system based on spectrum technology

By combining characteristic peak priority detection and dynamic monitoring point array with Raman spectroscopy, the problems of long detection cycle and insufficient accuracy in veterinary drug residue detection have been solved. This enables rapid identification of veterinary drug residues and real-time early warning of pollution spread, improving detection efficiency and accuracy and supporting environmental safety supervision.

CN121049231AInactive Publication Date: 2025-12-02SICHUAN HUASHU ANIMAL PHARMACY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511489399.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2025-12-02
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies for detecting veterinary drug residues have long detection cycles, complex sample pretreatment, insufficient detection accuracy, inability to track pollution spread in real time, lack of dynamic monitoring methods, difficulty in real-time tracking of residue migration paths, and inability to issue timely early warning information, thus increasing environmental safety hazards.

Method used

By establishing a priority detection mechanism for characteristic peaks and a dynamic monitoring point array, rapid identification of veterinary drug residues and real-time early warning of pollution spread are achieved. Raman spectroscopy is used for wavelength partitioning scanning to obtain the position and intensity of characteristic peaks, the enhancement factor of surface-enhanced Raman spectroscopy is calculated, the time-varying characteristics of the enhancement factor are extracted, a residue distribution map is generated, the velocity field and concentration field of residue diffusion are calculated, and a dynamic monitoring point array is set up to track the migration path of residues in real time.

Benefits of technology

It enables rapid identification of veterinary drug residues and real-time early warning of pollution spread, improving detection efficiency and accuracy. The dynamic monitoring point array enables real-time tracking of residue migration paths, timely prediction of pollution spread range, and provides early warning and prevention support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121049231A_ABST
    Figure CN121049231A_ABST
Patent Text Reader

Abstract

The invention discloses a veterinary drug residue detection method and system based on a spectrum technology, and relates to the technical field of spectrum detection.The veterinary drug residue detection method comprises the steps that Raman spectrum data of a to-be-detected sample is collected, wavelength partition scanning is conducted, the position and intensity of a characteristic peak are obtained, and a detection priority is set according to the intensity change rate of the characteristic peak to generate a time sequence detection instruction; carrying out surface enhanced Raman spectrum collection at the position of the characteristic peak and calculating an enhancement factor; extracting the time-varying characteristics of the enhancement factors to judge the type and content of veterinary drug residues, and generating a residue distribution diagram; and calculating a velocity field and a concentration field of residue diffusion based on the residue distribution diagram, setting a dynamic monitoring point array tracking migration path along the direction of the velocity field, predicting a pollution diffusion range in combination with the concentration field, and outputting early warning information. The method can rapidly and accurately detect and early warn veterinary drug residue pollution, and has important practical application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spectral detection technology, specifically to a method and system for detecting veterinary drug residues based on spectral technology. Background Technology

[0002] Veterinary drug residue detection mainly employs methods such as liquid chromatography, gas chromatography, and mass spectrometry (LC-MS), which suffer from drawbacks including long detection cycles and complex sample pretreatment. Raman spectroscopy offers advantages such as speed, non-destructive testing, and high sensitivity, but its practical applications are limited by insufficient detection accuracy and the inability to track pollution diffusion in real time. While surface-enhanced Raman spectroscopy can improve detection sensitivity, the lack of effective detection strategies to determine the acquisition order of characteristic peaks leads to low detection efficiency. Existing technologies struggle to accurately predict residue diffusion trends and cannot issue timely warnings, increasing environmental safety risks.

[0003] Traditional detection methods typically focus only on single-point detection results, neglecting the spatial distribution characteristics and temporal evolution patterns of residues. The lack of dynamic monitoring tools makes it difficult to track residue migration paths in real time, severely hindering the establishment of early warning systems and the development of risk control measures. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for detecting veterinary drug residues based on spectral technology. This method achieves rapid identification of veterinary drug residues and real-time early warning of pollution spread by establishing a priority detection mechanism for characteristic peaks and a dynamic monitoring point array.

[0005] In a first aspect, the present invention provides a method for detecting veterinary drug residues based on spectral technology, characterized by comprising the following steps: Raman spectral data of the sample to be tested are collected and wavelength partition scanning is performed to obtain the position and intensity of characteristic peaks. The detection priority is set according to the intensity change rate of characteristic peaks, and time-series detection instructions are generated. In response to the timing detection command, surface-enhanced Raman spectroscopy is acquired at the characteristic peak position, and the enhancement factor of the surface-enhanced Raman spectrum is calculated. Extract the time-varying features of the enhancement factor, determine the type of veterinary drug residue, calculate the residue content based on the enhancement factor, and mark the residue content in the target detection area to generate a residue distribution map; Based on the residual distribution map, the velocity field and concentration field of residual diffusion are calculated. A dynamic monitoring point array is set along the direction of the velocity field to track the migration path of the residual in real time. Combined with the concentration field, the pollution diffusion range is predicted. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning information is output.

[0006] Furthermore, Raman spectral data of the sample to be tested are acquired, and wavelength partition scanning is performed to obtain the position and intensity of characteristic peaks. Detection priorities are set based on the intensity change rate of characteristic peaks, and time-series detection instructions are generated, including: Raman spectral data of the sample to be tested are collected, the boundary position of the wavelength partition is determined based on the preset wavelength interval, spectral scanning is performed within the wavelength partition, and the characteristic peak wavelength position and characteristic peak intensity obtained from the spectral scanning are extracted. Calculate the rate of change of the intensity of the characteristic peak at adjacent wavelength positions, divide the characteristic peak into multiple detection groups according to the numerical range of the rate of change, calculate the mean and fluctuation range of the rate of change within each detection group, and use the ratio of the mean to the fluctuation range as a priority indicator. The sampling time interval of the detection group is determined according to the priority index. The sampling time intervals are sorted according to the priority index to form a time series. The detection time of each detection group is determined based on the time series, and a time-series detection instruction is generated.

[0007] Furthermore, in response to the timing detection command, surface-enhanced Raman spectroscopy is performed at the characteristic peak positions, and the enhancement factor of the surface-enhanced Raman spectrum is calculated, including: Calculate the gradient value based on the characteristic peak intensity change rate in the time-series detection instruction, set detection points at the characteristic peak positions based on the gradient value, and obtain the detection point distribution. The location of intensity abrupt change is determined based on the difference in characteristic peak intensity between adjacent detection points in the detection point distribution. Supplementary detection points are added at the location of intensity abrupt change, and the sampling time interval of the detection points is determined based on the time decay rate of the characteristic peak intensity. According to the sampling time interval, a composite substrate with a double-layer nanostructure is set at the detection point and the supplementary detection point for surface-enhanced Raman spectroscopy acquisition. The intensity of characteristic peak signals in the surface-enhanced Raman spectrum is extracted, and the enhancement factor of the surface-enhanced Raman spectrum is calculated based on the ratio of the intensity of the characteristic peak signals to the intensity of the conventional Raman spectrum.

[0008] Furthermore, the time-varying characteristics of the enhancement factors are extracted to determine the type of veterinary drug residue, and the residue content is calculated based on the enhancement factors. The residue content is then marked in the target detection area to generate a residue distribution map, including: The enhancement factors at multiple time points were collected, and a time series of the enhancement factors over time was constructed. Wavelet transform is performed on the time series of the enhancement factor, time-varying features are extracted from the transform coefficients, statistical parameters are calculated based on the time-varying features, and feature vectors are constructed. The feature vector of each sampling point is input into a support vector machine classifier to determine the type of veterinary drug residue and obtain the residue type of the sampling point. Select the corresponding enhancement factor-residue content standard curve according to the type of veterinary drug residue at each sampling point, and convert the enhancement factor of the sampling point into the residue content value; Using the spatial coordinates of the sampling points as a reference, a local weighted interpolation algorithm is used to perform spatial interpolation on the residual content values ​​to generate a residual distribution map of the target detection area.

[0009] Furthermore, the calculation of the velocity field and concentration field of residue diffusion based on the residue distribution map includes: Extract the spatial variation features of the concentration gradient from the residue distribution map to construct a residue distribution feature vector; The cross-correlation coefficient of the residue distribution map at adjacent time points is calculated based on the residue distribution feature vector. The residue distribution map is then spatially registered according to the cross-correlation coefficient to obtain the position change trajectory of the residue. The velocity vector of the residue is then calculated based on the position change trajectory. A curvilinear coordinate system is constructed along the trajectory of position change, and the velocity vector of the residue is decomposed to obtain translational and rotational components. The initial velocity field is constructed using the translational components, and the ratio of the rotational component to the translational component is calculated to obtain the vorticity field intensity. The initial velocity field is corrected by using the vorticity field intensity to obtain the corrected velocity field, and the corrected velocity field is substituted into the convection-diffusion equation to calculate the residual concentration field in the target area.

[0010] Furthermore, a curvilinear coordinate system is constructed along the position change trajectory, and the velocity vector of the residue is decomposed into translational and rotational components. The initial velocity field is constructed using the translational components, and the ratio of the rotational to the translational components is calculated to obtain the vorticity field intensity, including: Obtain the tangent direction of the trajectory along the position change path, and establish a curve coordinate system based on the tangent direction of the trajectory; Project the velocity vector of the residue onto the curvilinear coordinate system to obtain the translational component along the tangent of the trajectory and the rotational component perpendicular to the tangent of the trajectory. Determine the local solution region based on the spatial distribution of the translational and rotational components. Within the local solution region, the Laplace equation of the velocity potential is constructed using the translational component as the boundary condition. The velocity potential is obtained by block iterative solution. The gradient of the velocity potential is superimposed with the translational component to construct the initial velocity field. A vorticity calculation grid is constructed based on the initial velocity field. The ratio of the rotational component to the translational component is calculated at the nodes of the vorticity calculation grid. The distribution of the ratio on the vorticity calculation grid is taken as the vorticity field intensity.

[0011] Furthermore, a dynamic monitoring point array is set up along the direction of the velocity field to track the migration path of the residue in real time. Combined with the concentration field, the pollution diffusion range is predicted. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning message is output, including: Extract topological singularities from the velocity field, calculate the velocity gradient values ​​at the topological singularities, divide the monitoring priorities according to the velocity gradient values, and deploy a dynamic monitoring point array along the direction of the velocity field according to the monitoring priorities. Enhancement factor data is collected from the dynamic monitoring point array. Information entropy is calculated based on the spatial distribution characteristics of the enhancement factor data. Supplementary monitoring locations are determined based on the change in information entropy. A concentration field is constructed using enhancement factor data collected from the supplementary monitoring locations. Multi-wavelength scanning of the concentration field was performed to obtain the characteristic absorption band combination of veterinary drug residues, and the diffusion trend of residues was identified based on the spectral response changes of the characteristic absorption band combination. The absorbance change of the diffusion trend is compared with the preset diffusion threshold, and a warning message is output when the absorbance exceeds the preset diffusion threshold.

[0012] Secondly, an embodiment of the present invention provides a veterinary drug residue detection system based on spectral technology, the system comprising: The Raman spectroscopy acquisition module is used to acquire Raman spectral data of the sample to be tested, perform wavelength partition scanning, obtain the position and intensity of characteristic peaks, set the detection priority according to the intensity change rate of characteristic peaks, and generate time-series detection instructions. The surface enhancement detection module is used to respond to time-series detection commands, acquire surface-enhanced Raman spectra at characteristic peak positions, and calculate the enhancement factor of the surface-enhanced Raman spectra. The residue identification module is used to extract the time-varying features of the enhancement factor, determine the type of veterinary drug residue, calculate the residue content based on the enhancement factor, and mark the residue content in the target detection area to generate a residue distribution map. The pollution early warning module is used to calculate the velocity field and concentration field of residue diffusion based on the residue distribution map, set up a dynamic monitoring point array along the direction of the velocity field, track the migration path of the residue in real time, and predict the pollution diffusion range by combining the concentration field. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning information is output.

[0013] One technical solution provided in this embodiment of the invention is an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in any of the aforementioned methods.

[0014] One technical solution provided in this embodiment of the invention is a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the steps in any of the aforementioned methods.

[0015] This invention effectively identifies different types of veterinary drug residues through wavelength partitioning scanning and characteristic peak analysis, improving detection efficiency. The application of surface-enhanced Raman spectroscopy significantly improves detection sensitivity and accuracy. The generated residue distribution map visually displays the pollution status, facilitating analysis and assessment. The dynamic monitoring point array enables real-time tracking of residue migration paths; combined with velocity and concentration field analysis, it allows for timely prediction of pollution diffusion range, aiding in early warning and prevention.

[0016] The above description of the invention is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart of a veterinary drug residue detection method based on spectral technology provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a veterinary drug residue detection system based on spectral technology, provided in an embodiment of the present invention. Detailed Implementation

[0019] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements.

[0020] The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0021] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.

[0022] like Figure 1 As shown, Figure 1 A flowchart of a veterinary drug residue detection method based on spectral technology provided in this embodiment of the invention, the method comprising the following steps: Raman spectral data of the sample to be tested are collected and wavelength partition scanning is performed to obtain the position and intensity of characteristic peaks. The detection priority is set according to the intensity change rate of characteristic peaks, and time-series detection instructions are generated. In response to the timing detection command, surface-enhanced Raman spectroscopy is acquired at the characteristic peak position, and the enhancement factor of the surface-enhanced Raman spectrum is calculated. Extract the time-varying features of the enhancement factor, determine the type of veterinary drug residue, calculate the residue content based on the enhancement factor, and mark the residue content in the target detection area to generate a residue distribution map; Based on the residual distribution map, the velocity field and concentration field of residual diffusion are calculated. A dynamic monitoring point array is set along the direction of the velocity field to track the migration path of the residual in real time. Combined with the concentration field, the pollution diffusion range is predicted. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning information is output.

[0023] Raman spectral data of the sample to be tested are acquired, and wavelength partition scanning is performed to obtain the position and intensity of characteristic peaks. Detection priority is set according to the intensity change rate of characteristic peaks, and time-series detection instructions are generated, including: Raman spectral data of the sample to be tested are collected, the boundary position of the wavelength partition is determined based on the preset wavelength interval, spectral scanning is performed within the wavelength partition, and the characteristic peak wavelength position and characteristic peak intensity obtained from the spectral scanning are extracted. Calculate the rate of change of the intensity of the characteristic peak at adjacent wavelength positions, divide the characteristic peak into multiple detection groups according to the numerical range of the rate of change, calculate the mean and fluctuation range of the rate of change within each detection group, and use the ratio of the mean to the fluctuation range as a priority indicator. The sampling time interval of the detection group is determined according to the priority index. The sampling time intervals are sorted according to the priority index to form a time series. The detection time of each detection group is determined based on the time series, and a time-series detection instruction is generated.

[0024] First, Raman spectral data of the sample to be tested is acquired. Wavelength partition boundaries are determined according to preset wavelength intervals, and spectral scanning is performed within each wavelength partition. The wavelength range can be set into two main regions: the mid-to-low frequency region and the high frequency region. The preset wavelength intervals are adjusted according to the information density of different regions, thus dividing the entire spectral range into several wavelength partitions. Within each wavelength partition, the sample is scanned using spectral scanning technology to acquire the spectral information of the sample within that partition, and the wavelength positions and intensity data of characteristic peaks are extracted.

[0025] For the extracted characteristic peak data, this method calculates the rate of change of the characteristic peak intensity at adjacent wavelength positions. Specifically, it takes the difference between the characteristic peak intensity value and the intensity value at its adjacent wavelength position, and then divides this difference by the wavelength interval between the two points. Based on the calculated range of the rate of change, the characteristic peaks are divided into multiple detection groups. For example, characteristic peaks with a rate of change in a large negative range can be assigned to detection group A, those in a moderately negative range to detection group B, and those with a rate of change close to zero to detection group C. For each characteristic peak in each detection group, its mean rate of change and fluctuation range are calculated for subsequent priority evaluation.

[0026] The ratio of the absolute value of the mean rate of change within each detection group to the fluctuation range is used as a priority index to determine the detection priority of that group. For example, the priority index for detection group A is its absolute value of the mean divided by the fluctuation range; the priority indexes for detection groups B and C are calculated in the same way. The sampling time interval for each detection group is determined based on the magnitude of the priority index. A larger priority index indicates a more significant change in the intensity of the characteristic peak in that detection group, requiring more frequent sampling. A basic sampling time interval can be set, and the actual sampling time interval for each detection group can be adjusted according to the priority index.

[0027] The sampling time intervals of each detection group are sorted from highest to lowest priority to form a time series. The specific detection time for each detection group is determined based on this time series. Assuming the detection start time is zero, subsequent detection times can be calculated based on the sampling time intervals of each detection group. These detection times are combined into a time-series detection command and sent to the spectral detection equipment to execute the corresponding detection operation.

[0028] During the detection of veterinary drug residues, when the intensity of a characteristic peak at a specific wavelength exceeds a preset threshold, the system automatically marks the sample as a suspected positive for veterinary drug residues and initiates further analysis. For specific types of veterinary drug residues, when the peak intensity at its characteristic wavelength exceeds a preset threshold, the system will shorten the sampling time interval and increase the detection frequency to obtain more accurate trend data. Simultaneously, the system will activate a multi-wavelength joint detection mechanism to monitor the peak values ​​of this type of veterinary drug at multiple characteristic wavelengths, improving detection accuracy through comprehensive analysis of multi-point data.

[0029] The technical solution of this invention achieves intelligent optimization of veterinary drug residue detection through wavelength partitioning and characteristic peak grouping, significantly improving detection efficiency and accuracy. Priority indicators based on change rate calculation enable the system to concentrate limited detection resources on wavelengths with significant changes, reducing unnecessary data acquisition and lowering detection costs. The time-series detection command generation mechanism ensures timely monitoring of important characteristic peaks, improving the response capability to rapid changes in veterinary drug residues. The multi-wavelength joint detection mechanism effectively reduces the false positive rate and enhances the method's anti-interference capability by integrating information from multiple characteristic peaks, enabling accurate detection of trace veterinary drug residues even in complex matrices.

[0030] In response to the timing detection command, surface-enhanced Raman spectroscopy is performed at the characteristic peak positions, and the enhancement factor of the surface-enhanced Raman spectrum is calculated, including: Calculate the gradient value based on the characteristic peak intensity change rate in the time-series detection instruction, set detection points at the characteristic peak positions based on the gradient value, and obtain the detection point distribution. The location of intensity abrupt change is determined based on the difference in characteristic peak intensity between adjacent detection points in the detection point distribution. Supplementary detection points are added at the location of intensity abrupt change, and the sampling time interval of the detection points is determined based on the time decay rate of the characteristic peak intensity. According to the sampling time interval, a composite substrate with a double-layer nanostructure is set at the detection point and the supplementary detection point for surface-enhanced Raman spectroscopy acquisition. The intensity of characteristic peak signals in the surface-enhanced Raman spectrum is extracted, and the enhancement factor of the surface-enhanced Raman spectrum is calculated based on the ratio of the intensity of the characteristic peak signals to the intensity of the conventional Raman spectrum.

[0031] First, the gradient value is calculated based on the characteristic peak intensity change rate in the time-series detection command to optimize the setting of detection points. The characteristic peak intensity change rate refers to the change in characteristic peak intensity per unit time, obtained by dividing the difference in characteristic peak intensity between adjacent detection times by the time interval. The gradient value is the spatial rate of change of the characteristic peak intensity change rate, indicating how the change rate is distributed within the spectral wavelength range. For example, for veterinary drug residue detection, the intensity change rate can be calculated at the characteristic wavelength. If, at a certain characteristic peak wavelength position, the intensity change rates of two consecutive detections are negative and positive, respectively, it indicates a turning point in the trend of change at that location. In this case, the gradient value is large, and a detection point should be set accordingly.

[0032] Based on the calculated gradient values, detection points are set at the locations of characteristic peaks. Locations with larger gradient values ​​indicate more significant changes in spectral characteristics and are more likely to contain crucial veterinary drug residue information; therefore, they are prioritized as detection points. For example, when detecting a certain type of veterinary drug, if multiple locations with large gradient values ​​are found within the wavelength range, these locations can be set as detection points to obtain the distribution of detection points. The locations of intensity abrupt changes are determined based on the intensity difference of the characteristic peaks of adjacent detection points. An intensity abrupt change location refers to a location where the intensity difference of the characteristic peaks of adjacent detection points exceeds a preset threshold. If the intensity difference between the characteristic peaks of two adjacent detection points exceeds twice the average difference, an intensity abrupt change is considered to exist in this region, and supplementary detection points need to be added in this region to obtain more detailed spectral information.

[0033] Supplementary detection points are added at locations of abrupt changes in intensity, and the sampling time interval for these detection points is determined based on the time decay rate of the characteristic peak intensity. The time decay rate refers to the rate at which the characteristic peak intensity decays over time, calculated by repeatedly detecting the characteristic peak intensity at the same location and determining its trend over time. For detection points with a large decay rate, a shorter sampling time interval should be set to capture rapidly changing spectral information; for detection points with a small decay rate, a longer sampling time interval can be set to conserve detection resources. For example, if the characteristic peak intensity decay rate of a detection point is large, its sampling time interval can be set to a shorter value, such as sampling once every short interval; while for detection points with a small decay rate, the sampling time interval can be set to a longer value.

[0034] Following predetermined sampling time intervals, a composite substrate with a bilayer nanostructure was placed at the detection point and supplementary detection point for surface-enhanced Raman spectroscopy (SERS) acquisition. The bilayer nanostructure composite substrate is a specially designed SERS substrate consisting of a bottom layer of metal nanoparticles and an upper dielectric isolation layer. The bottom layer of metal nanoparticles is prepared from noble metal materials, with a particle size controlled within the tens of nanometers range, and is formed by deposition on the substrate via chemical reduction. The upper dielectric isolation layer is made from materials such as silica or alumina, with a thickness controlled within a few nanometers, and is prepared via a sol-gel method. This bilayer structure can generate a strong localized surface plasmon resonance effect, significantly enhancing the Raman signal. During SERS acquisition, the sample solution was dropped onto the composite substrate, and after the solvent evaporated, the sample was detected using a Raman spectrometer to obtain the enhanced Raman signal.

[0035] The intensity of characteristic peak signals in surface-enhanced Raman (SMR) spectroscopy is extracted, and the enhancement factor is calculated based on the ratio of the characteristic peak signal intensity to the conventional Raman signal intensity. The enhancement factor is a key parameter for evaluating the sensitivity of SMR, representing the factor by which the signal is amplified. During detection, the intensity of characteristic peak signals measured using both conventional and SMR techniques is obtained, and the ratio of these two measurements is used as the enhancement factor. Generally, a larger enhancement factor indicates higher sensitivity for the target substance. The magnitude of the enhancement factor is closely related to parameters such as the morphology, size, and spacing of the bilayer nanostructure; optimizing these parameters can improve the enhancement factor and thus enhance the detection sensitivity.

[0036] For the analysis and processing of detection results, a correlation between the intensity of characteristic peak signals and the concentration of veterinary drug residues can be established to form a standard curve. By substituting the intensity of the characteristic peak signals of the sample into the standard curve, the concentration of veterinary drug residues in the sample can be quantitatively calculated. Furthermore, the detection results can be corrected based on the magnitude of the enhancement factor, improving the accuracy of quantitative analysis. Additionally, the detection results of multiple characteristic peaks can be combined and comprehensively judged using pattern recognition algorithms to improve the specificity and accuracy of the detection.

[0037] This invention achieves precise localization of veterinary drug residues through gradient value calculation and optimized detection point settings, significantly improving detection efficiency. The identification of intensity abrupt changes and the addition of supplementary detection points ensure complete capture of key information, avoiding the omission of important features. The application of a bilayer nanostructured composite substrate significantly enhances Raman signal intensity, increasing detection sensitivity by several orders of magnitude, enabling the detection of extremely low concentrations of veterinary drug residues. The dynamic adjustment mechanism of the sampling time interval ensures the rational allocation of detection resources, guaranteeing the detection frequency at key locations while avoiding resource waste. The calculation and application of enhancement factors provide a reliable basis for quantitative analysis, significantly improving the accuracy and reliability of detection results.

[0038] Extracting the time-varying characteristics of enhancement factors, determining the type of veterinary drug residue, calculating the residue content based on the enhancement factors, and marking the residue content in the target detection area to generate a residue distribution map includes: The enhancement factors at multiple time points were collected, and a time series of the enhancement factors over time was constructed. Wavelet transform is performed on the time series of the enhancement factor, time-varying features are extracted from the transform coefficients, statistical parameters are calculated based on the time-varying features, and feature vectors are constructed. The feature vector of each sampling point is input into a support vector machine classifier to determine the type of veterinary drug residue and obtain the residue type of the sampling point. Select the corresponding enhancement factor-residue content standard curve according to the type of veterinary drug residue at each sampling point, and convert the enhancement factor of the sampling point into the residue content value; Using the spatial coordinates of the sampling points as a reference, a local weighted interpolation algorithm is used to perform spatial interpolation on the residual content values ​​to generate a residual distribution map of the target detection area.

[0039] First, an enhancement factor time series is constructed by collecting data at multiple time points. This requires acquiring enhancement factor data at different time points to create a time series showing the change of the enhancement factor over time. For example, surface-enhanced Raman (SMR) spectral data can be collected at multiple consecutive time points at a specific detection location, such as by collecting data at regular intervals after the start of detection, resulting in multiple sets of data. For each set of data, the ratio of the intensity of the characteristic peak in the SMR spectrum to the corresponding peak intensity in the conventional Raman spectrum is calculated to obtain the enhancement factor at that time point. During detection, the SMR signal intensity can be measured at a characteristic wavelength to be several times that of the conventional Raman signal intensity; this ratio is the enhancement factor. The enhancement factors at all time points are then arranged in chronological order to form a time series of the enhancement factors.

[0040] Wavelet transform is applied to the time series of the enhancement factor to extract time-varying features from the transform coefficients. Wavelet transform is a time-frequency analysis method that can simultaneously acquire time-domain and frequency-domain information of a signal. In implementation, appropriate wavelet basis functions are selected to decompose the enhancement factor time series, obtaining wavelet coefficients at different scales. The db4 wavelet can be used as the basis function to decompose the enhancement factor time series into wavelet coefficients at multiple scales. These wavelet coefficients reflect the variation characteristics of the enhancement factor at different time scales and are the basis for extracting time-varying features. The time-varying features extracted from the wavelet coefficients mainly include energy distribution, frequency characteristics, and phase information. The energy proportion of wavelet coefficients at each scale can be calculated, reflecting the distribution of the enhancement factor at different frequency components; the peak position and peak size of the wavelet coefficients can be extracted, reflecting the key feature points of the enhancement factor's change over time; and the phase changes of the wavelet coefficients can be analyzed, reflecting the nonlinear characteristics of the enhancement factor time series.

[0041] Statistical parameters are calculated based on the extracted time-varying features to construct a feature vector. These statistical parameters include mean, standard deviation, skewness, kurtosis, and entropy, which describe the statistical distribution characteristics of the time-varying features. Taking wavelet coefficient energy distribution as an example, the mean of energy at different scales can be calculated, reflecting the scale level of energy concentration; the standard deviation of the energy distribution can be calculated, reflecting the dispersion of the energy distribution; the skewness of the energy distribution can be calculated, reflecting the asymmetry of the energy distribution; the kurtosis of the energy distribution can be calculated, reflecting the peaks or flatness of the energy distribution; and the entropy of the energy distribution can be calculated, reflecting the uncertainty of the energy distribution. These statistical parameters are arranged in a predetermined order to form a feature vector. The feature vector can contain multiple dimensions, each corresponding to a statistical parameter, comprehensively describing the characteristics of the enhancement factor time series.

[0042] The feature vector of each sampling point is input into a Support Vector Machine (SVM) classifier to determine the type of veterinary drug residue, thus obtaining the residue type of the sampling point. SVM is a supervised learning model that classifies data by finding the optimal hyperplane. The SVM classifier must first be trained using feature vectors from samples of known veterinary drug residue types. The training samples should cover common veterinary drug residue types. For each type, feature vectors from multiple samples and their corresponding residue type labels are collected for classifier training. After training, the feature vector of the sampling point to be tested is input into the classifier to obtain the veterinary drug residue type determination result for that point.

[0043] For each sampling point, a corresponding enhancement factor-residue content standard curve is selected based on the type of veterinary drug residue. The enhancement factor of the sampling point is then converted into a residue content value. Different types of veterinary drug residues have different enhancement factor-residue content correspondences, requiring the establishment of dedicated standard curves for each type. For example, the enhancement factor of sulfonamide standard solutions at different concentrations can be measured to plot the curve corresponding to the enhancement factor and residue content. When a sampling point is determined to have veterinary drug residue, the corresponding residue content value is obtained by consulting the sulfonamide standard curve based on the enhancement factor of that point. Standard curves are typically established using a fitting method, where the enhancement factor of a known concentration sample is fitted to the concentration data points to obtain their functional relationship. Substituting the enhancement factor of the sample to be tested into this function yields the residue content value.

[0044] Using the spatial coordinates of sampling points as a reference, a local weighted interpolation algorithm is employed to spatially interpolate the residual content values, generating a residual distribution map of the target detection area. Spatial interpolation is a method for estimating the values ​​at unsampled locations based on a finite number of sampling points. The local weighted interpolation algorithm considers the spatial relationships between sampling points, assigning higher weights to sampling points that are closer. First, the spatial coordinates of each sampling point are determined. Based on these known sampling points and their corresponding residual content values, the estimated residual content value at any location within the target detection area is calculated. During the calculation, each sampling point is assigned a weight, which is inversely proportional to the distance from the point to the target location; the closer the distance, the greater the weight. The residual content values ​​of all sampling points are then weighted and averaged to obtain the estimated residual content value at the target location. This calculation is performed on all locations within the detection area, ultimately generating a residual distribution map covering the entire detection area, visually displaying the spatial distribution of veterinary drug residues.

[0045] This invention effectively extracts the time-varying features of veterinary drug residues by constructing an enhancement factor time series and wavelet transform, significantly improving the accuracy and specificity of detection. The application of a support vector machine classifier enables accurate identification of different types of veterinary drug residues, avoiding misjudgments common in traditional methods. Targeted quantitative analysis strategies based on residue types significantly improve the accuracy of content determination, providing reliable data support for food safety supervision. The introduction of a local weighted interpolation algorithm makes the conversion from discrete sampling points to continuous distribution maps smoother and more natural, intuitively displaying the spatial distribution patterns of veterinary drug residues. The overall solution integrates multiple technologies such as spectral analysis, signal processing, machine learning, and spatial analysis, forming a complete system of veterinary drug residue detection methods. It can quickly and accurately complete the entire process from sample collection to residue distribution visualization, providing strong technical support for the safe production and quality supervision of livestock products.

[0046] In this embodiment, calculating the velocity field and concentration field of residue diffusion based on the residue distribution map includes: Extract the spatial variation features of the concentration gradient from the residue distribution map to construct a residue distribution feature vector; The cross-correlation coefficient of the residue distribution map at adjacent time points is calculated based on the residue distribution feature vector. The residue distribution map is then spatially registered according to the cross-correlation coefficient to obtain the position change trajectory of the residue. The velocity vector of the residue is then calculated based on the position change trajectory. A curvilinear coordinate system is constructed along the trajectory of position change, and the velocity vector of the residue is decomposed to obtain translational and rotational components. The initial velocity field is constructed using the translational components, and the ratio of the rotational component to the translational component is calculated to obtain the vorticity field intensity. The initial velocity field is corrected by using the vorticity field intensity to obtain the corrected velocity field, and the corrected velocity field is substituted into the convection-diffusion equation to calculate the residual concentration field in the target area.

[0047] First, it is necessary to extract the spatial variation characteristics of the concentration gradient in the residue distribution map to construct a residue distribution feature vector. The concentration gradient refers to the rate of change of residue concentration in space, reflecting the non-uniformity of residue distribution. Multiple directions can be selected on the residue distribution map, and the rate of change of concentration in each direction can be calculated to obtain the directional gradient. Calculating the concentration gradient in both the horizontal and vertical orthogonal directions yields information on the magnitude and direction of the gradient. In addition to the first-order gradient, the second derivative of the concentration can be calculated to obtain the acceleration information of the concentration change, reflecting the curvature characteristics of the residue distribution. Extracted features also include the centroid location, principal axis direction, and shape parameters of the residue distribution. The centroid location is the spatial location of the weighted average of residue concentrations, the principal axis direction is the main extension direction of the residue distribution, and the shape parameters include the length of the major axis, the length of the minor axis, and the eccentricity. These features are combined in a predetermined order to form a residue distribution feature vector for subsequent analysis.

[0048] Based on the characteristic vector of residue distribution, the cross-correlation coefficient of residue distribution maps at adjacent time points is calculated. Spatial registration of the residue distribution maps is then performed based on the cross-correlation coefficient to obtain the trajectory of residue position changes. The cross-correlation coefficient is an indicator of the similarity between two distributions, ranging from -1 to 1; a higher value indicates greater similarity. When calculating the cross-correlation coefficient of residue distribution maps at adjacent time points, a sliding window method can be used. The distribution map at the next time point is shifted at different positions, and the cross-correlation coefficient with the distribution map at the previous time point is calculated. The shift that maximizes the cross-correlation coefficient is the displacement of the residue within that time interval. If a shift in the residue position is found between two adjacent time points, the magnitude and direction of the shift can be accurately calculated through cross-correlation analysis. Connecting the displacements at all adjacent time points forms the trajectory of residue position changes. Based on the trajectory of position changes and the corresponding time interval, the velocity vector of the residue at each time point is calculated. The velocity vector has both magnitude and direction, representing the displacement of the residue per unit time.

[0049] A curvilinear coordinate system is constructed along the trajectory of position change, and the velocity vector of the residue is decomposed into translational and rotational components. The curvilinear coordinate system is a local coordinate system established based on the residue trajectory, typically including tangential and normal directions. In the curvilinear coordinate system, the velocity vector can be decomposed into a translational component along the tangential direction of the trajectory and a rotational component perpendicular to the trajectory. The translational component represents the velocity of the residue along the trajectory, and the rotational component represents the velocity of the residue around the trajectory. If the trajectory of position change exhibits a certain curvature, it indicates that the residue, in addition to moving along a certain direction, also exhibits rotational or deflective behavior. An initial velocity field is constructed using the translational component, which describes the motion state of the residue throughout the detection area. For points on the trajectory, the velocity value is taken as the actually measured translational component; for points outside the trajectory, the velocity value can be estimated using interpolation methods, commonly including the inverse distance weighted method and the Kriging method. The ratio of the rotational component to the translational component is calculated to obtain the vorticity field intensity. The vorticity field represents the intensity and direction of fluid rotation and is an important indicator for determining whether there is a rotational trend in the migration of residue.

[0050] The modified velocity field is obtained by correcting the initial velocity field using vorticity field intensity. The initial velocity field mainly considers the translational behavior of the residue, while residue migration often involves both translational and rotational behaviors. Vorticity field intensity reflects the significance of rotational behavior and can be used to correct the initial velocity field. The correction method uses vorticity field intensity as a weighting factor to adjust the direction and magnitude of the initial velocity field. In regions with high vorticity field intensity, the direction of the velocity field will deflect, forming a local rotating flow field; in regions with low vorticity field intensity, the velocity field basically maintains its original direction. If a strong vorticity field is detected in a certain region, it indicates that there is significant rotating flow in that region, and the velocity field needs to be corrected accordingly. The modified velocity field is substituted into the convection-diffusion equation to calculate the residue concentration field in the target region. The convection-diffusion equation is the fundamental equation describing the migration law of matter in a fluid, consisting of two parts: convection term and diffusion term. The convection term represents the process of residue migration with the overall fluid motion and is directly related to the velocity field; the diffusion term represents the process of spontaneous diffusion of residue due to concentration gradient and is related to the diffusion coefficient. Numerical methods, such as the finite difference method and the finite element method, are commonly used to solve the convection-diffusion equation. By substituting the modified velocity field and the known diffusion coefficient into the convection-diffusion equation and solving it numerically, the concentration distribution of residues in the target region at different times can be obtained.

[0051] This invention achieves accurate extraction of the spatial distribution characteristics of veterinary drug residues and effective tracking of their changing patterns by constructing a residue distribution feature vector and performing cross-correlation analysis. The introduction of a curvilinear coordinate system allows the complex residue motion to be decomposed into two fundamental components: translation and rotation, significantly simplifying the complexity of motion analysis. The calculation and application of eddy field intensity solves the problem of insufficient description of rotational motion in traditional methods, making residue migration prediction more accurate. The combination of the modified velocity field and the convection-diffusion equation forms a complete method for predicting residue concentration fields, which can extrapolate the distribution of veterinary drug residues over a future period based on existing monitoring data, providing a scientific basis for preventative supervision.

[0052] A curvilinear coordinate system is constructed along the trajectory of position change, and the velocity vector of the residue is decomposed to obtain translational and rotational components. An initial velocity field is constructed using the translational components, and the ratio of the rotational to translational components is calculated to obtain the vorticity field intensity, including: Obtain the tangent direction of the trajectory along the position change path, and establish a curve coordinate system based on the tangent direction of the trajectory; Project the velocity vector of the residue onto the curvilinear coordinate system to obtain the translational component along the tangent of the trajectory and the rotational component perpendicular to the tangent of the trajectory. Determine the local solution region based on the spatial distribution of the translational and rotational components. Within the local solution region, the Laplace equation of the velocity potential is constructed using the translational component as the boundary condition. The velocity potential is obtained by block iterative solution. The gradient of the velocity potential is superimposed with the translational component to construct the initial velocity field. A vorticity calculation grid is constructed based on the initial velocity field. The ratio of the rotational component to the translational component is calculated at the nodes of the vorticity calculation grid. The distribution of the ratio on the vorticity calculation grid is taken as the vorticity field intensity.

[0053] First, the tangent direction of the trajectory is obtained along the position change path, and a curvilinear coordinate system is established based on the tangent direction. The position change trajectory is a spatial curve formed by connecting the centroid positions of the residue distribution at adjacent time points, reflecting the migration path of the residue. For each trajectory point, the local direction of the trajectory, i.e., the trajectory tangent direction, can be calculated by the position difference between two adjacent points. For example, if the centroid positions of the residue are monitored at different coordinate points at multiple consecutive time points, these points can be connected to form a trajectory, and the tangent direction of the trajectory can be calculated at each point. The curvilinear coordinate system is a local coordinate system established based on the trajectory tangent direction, and typically includes a tangential coordinate axis along the tangent direction and a normal coordinate axis perpendicular to the tangent direction. In the curvilinear coordinate system, spatial position can be represented by the arc length coordinate along the trajectory and the normal distance perpendicular to the trajectory. This representation method is particularly suitable for describing objects moving along a curved path.

[0054] Projecting the velocity vector of the residue onto a curvilinear coordinate system yields the translational component along the tangent to the trajectory and the rotational component perpendicular to the tangent. The velocity vector is calculated by dividing the change in the residue's position between adjacent moments by the time interval, representing the residue's motion state. In the curvilinear coordinate system, the velocity vector can be decomposed into two components: the component along the tangent to the trajectory is called the translational component, representing the velocity of the residue moving along the trajectory; the component perpendicular to the tangent is called the rotational component, representing the velocity of the residue rotating around or deviating from the trajectory. If the velocity vector has a specific value, it can be projected onto the tangent to the trajectory to obtain the translational component; projecting it onto the normal direction yields the rotational component.

[0055] The local solution region is determined based on the spatial distribution of translational and rotational components. The local solution region refers to the spatial area requiring detailed calculations, typically selected from regions where the residue distribution is concentrated and its motion characteristics are significant. Methods for determining the local solution region can be based on the spatial distribution characteristics of the translational and rotational components; for example, regions with large translational gradients or significant rotational component gradients can be selected as the local solution region. Regions meeting certain criteria can be filtered by setting thresholds, such as selecting regions where the translational component is greater than a certain threshold or where the ratio of the rotational component to the translational component exceeds a specific threshold.

[0056] Within the local solution domain, the Laplace equation for the velocity potential is constructed using translational components as boundary conditions, and the velocity potential is obtained through block iteration. The velocity potential is a scalar function describing the velocity field, and its gradient is equal to the irrotational velocity field. The Laplace equation is the fundamental equation satisfied by the velocity potential, indicating that the sum of the second derivatives of the velocity potential equals zero. When constructing the Laplace equation, boundary conditions need to be specified, typically using known translational components. Normal derivative values ​​consistent with the measured translational components can be specified as boundary conditions at the boundaries of the local solution domain. Solving the Laplace equation usually employs numerical methods, among which block iteration is an efficient solution technique. The basic idea of ​​block iteration is to divide the solution domain into multiple sub-regions, using a direct solution method within each sub-region, and exchanging information between sub-regions through iterative updates. The local solution domain can be discretized into a grid, and a discretized Laplace equation can be established at each grid node, forming a system of linear equations. The entire grid is divided into several sub-blocks, and the system of linear equations is solved simultaneously within each sub-block. Then, the values ​​at the sub-block boundaries are updated, and this process is repeated until convergence.

[0057] The velocity potential obtained through block-based iterative solution reflects the flow characteristics of the residue under irrotational conditions. The initial velocity field is constructed by superimposing the gradient of the velocity potential with its translational components. The gradient of the velocity potential is a vector field representing the velocity distribution of the irrotational flow. Superimposing the gradient of the velocity potential with the known translational components yields an initial velocity field that more closely reflects reality, containing both irrotational flow components and preserving the measured translational characteristics.

[0058] A vorticity calculation grid is constructed based on the initial velocity field. The ratio of the rotational component to the translational component is calculated at the nodes of the vorticity calculation grid, and the distribution of this ratio across the grid is taken as the vorticity field intensity. The vorticity calculation grid is a spatially discretized grid specifically designed for calculating vorticity, typically requiring a sufficiently high grid resolution to capture the spatial variation characteristics of vorticity. When constructing the vorticity calculation grid, adaptive grid partitioning can be performed based on the characteristics of the initial velocity field, using a denser grid in regions with larger velocity gradients. For each grid node, the ratio of the rotational component to the translational component is calculated. This ratio reflects the rotational trend of the local flow; a larger ratio indicates more significant rotation. The distribution of these ratios across all grid nodes is taken as the vorticity field intensity, which describes the spatial distribution characteristics of the rotational behavior during residue migration. If a large ratio of the rotational component to the translational component is measured in a certain region, it indicates significant rotational flow and a high vorticity field intensity in that region; conversely, in regions with a smaller ratio, the flow is predominantly translational, and the vorticity field intensity is lower.

[0059] This invention achieves precise decomposition of the motion of veterinary drug residues by establishing a curvilinear coordinate system based on the trajectory tangent direction, simplifying complex migration behavior into two fundamental components: translation and rotation. The introduction of velocity potential and the solution of the Laplace equation effectively solve the problem of discontinuous velocity field construction in traditional methods, ensuring the physical rationality of the velocity field. The application of block-based iterative technology significantly improves computational efficiency, enabling high-precision solutions even under limited computational resources. The calculation of vorticity field intensity helps identify key diffusion regions, providing a more reliable basis for pollutant diffusion prediction.

[0060] A dynamic monitoring point array is set up along the direction of the velocity field to track the migration path of the residue in real time. Combined with the concentration field, the pollution diffusion range is predicted. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning message is output, including: Extract topological singularities from the velocity field, calculate the velocity gradient values ​​at the topological singularities, divide the monitoring priorities according to the velocity gradient values, and deploy a dynamic monitoring point array along the direction of the velocity field according to the monitoring priorities. Enhancement factor data is collected from the dynamic monitoring point array. Information entropy is calculated based on the spatial distribution characteristics of the enhancement factor data. Supplementary monitoring locations are determined based on the change in information entropy. A concentration field is constructed using enhancement factor data collected from the supplementary monitoring locations. Multi-wavelength scanning of the concentration field was performed to obtain the characteristic absorption band combination of veterinary drug residues, and the diffusion trend of residues was identified based on the spectral response changes of the characteristic absorption band combination. The absorbance change of the diffusion trend is compared with the preset diffusion threshold, and a warning message is output when the absorbance exceeds the preset diffusion threshold.

[0061] First, topological singularities in the velocity field are extracted. The velocity gradient values ​​at these singularities are calculated, and monitoring priorities are assigned based on these gradient values. A dynamic monitoring point array is then deployed along the velocity field direction according to these priorities. Topological singularities are special points in the velocity field where the velocity is zero or the velocity direction is uncertain. They typically include vortex cores, saddle points, and foci. Methods for extracting topological singularities can be based on local feature analysis of the velocity field, such as calculating the eigenvalues ​​of the Jacobian matrix. When the eigenvalues ​​satisfy specific conditions, the corresponding points are considered topological singularities. For example, if a point in the velocity field of a certain region exhibits a rotating velocity distribution around it with a central velocity close to zero, this point may be a vortex core-type topological singularity. For each identified topological singularity, its velocity gradient value is calculated. The velocity gradient value is the derivative of velocity with respect to spatial coordinates, reflecting the rate of change of velocity in space. The finite difference method can be used to approximate the velocity gradient value, i.e., calculating the velocity difference between grid points near the topological singularity and dividing by the spatial distance. The larger the velocity gradient value, the more drastic the velocity change at that point, which may correspond to a key area for the migration of veterinary drug residues.

[0062] Based on velocity gradient values, monitoring priorities can be assigned by sorting topological singularities from highest to lowest velocity gradient value and classifying them into high, medium, and low priority levels. For example, topological singularities with the highest velocity gradient values ​​are classified as high priority, those in the medium range as medium priority, and those in the lower range as low priority. A dynamic monitoring point array is then deployed along the velocity field direction according to the monitoring priority. For high-priority topological singularities, dense monitoring points can be deployed around them along the main velocity field direction; for medium-priority topological singularities, a moderate density of monitoring points is deployed; and for low-priority topological singularities, sparser monitoring points are deployed. When deploying monitoring points, they can be extended along the streamline direction of the velocity field to capture the migration path of residues. If the velocity field around a high-priority topological singularity indicates that residues may diffuse in a specific direction, a series of monitoring points can be deployed in that direction to form a monitoring point array.

[0063] Enhancement factor data is collected at a dynamic monitoring point array. Information entropy is calculated based on the spatial distribution characteristics of the enhancement factor data. Supplementary monitoring locations are determined based on the change in information entropy, and a concentration field is constructed using enhancement factor data collected at these supplementary monitoring locations. Enhancement factor data represents the signal enhancement factor obtained through surface-enhanced Raman spectroscopy (SERS), and its value is related to the concentration of veterinary drug residues. At each monitoring point, SERS data is collected, and the ratio of the intensity of the characteristic peak signal to the corresponding peak intensity in conventional Raman spectroscopy is calculated to obtain the enhancement factor for that point. For veterinary drug residues, the SERS signal intensity at a characteristic wavelength is measured to be several times that of the conventional Raman signal intensity; this ratio is the enhancement factor. Information entropy is calculated based on the spatial distribution characteristics of the enhancement factor data. Information entropy is an indicator of the uncertainty of data distribution. The calculation method involves dividing the enhancement factor data into several intervals, statistically analyzing the data frequency of each interval, and then calculating the information entropy based on the frequency. A larger information entropy indicates a more dispersed data distribution; a smaller information entropy indicates a more concentrated data distribution. Supplementary monitoring locations are determined based on the change in information entropy. Information entropy change refers to the difference in information entropy between adjacent regions or adjacent time points. Regions with large changes may exhibit abrupt changes or abnormal distributions in veterinary drug residue concentrations, requiring supplementary monitoring. For example, if the information entropy change exceeds a threshold in a certain region, supplementary monitoring points can be added in that region to obtain more detailed data. By combining the enhancement factor data collected from all monitoring points and supplementary monitoring points with spatial interpolation techniques, a concentration field covering the entire target area is constructed.

[0064] Multi-wavelength scanning of the concentration field is used to obtain characteristic absorption band combinations of veterinary drug residues. The diffusion trend of the residues is identified based on the spectral response changes of these characteristic absorption band combinations. Multi-wavelength scanning refers to the process of sequentially acquiring spectra within a certain wavelength range according to preset wavelength intervals. For a pre-constructed concentration field, multi-wavelength scanning can be performed in the ultraviolet-visible spectral region to measure the absorbance of the sample at different wavelengths. A characteristic absorption band combination refers to a set of wavelengths that can effectively distinguish target veterinary drug residues, typically including the characteristic absorption peak wavelength of the veterinary drug residue and its adjacent wavelengths. For example, for veterinary drug residues, there may be a characteristic absorption peak in the ultraviolet region; the wavelength of this peak and several wavelengths on either side are selected to form a characteristic absorption band combination. The diffusion trend of the residues is identified based on the spectral response changes of the characteristic absorption band combination. The spectral response change refers to the variation of the absorbance of each wavelength in the characteristic absorption band combination over time or space. By analyzing these changes, the diffusion direction and speed of the residues can be inferred. If the absorbance of the characteristic absorption peak is observed to exhibit a gradient distribution in space, and the gradient direction is consistent with the predicted diffusion direction, it can be determined that the residue is diffusing along that direction; if the absorbance increases with time, it indicates that the residue concentration is increasing and the diffusion trend is intensifying.

[0065] The system compares the absorbance change of the diffusion trend with a preset diffusion threshold, and outputs an early warning message when the threshold is exceeded. The absorbance change of the diffusion trend refers to the rate of change of absorbance at each wavelength in the characteristic absorption band combination over space or time. The larger the rate of change, the faster the residue diffuses. The preset diffusion threshold is a critical value determined based on food safety standards and laboratory validation results, used to determine whether the diffusion has reached a dangerous level. When the absorbance change rate exceeds the preset diffusion threshold, it indicates that the diffusion rate of veterinary drug residues has reached a warning level, requiring timely intervention. At this time, an early warning message will be output, including key information such as the diffusion area, diffusion direction, and diffusion rate, so that corresponding control measures can be taken. For example, if the absorbance change rate of veterinary drug residues in a meat product exceeds the preset threshold, the system will generate an early warning message, indicating that the risk of veterinary drug residue diffusion in that area is high and immediate treatment or isolation is required.

[0066] This invention achieves precise identification of key areas for veterinary drug residue migration by extracting topological singularities from the velocity field and calculating velocity gradient values, significantly improving the targeting and efficiency of monitoring. The priority deployment mechanism of the dynamic monitoring point array ensures the rational allocation of monitoring resources, concentrating limited detection capabilities on the most risky areas. Information entropy analysis and supplementary monitoring location determination methods effectively solve the problem that traditional fixed monitoring point layouts are difficult to adapt to complex migration situations, enabling the monitoring network to be dynamically adjusted according to actual conditions. The application of multi-wavelength scanning and characteristic absorption band combinations improves the accuracy of veterinary drug residue type identification and avoids the susceptibility to interference in single-wavelength detection. The establishment of a diffusion trend early warning mechanism shifts regulatory focus from passive response to proactive prevention, providing a guarantee for food safety.

[0067] like Figure 2 As shown, Figure 2 This is a schematic diagram of a veterinary drug residue detection system based on spectral technology. The system includes: The Raman spectroscopy acquisition module is used to acquire Raman spectral data of the sample to be tested, perform wavelength partition scanning, obtain the position and intensity of characteristic peaks, set the detection priority according to the intensity change rate of characteristic peaks, and generate time-series detection instructions. The surface enhancement detection module is used to respond to time-series detection commands, acquire surface-enhanced Raman spectra at characteristic peak positions, and calculate the enhancement factor of the surface-enhanced Raman spectra. The residue identification module is used to extract the time-varying features of the enhancement factor, determine the type of veterinary drug residue, calculate the residue content based on the enhancement factor, and mark the residue content in the target detection area to generate a residue distribution map. The pollution early warning module is used to calculate the velocity field and concentration field of residue diffusion based on the residue distribution map, set up a dynamic monitoring point array along the direction of the velocity field, track the migration path of the residue in real time, and predict the pollution diffusion range by combining the concentration field. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning information is output.

[0068] One technical solution provided in this embodiment of the invention is an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in any of the aforementioned methods.

[0069] One technical solution provided in this embodiment of the invention is a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the steps in any of the aforementioned methods.

[0070] The specific embodiments described above are preferred embodiments of the present invention and are not intended to limit the specific scope of the present invention. The scope of the present invention includes, but is not limited to, these specific embodiments. All equivalent changes made in accordance with the shape and structure of the present invention are within the protection scope of the present invention.

Claims

1. A method for detecting veterinary drug residues based on spectral technology, characterized in that, Includes the following steps: Raman spectral data of the sample to be tested are collected and wavelength partition scanning is performed to obtain the position and intensity of characteristic peaks. The detection priority is set according to the intensity change rate of characteristic peaks, and time-series detection instructions are generated. In response to the timing detection command, surface-enhanced Raman spectroscopy is acquired at the characteristic peak position, and the enhancement factor of the surface-enhanced Raman spectrum is calculated. Extract the time-varying features of the enhancement factor, determine the type of veterinary drug residue, calculate the residue content based on the enhancement factor, and mark the residue content in the target detection area to generate a residue distribution map; Based on the residual distribution map, the velocity field and concentration field of residual diffusion are calculated. A dynamic monitoring point array is set along the direction of the velocity field to track the migration path of the residual in real time. Combined with the concentration field, the pollution diffusion range is predicted. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning information is output.

2. The method according to claim 1, characterized in that, Raman spectral data of the sample to be tested are acquired, and wavelength partition scanning is performed to obtain the position and intensity of characteristic peaks. Detection priority is set according to the intensity change rate of characteristic peaks, and time-series detection instructions are generated, including: Raman spectral data of the sample to be tested are collected, the boundary position of the wavelength partition is determined based on the preset wavelength interval, spectral scanning is performed within the wavelength partition, and the characteristic peak wavelength position and characteristic peak intensity obtained from the spectral scanning are extracted. Calculate the rate of change of the intensity of the characteristic peak at adjacent wavelength positions, divide the characteristic peak into multiple detection groups according to the numerical range of the rate of change, calculate the mean and fluctuation range of the rate of change within each detection group, and use the ratio of the mean to the fluctuation range as a priority indicator. The sampling time interval of the detection group is determined according to the priority index. The sampling time intervals are sorted according to the priority index to form a time series. The detection time of each detection group is determined based on the time series, and a time-series detection instruction is generated.

3. The method according to claim 1, characterized in that, In response to the timing detection command, surface-enhanced Raman spectroscopy is performed at the characteristic peak positions, and the enhancement factor of the surface-enhanced Raman spectrum is calculated, including: Calculate the gradient value based on the characteristic peak intensity change rate in the time-series detection instruction, set detection points at the characteristic peak positions based on the gradient value, and obtain the detection point distribution. The location of intensity abrupt change is determined based on the difference in characteristic peak intensity between adjacent detection points in the detection point distribution. Supplementary detection points are added at the location of intensity abrupt change, and the sampling time interval of the detection points is determined based on the time decay rate of the characteristic peak intensity. According to the sampling time interval, a composite substrate with a double-layer nanostructure is set at the detection point and the supplementary detection point for surface-enhanced Raman spectroscopy acquisition. The intensity of characteristic peak signals in the surface-enhanced Raman spectrum is extracted, and the enhancement factor of the surface-enhanced Raman spectrum is calculated based on the ratio of the intensity of the characteristic peak signals to the intensity of the conventional Raman spectrum.

4. The method according to claim 1, characterized in that, Extracting the time-varying characteristics of enhancement factors, determining the type of veterinary drug residue, calculating the residue content based on the enhancement factors, and marking the residue content in the target detection area to generate a residue distribution map includes: The enhancement factors at multiple time points were collected, and a time series of the enhancement factors over time was constructed. Wavelet transform is performed on the time series of the enhancement factor, time-varying features are extracted from the transform coefficients, statistical parameters are calculated based on the time-varying features, and feature vectors are constructed. The feature vector of each sampling point is input into a support vector machine classifier to determine the type of veterinary drug residue and obtain the residue type of the sampling point. Select the corresponding enhancement factor-residue content standard curve according to the type of veterinary drug residue at each sampling point, and convert the enhancement factor of the sampling point into the residue content value; Using the spatial coordinates of the sampling points as a reference, a local weighted interpolation algorithm is used to perform spatial interpolation on the residual content values ​​to generate a residual distribution map of the target detection area.

5. The method according to claim 1, characterized in that, The velocity and concentration fields of residue diffusion, calculated based on the residue distribution map, include: Extract the spatial variation features of the concentration gradient from the residue distribution map to construct a residue distribution feature vector; The cross-correlation coefficient of the residue distribution map at adjacent time points is calculated based on the residue distribution feature vector. The residue distribution map is then spatially registered according to the cross-correlation coefficient to obtain the position change trajectory of the residue. The velocity vector of the residue is then calculated based on the position change trajectory. A curvilinear coordinate system is constructed along the trajectory of position change, and the velocity vector of the residue is decomposed to obtain translational and rotational components. The initial velocity field is constructed using the translational components, and the ratio of the rotational component to the translational component is calculated to obtain the vorticity field intensity. The initial velocity field is corrected by using the vorticity field intensity to obtain the corrected velocity field, and the corrected velocity field is substituted into the convection-diffusion equation to calculate the residual concentration field in the target area.

6. The method according to claim 5, characterized in that, A curvilinear coordinate system is constructed along the trajectory of position change, and the velocity vector of the residue is decomposed to obtain translational and rotational components. An initial velocity field is constructed using the translational components, and the ratio of the rotational to translational components is calculated to obtain the vorticity field intensity, including: Obtain the tangent direction of the trajectory along the position change path, and establish a curve coordinate system based on the tangent direction of the trajectory; Project the velocity vector of the residue onto the curvilinear coordinate system to obtain the translational component along the tangent of the trajectory and the rotational component perpendicular to the tangent of the trajectory. Determine the local solution region based on the spatial distribution of the translational and rotational components. Within the local solution region, the Laplace equation of the velocity potential is constructed using the translational component as the boundary condition. The velocity potential is obtained by block iterative solution. The gradient of the velocity potential is superimposed with the translational component to construct the initial velocity field. A vorticity calculation grid is constructed based on the initial velocity field. The ratio of the rotational component to the translational component is calculated at the nodes of the vorticity calculation grid. The distribution of the ratio on the vorticity calculation grid is taken as the vorticity field intensity.

7. The method according to claim 1, characterized in that, A dynamic monitoring point array is set up along the direction of the velocity field to track the migration path of the residue in real time. Combined with the concentration field, the pollution diffusion range is predicted. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning message is output, including: Extract topological singularities from the velocity field, calculate the velocity gradient values ​​at the topological singularities, divide the monitoring priorities according to the velocity gradient values, and deploy a dynamic monitoring point array along the direction of the velocity field according to the monitoring priorities. Enhancement factor data is collected from the dynamic monitoring point array. Information entropy is calculated based on the spatial distribution characteristics of the enhancement factor data. Supplementary monitoring locations are determined based on the change in information entropy. A concentration field is constructed using enhancement factor data collected from the supplementary monitoring locations. Multi-wavelength scanning of the concentration field was performed to obtain the characteristic absorption band combination of veterinary drug residues, and the diffusion trend of residues was identified based on the spectral response changes of the characteristic absorption band combination. The absorbance change of the diffusion trend is compared with the preset diffusion threshold, and a warning message is output when the absorbance exceeds the preset diffusion threshold.

8. A veterinary drug residue detection system based on spectroscopic technology, used to implement the method described in any one of claims 1-7, characterized in that, The system includes: The Raman spectroscopy acquisition module is used to acquire Raman spectral data of the sample to be tested, perform wavelength partition scanning, obtain the position and intensity of characteristic peaks, set the detection priority according to the intensity change rate of characteristic peaks, and generate time-series detection instructions. The surface enhancement detection module is used to respond to time-series detection commands, acquire surface-enhanced Raman spectra at characteristic peak positions, and calculate the enhancement factor of the surface-enhanced Raman spectra. The residue identification module is used to extract the time-varying features of the enhancement factor, determine the type of veterinary drug residue, calculate the residue content based on the enhancement factor, and mark the residue content in the target detection area to generate a residue distribution map. The pollution early warning module is used to calculate the velocity field and concentration field of residue diffusion based on the residue distribution map, set up a dynamic monitoring point array along the direction of the velocity field, track the migration path of the residue in real time, and predict the pollution diffusion range by combining the concentration field. When the predicted diffusion range exceeds the preset diffusion threshold, an early warning information is output.

9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method as described in any one of claims 1 to 7.

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