A method and system for detecting feed additives based on spectral technology

By incorporating sensitivity mining of spectral detection bands and multi-band spectral detection in feed additive testing, combined with scene interference compensation and matrix spectral separation, the adaptability problem of spectral detection methods under different process conditions was solved, achieving highly accurate and reliable detection results.

CN123111983APending Publication Date: 2026-11-17WUHAN HUAYANG TIANLE BIOTECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611364610.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-04
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing spectroscopic detection methods have failed to effectively adapt to the matrix composition and environmental interference of different feed production processes in the detection of feed additives, resulting in poor accuracy and reliability of detection results.

Method used

By conducting spectral detection sensitivity mining based on feed production process schemes, combining multi-band spectral detection with hyperspectral imaging devices, and utilizing scene interference compensation correction and matrix spectral background separation, spatial spectral fusion detection and process-related dynamic anomaly detection are employed to obtain accurate additive detection results.

Benefits of technology

It improves the adaptive matching capability of detection bands under different feed production process conditions, reduces the impact of complex matrix and detection scene interference on the spectral response of additives, and improves the accuracy and reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123111983A_ABST
    Figure CN123111983A_ABST
Patent Text Reader

Abstract

This invention proposes a method and system for detecting feed additives based on spectral technology, belonging to the field of trace detection technology. The method includes: identifying multiple sensitive bands; acquiring spectral data for each band, spatial location correlation information for each detection band, and scene data for each detection device; compensating for scene interference features in the spectral data for each band; separating the feed matrix spectral background from the reliable response data of each band to determine the spectral characteristics of additive responses in each band; performing spatial spectral fusion detection on the spatial location correlation information and the spectral characteristics of additive responses in each band to obtain the detection results for each band; and obtaining a feed additive detection report. This invention addresses the technical problem in existing feed additive spectral detection methods where additive spectral signals are easily masked by matrix background and environmental noise, resulting in low accuracy and poor reliability of feed additive detection results. It improves the accuracy and reliability of feed additive detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of trace detection technology, and in particular to a method and system for detecting feed additives based on spectral technology. Background Technology

[0002] The content of feed additives directly affects feed quality and requires accurate detection. Traditional detection methods, such as high-performance liquid chromatography (HPLC), gas chromatography (GC), and mass spectrometry (MS), offer high accuracy but require complex pretreatment processes like pulverization, extraction, and purification, which are time-consuming, destructive to the sample, and difficult to implement for rapid online detection. Spectroscopic techniques offer the advantages of being non-destructive and rapid, especially hyperspectral imaging, which can simultaneously acquire spectral and spatial information and has been used for feed additive detection. However, existing spectroscopic detection methods typically use fixed wavelengths, resulting in insufficient adaptability to different process conditions. Furthermore, the complex composition of feed matrices can easily mask the spectral signals of additives due to background noise, and environmental interferences such as temperature and humidity are not effectively compensated for during detection, affecting the accuracy and reliability of the detection. Summary of the Invention

[0003] This application provides a method and system for detecting feed additives based on spectral technology, which solves the technical problem that existing methods for detecting feed additives typically use fixed spectral bands and do not consider the differences in matrix composition and interference factors caused by different feed production processes. As a result, the spectral signals of additives are easily masked by matrix background and environmental noise, leading to low accuracy and poor reliability of feed additive detection results.

[0004] This application provides a method for detecting feed additives based on spectral technology. The method is applied to a feed additive detection system based on spectral technology. The method includes: performing spectral sensitivity mining based on the feed production process of the feed sample to determine multiple sensitive bands; performing multi-band spectral detection on the feed sample using a hyperspectral imaging device based on the multiple sensitive bands to acquire spectral acquisition data for each band, spatial location correlation information for each detection band, and scene data for each detection device; performing scene interference feature compensation and correction on the spectral acquisition data for each band using the scene data from each detection device to acquire reliable response data for each band; performing feed matrix spectral background separation on the reliable response data for each band based on the feed production process to determine the spectral response characteristics of additives in each band; performing spatial spectral fusion detection on the spatial location correlation information and the spectral response characteristics of additives in each band based on a feed additive detection model to acquire detection results for additives in each band; and performing process-related dynamic anomaly detection on the detection results for additives in each band based on the feed production process to acquire a feed additive detection report.

[0005] This application provides a feed additive detection system based on spectral technology. The system includes: a band sensitivity mining module, used to mine the spectral sensitivity of the feed sample according to the feed production process scheme, and determine multiple sensitive bands; a multi-band spectral detection module, used to perform multi-band spectral detection on the feed sample based on the multiple sensitive bands using a hyperspectral imaging device, acquiring spectral acquisition data for each band, spatial location correlation information for each detection, and scene data for each detection device; and a scene interference compensation and correction module, used to compensate and correct the scene interference features of the spectral acquisition data for each band using the scene data from each detection device, and acquire spectral data for each band. The system includes: a reliable spectral response data module; a matrix spectral background separation module, used to separate the feed matrix spectral background of the reliable spectral response data of each band according to the feed production process scheme, and determine the spectral response characteristics of additives in each band; a spatial spectral fusion detection module, used to perform spatial spectral fusion detection on the spatial location association information of each detection and the spectral response characteristics of additives in each band according to the feed additive detection model, and obtain the detection results of additives in each band; and a process-related dynamic anomaly detection module, used to perform process-related dynamic anomaly detection on the detection results of additives in each band according to the feed production process scheme, and obtain a feed additive detection report.

[0006] This application also provides a computer-readable storage medium, including: a computer program stored thereon, which, when executed by a processor, implements a method for detecting feed additives based on spectral technology.

[0007] This application proposes a method and system for detecting feed additives based on spectral technology, which includes at least one of the following beneficial effects: By performing spectral sensitivity analysis on feed samples based on their feed production process, multiple sensitive bands were identified. Multi-band spectral analysis was then conducted on the feed samples using a hyperspectral imaging device, acquiring spectral data for each band, spatial location correlation information, and scene data from each detection device. Scene data from each detection device was used to compensate for interference features in the spectral data for each band, obtaining reliable spectral response data for each band. The feed production process was used to separate the background spectral data of each band's reliable spectral response data, determining the spectral characteristics of additive responses in each band. A feed additive detection model was employed to perform spatial spectral fusion detection on the spatial location correlation information and the spectral characteristics of additive responses in each band, obtaining the additive detection results for each band. Finally, dynamic anomaly detection was performed on the additive detection results for each band based on the feed production process, generating a feed additive detection report. This approach improves the adaptive matching capability of detection bands under different feed production process conditions, reduces the impact of complex matrices and detection scene interference on the spectral response of additives, and enhances the accuracy and reliability of feed additive detection. Attached Figure Description

[0008] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments of the present invention will be briefly described below. Flowcharts are used in this application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from these processes.

[0009] Figure 1 This is a flowchart illustrating a method for detecting feed additives based on spectral technology, as provided in this application.

[0010] Figure 2 This is a schematic diagram illustrating the process of determining multiple sensitive bands in a feed additive detection method based on spectral technology provided in this application.

[0011] Figure 3 This is a schematic diagram of the process for obtaining reliable spectral response data of each band in a feed additive detection method based on spectral technology provided in this application.

[0012] Figure 4 This is a schematic diagram of a feed additive detection system based on spectral technology provided in this application.

[0013] Figure labeling: Band-sensitive mining module 1, multi-band spectral detection module 2, scene interference compensation and correction module 3, matrix spectral background separation module 4, spatial spectral fusion detection module 5, process-related dynamic anomaly detection module 6. Detailed Implementation

[0014] The above description is merely an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below.

[0015] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description of this application will be provided in conjunction with the accompanying drawings. The described embodiments should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0016] In the following description, references to "some embodiments" describe a subset of all possible embodiments. However, it is understood that "some embodiments" can be the same or different subsets of all possible embodiments and can be combined with each other without conflict. The terms "first" and "second" are used merely to distinguish similar objects and do not represent a specific ordering of objects. The terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terminology used herein is for the purpose of describing this application only.

[0017] Example 1: This application provides a method for detecting feed additives based on spectral technology. The method is applied to a feed additive detection system based on spectral technology, such as... Figure 1 As shown, the method includes: Step S100: Based on the feed production process plan of the feed sample, perform spectral detection band sensitivity analysis to identify multiple sensitive bands. Among them, such as... Figure 2As shown, step S100 includes: Step S110: Performing a historical spectral detection search for additives based on the feed production process scheme to obtain a historical spectral detection database matching the process. The feed production process scheme refers to the complete combination of process parameters used in the factory production of the feed sample. The feed production process scheme includes fields such as feed ingredient type, feed ingredient addition parameters, conditioning temperature, pelleting temperature, expansion degree, and mixing uniformity. The historical spectral detection search for additives is performed in a pre-built spectral detection database, which stores spectral data collected from different feed production batches in the past, along with corresponding production process parameters and historical additive detection parameters. Each record includes information such as feed ingredient type parameters, additive parameters, pelleting temperature parameters, conditioning time parameters, expansion degree parameters, spectral acquisition band parameters, detection signal intensity parameters, and measured additive content. Specifically, the feed ingredient type and feed ingredient addition parameters in the feed production process scheme are used as the main matching conditions. Simultaneously, key process parameters such as conditioning temperature, pelleting temperature, and expansion degree are compared item by item with historical records in the spectral detection database to calculate the relative deviation between each parameter, setting a deviation threshold of no more than five percent. Only records with identical primary matching conditions and all key process parameter deviations below the threshold are included in the process matching spectral detection history database. If the number of records meeting the above conditions is too small, the deviation threshold can be relaxed to 10%, or records with the same feed matrix type but similar additive types can be selected as supplements to ensure sufficient statistical sample size for subsequent band extraction. The process matching spectral detection history database includes multiple historical matching spectral detection records corresponding to feed production process schemes.

[0018] Step S120: Extract multiple historical spectral bands based on the process-matched spectral detection history library. A historical spectral band refers to the spectral wavelength or wavelength range actually used in each historical matched spectral detection record in the process-matched spectral detection history library. Traverse each historical matched spectral detection record in the library, extracting the marked spectral bands one by one to form a candidate band list. The candidate band list may contain duplicate bands. Remove duplicate bands from the candidate band list to obtain multiple historical spectral detection bands.

[0019] Step S130: Evaluate the additive detection sensitivity of the multiple historical spectral bands according to the process-matched spectral detection history library, and obtain the detection sensitivity of multiple bands. Step S130 includes: Step S131: Traverse the multiple historical spectral bands and extract the first historical spectral band. Traversal means extracting each band from the multiple historical spectral bands in a preset order. The preset order can be arranged from shortest to longest wavelength. The first historical spectral band is the band extracted from the multiple historical spectral bands in the current loop, and this band serves as the independent analysis object for this round of sensitivity evaluation. After completing the subsequent reliability evaluation of the first historical spectral band and obtaining its detection sensitivity, the system will extract the next band in the same way and continue processing until all bands in the multiple historical spectral bands have been evaluated.

[0020] Step S132: The process-matching spectral detection history database is matched and extracted based on the first spectral detection history band to obtain multiple band-matched historical detection data. Band-matched historical detection data refers to multiple additive detection history parameters corresponding to the same band of the first spectral detection history band in the process-matching spectral detection history database. The system reads each historical matching spectral detection record in the process-matching spectral detection history database and determines whether the spectral acquisition band parameters of the record are the same as the first spectral detection history band. If they are the same, multiple additive detection history parameters are extracted from the record as band-matched historical detection data.

[0021] Step S133: Identify the deviation between the historical detection data matched to each band and the actual data of each feed additive to obtain the detection deviation characteristics of each historical additive. The actual data of each feed additive refers to the actual parameter of the additive content in the historical matched spectral detection record corresponding to the historical detection data matched to each band. Specifically, calculate the difference between the historical detection data matched to each band and the actual data of each feed additive to obtain a set of detection deviations for each band. Each set of detection deviations includes multiple difference parameters between the historical detection data matched to each band and the actual data of each feed additive. Furthermore, based on each set of detection deviations, calculate multiple relative percentages of deviation, and use the average of these relative percentages as the detection deviation characteristic of each historical additive. The relative percentage of deviation is equal to the absolute value of the deviation divided by the actual parameter of the additive content, then multiplied by 100%.

[0022] Step S134: Evaluate the detection reliability of the first spectral detection historical bands based on the detection deviation characteristics of each historical additive, obtain multiple band reliability values, and calculate the average of the multiple band reliability values ​​to generate the first band detection sensitivity. Detection reliability evaluation refers to judging the detection credibility of the first spectral detection historical band on the corresponding historical sample based on the detection deviation characteristics of each historical additive. Reliability is a numerical indicator that quantifies this credibility. The reliability is calculated using a segmented assignment method: if the historical additive detection deviation characteristic is less than or equal to 5%, the corresponding band reliability is recorded as 1. If the historical additive detection deviation characteristic is greater than 5% and less than or equal to 10%, the corresponding band reliability is recorded as 0.8. If the historical additive detection deviation characteristic is greater than 10% and less than or equal to 20%, the corresponding band reliability is recorded as 0.5. If the historical additive detection deviation characteristic is greater than 20%, the corresponding band reliability is recorded as 0. Following the above rules, calculate a band reliability for each historical additive detection deviation characteristic corresponding to the first spectral detection historical band, obtaining multiple band reliability values. Then, the average reliability of multiple bands is calculated to obtain the detection sensitivity of the first band. The closer the band detection sensitivity is to 1, the higher the detection reliability of the additive under similar process conditions. After completing the sensitivity calculation of the first spectral detection historical band, the process returns to step S131 to continue processing the next spectral detection historical band until the corresponding band detection sensitivity is obtained for all spectral detection historical bands.

[0023] Step S140: Based on a predetermined detection sensitivity, the multiple historical spectral detection bands are filtered according to the multiple band detection sensitivities to obtain the multiple sensitive bands. The predetermined detection sensitivity is a pre-set numerical threshold used to determine whether a certain historical spectral detection band has sufficient detection reliability. The predetermined detection sensitivity is pre-configured by the feed production enterprise according to the allowable error range of the additive and the process quality control standards. The system sequentially reads the multiple band detection sensitivities and compares each band detection sensitivity with the predetermined detection sensitivity. If the band detection sensitivity is greater than or equal to the predetermined detection sensitivity, the historical spectral detection band corresponding to that band detection sensitivity is recorded as a sensitive band. If the band detection sensitivity is less than the predetermined detection sensitivity, the historical spectral detection band corresponding to that band detection sensitivity is discarded.

[0024] Step S200: Based on the multiple sensitive bands, the feed sample is subjected to multi-band spectral detection using a hyperspectral imaging device to acquire spectral acquisition data for each band, spatial location correlation information for each detection, and scene data for each detection device. The hyperspectral imaging device is an imaging device capable of simultaneously acquiring spatial distribution information and spectral information of the sample. The hyperspectral imaging device consists of a broadband light source, a wavelength selection unit, an area array detector, and a two-dimensional scanning platform. The broadband light source emits continuous light covering the visible to near-infrared range to illuminate the surface of the feed sample. The wavelength selection unit uses an acousto-optic tunable filter or a liquid crystal tunable filter, which can sequentially separate the desired narrowband light from the continuous spectrum without moving the sample.

[0025] Multi-band spectral detection refers to a hyperspectral imaging device sequentially acquiring images of feed samples according to the wavelength order of multiple sensitive bands. Each acquisition allows only light within the current sensitive band range to enter the detector, resulting in several spectral images equal to the number of sensitive bands. The spectral acquisition data for each band refers to the spectral response intensity values ​​recorded by the area array detector at various locations on the feed sample surface under each sensitive band. These values ​​are stored in the form of a two-dimensional matrix, where the number of rows and columns corresponds to the number of spatial sampling points on the feed sample in the horizontal and vertical directions, respectively. All two-dimensional matrices of sensitive bands together form a three-dimensional data cube, where the first two dimensions represent spatial location, and the third dimension represents the band number. The spatial location association information refers to the actual physical coordinates of each spectral acquisition data point on the feed sample surface. These coordinates are synchronously recorded by the displacement encoder of the scanning platform during acquisition, including horizontal and vertical displacement values, in millimeters. Each spatial location corresponds one-to-one with a spectral response intensity value, used for subsequent spatial spectral fusion detection and additive spatial distribution analysis. Scene data for each detection device refers to environmental and equipment status parameters collected synchronously during multi-band spectral detection, including ambient temperature, relative humidity, light source output power, detector integration time, detector gain, dark current noise level, and scanning platform movement speed.

[0026] Specifically, the feed sample is evenly spread on the stage and kept flat. The moving step size of the scanning platform and the integration time of the detector are set so that the spatial sampling point spacing is no more than 0.5 mm. Then, each of the multiple sensitive bands is selected in sequence. The output of the light source is limited to the range of the band by the wavelength selection unit. The scanning platform is driven to move the sample at a constant speed. The detector synchronously collects the spectral response intensity of each row of pixels on the sample surface. At the same time, the displacement encoder data and various scene sensor data are read until all sensitive bands are collected. Finally, complete spectral acquisition data of each band, spatial location correlation information of each detection, and scene data of each detection device are formed.

[0027] Step S300: The scene interference characteristics of the spectral acquisition data for each band are compensated and corrected using the scene data from each detection device to obtain reliable spectral response data for each band. Wherein, for example... Figure 3 As shown, step S300 includes: Step S310: Perform anomaly detection on the scene data of each detection device and obtain anomaly matrices for each detection scene. First, establish normal reference intervals and rate of change thresholds for each scene parameter. The normal reference intervals for ambient temperature and relative humidity are set according to the temperature and humidity control standards of the testing laboratory. The normal reference interval for light source output power is ±3% of the rated power. The normal reference interval for detector integration time and gain value is ±2% of the nominal value of the equipment. The normal reference interval for dark current noise level is ±5% of the factory calibration value. The normal reference interval for scanning platform movement speed is ±1% of the set speed. The rate of change threshold is defined as the upper limit of the absolute value change of the parameter between two adjacent band acquisition times. The rate of change threshold for ambient temperature is no more than 0.5 degrees Celsius between adjacent bands, and the rate of change threshold for light source output power is no more than 1% of the rated power between adjacent bands. Specifically, align the time series of each scene parameter in the scene data of each detection device with the band acquisition time. If the sampling frequency of the scene data is higher than the band acquisition frequency, take the average value within the acquisition time window of each band. If the acquisition frequency is lower than the band acquisition frequency, linear interpolation is used to obtain the estimated value for each band acquisition time. Then, each scene parameter is individually checked to see if its value at each band acquisition time exceeds its normal baseline range, or if the change between adjacent times exceeds the rate of change threshold. If either condition is met, the scene parameter is judged as abnormal. The abnormality judgment results of all scene parameters at all band acquisition times constitute a two-dimensional matrix. The rows of the matrix correspond to different scene parameters, and the columns correspond to different band acquisition times. The matrix elements take values ​​of 0 or 1, where 0 indicates that the scene parameter is normal at that time, and 1 indicates that the scene parameter is abnormal at that time. This two-dimensional matrix is ​​the abnormality matrix for each detected scene.

[0028] Step S320: Based on the anomaly matrices of each detection scene, identify the interference effects on the spectral acquisition data of each band to obtain the anomaly interference effect matrix for each scene. Interference effect identification refers to further quantifying the actual light intensity disturbance direction and magnitude caused by the anomalies marked as anomalous in the anomaly matrices of each detection scene on the corresponding spectral acquisition data. The anomaly interference effect matrix for each scene is a three-dimensional numerical matrix with the same data dimension as the spectral acquisition data of each band. Each element represents the amount of spectral intensity interference superimposed on the corresponding spatial location and corresponding band due to the anomaly of scene parameters, with the unit being absorbance or relative light intensity percentage. Specifically, a scene interference response coefficient table is first pre-established. The scene interference response coefficient table is obtained by changing the parameters of a single scene under controlled conditions and conducting multiple spectral acquisition experiments on standard samples. For example, the scene interference response coefficient table is shown in Table 1.

[0029] Table 1. Scene Interference Response Coefficient Table ; According to the scene interference response coefficient table, for each scene parameter marked as 1 by the anomaly matrix of each detected scene, the system first reads the actual value of the parameter at the current acquisition time in the current band and subtracts it from the corresponding normal reference value to obtain the deviation. A positive deviation indicates that the parameter is higher than the normal reference, and a negative deviation indicates that the parameter is lower than the normal reference. Then, the system looks up the corresponding spectral response change coefficient in the scene interference response coefficient table according to the parameter name and deviation direction, and converts the deviation into a multiple of the unit deviation in the scene interference response coefficient table. For example, if the normal reference value of the light source output power is the rated power, and the actual power decreases by 2% compared to the rated power, the deviation is negative 2 percentage points. The unit deviation is 1% decrease, so the multiple is 2. The spectral response change coefficient is an average decrease of 0.9%, and the calculated interference is negative 1.8% multiplied by the spectral response intensity at each spatial location in that band. For interference coefficients expressed in absorbance, such as an increase of 0.002 absorbance for every 1 calibration unit increase in dark current noise level, the deviation is directly divided by the unit deviation and then multiplied by 0.002 absorbance to obtain the fixed absorbance interference amount superimposed at each spatial location. If multiple scene parameters are marked as anomalous at the same acquisition time for a band, the system calculates the interference amount generated by each anomalous parameter separately and adds them pixel by pixel at the same spatial location and band to obtain the comprehensive interference amount matrix for that band. For scene parameters with limited applicable spectral ranges, such as ambient temperature only affecting sensitive bands with wavelengths greater than 1100 nm, if the current band wavelength is outside this range, the interference amount of that parameter is treated as 0. The interference amounts of all scene parameters not marked as anomalous are also treated as 0. After calculating for each band and each spatial location in the above manner, the resulting three-dimensional numerical array is the anomalous interference influence matrix for each scene. The number of rows and columns of the abnormal interference effect matrix for each scene is completely consistent with the number of two-dimensional spectral response matrices in the spectral acquisition data of each band. The number of layers is the same as the number of sensitive bands. The positive or negative sign of the value of each element indicates the direction of interference. A positive value indicates that the spectral response intensity is too high, and a negative value indicates that the spectral response intensity is too low.

[0030] Step S330: Adaptively correct the spectral acquisition data of each band using the scene anomaly interference influence matrix to generate reliable spectral response data for each band. Adaptive correction refers to targeted subtraction or correction of the spectral acquisition data of each band based on the point-by-point perturbation value in the scene anomaly interference influence matrix, so that the corrected spectral data is as close as possible to the true spectral response when there are no scene anomalies. The specific process of adaptive correction includes: First, aligning the scene anomaly interference influence matrix with the corresponding spectral acquisition data of each band at the pixel level to ensure that the row and column indices of the matrix correspond one-to-one with the spatial positions. Then, for each band and each spatial position, subtracting the interference amount corresponding to that position from the original spectral response intensity value to obtain a preliminary correction value. If the preliminary correction value is less than 0, it is set to 0, because the spectral response intensity cannot be negative physically. For pixels where the absolute value of the interference exceeds 60% of the original spectral response intensity value, selecting pixels in the 8 neighboring pixels around that pixel where the interference is less than 20% and the preliminary correction value is within the normal range, and calculating the average of the preliminary correction values ​​of these pixels as the final correction value for that pixel. If fewer than 3 points in the surrounding 8 neighborhoods meet the criteria, the range is expanded to 24 neighborhoods. If this is still insufficient, the median of the preliminary correction values ​​for all pixels in that band is used instead. After the above point-by-point correction, a new set of two-dimensional spectral response matrices is obtained. These matrices have numerically eliminated the light intensity disturbances caused by scene anomalies and are called the reliable spectral response data for each band. This reduces the impact of scene interference on the additive's spectral response, improves the reliability of the spectral data, and thus enhances the accuracy of subsequent additive identification.

[0031] Step S400: Based on the feed production process scheme, perform feed matrix spectral background separation on the reliable response data of each band spectrum to determine the spectral characteristics of additives in each band. Step S400 includes steps S410 to S440. Step S410: Construct a feed matrix spectral evolution model based on the feed ingredient spectral detection database. Step S410 includes: Step S411: Mining mapping relationships in the feed ingredient spectral detection database to obtain multiple ingredient spectral mapping relationships. The feed ingredient spectral detection database is a pre-established database that stores the absorbance curves of common feed ingredients such as corn, soybean meal, wheat bran, fish meal, rapeseed meal, cottonseed meal, rice bran, and alfalfa meal collected under standard detection conditions. Each curve covers a wavelength range of 400 nm to 1700 nm, with a wavelength interval of 5 nm, containing a total of 261 wavelength points, each corresponding to an absorbance value. Each sample record in the feed ingredient spectral analysis database, in addition to its spectral curve, includes the moisture content, crude protein content, crude fat content, crude fiber content, and ash content of the raw material sample. These five chemical components are expressed as mass percentages, and their sum does not exceed 100. Mapping relationship mining refers to extracting the quantitative correlation between the chemical component content and the spectral absorbance of each feed ingredient from the feed ingredient spectral analysis database. During mapping relationship mining, all samples in the feed ingredient spectral analysis database are first grouped by raw material name, with each group corresponding to one feed ingredient. Each group must contain at least 20 samples; raw materials with fewer than 20 samples are excluded from this mining. For each group, the contents of the five chemical components of all samples in that group are used to construct an independent variable matrix, with the number of rows equal to the number of samples and the number of columns equal to 5. The absorbance values ​​of all samples in that group at 261 wavelength points are then used to construct a dependent variable matrix, with the number of rows equal to the number of samples and the number of columns equal to 261. The mean of each column in the independent variable matrix and the mean of each column in the dependent variable matrix are centered to ensure that the mean of all variables is 0. A partial least squares regression (PLR) algorithm is then used to establish a linear regression model between the independent and dependent variables. PLR is a multivariate statistical modeling method used to establish a linear regression relationship between two sets of variables, and it is particularly suitable for situations where there are many independent variables and they are strongly correlated with each other.

[0032] When mining mapping relationships in a feed ingredient spectral detection database, the independent variables are the contents of five chemical components of the feed ingredient, and the dependent variable is the absorbance value of the ingredient at 261 wavelengths. Because these 261 wavelengths are highly correlated, ordinary multiple linear regression is prone to parameter estimation instability and overfitting. Partial least squares regression (PLR) addresses this problem by iteratively extracting a small number of latent variables. Each latent variable is a linear combination of the original independent variables, and the covariance between the latent variable and the dependent variable should be as large as possible. The PLS algorithm involves: starting with an initial weight vector, calculating the first latent variable, subtracting the portion explained by the latent variable from both the independent and dependent variables, and then extracting the next latent variable from the residuals until a preset number of latent variables is reached or the cross-validation error no longer decreases. The final model is represented as a linear combination of the original independent variables, with a regression coefficient matrix of 5 rows and 261 columns, used to describe the influence of changes in the content of each chemical component on the absorbance at each wavelength. After model training, the regression coefficient matrix of the partial least squares regression model is extracted. This matrix has 5 rows, corresponding to the five chemical components: moisture content, crude protein content, crude fat content, crude fiber content, and ash content. It also has 261 columns, corresponding to 261 wavelength points in the wavelength range of 400 nm to 1700 nm, spaced 5 nm apart. The value in the i-th row and j-th column of the matrix represents the average change in absorbance at the j-th wavelength point when the content of the i-th chemical component increases by 1 percentage point. A positive value indicates that an increase in the component content will increase the absorbance at that wavelength point, while a negative value indicates that an increase in the component content will decrease the absorbance at that wavelength point. This regression coefficient matrix represents a spectral mapping relationship for the raw material. The above operations of grouping by name, mean centering, partial least squares regression modeling, and regression coefficient matrix extraction are performed on each of the feed raw materials in the feed raw material spectral detection database with at least 20 samples per group, ultimately yielding multiple spectral mapping relationships for the raw materials. Each spectral mapping relationship includes a regression coefficient matrix and the name of the corresponding raw material.

[0033] Step S412: The feed ingredient spectral detection database is fused with confidence scores based on the multiple raw material spectral mapping relationships to obtain a raw material spectral detection data space. Confidence score refers to the degree of reliability of each raw material spectral mapping relationship in predicting the spectrum of that raw material, represented by a value between 0 and 1; a higher value indicates a more reliable mapping relationship. The confidence score calculation process includes: for each raw material spectral mapping relationship, all samples of the corresponding raw material are randomly divided into a training set and a validation set. The training set accounts for 70% of the total number of raw material samples, and the validation set accounts for 30%. A fixed random seed is set during the random division to ensure repeatability of the results. The partial least squares regression model is refitted using samples from the training set, following the same fitting process as in step S411, resulting in a regression coefficient matrix on the training set. Then, the content of five chemical components of each sample in the validation set is substituted into the regression coefficient matrix to calculate the predicted spectral absorbance vector. The predicted spectral absorbance vector is then compared with the true spectral absorbance vector of the sample at each wavelength point to calculate the coefficient of determination. The coefficient of determination is 1 minus the ratio of the sum of squares of the predicted residuals to the sum of squares of the true values. The sum of squares of the predicted residuals is equal to the sum of the squares of the differences between the predicted and actual values ​​at each wavelength point. The sum of squares of the actual values ​​is equal to the sum of the squares of the differences between the actual values ​​and the average of the actual values ​​at each wavelength point. The coefficient of determination ranges from 0 to 1. When the predicted spectrum is completely consistent with the actual spectrum, the coefficient of determination is 1. When the predicted spectrum is completely uncorrelated with the actual spectrum, the coefficient of determination is 0 or negative, with negative values ​​uniformly treated as 0. This coefficient of determination is the confidence weight of the spectral mapping relationship of the raw material.

[0034] The raw material spectral detection data space refers to the unified spectral prediction capability set formed by fusing multiple raw material spectral mapping relationships according to their respective confidence weights. Specifically, each value in the regression coefficient matrix of each raw material spectral mapping relationship is multiplied by the confidence weight of that mapping relationship to obtain a weighted regression coefficient matrix. Then, the weighted regression coefficient matrices of all raw materials are summed element-wise to obtain a comprehensive regression coefficient matrix. The comprehensive regression coefficient matrix still has 5 rows and 261 columns, where the value in the i-th row and j-th column represents the comprehensive average change in absorbance at the j-th wavelength point when the content of the i-th chemical component increases by 1 percentage point after fusing information from multiple raw materials. This comprehensive regression coefficient matrix can directly calculate the predicted spectral absorbance vector of any mixed feed matrix by matrix multiplication when the content of the five chemical components is known. The complete mapping capability set consisting of all possible input-output combinations constitutes the raw material spectral detection data space.

[0035] Step S413: Based on the raw material spectral detection data space, train multiple feed matrix spectral evolvers, each with multiple evolution accuracy labels. The feed matrix spectral evolver is a supervised learning regression model that takes the chemical composition content of the mixed feed matrix as input and the spectral absorbance of the matrix at 261 wavelength points as output, implemented using a random forest regressor. The random forest regressor consists of multiple binary decision trees. During training, each decision tree randomly selects a subset of input features and fits the output by recursively partitioning the sample space. The final predicted value is the arithmetic mean of the output values ​​of all decision trees. When training multiple feed matrix spectral evolvers, a training sample set is first generated using the raw material spectral detection data space. The specific process includes: randomly generating 5000 sets of feed ingredient ratios, each containing the mass percentages of five ingredients: corn, soybean meal, wheat bran, fish meal, and rapeseed meal. Each percentage is a random number between 0 and 50. Ratios where the sum of all percentages is between 98 and 100 are retained; any shortfall is supplemented with rice bran to reach 100, thus ensuring the practical significance of each ratio. For each ratio, the mass percentage of each ingredient is multiplied by its corresponding moisture, crude protein, crude fat, crude fiber, and ash content. Then, the corresponding chemical components of the five ingredients are summed separately to obtain a vector of the five chemical components of the mixed matrix. This vector of five chemical components is multiplied by the comprehensive regression coefficient matrix obtained in step S412 to obtain a predicted spectral absorbance vector of length 261, which serves as the label for the training sample. The 5000 chemical component content vectors are paired one-to-one with the corresponding 5000 spectral absorbance vectors to form a training sample set.

[0036] Then, the first set of training parameters is set, including 200 decision trees, a maximum depth of 15, and a feature subset size of 2 for each decision tree. The first feed matrix spectral evolver is obtained by training the training sample set using these parameters. Next, the second set of training parameters is set, including 300 decision trees, a maximum depth of 20, and a feature subset size of 3. The second feed matrix spectral evolver is obtained by training the training sample set using these parameters. Finally, the third set of training parameters is set, including 400 decision trees, a maximum depth of 12, and a feature subset size of 2. The third feed matrix spectral evolver is obtained by training the training sample set using these parameters. The first, second, and third feed matrix spectral evolvers all use the same training sample set but are initialized with different random seeds to ensure differences in their internal structures. Multiple feed matrix spectral evolvers are included, comprising a first, a second, and a third. After training, 500 independent formulation samples are generated as a validation sample set. The same method is used to obtain the content vectors of five chemical components and the true spectral absorbance vector for each validation sample. The chemical component content vectors of each validation sample are input into the three trained feed matrix spectral evolvers to obtain three predicted spectral absorbance vectors. The average coefficient of determination (COD) for each evolver on all 500 validation samples is calculated using the same method as in step S412. The average COD of each feed matrix spectral evolver is used as the corresponding evolution accuracy label. A higher COD value indicates a stronger predictive ability of the feed matrix spectral evolver for independent samples.

[0037] Step S414: Integrate and fuse the multiple feed matrix spectral evolvers according to the multiple evolution accuracy labels to generate the feed matrix spectral evolution model. Integration and fusion training refers to combining the prediction results of multiple feed matrix spectral evolvers to train a secondary model to improve overall prediction stability and accuracy, achieved using a stacked generalization strategy. The stacked generalization strategy means that instead of directly using the average output of multiple feed matrix spectral evolvers as the final result, the outputs of multiple feed matrix spectral evolvers are used as new features, and a simple linear model is trained to learn the optimal combination weights between these new features and the true spectrum. Specifically, the 500 independent validation samples generated in step S413 are used as a secondary training set. For each of these 500 secondary training samples, its five chemical component content vectors are taken and input into the first, second, and third feed matrix spectral evolvers, respectively, to obtain three predicted spectral absorbance vectors of length 261. These three vectors are then concatenated sequentially to form an extended feature vector of length 783. The first to 261st elements of the extended feature vector come from the output of the first feed matrix spectral evolver, the 262nd to 522nd elements from the output of the second feed matrix spectral evolver, and the 523rd to 783rd elements from the output of the third feed matrix spectral evolver. These 500 extended feature vectors form a secondary input matrix with 500 rows and 783 columns. The true spectral absorbance vectors corresponding to these 500 samples form a secondary output matrix with 500 rows and 261 columns. Using the secondary input matrix as the independent variable and the secondary output matrix as the dependent variable, a multi-output linear regression model is trained. The model's parameter matrix has a size of 783 rows and 261 columns. The parameters are solved using the least squares method to minimize the sum of squared errors between the predicted and true spectra on all secondary training samples. A small regularization coefficient of 0.001 is added during the least squares solution to prevent overfitting due to excessively large parameters. The trained multi-output linear regression model, together with three feed matrix spectral evolvers, constitutes the feed matrix spectral evolution model. The feed matrix spectral evolution model has a two-stage cascaded structure. The first stage consists of three pre-trained feed matrix spectral evolvers operating in parallel, and the second stage is the multi-output linear regression model.

[0038] Step S420: Extract feed ingredient characteristic data according to the feed production process scheme, and combine the feed ingredient characteristic data with the multiple sensitive bands to obtain the matrix feature vector of each band. Feed ingredient characteristic data refers to the content of five chemical components in the mixed feed matrix calculated according to the feed production process scheme, including moisture content, crude protein content, crude fat content, crude fiber content, and ash content, each expressed as a mass percentage. Calculation method: First, read the name and mass percentage of each raw material in the feed production process scheme. Then, find the corresponding content of the five chemical components in the feed ingredient spectral detection database. Multiply the mass percentage of each raw material by its corresponding chemical component content. Then, sum the products of all raw materials according to the chemical component category to obtain five values. The vector formed by these five values ​​is the feed ingredient characteristic data, with a length of 5. Combination encoding refers to concatenating the feed ingredient characteristic data with each sensitive band to form a vector that simultaneously contains chemical component information and band information. Specifically, first, select a sensitive band and calculate the average of its starting and ending wavelengths as the center wavelength value of that sensitive band. For example, if the starting wavelength of a sensitive band is 1100 nm and the ending wavelength is 1150 nm, then the center wavelength value is 1125 nm. This center wavelength value is then concatenated sequentially with the content of five chemical components from the feed ingredient characteristic data to form a vector of length 6. The first five elements of the vector are, in order, moisture content, crude protein content, crude fat content, crude fiber content, and ash content, and the sixth element is the center wavelength value of the sensitive band. This center wavelength calculation and concatenation operation is performed on each of the multiple sensitive bands, ultimately resulting in multiple vectors equal to the number of sensitive bands; these are the matrix feature vectors for each band.

[0039] Step S430: Input the matrix feature vectors of each band into the feed matrix spectral evolution model to obtain the spectral features of the feed matrix in each band. The feed matrix spectral evolution model is a two-stage cascaded model generated in step S414. The first stage consists of three feed matrix spectral evolvers in parallel, and the second stage is a multi-output linear regression model. During training, the feed matrix spectral evolution model accepts a chemical component content vector of length 5 as input and outputs a spectral absorbance vector of length 261. The 261 elements correspond to all wavelength points in the wavelength range of 400 nm to 1700 nm, spaced 5 nm apart. In order to input the matrix feature vectors of each band into the model, each vector needs to be split first, and its first 5 elements need to be extracted to reconstruct a pure chemical component content vector of length 5. This pure chemical component content vector is then input into the feed matrix spectral evolution model. The three feed matrix spectral evolvers in the model predict independently, and each outputs a predicted spectral vector of length 261. The three predicted spectral vectors are sequentially concatenated into an extended vector of length 783, which is then multiplied by the parameter matrix of the second-level linear regression model to obtain a fused spectral absorbance vector of length 261. Then, based on the sixth element of the matrix feature vector for that band, i.e., the center wavelength value, the wavelength point closest to this center wavelength value is found among the 261 wavelength points. From this position, several wavelength points are extended to the left and right, ensuring that the extended wavelength interval precisely covers the complete start and end wavelength range of the sensitive band. The absorbance values ​​corresponding to all wavelength points within this interval are extracted and formed into a vector with a length equal to the number of wavelength points covered by the sensitive band. This vector represents the spectral characteristics of the feed matrix for that band. The above splitting, input, fusion, and interval extraction operations are performed on each band matrix feature vector to obtain multiple vectors equal to the number of sensitive bands; these vectors represent the spectral characteristics of the feed matrix for each band.

[0040] Step S440: Based on the spectral characteristics of the feed matrix in each band, perform feed matrix spectral background separation on the reliable response data of each band to obtain the additive response spectral characteristics of each band. The feed matrix spectral characteristics of each band refer to the vector generated for each sensitive band in step S430, composed of the predicted absorbance values ​​of each wavelength point within that band's wavelength range. It represents the spectral absorbance that the feed matrix itself should exhibit within that band range when there is no additive influence. The additive response spectral characteristics of each band refer to the set of spectral response matrices after scene interference compensation correction. Each sensitive band corresponds to a two-dimensional matrix, with the number of rows and columns matching the number of spatial sampling points of the hyperspectral imaging device. Each element in the matrix represents the actual spectral response intensity of that spatial location within that sensitive band. Feed matrix spectral background separation refers to subtracting the matrix spectral contribution represented by the feed matrix spectral characteristics of that band from the reliable response data of each band, thereby extracting the spectral changes caused by the additives separately. During feed matrix spectral background separation, each absorbance value in the spectral characteristics of the feed matrix in each band is assigned to different wavelength channels of that band according to the order of wavelength points within the sensitive band. For each spatial location in the reliable response data of that band's spectrum, the absorbance value of the corresponding wavelength channel is subtracted from the absorbance value of the corresponding matrix spectral characteristic, yielding the additive response spectral intensity at that spatial location. This subtraction operation is performed point-by-point for all spatial locations and all wavelength channels. After subtraction, a difference matrix with the same size as the reliable response data of each band's spectrum is obtained. This difference matrix represents the additive response spectral characteristics of that band. If any element in the difference matrix is ​​less than 0, it is set to 0, because absorbance cannot physically be negative. The above expansion, point-by-point subtraction, and non-negation processing operations are repeated for each sensitive band, resulting in multiple difference matrices equal to the number of sensitive bands. These multiple difference matrices represent the additive response spectral characteristics of each band. The spectral characteristics of additive responses in each band have eliminated the interference of the feed matrix spectral background, and can more clearly reflect the spectral signal of the additive in the feed sample, thereby reducing the impact of complex matrix interference on the spectral response of the additive and improving the accuracy and reliability of feed additive detection.

[0041] Step S500: Based on the feed additive detection model, spatial spectral fusion detection is performed on the spatial location association information of each detection area and the spectral characteristics of the additive response in each band to obtain the additive detection results for each band. The feed additive detection model is used to simultaneously process spectral information and spatial location information and output the predicted value of additive content. The feed additive detection model adopts a three-dimensional convolutional neural network structure. The feed additive detection model consists of an input layer, a first convolutional module, a second convolutional module, a third convolutional module, a spatial attention module, a flattening layer, and a fully connected output layer connected in series.

[0042] Spatial spectral fusion detection refers to merging the spatial location correlation information of each detection zone with the spectral characteristics of the additive response in each band along the channel dimension, and then feeding it into the feed additive detection model for joint feature extraction and regression prediction. Specifically, the spectral characteristics of the additive response in each band are first stacked in ascending order of wavelength to form a three-dimensional tensor. The first dimension of this tensor corresponds to the number of spatial sampling rows, the second dimension to the number of spatial sampling columns, and the third dimension to the number of sensitive bands, with each sensitive band serving as an independent spectral channel. Then, the lateral and longitudinal displacement values ​​in the spatial location correlation information of each detection zone are subjected to min-max normalization. Min-max normalization involves subtracting the minimum value in that direction from the original coordinate value and dividing by the difference between the maximum and minimum values, mapping all coordinate values ​​to between 0 and 1, resulting in two two-dimensional normalized coordinate matrices with the same number of rows and columns as a single band matrix. These two two-dimensional normalized coordinate matrices are then used as two additional channels and concatenated with the aforementioned three-dimensional tensor along the third dimension, resulting in an input tensor with a total number of channels equal to the number of sensitive bands plus two.

[0043] After receiving the input tensor, the feed additive detection model performs three-dimensional convolution on the input tensor. The first convolutional module uses 32 kernels of size 3x3x3 with a stride of 1 and a modified linear unit (MRU) activation function, outputting 32 feature maps. The second convolutional module uses 64 kernels of size 3x3x3 with a stride of 1 and the same MRU activation function, further convolving the output of the first module to output 64 feature maps. The third convolutional module uses 128 kernels of size 3x3x3 with a stride of 1 and the same MRU activation function, outputting 128 feature maps. Each convolutional module is followed by a 2x2x2 three-dimensional max-pooling layer to reduce the feature map size in both spatial and spectral dimensions while preserving the most salient local features. The spatial attention module receives 128 feature maps output from the third convolutional module. First, it calculates the average of all pixel values ​​for each feature map in the spatial dimension, resulting in a channel description vector of length 128. This channel description vector is then input into a fully connected layer. After activation function processing, 128 channel attention weights are obtained, each weight ranging from 0 to 1. Each feature map is multiplied by its corresponding attention weight to obtain a weighted 128 feature maps. The flattening layer arranges all the weighted feature maps into a one-dimensional vector in a fixed order. The length of this vector is determined by the number of feature maps, their spatial size, and their spectral size. The fully connected output layer contains nodes equal to the number of sensitive bands. Each node is fully connected to the one-dimensional vector of the flattening layer. After a linear transformation, it outputs a real number representing the predicted additive content value for the corresponding sensitive band, expressed in milligrams per kilogram, after comprehensively considering the spectral and spatial information of all sensitive bands. The vector output from a single forward computation of the feed additive detection model has a length equal to the number of sensitive bands, with each element in the vector corresponding to a specific additive detection result for that band. The additive detection results for each band include the predicted additive content for each sensitive band.

[0044] Step S600: Perform process-related dynamic anomaly detection on the additive detection results of each band using the feed production process scheme to obtain a feed additive detection report. Step S600 includes: Step S610: Retrieve additive detection parameters for the multiple sensitive bands according to the feed production process scheme to obtain multiple band additive detection sets. Additive detection parameters are numerical indicators describing the quantitative relationship between the additive spectral response and additive content in sensitive bands, including the standard curve slope, standard curve intercept, detection limit, quantitation limit, and linear correlation coefficient. The standard curve slope represents the average change in absorbance in that band when the additive content increases by 1 mg / kg. The standard curve intercept represents the baseline absorbance in that band when the additive content is 0. The detection limit represents the lowest additive content that can be reliably detected, and the quantitation limit represents the lowest additive content that can be accurately quantified. The linear correlation coefficient represents the strength of the linear relationship between absorbance and additive content. Additive detection parameter retrieval is performed in the additive detection parameter database. This database stores the values ​​of the five detection parameters (listed above) for each sensitive wavelength band under different feed production process conditions. Each record includes feed ingredient type, additive name, conditioning temperature, pelleting temperature, degree of expansion, center wavelength of the wavelength band, slope of the standard curve, intercept of the standard curve, limit of detection, limit of quantitation, and linear correlation coefficient. During the retrieval, the feed ingredient type and additive name in the feed production process plan are used as the primary matching criteria, and multiple sensitive wavelength bands are used as wavelength band matching criteria. Simultaneously, the conditioning temperature, pelleting temperature, and degree of expansion are compared item by item with the historical records in the additive detection parameter database, and the relative deviation is calculated. The deviation threshold is set to 5%. Only records with completely consistent primary matching criteria, completely consistent wavelength bands, and relative deviations of all process parameters not exceeding 5% are extracted. For each sensitive wavelength band, all detection parameter records that meet the criteria retrieved from the additive detection parameter database are grouped into a set. Each record in the set retains the complete values ​​of the five detection parameters and the corresponding process parameter information. This set is the wavelength band additive detection set corresponding to that wavelength band. The above retrieval and aggregation operations are performed sequentially on multiple sensitive bands to obtain multiple band additive detection sets with the same number of sensitive bands.

[0045] Step S620: Perform trend characteristic analysis based on the multiple band additive detection sets to establish a dynamic space for multiple band additive detection. Trend characteristic analysis refers to calculating the statistical characteristics of the five detection parameters in each band additive detection set and analyzing the patterns of these statistical characteristics as the center wavelength of the sensitive band changes. That is, for each sensitive band, extract the five detection parameters of all records in the corresponding band additive detection set, and calculate the mean, standard deviation, minimum, and maximum values ​​of all records in the set for each parameter. The mean represents the typical level of the parameter in that band, the standard deviation represents the fluctuation range of the parameter between different historical batches, and the minimum and maximum values ​​represent the historical extreme range of the parameter. Plot the average points corresponding to all sensitive bands on the coordinate system with the center wavelength of the sensitive band as the abscissa and the mean value of a certain detection parameter as the ordinate, to obtain a scatter sequence of the parameter changing with wavelength. Fit the scatter sequence with a cubic polynomial to obtain a smooth trend curve, which represents the overall trend of the detection parameter changing with wavelength under normal process conditions. The dynamic space for detecting additives in different bands refers to the region enclosed by the trend curve and its upper and lower confidence boundaries. This region represents the range of values ​​that the detection parameter is allowed to occur within normal fluctuations. The confidence boundaries are calculated by adding or subtracting 1.96 times the standard deviation from the mean of each band; 1.96 times corresponds to a 95% confidence level under a normal distribution. The above statistical calculations, scatter plot generation, polynomial fitting, and confidence boundary calculations are performed on the five detection parameters—standard curve slope, standard curve intercept, detection limit, quantitation limit, and linear correlation coefficient—resulting in five banded regions with wavelength as the horizontal axis. These banded regions collectively constitute the dynamic space for detecting additives in multiple bands.

[0046] Step S630: Anomaly detection is performed on the additive detection results of each band using the multi-band additive detection dynamic space to obtain multiple additive detection anomaly information. For each sensitive band, the slope trend value, intercept trend value, detection limit trend value, and quantitation limit trend value of the corresponding standard curve are first searched in the multi-band additive detection dynamic space based on the center wavelength of that band. Simultaneously, the upper boundary values ​​of the detection limit and quantitation limit are also searched. Then, the predicted additive content value of that band in the additive detection results is compared with the quantitation limit. If the predicted value is lower than the quantitation limit trend value, it is judged that the accurate quantification level has not been reached, and the detection result of that band is marked as low. If the predicted value is higher than 1.5 times the upper boundary value of the quantitation limit, it is judged that it exceeds the normal quantification range, and the detection result of that band is marked as high. If the predicted value is between the quantitation limit trend value and 1.5 times the upper boundary value of the quantitation limit, the detection result of that band is considered to be within the normal range. The above comparison and judgment are performed for each sensitive band to obtain the anomaly determination result for each band. Multiple additive detection anomaly information refers to the collection of all band information that has been judged as abnormal or questionable. Each additive detection anomaly information includes the band number, center wavelength, predicted additive content for that band, permissible limit of quantitation trend value and upper boundary value, anomaly type, and anomaly severity. Anomaly types include lower than normal and higher than normal. The anomaly severity is expressed as the absolute value of the difference between the predicted value and the permissible limit, divided by the permissible limit value, and then multiplied by 100%.

[0047] Step S640: Organize the detection results of additives in each band, the dynamic space of additive detection in multiple bands, and the abnormal information of additive detection in multiple bands to generate the feed additive detection report. Organizing refers to summarizing the detection results of additives in each band, the dynamic space of additive detection in multiple bands, and the abnormal information of additive detection in multiple bands according to a fixed format to form a structurally complete feed additive detection report. The feed additive detection report includes a report title, detection time, feed sample number, summary of feed production process plan, summary table of detection results, dynamic space description, list of abnormal information, and detection conclusions. The summary table of detection results lists the starting wavelength, ending wavelength, center wavelength, predicted additive content, trend value of the limit of quantitation, upper boundary value of the limit of quantitation, and abnormal status of each sensitive band according to the band number. Abnormal status is marked with text as normal, low abnormal, or high abnormal. The dynamic space description section lists the trend polynomial coefficients and confidence interval widths of the five detection parameters item by item, presented in tabular form for easy subsequent traceability. The anomaly information list details the band number, center wavelength, predicted value, allowable boundary value, anomaly type, and anomaly severity for each additive detection anomaly. If the additive detection anomaly information is empty, indicate "no anomalies found" in this list. The detection conclusion section provides an overall judgment based on the anomalies across all bands. If all bands are normal, the additive content of the feed sample is determined to be within the normal process fluctuation range. If one or two bands are abnormal but the anomaly severity is less than 20%, the sample requires retesting for confirmation. If three or more bands are abnormal, or any band has an anomaly severity exceeding 20%, the additive detection result of the sample is deemed abnormal, and quality traceability is recommended.

[0048] Step S600 includes step S650, which involves encrypting and storing the feed additive test report in a cloud-edge collaborative storage block. Encrypted storage means converting the feed additive test report into ciphertext using an encryption algorithm before saving it, ensuring that only authorized parties with the correct key can decrypt and read it. The encryption algorithm uses the Advanced Encryption Standard (AES) with a key length of 256 bits. Before encryption, the feed additive test report is converted into a binary data stream, and then encrypted using the AES-256 algorithm and a randomly generated initialization vector to obtain ciphertext data. The cloud-edge collaborative storage block refers to a distributed storage structure composed of edge computing nodes and cloud servers. The edge computing nodes are located locally at the feed production enterprise and are responsible for real-time storage of the encrypted test report ciphertext and report digest. The cloud servers are located in a remote data center and are responsible for storing the encrypted complete report and backup data. The two maintain data synchronization through a secure transmission protocol. Specifically, an asymmetric key pair, including a public key and a private key, is first generated on the edge computing node. The private key is stored in the secure encryption chip of the edge computing node, and the public key is used to encrypt and store index information. After encrypting the feed additive test report using the AES-256 algorithm, ciphertext data is obtained. Simultaneously, the SHA-256 hash value of the ciphertext data is calculated, serving as a unique fingerprint for subsequent integrity verification. The ciphertext data and hash value are packaged into a data block. The header of the data block includes the report number, test time, feed sample number, hash value, and data length. The body of the data block contains the ciphertext data. Then, the local storage interface of the edge computing node is called to write the data block to the local persistent storage area of ​​the edge computing node. Immediately after writing, a synchronization request is sent to the cloud server, uploading the data block to the cloud server via a Transport Layer Security (TLS) encrypted channel. Upon receiving the data block, the cloud server first verifies whether the hash value matches the data block header. If the verification is successful, the data block is stored in the cloud's object storage service and a storage success confirmation message is returned. After receiving the storage success confirmation message, the edge computing node records the cloud storage path and synchronization timestamp of the data block locally, completing the entire encrypted storage process. If the network is interrupted during cloud synchronization, the edge computing node marks the data block as pending synchronization and automatically retransmits it after the network is restored, until the cloud confirms successful storage. Encrypted storage ensures that feed additive test reports are not read or tampered with by unauthorized personnel during storage and transmission.

[0049] In summary, the feed additive detection method based on spectral technology provided in this application has the following technical advantages: By using spectral detection band sensitivity mining based on feed production process schemes, the traditional fixed band detection method is replaced. This allows the detection band to be automatically adjusted according to specific feed formulas and process parameters, improving the adaptive matching capability of the detection band under different production conditions. This avoids the problem of fixed band failure or decreased sensitivity due to process changes.

[0050] By using scene data from various detection devices to compensate for and correct the scene interference characteristics of the spectral data acquired in each band, the influence of external interferences such as ambient temperature, humidity, light source fluctuations, and detector gain changes on the spectral response is effectively eliminated, making the obtained spectral data closer to the real sample response and improving the reliability and stability of feed additive detection.

[0051] By using feed production process schemes to separate the spectral background of the feed matrix from the reliable response data of each band spectrum, the spectral contribution of complex feed raw materials can be deducted from the total spectrum. This significantly reduces the masking effect of the matrix background on the weak spectral signal of the additives, making the response characteristics of the additives more prominent, thereby improving the detection sensitivity and accuracy of low-content additives.

[0052] By combining the spatial spectral information of each detection location with the spectral characteristics of the additive response in each band, spatial spectral fusion detection is achieved. This not only utilizes the spectral characteristics of the additive in different bands, but also combines its spatial distribution information on the surface of the feed sample, realizing quantitative detection and spatial distribution analysis of the additive content, thus improving the reliability and spatial resolution of the detection results.

[0053] By utilizing feed production process schemes, dynamic anomaly detection of additive test results in various bands is performed. The test results of additives in each band are compared with the reasonable fluctuation range under the corresponding process conditions, which reduces false alarms caused by normal fluctuations in process parameters. At the same time, it can more accurately identify real anomalies caused by abnormal addition or uneven mixing of additives, thereby enhancing the process-specificity of the test results and the accuracy of anomaly identification.

[0054] Example 2: Based on the same inventive concept as the feed additive detection method based on spectral technology in the previous examples, this invention also provides a feed additive detection system based on spectral technology. Please refer to the appendix. Figure 4 The system includes: The feed sample is divided into several modules: a band sensitivity mining module 1, which is used to mine the band sensitivity of the feed sample based on the feed production process scheme, and identify multiple sensitive bands; a multi-band spectral detection module 2, which is used to perform multi-band spectral detection on the feed sample using a hyperspectral imaging device based on the multiple sensitive bands, and acquire spectral acquisition data of each band, spatial location association information of each detection, and scene data of each detection device; a scene interference compensation and correction module 3, which is used to compensate and correct the scene interference features of the spectral acquisition data of each band using the scene data of each detection device, and acquire reliable response data of each band; a matrix spectral background separation module 4, which is used to separate the matrix spectral background of each band spectral reliable response data based on the feed production process scheme, and determine the additive response spectral characteristics of each band; a spatial spectral fusion detection module 5, which is used to perform spatial spectral fusion detection of the spatial location association information of each detection and the additive response spectral characteristics of each band based on the feed additive detection model, and acquire the additive detection results of each band; and a process-related dynamic anomaly detection module 6, which is used to perform process-related dynamic anomaly detection of the additive detection results of each band based on the feed production process scheme, and acquire a feed additive detection report.

[0055] Furthermore, the band sensitivity mining module 1 is also used for: performing a historical retrieval of additive spectral detection based on the feed production process scheme to obtain a process-matched spectral detection historical library; extracting multiple historical spectral detection bands based on the process-matched spectral detection historical library; evaluating the additive detection sensitivity of the multiple historical spectral detection bands based on the process-matched spectral detection historical library to obtain multiple band detection sensitivities; and filtering the multiple historical spectral detection bands based on the predetermined detection sensitivity to obtain the multiple sensitive bands.

[0056] Furthermore, the band sensitivity mining module 1 is also used to: traverse the multiple historical spectral detection bands and extract the first historical spectral detection band; match and extract the process matching spectral detection history library according to the first historical spectral detection band to obtain multiple band matching historical detection data; identify the deviation between each band matching historical detection data and the actual data of each feed additive to obtain the detection deviation characteristics of each historical additive; evaluate the detection reliability of the first historical spectral detection band according to the detection deviation characteristics of each historical additive to obtain the reliability of multiple bands, and calculate the average value of the reliability of multiple bands to generate the first band detection sensitivity.

[0057] Furthermore, the scene interference compensation and correction module 3 is also used to: perform anomaly detection on the scene data of each detection device and obtain anomaly matrices for each detection scene; identify interference effects on the spectral acquisition data of each band based on the anomaly matrices for each detection scene and obtain anomaly interference effect matrices for each scene; and perform adaptive correction on the spectral acquisition data of each band through the anomaly interference effect matrices for each scene to generate reliable response data for each band spectrum.

[0058] Furthermore, the matrix spectral background separation module 4 is also used for: constructing a feed matrix spectral evolution model based on the feed raw material spectral detection database; extracting feed raw material characteristic data according to the feed production process scheme, and combining and encoding the feed raw material characteristic data with the multiple sensitive bands to obtain matrix feature vectors for each band; inputting the matrix feature vectors for each band into the feed matrix spectral evolution model to obtain feed matrix spectral features for each band; and performing feed matrix spectral background separation on the reliable response data of each band spectral based on the feed matrix spectral features for each band to obtain the additive response spectral features for each band.

[0059] Furthermore, the matrix spectral background separation module 4 is also used for: mining mapping relationships in the feed ingredient spectral detection database to obtain multiple ingredient spectral mapping relationships; performing confidence fusion on the feed ingredient spectral detection database based on the multiple ingredient spectral mapping relationships to obtain an ingredient spectral detection data space; training multiple feed matrix spectral evolvers based on the ingredient spectral detection data space, wherein the multiple feed matrix spectral evolvers have multiple evolution accuracy labels; and performing integrated fusion training on the multiple feed matrix spectral evolvers based on the multiple evolution accuracy labels to generate the feed matrix spectral evolution model.

[0060] Furthermore, the process-related dynamic anomaly detection module 6 is also used for: retrieving additive detection parameters for the multiple sensitive bands according to the feed production process scheme to obtain multiple band additive detection sets; performing trend characteristic analysis based on the multiple band additive detection sets to establish a dynamic space for multiple band additive detection; performing anomaly detection on the additive detection results of each band through the dynamic space for multiple band additive detection to obtain multiple additive detection anomaly information; and organizing the additive detection results of each band, the dynamic space for multiple band additive detection, and the multiple additive detection anomaly information to generate the feed additive detection report.

[0061] Furthermore, the process-related dynamic anomaly detection module 6 is also used to: encrypt and store the feed additive detection report in the cloud-edge collaborative storage block.

[0062] The feed additive detection system based on spectral technology provided in this embodiment of the invention can execute the feed additive detection method based on spectral technology provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0063] Although this application makes various references to certain modules in the system according to the embodiments of this application, any number of different modules can be used and run on user terminals and / or servers. The various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy distinction between each other and are not used to limit the scope of protection of this invention.

[0064] In embodiment three, this application also provides a computer-readable storage medium storing a computer program. When executed by a processor of an electronic device, the computer program can implement a feed additive detection method based on spectral technology as described in any of the foregoing embodiments.

[0065] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for detecting feed additives based on spectroscopic technology, characterized in that, The method includes: Based on the feed production process plan of the feed samples, the spectral detection band sensitivity was explored to identify multiple sensitive bands; Based on the multiple sensitive bands, the feed sample is subjected to multi-band spectral detection by a hyperspectral imaging device to obtain spectral acquisition data of each band, spatial location correlation information of each detection, and scene data of each detection device. The scene interference feature compensation and correction are performed on the spectral acquisition data of each band by using the scene data of each detection device to obtain reliable spectral response data of each band. Based on the feed production process scheme, the feed matrix spectral background is separated from the reliable response data of each band to determine the spectral characteristics of the additive response in each band. Based on the feed additive detection model, spatial spectral fusion detection is performed on the spatial location correlation information of each detection space and the spectral characteristics of the additive response of each band to obtain the detection results of additives in each band. The feed production process scheme is used to perform process-related dynamic anomaly detection on the detection results of additives in each band, and a feed additive detection report is obtained.

2. The method as described in claim 1, characterized in that, Based on the feed production process plan of the feed samples, spectral detection band sensitivity mining was conducted to identify multiple sensitive bands, including: Based on the feed production process scheme, perform a historical spectral detection search of additives to obtain a historical database of process-matched spectral detection. Based on the process matching spectral detection history library, multiple spectral detection history bands are extracted; The additive detection sensitivity is evaluated based on the process-matched spectral detection history library to obtain the detection sensitivity of multiple spectral detection history bands. Based on a predetermined detection sensitivity, the multiple historical spectral detection bands are filtered according to the multiple band detection sensitivity to obtain the multiple sensitive bands.

3. The method as described in claim 2, characterized in that, Based on the process-matched spectral detection history library, the sensitivity of additive detection is evaluated for the multiple spectral detection history bands to obtain the detection sensitivity of multiple bands, including: Traverse the multiple spectral detection history bands and extract the first spectral detection history band; Based on the first spectral detection historical band, the process matching spectral detection historical library is matched and extracted to obtain multiple band matching historical detection data; The deviation is identified by matching historical detection data of each band with actual data of each feed additive, and the detection deviation characteristics of each historical additive are obtained. The detection reliability of the first spectral detection historical band is evaluated based on the detection deviation characteristics of each historical additive, the reliability of multiple bands is obtained, and the average value of the reliability of multiple bands is calculated to generate the detection sensitivity of the first band.

4. The method as described in claim 1, characterized in that, By performing scene interference feature compensation and correction on the spectral acquisition data of each band using scene data from each detection device, reliable spectral response data for each band is obtained, including: Anomaly detection is performed on the scene data of each detection device to obtain an anomaly matrix for each detection scene; Based on the anomaly matrix of each detection scenario, the interference effect of the spectral data of each band is identified, and the anomaly interference effect matrix of each scenario is obtained. Adaptive correction is performed on the spectral acquisition data of each band using the abnormal interference influence matrix of each scenario to generate reliable spectral response data of each band.

5. The method as described in claim 1, characterized in that, Based on the feed production process scheme, the spectral background of the feed matrix is ​​separated from the reliable response data of each band to determine the spectral characteristics of the additive response in each band, including: Based on the feed ingredient spectral detection database, a feed matrix spectral evolution model was constructed. The feed raw material characteristic data are extracted according to the feed production process scheme, and the feed raw material characteristic data are combined and encoded with the multiple sensitive bands to obtain the matrix feature vector of each band. The matrix feature vectors of each band are input into the feed matrix spectral evolution model to obtain the spectral features of the feed matrix in each band; Based on the spectral characteristics of the feed matrix in each band, the reliable response data of the spectral data in each band are separated by the background of the feed matrix spectral data to obtain the spectral characteristics of the additive response in each band.

6. The method as described in claim 5, characterized in that, Based on a database of feed ingredient spectral detection, a spectral evolution model of feed matrix is ​​constructed, including: The mapping relationship of the feed raw material spectral detection database is mined to obtain multiple raw material spectral mapping relationships; Based on the multiple raw material spectral mapping relationships, the confidence level of the feed raw material spectral detection database is fused to obtain the raw material spectral detection data space. Based on the raw material spectral detection data space, multiple feed matrix spectral evolvers are trained, and the multiple feed matrix spectral evolvers have multiple evolution accuracy labels; The feed matrix spectral evolution model is generated by integrating and training the multiple feed matrix spectral evolutioners based on the multiple evolution accuracy labels.

7. The method as described in claim 1, characterized in that, By performing process-related dynamic anomaly detection on the detection results of additives in each band using the aforementioned feed production process scheme, a feed additive detection report is obtained, including: According to the feed production process scheme, additive detection parameters are retrieved for the multiple sensitive bands to obtain multiple band additive detection sets; Based on the trend characteristics analysis of the multiple band additive detection sets, a dynamic space for multiple band additive detection is established. Anomaly detection is performed on the detection results of additives in each band using the dynamic space of additive detection in multiple bands, and multiple additive detection anomaly information is obtained. The feed additive detection report is generated by compiling the detection results of each band of additives, the dynamic space of the detection of additives in multiple bands, and the abnormal detection information of the additives.

8. The method as described in claim 1, characterized in that, Obtain feed additive test reports, including: The feed additive test report is encrypted and stored in the cloud-edge collaborative storage block.

9. A feed additive detection system based on spectral technology, characterized in that, The system is used to implement the method according to any one of claims 1 to 8, the system comprising: The band sensitivity mining module is used to perform spectral detection band sensitivity mining based on the feed production process plan of the feed sample to determine multiple sensitive bands; The multi-band spectral detection module is used to perform multi-band spectral detection on the feed sample based on the multiple sensitive bands using a hyperspectral imaging device, and to acquire spectral acquisition data for each band, spatial location correlation information for each detection, and scene data for each detection device. The scene interference compensation and correction module is used to perform scene interference feature compensation and correction on the spectral acquisition data of each band using the scene data of each detection device, and to obtain reliable response data of each band spectrum. The matrix spectral background separation module is used to separate the feed matrix spectral background from the reliable response data of each band of the feed production process scheme, and to determine the spectral characteristics of the additive response of each band. The spatial spectral fusion detection module is used to perform spatial spectral fusion detection on the spatial location association information of each detection space and the spectral characteristics of each band of additive response based on the feed additive detection model, and to obtain the detection results of each band of additive. The process-related dynamic anomaly detection module is used to perform process-related dynamic anomaly detection on the detection results of additives in each band according to the feed production process scheme, and obtain a feed additive detection report.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 8.