Food multi-residue collaborative detection system and method thereof

By combining X-ray backscattering and Raman spectroscopy technology and combining with the federal distillation learning framework, a multi-residue collaborative detection system for food was built, which solved the problems of long detection cycles, high costs and difficulty in realizing collaborative detection of multiple pesticide residues in the existing technology, achieved rapid and accurate detection of multiple pesticide residues, and protected data privacy.

CN120084832AInactive Publication Date: 2025-06-03GUANGDONG YELLOW RIVER FOOD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510239914.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-06-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing food pesticide residue detection technology has the problems of long testing cycles, high costs, complex operations, and difficulty in achieving coordinated testing of multiple pesticide residues. The centralized architecture of traditional testing systems increases sample transportation costs and poses a risk of deterioration.

Method used

By combining X-ray backscattering technology and Raman spectroscopy technology, combined with the federal distillation learning framework, a multi-residue collaborative detection system for food is built to achieve rapid and accurate collaborative detection of multiple pesticide residues in food.

Benefits of technology

Multimodal data fusion is realized, improving the comprehensiveness and accuracy of detection; through the federal distillation learning framework, data privacy is protected and the collaborative optimization of distributed models is realized; efficient feature extraction is adopted using residual compression coding method, reducing computing complexity; lightweight deployment allows the system to run on devices with limited computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120084832A_ABST
    Figure CN120084832A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of food safety detection, in particular to a food multi-residue collaborative detection system and method, and the system comprises a cloud module which is used for constructing a heterogeneous data fusion network and keeping synchronous updating with each detection model in a federal distillation mode; the data processing module in the local area network is connected with the cloud module and is used for calling data and updating a detection model; the acquisition module is arranged on a detection site and is used for acquiring an X-ray back scattering characteristic spectrum, a Raman spectrum and a food concentration index of to-be-detected food; the communication and data acquisition module is connected with the acquisition module and the data processing module and is used for transmitting the data acquired by the acquisition module to the data processing module. The system disclosed by the invention realizes complementary characterization of physical characteristics and chemical characteristics by fusing X-ray back scattering characteristic spectrum and Raman spectrum data; and the detection comprehensiveness and accuracy are obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of food safety detection, and particularly to a system and method for co-detection of multiple food residues. Background Art

[0002] With the expansion of the scope of pesticide use in modern agricultural production, the problem of pesticide residues in food has attracted increasing attention. Traditional food pesticide residue detection technologies mainly rely on single detection methods, such as gas chromatography-mass spectrometry, liquid chromatography-mass spectrometry, etc. Although these methods have high accuracy, they often have disadvantages such as long detection cycles, high costs, and complex operations, and are difficult to meet the requirements of rapid, efficient, and economical detection.

[0003] In addition, most of the existing detection technologies are aimed at single or a few kinds of pesticide residues, and it is difficult to achieve co-detection of multiple pesticide residues. At the same time, traditional detection systems usually adopt a centralized architecture, and it is necessary to send the samples to be tested to the central laboratory for detection, which not only increases the sample transportation cost, but also there is a risk of deterioration that may occur during the sample transportation process.

[0004] In addition, the existing detection models usually use a single data source for training, and it is difficult to comprehensively utilize multi-modal data to improve the detection accuracy. With the increasing requirements for data privacy protection, how to achieve collaborative optimization of distributed models on the premise of protecting data privacy has also become an urgent problem to be solved.

[0005] Therefore, there is an urgent need to develop a system and method that can combine the advantages of multiple detection technologies to achieve rapid co-detection of multiple pesticide residues in food. Summary of the Invention

[0006] The object of the present invention is to provide a system and method for co-detection of multiple food residues, which can achieve rapid and accurate co-detection of multiple pesticide residues in food by integrating X-ray backscattering technology and Raman spectroscopy technology and combining with the federated distillation learning framework.

[0007] The present invention provides a system for co-detection of multiple food residues, including:

[0008] A cloud module, configured to construct a heterogeneous data fusion network and keep synchronous updates with each detection model in a federated distillation mode;

[0009] A data processing module within a local area network, connected to the cloud module, configured to retrieve data and update the detection model;

[0010] A collection module, arranged at the detection site, configured to collect X-ray backscattering characteristic spectra, Raman spectra, and food concentration indicators of the food to be tested;

[0011] A communication and data acquisition module, connected to the acquisition module and the data processing module, is used to transmit the data collected by the acquisition module to the data processing module.

[0012] Preferably, when each data processing module updates the detection model, it respectively collects the X-ray backscattering characteristic spectrum, Raman spectrum and food concentration index of the on-site object to be measured, calculates the loss value of the detection model, and then encapsulates and packs the detection model, X-ray backscattering characteristic spectrum, Raman spectrum and food concentration training data and sends them to the cloud module.

[0013] Preferably, the detection model includes: an image recognition module, a Raman spectrum recognition module and a food concentration detection module.

[0014] Preferably, the input of the image recognition module is the X-ray backscattering characteristic spectrum collected by the acquisition module, and the residual compression coding method is used to reduce the dimension of the spectrum features.

[0015] Preferably, the steps of the residual compression coding method are: input the X-ray backscattering characteristic spectrum into the image recognition module, based on ResNet50 as the backbone of the image recognition module, first pass through a convolutional layer and a residual bottleneck module; the output of the residual bottleneck module passes through a convolutional layer, a linear bottleneck module and a residual dilation module; after the output of the residual bottleneck module and the output of the residual dilation module are concatenated, they pass through a convolutional layer, a residual compression module and a convolutional layer, and its output passes through a convolutional layer and a residual compression module again; this output passes through a convolutional layer, a residual dilation module and a lightweight MobileNet module to output a feature map; the feature map passes through a convolutional layer and serves as the input of the last two convolutional blocks of ResNet50; finally, through a pooling layer and two fully connected layers, the prediction is output.

[0016] Preferably, the input of the Raman spectrum recognition module is the Raman spectrum collected by the acquisition module. The Raman spectrum data is input into a multi-layer perceptron MLP as the Raman spectrum recognition module to extract spectral features; the last layer of the multi-layer perceptron uses a normalization layer, and the output result is the concentration of the sample to be measured.

[0017] Preferably, an attention parameter distillation mechanism is adopted between the cloud module and the data processing module. By calculating the attention coefficient weights of each sub-feature, the sub-features are weighted and then feature fusion is performed to form a heterogeneous data fusion network.

[0018] Preferably, the cloud module distills and trains the pre-trained teacher network Model_tea to obtain a lightweight student network Model_stu based on the image recognition module, and sends the lightweight student network Model_stu to the data processing module.

[0019] Preferably, the attention coefficient is calculated by the following formula: w i,j = Softmax(W θ (i, j)·γ), where w i,j represents the attention coefficient; Softmax(·) is the normalized exponential function, and W θ (i, j) represents the value of the j-th column in the i-th row of the matrix after weighting the parameters.

[0020] The method using the food multi-residue co-detection system includes the following steps:

[0021] Step S1: Collect the X-ray backscattering characteristic spectrum, Raman spectrum and food concentration index of the food;

[0022] Step S2: The cloud module constructs a heterogeneous data fusion network for the X-ray backscattering characteristic spectrum and Raman spectrum, and uses the federated distillation method to collect and update the detection model. Pack the latest detection model, X-ray backscattering characteristic spectrum, Raman spectrum, food concentration index and training data and send them to the cloud module to update the detection model;

[0023] Among them, the federated distillation method includes:

[0024] S2.1: The cloud module collects the image recognition modules of each detection model, constructs an image recognition model as the pre-trained teacher network Model_tea, distills and trains the pre-trained teacher network Model_tea to obtain a lightweight student network Model_stu based on the image recognition module, and sends the lightweight student network Model_stu to the client;

[0025] S2.2: The data processing module receives the lightweight student network Model_stu sent by the cloud module;

[0026] S2.3: The data processing module collects the Raman spectrum recognition modules of each detection model, performs distillation training based on the Raman software-based characteristic spectrum to obtain a lightweight student network as the Raman spectrum recognition module of the client;

[0027] S2.4: The data processing module collects the food concentration detection modules of each detection module, updates the food concentration detection module to obtain the latest food concentration detection module;

[0028] S2.5: Through data fusion, package and send the latest image recognition module, Raman spectroscopy recognition module and food concentration detection module to the cloud module to update the detection model of the cloud module.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] 1. Multi-modal data fusion: The system of the present invention realizes the complementary characterization of physical and chemical properties by fusing X-ray backscattering characteristic spectra and Raman spectroscopy data, significantly improving the comprehensiveness and accuracy of detection.

[0031] 2. Federated distillation learning: The present invention adopts a federated distillation learning framework, enabling the detection models distributed on different devices to collaboratively optimize without sharing the original data, effectively protecting data privacy.

[0032] 3. Efficient feature extraction: The present invention designs an innovative residual compression coding method to effectively extract the features of X-ray backscattering spectra through a multi-level residual structure, reducing the data dimension while retaining key information.

[0033] 4. Lightweight deployment: The present invention realizes the effective compression of the model through a teacher-student network structure, enabling the system to run on devices with limited computing resources.

[0034] 5. Attention parameter distillation: The present invention designs a parameter distillation method based on the attention mechanism to precisely adjust the importance of features on different devices, optimizing the effect of distributed learning. Description of the Drawings

[0035] Figure 1 It is the system architecture diagram of the food multi-residue collaborative detection system of the present invention;

[0036] Figure 2 It is the structural schematic diagram of the residual compression coding method in the food multi-residue collaborative detection system of the present invention;

[0037] Figure 3 It is the flow chart of the federated distillation learning framework in the food multi-residue collaborative detection system of the present invention;

[0038] Figure 4 It is the flow chart of the food multi-residue collaborative detection method of the present invention;

[0039] Figure 5 It is the schematic diagram of the principle of the attention parameter distillation mechanism in the food multi-residue collaborative detection system of the present invention. Detailed Embodiments

[0040] The technical solution of the present invention will be described in detail below through specific embodiments in conjunction with the accompanying drawings. It should be understood that the embodiments described herein are only used to illustrate the present invention and do not limit the scope of the present invention.

[0041] Embodiment 1

[0042] As Figure 1 shown, the food multi-residue collaborative detection system provided by the present invention includes a cloud module 1, a data processing module 2 within a local area network, a collection module 3, and a communication and data collection module 4.

[0043] The collection module 3 is arranged at the detection site and is connected to the communication and data collection module 4, and is used to collect the X-ray backscattering characteristic spectrum, Raman spectrum, and food concentration index of the food to be detected. Preferably, the collection module 3 includes an X-ray backscattering spectrum collection unit and a Raman spectrum collection unit, which are respectively used to collect data of different physical characteristics.

[0044] The communication and data collection module 4 is connected to the cloud module 1 and is also connected to the data processing module 2 within the local area network, and is used to transmit the data collected by the collection module 3 to the data processing module 2. In an embodiment of the present invention, the communication and data collection module 4 adopts wireless transmission technologies such as Wi-Fi, 5G, etc. to achieve high-speed data transmission.

[0045] The cloud module 1 is connected to the data processing module 2 within the local area network and adopts the federated distillation mode to keep the detection models of each data processing module 2 synchronized and updated. In the present invention, the cloud module 1 is mainly responsible for constructing a heterogeneous data fusion network and integrating the model parameters from different devices through the federated distillation mechanism to form a globally optimal model.

[0046] The data processing module 2 is a detection model within the local area network, which can retrieve the data transmitted by the collection and communication modules and can also be connected to the cloud module 1 to update the detection model. In a preferred embodiment of the present invention, the data processing module 2 includes a plurality of detection units distributed at different positions, and each unit independently completes the processing of local data and model training.

[0047] When each data processing module 2 updates the detection model, it respectively collects the X-ray backscattering characteristic spectrum, Raman spectrum, and food concentration index of the object to be detected on-site, calculates the loss value of the detection model, and then packages and sends the detection model, X-ray backscattering characteristic spectrum, Raman spectrum, and food concentration training data to the cloud module 1.

[0048] The detection model of the present invention includes: an image recognition module, a Raman spectrum recognition module, and a food concentration detection module. The input of the image recognition module is the X-ray backscattering characteristic spectrum collected by the collection module 3, and the residual compression coding method is used to reduce the dimension of the spectrum features.

[0049] As Figure 2 shown, the steps of the residual compression coding method are as follows: Input the X-ray backscattering feature map into the image recognition module. Based on ResNet50 as the backbone of the image recognition module, first pass through a convolutional layer and a residual bottleneck module; the output of the residual bottleneck module passes through a convolutional layer, a linear bottleneck module, and a residual dilation module; after the output of the residual bottleneck module is concatenated with the output of the residual dilation module, it passes through a convolutional layer, a residual compression module, and a convolutional layer, and its output then passes through a convolutional layer and a residual compression module; this output passes through a convolutional layer, a residual dilation module, and a lightweight MobileNet module to output a feature map; the feature map passes through a convolutional layer and serves as the input to the last two convolutional blocks of ResNet50; finally, through a pooling layer and two fully connected layers, the prediction is output.

[0050] In this coding method, the residual bottleneck module contains 7 convolutional kernels of the same size, the number of 7 convolutional kernels gradually increases, and the number of convolutional kernels is 128 each; the output of each convolutional kernel passes through a normalization BN layer and a rectified linear unit ReLU layer. This design enables the network to effectively extract multi-scale features of the X-ray backscattering map.

[0051] The structure of the linear bottleneck module is as follows: It contains 1 ordinary convolution with a convolutional kernel size of 1×1 and 1 ordinary convolutional kernel, and the two output channels are 256 and 128 respectively; the two ordinary convolutions are cascaded using skip connections; and each ordinary convolution contains 2 convolutional kernels. This module effectively reduces the feature dimension and improves the calculation efficiency.

[0052] The structure of the residual compression module is as follows: It contains a group of residual structures, and the number of input and output channels of this residual structure is the same, only the number of channels of the last layer is different. This design effectively avoids the problem of gradient disappearance in deep networks.

[0053] The residual dilation module uses dilated convolution for feature extraction, and its convolutional kernel size is set to 3×3, the dilation size is 2, and the number of convolutional kernels is 256. Dilated convolution improves the efficiency of feature extraction by increasing the receptive field without increasing the number of parameters.

[0054] The input of the Raman spectroscopy recognition module is the Raman spectroscopy collected by the collection module 3. The Raman spectroscopy data is input into a multi-layer perceptron MLP as the Raman spectroscopy recognition module to extract spectral features; the last layer of the multi-layer perceptron uses a normalization layer, and the output result is the concentration of the sample to be measured. In an embodiment of the present invention, the multi-layer perceptron contains 3 hidden layers, and the number of nodes is 512, 256, and 128 respectively, and finally the prediction result is obtained through an output layer.

[0055] An attention parameter distillation mechanism is adopted between the cloud module 1 and the data processing module 2. By calculating the attention coefficient weights of each sub-feature, the sub-features are weighted and then feature fusion is performed to form a heterogeneous data fusion network. As Figure 5 shown, the attention coefficient is calculated by the following formula:

[0056] w i,j = Softmax(W θ (i,j)),

[0057] where, w i,j represents the attention coefficient; Softmax(·) is the normalized exponential function, and W θ (i,j) represents the value of the i-th row and j-th column in the matrix after weighting the parameters. This mechanism enables the system to automatically adjust the importance of different features and improve the model performance.

[0058] In the preferred embodiment of the present invention, the Softmax function is specifically defined as:

[0059]

[0060] where, z i is the i-th element of the input vector, and K is the dimension of the vector.

[0061] The Softmax function converts the input into a probability distribution, making the sum of all values equal to 1, and effectively adjusts the weight distribution of the features.

[0062] The cloud module 1 performs distillation training on the pre-trained teacher network Model_tea to obtain a lightweight student network Model_stu based on the image recognition module, and sends the lightweight student network Model_stu to the data processing module 2. In this embodiment, the teacher network Model_tea is based on the ResNet50 architecture and has approximately 25 million parameters; while the student network Model_stu is based on the MobileNetV2 architecture and has only approximately 3 million parameters, greatly reducing the computational resource requirements.

[0063] Embodiment 2

[0064] As Figure 4 shown, the food multi-residue collaborative detection method provided by the present invention includes the following steps:

[0065] Step S1: Collect the X-ray backscattering characteristic spectrum, Raman spectrum and food concentration index of the food.

[0066] In this embodiment, when collecting the X-ray backscattering characteristic spectrum, an X-ray radiation source is used to irradiate the sample from the backscattering direction, and the backscattering signal is received by a dedicated camera. Preferably, the energy of the X-ray radiation source is 30 - 50 keV, the irradiation angle is 45°, and the acquisition time is 10 - 30 seconds. These parameter settings can obtain a clear backscattering spectrum while avoiding damage to the sample.

[0067] When collecting the Raman spectrum, a laser (preferably with a wavelength of 785 nm) is used to irradiate the sample, and the Raman scattering signal is collected through an optical fiber. Preferably, the laser power is set to 100 - 300 mW, the integration time is 5 - 15 seconds, and the acquisition wavenumber range is 400 - 2000 cm-1. These parameter settings can obtain a Raman spectrum with a high signal-to-noise ratio while avoiding photothermal damage to the sample.

[0068] Step S2: The cloud module 1 constructs a heterogeneous data fusion network for the X-ray backscattering characteristic spectrum and the Raman spectrum, and uses the federated distillation method to collect and update the detection model. The latest detection model, X-ray backscattering characteristic spectrum, Raman spectrum, food concentration index, and training data are packaged and sent to the cloud module 1 to update the detection model.

[0069] As Figure 3 shown, the federated distillation method includes the following sub-steps:

[0070] S2.1: The cloud module 1 collects the image recognition modules of each detection model, constructs the image recognition model as the pre-trained teacher network Model_tea, performs distillation training on the pre-trained teacher network Model_tea to obtain the lightweight student network Model_stu based on the image recognition module, and sends the lightweight student network Model_stu to the client.

[0071] In this step, the pre-trained teacher network Model_tea is optimized by the following objective function:

[0072] L tea = CE(y, f tea (x)) + λ · R(f tea ),

[0073] where CE represents the cross-entropy loss function, y is the true label, f tea (x) is the predicted output of the teacher network, λ is the regularization coefficient (preferred value is 0.0001), and R is the L2 regularization term. This optimization method effectively prevents the model from overfitting and improves the generalization ability.

[0074] S2.2: The data processing module 2 receives the lightweight student network Model_stu sent by the cloud module 1.

[0075] S2.3: The data processing module 2 collects the Raman spectroscopy recognition modules of each detection model, conducts distillation training based on the Raman software-based characteristic spectra, and obtains a lightweight student network as the Raman spectroscopy recognition module of the client.

[0076] In this step, the following loss function is used for the distillation training of the Raman spectroscopy recognition module:

[0077] L distill = α·CE(y, f stu (x)) + (1 - α)·KL(f stu (x), f tea (x)),

[0078] where α is the balance coefficient (the preferred value is 0.5), CE is the cross-entropy loss, and KL is the KL divergence loss, which is used to make the output distribution of the student network similar to that of the teacher network. f stu (x) and f tea (x) are the outputs of the student network and the teacher network respectively. This distillation mechanism effectively transfers the knowledge of the teacher network while maintaining the lightweight of the model.

[0079] S2.4: The data processing module 2 collects the food concentration detection modules of each detection module, updates the food concentration detection module, and obtains the latest food concentration detection module.

[0080] In this embodiment, the food concentration detection module updates the model parameters using the weighted average method:

[0081]

[0082] where θ new is the updated model parameter, θ i is the model parameter of the i-th client, w i is the weight coefficient (proportional to the client data volume), and N is the number of clients. This weighting method enables clients with more data to make a greater contribution to model update. This weighting method enables clients with more data to make a greater contribution to model update.

[0083] S2.5: Through data fusion, the latest image recognition module, Raman spectroscopy recognition module, and food concentration detection module are encapsulated and sent to the cloud module 1 to update the detection model of the cloud module 1.

[0084] In this step, the data fusion adopts the feature-level fusion method. After transforming different modality features through a 1×1 convolutional layer and then splicing them, a fused feature vector is formed. Preferably, the dimension of the fused feature is set to 75% of the sum of the original feature dimensions, which not only retains the key information but also reduces the computational complexity.

[0085] Through the detailed description of the above embodiments, those skilled in the art should be able to implement the present invention. The food multi-residue collaborative detection system and method of the present invention, by integrating two detection technologies of X-ray backscattering and Raman spectroscopy and combining with the federated distillation learning framework, realizes the efficient and accurate detection of multiple pesticide residues in food, while effectively protecting data privacy. The system of the present invention is applicable to various scenarios such as food processing enterprises, agricultural product markets, and food supervision departments, and has important application value and promotion prospects.

[0086] Example 3: Collaborative Detection of Multiple Organophosphorus Pesticide Residues in Apples

[0087] In this example, the food multi-residue collaborative detection system of the present invention is applied to the detection of multiple organophosphorus pesticide residues in apple samples, including four common pesticides: methamidophos, dimethoate, malathion, and parathion.

[0088] First, apple samples containing the above four organophosphorus pesticides were prepared by the standard addition method. Specifically, organically grown apples without pesticide contamination were selected, peeled, cut into small pieces, and homogenized. Subsequently, a mixed standard solution of the four pesticides with known concentrations was added to the apple homogenate to prepare five gradient samples with concentrations of 0.01 mg / kg, 0.05 mg / kg, 0.1 mg / kg, 0.5 mg / kg, and 1 mg / kg, respectively.

[0089] The acquisition module 3 collected the X-ray backscattering characteristic spectra and Raman spectra of the processed apple samples. During the X-ray backscattering data acquisition, the X-ray source energy was set to 40 keV, the irradiation angle was 45°, and the acquisition time was 15 seconds; in the Raman spectrum acquisition, a 785 nm laser was used, the power was set to 150 mW, the integration time was 10 seconds, and the acquisition wavenumber range was 400 - 1800 cm -1 .

[0090] Through analysis, it was found that the four organophosphorus pesticides showed obvious differential characteristics in the X-ray backscattering spectra. Specifically, methamidophos had obvious scattering peaks in the 500 - 600 pixel region, dimethoate had a higher scattering intensity in the 700 - 800 pixel region, malathion had a characteristic scattering pattern in the 300 - 400 pixel region, and parathion showed unique scattering characteristics in the 900 - 1000 pixel region.

[0091] At the same time, these four organophosphorus pesticides also showed unique fingerprint region characteristics in the Raman spectrum: methamidophos had an obvious P=O stretching vibration peak at 1050 - 1100 cm -1 , dimethoate had characteristic peaks at 650 - 700 cm -1 and 950 - 1000 cm -1 , malathion had characteristic peaks at 550 - 600 cm-1 There is a P-S stretching vibration peak at this position, while parathion has obvious characteristic peaks at 450 - 500 cm -1 and 1150 - 1200 cm -1 .

[0092] The system of the present invention integrates and analyzes X-ray backscattering and Raman spectroscopy data through a heterogeneous data fusion network. X-ray backscattering mainly reflects the physical structure and elemental composition information of the sample, while Raman spectroscopy provides molecular vibration and chemical bond information, and the two complement each other at the physical and chemical levels. In particular, the phosphorus element in organophosphorus pesticides shows obvious characteristics in X-ray backscattering, while chemical bonds such as P-O and P-S have unique responses in Raman spectroscopy. This physical-chemical dual characterization is the unique synergistic mechanism of the present invention.

[0093] The specific detection process is as follows:

[0094] The acquisition module 3 obtains the X-ray backscattering spectrum and Raman spectroscopy data of the apple sample;

[0095] The communication and data acquisition module 4 transmits the collected data to the data processing module 2;

[0096] The data processing module 2 processes the two types of data through the image recognition module and the Raman spectroscopy recognition module respectively;

[0097] The image recognition module uses the residual compression coding method to extract the characteristics of the X-ray backscattering spectrum, and the Raman spectroscopy recognition module extracts the Raman spectroscopy characteristics through a multi-layer perceptron;

[0098] The cloud module 1 fuses the two types of characteristics based on the attention parameter distillation mechanism to generate a comprehensive feature representation;

[0099] The system finally outputs the predicted values of the concentrations of four organophosphorus pesticides.

[0100] Preferably, in the actual detection process, the system uses the five-fold cross-validation method to evaluate the performance to ensure the stability of the model.

[0101] In this embodiment, the detection results of the system for five pesticide concentration gradients are shown in the following table:

[0102]

[0103]

[0104] Data analysis shows that the average relative error of the system of the present invention is only 2.1%, far lower than 5 - 8% of the traditional single detection method, and the detection limit can reach 0.005 mg / kg, and the precision and accuracy are significantly better than the prior art.

[0105] Meanwhile, the detection time of the system of the present invention is only 45 seconds (including sample preparation time), while traditional liquid chromatography-mass spectrometry requires 2 - 3 hours, and gas chromatography-mass spectrometry requires 1 - 2 hours. The speed is increased by about 100 times, and no organic solvents are needed for sample pretreatment, significantly reducing the detection cost and environmental impact.

[0106] Compared with existing single detection technologies, the unique advantages of the system of the present invention based on multi-modal data fusion and federated distillation learning are as follows: 1) Physical-chemical double-layer characterization greatly improves detection accuracy; 2) Complementary data features reduce the false positive rate; 3) The federated learning framework enables the system to continuously optimize without sharing raw data; 4) Residual compression coding improves feature extraction efficiency; 5) The attention parameter distillation mechanism precisely adjusts feature weights.

[0107] Example 4: Simultaneous detection of deoxynivalenol and zearalenone in wheat

[0108] This example demonstrates the application of the system of the present invention in the detection of mycotoxins in grains, especially the simultaneous detection of two common mycotoxins in wheat: deoxynivalenol (DON) and zearalenone (ZEN).

[0109] Select wheat samples without fungal contamination. After grinding them into 60-mesh powder, add standard DON and ZEN solutions respectively to prepare samples with different concentration combinations: DON concentrations are 0.5 mg / kg, 1.0 mg / kg, 1.5 mg / kg; ZEN concentrations are 0.05 mg / kg, 0.1 mg / kg, 0.2 mg / kg, a total of 9 combinations.

[0110] The acquisition module 3 acquires X-ray backscattering characteristic spectra and Raman spectra of the wheat flour samples. The X-ray backscattering acquisition conditions are: X-ray source energy 45 keV, irradiation angle 40°, acquisition time 20 seconds; the Raman spectrum acquisition conditions are: 532 nm laser, power 100 mW, integration time 12 seconds, wavenumber range 500 - 2000 cm -1 。

[0111] In the data processing stage, special attention is paid to the characteristic differences between DON and ZEN in X-ray backscattering and Raman spectra: DON has a characteristic scattering pattern in the 350 - 450 pixel region in X-ray backscattering, while ZEN shows prominently in the 650 - 750 pixel region; in the Raman spectrum, DON has a C=O stretching vibration characteristic peak at 1650 - 1700 cm -1 , and ZEN has an aromatic ring vibration characteristic peak at 1600 - 1650 cm -1 。

[0112] The co-detection mechanism in this embodiment is based on the differences in the molecular structures and physical properties of DON and ZEN. The DON molecule contains three hydroxyl groups and one epoxy group, while the ZEN molecule contains phenolic hydroxyl groups and a lactone ring structure. These structural differences are manifested as different scattering patterns in X-ray backscattering and different vibration characteristics in Raman spectroscopy.

[0113] The uniqueness of the system of the present invention lies in: processing X-ray backscattering data through a residual compression coding method to accurately extract the structural characteristics of DON and ZEN; at the same time, analyzing Raman spectroscopy data through a multi-layer perceptron model to capture the molecular vibration information of the two toxins; finally, through an attention parameter distillation mechanism, dynamically adjusting the weights of the two types of data according to the sample characteristics to achieve optimal fusion.

[0114] Preferably, the calculation of the attention coefficient in this embodiment adopts optimized parameters for the characteristics of mycotoxins:

[0115] w i,j = Softmax(W θ (i,j)·γ),

[0116] where γ is the toxin characteristic adjustment factor, which is set to 1.25 after experimental optimization. This parameter makes the system more focused on the specific band information in Raman spectroscopy and improves the detection ability for low-concentration toxins.

[0117] The system detection results show that the average relative error for DON is 2.8%, and the average relative error for ZEN is 3.2%. The detection limits for both reach 0.1 mg / kg and 0.01 mg / kg respectively. It is worth noting that the system still maintains high accuracy in the complex situation where both toxins coexist, which benefits from the advantages of multi-modal data fusion and the federated learning framework.

[0118] Compared with the traditional enzyme-linked immunosorbent assay (ELISA) and high-performance liquid chromatography (HPLC), this system has significant advantages: the detection time is shortened from 2 - 3 hours for ELISA and 1 hour for HPLC to within 1 minute; it avoids the possible cross-reaction problems in ELISA; it does not require a large amount of organic solvents for sample pretreatment compared with HPLC; at the same time, the system can detect multiple toxins simultaneously, while traditional methods usually require separate detection for different toxins.

[0119] In this embodiment, the detection model of the system of the present invention is deployed on 4 different devices, and the model performance is continuously optimized through the federated distillation mechanism. Experimental data shows that after 100 rounds of federated learning, the average detection accuracy of the system is improved from the initial 87.5% to 98.3%, while the traditional centralized training method can only reach an accuracy of 92.1% with the same amount of data.

[0120] Example 5: Synergistic Detection of Three Herbicides Residues in Tea

[0121] This example demonstrates the synergistic detection application of the system of the present invention for three herbicides residues, namely glyphosate, paraquat and 2,4-dichlorophenoxyacetic acid (2,4-D), in tea.

[0122] Select organic green tea samples, grind them and add standard glyphosate, paraquat and 2,4-D solutions to prepare samples with concentrations of 0.05 mg / kg, 0.1 mg / kg and 0.5 mg / kg respectively.

[0123] Different from the previous examples, the tea matrix contains a large number of interfering substances such as polyphenols and amino acids, which pose a great challenge to the detection. Therefore, this example adopts optimized data acquisition parameters: when collecting X-ray backscattering, use an energy of 50 keV, an irradiation angle of 35°, and a collection time of 25 seconds; when collecting Raman spectra, use a 785 nm laser, a power of 180 mW, and an integration time of 15 seconds, and pay special attention to the wavenumber range of 600 - 1800 cm^-1.

[0124] This example particularly demonstrates the optimization process of the present invention in a distributed environment. Specifically, the system is deployed at detection stations in 5 different locations. Each station independently collects and processes the data of local tea samples, but does not share the original data.

[0125] During the federated distillation process, the data processing module 2 at each station trains a model based on local data, and only transmits the model parameters to the cloud module 1 through the communication and data acquisition module 4. The cloud module 1 integrates the model knowledge of each station into a lightweight model through the teacher-student distillation mechanism and then distributes it to each station. This process not only protects data privacy but also greatly reduces communication overhead.

[0126] Specifically, the federated distillation loss function in this example adopts an improved form targeting the characteristics of the tea matrix:

[0127] L fed =β 1 ·L ce +β 2 ·L kd +β 3 ·L reg ,

[0128] where L ce is the cross-entropy loss, L kd is the knowledge distillation loss, L r eg is the regularization term, and β 1 , β 2 , β 3is the weight coefficient, which is set to 0.4, 0.5, and 0.1 respectively through experiments. This loss function configuration is particularly suitable for dealing with the complex detection scenarios of herbicides in tea leaves.

[0129] In view of the strong background interference in tea samples, in this embodiment, an adaptive optimization is carried out on the residual compression coding method. An attention gating mechanism is added to the residual bottleneck module, enabling the network to automatically focus on herbicide features and suppress the tea matrix background:

[0130] A i = σ(W a ·F i + b a ),

[0131] F i ′ = A i ⊙ F i ,

[0132] where A i is the attention weight, F i is the original feature, σ is the sigmoid function, W a and b a are learnable parameters, ⊙ represents element-wise multiplication, and F′ i is the weighted feature. This mechanism enables the network to more accurately identify herbicide features in complex matrices.

[0133] The collaborative detection results of the three herbicides in tea by the system of the present invention show that the detection limits of glyphosate, paraquat, and 2,4-D reach 0.02 mg / kg, 0.01 mg / kg, and 0.03 mg / kg respectively, and the average relative error is controlled within 4%, meeting the requirements of national food safety standards.

[0134] It should be noted that the system of the present invention is particularly suitable for dealing with complex matrix samples such as tea leaves. Compared with the existing liquid chromatography-mass spectrometry method, this system does not require cumbersome sample pretreatment (the traditional method requires multiple steps such as extraction, purification, and concentration, taking about 3 hours), and the direct detection time is only 1 minute; compared with the traditional enzyme inhibition method, this system avoids the interference of polyphenols in tea leaves on enzyme activity and greatly improves the detection accuracy; compared with the existing Raman spectroscopy method used alone, this system effectively overcomes the problem of fluorescence background interference through multi-modal data fusion.

[0135] In particular, the distributed learning implemented by the federated distillation mechanism of the present invention enables the system to integrate data features from different tea-producing areas without sharing the original data, protecting data privacy while improving the model's adaptability to different tea varieties. After testing, after 200 rounds of federated learning, the detection accuracy of the system for unseen tea varieties (such as white tea, black tea, etc.) can still reach over 95%, demonstrating excellent generalization ability.

[0136] Through the detailed description of the above three embodiments, it can be seen that the food multi-residue collaborative detection system and method of the present invention have significant advantages compared with the prior art, including the improved detection accuracy brought by multi-modal data fusion, privacy protection and model optimization achieved by the federated distillation framework, efficient feature extraction brought by residual compression coding, and the fast detection ability of the overall system. These advantages make the present invention have broad application prospects in the field of food safety.

[0137] Example 6: Detailed algorithm of the residual compression coding method

[0138] As Figure 2 shown, the residual compression coding method is one of the core innovations of the present invention. This method is based on deep learning technology and is specifically designed for efficient feature extraction and dimensionality reduction of X-ray backscattering feature maps. Compared with traditional convolutional neural networks, the residual compression coding method of the present invention significantly reduces the computational complexity while retaining key features through a multi-level residual structure and a special bottleneck module, and is particularly suitable for feature extraction tasks in food multi-residue detection.

[0139] The specific algorithm steps of the residual compression coding method are as follows:

[0140] Step 1: Initial feature extraction

[0141] Input the X-ray backscattering feature map I ∈ R H×W×C , where H, W, and C represent the height, width, and number of channels of the map respectively.

[0142] First, perform feature extraction through an initial convolutional layer:

[0143] F 0 = Conv(I, W 0 , b 0 ),

[0144] where Conv represents the convolution operation, is the convolution kernel weight, is the bias term, k is the convolution kernel size (usually set to 7×7), C 1 is the number of output channels (usually set to 64). is the initial feature extracted, where H' and W' depend on the convolution stride and padding settings.

[0145] Step 2: Processing by the residual bottleneck module

[0146] Input the initial feature F 0 into the residual bottleneck module for processing:

[0147] F 1 = ResBottleneck(F 0 ),

[0148] The internal structure of the residual bottleneck module is defined as follows:

[0149] F 1,i = ReLU(BN(Conv 3×3 (F 0 , W 1,i , b 1,i ))),

[0150] where i ∈ {1, 2,..., 7} represents 7 parallel convolutional branches, each branch uses a 3×3 convolutional kernel, and the number of output channels is 128. BN represents the batch normalization operation, and ReLU represents the ReLU activation function. Finally, the output of the residual bottleneck module is

[0151] F 1 = F 0 + Concat(F 1,1 , F 1,2 ,..., F 1,7 ),

[0152] where Concat represents the feature concatenation operation in the channel dimension, and then the number of channels is adjusted by a 1×1 convolution to match the dimension of F 0 to achieve the residual connection.

[0153] Step 3: Processing by the convolutional layer and the linear bottleneck module

[0154] Input F 1 into a convolutional layer for processing:

[0155] F 2 = Conv(F 1 , W 2 , b 2 ),

[0156] Then input it into the linear bottleneck module:

[0157] F 3 = LinearBottleneck(F 2 ),

[0158] The definition of the linear bottleneck module is as follows:

[0159] F 3,1 = Conv 1×1 (F 2 , W 3,1 , b 3,1 ),

[0160] F 3,2 = Conv 3×3 (F 3,1 , W 3,2 , b 3,2 ),

[0161] F 3 = F 2 + F 3,2 ,

[0162] Among them, Conv 1×1 and Conv 3×3 respectively represent 1×1 and 3×3 convolution operations. The number of channels of F 3,1 is 256, the number of channels of F 3,2 is 128, and it matches with F 2 to achieve residual connection.

[0163] Step 4: Residual dilation module processing

[0164] F 4 = ResDilation(F 3 ),

[0165] The residual dilation module uses dilated convolution for feature extraction:

[0166] F 4,1 = DilatedConv 3×3,r=2 (F 3 , W 4 , b 4 ),

[0167] F 4 = F 3 + F 4,1 ,

[0168] Among them, DilatedConv 3×3,r=2 represents a 3×3 dilated convolution with a dilation rate of 2, and the output number of channels is 256. The advantage of dilated convolution is that it can expand the receptive field and capture more context information without increasing the number of parameters.

[0169] Step 5: Feature fusion and concatenation

[0170] The output F 1 of the residual bottleneck module and the output F of the residual dilation module4 Perform splicing:

[0171] F 5 = Concat(F 1 , F 4 ),

[0172] Then adjust the number of channels through the convolutional layer:

[0173] F 6 = Conv(F 5 , W 6 , b 6 _,

[0174] Step 6: Process with the residual compression module

[0175] Input F 6 into the residual compression module for processing:

[0176] F 7 = ResCompression(F 6 _,

[0177] The definition of the residual compression module is as follows:

[0178] F 7,1 = Conv 1×1 (F 6 , W 7,1 , b 7,1 _,

[0179] F 7,2 = Conv 3×3 (F 7,1 , W 7,2 , b 7,2 ),

[0180] F 7,3 = Conv 1×1 (F 7,2 , W 7,3 , b 7,3 ),

[0181] F 7 = F 6 + F 7,3 ,

[0182] where the number of channels of F 7,1 , F 7,2 and F 7,3 is the same as that of F 6 , unless the number of channels needs to be changed in the last layer. The design purpose of the residual compression module is to reduce the feature map size through the residual structure while retaining key information.

[0183] Step 7: Continue convolution and the second residual compression

[0184] Apply F 7 through another convolutional layer:

[0185] F 8 = Conv(F 7 , W 8 , b 8 ),

[0186] Then input it into the second residual compression module:

[0187] F 9 = ResCompression(F 8 ),

[0188] The second residual compression module has the same structure as the first one, but different parameters.

[0189] Step 8: Processing by the lightweight MobileNet module

[0190] Apply F 9 through a convolutional layer and then input it into the lightweight MobileNet module:

[0191] F 10 = Conv(F 9 , W 10 , b 10 ),

[0192] F 11 = ResDilation(F 10 ),

[0193] F 12 = MobileNet(F 11 ),

[0194] The lightweight MobileNet module adopts a depthwise separable convolution structure, defined as follows:

[0195] F 12,1 = DepthwiseConv 3×3 (F 11 , W 12,1 , b 12,1 ),

[0196] F 12,2 = PointwiseConv 1×1 (F 12,1 , W 12,2 , b 12,2 ),

[0197] F 12 = ReLU(BN(F 12,2 ))

[0198] Among them, DepthwiseConv 3×3 represents a 3×3 depth convolution, and PointwiseConv 1×1 represents a 1×1 pointwise convolution. The depthwise separable convolution decomposes the standard convolution into two-step operations, significantly reducing the computational amount and the number of parameters.

[0199] Step 9: Feature map generation and output

[0200] The output F of the lightweight MobileNet module 12 is used as the feature map and is input into the last two convolutional blocks of ResNet50 after passing through a convolutional layer:

[0201] F 13 = Conv(F 12 , W 13 , b 13 ),

[0202] F 14 = ResNet50 Block 4(F 13 ),

[0203] F 15 = ResNet50 Block 5(F 14 ),

[0204] Finally, the final prediction result is obtained through global average pooling and two fully connected layers:

[0205] F 16 = GlobalAvgPool(F 15 ),

[0206] F 17 = FC(F 16 , W 17 , b 17 ),

[0207] Output = FC(F 17 , W out , b out ),

[0208] Among them, GlobalAvgPool represents the global average pooling operation, and FC represents the fully connected layer. The output dimension of the first fully connected layer is usually 1024 or 512, and the output dimension of the second fully connected layer is equal to the number of categories of the pesticide residues to be detected.

[0209] Key optimizations of the residual compression coding method:

[0210] Multi - path Feature Extraction: Through the 7 parallel convolutional branches in the residual bottleneck module, multi - scale features can be extracted, enhancing the recognition ability for pesticide residue features of different sizes.

[0211] Dilated Convolution Receptive Field Expansion: The dilated convolution in the residual dilation module expands the receptive field, enabling the network to capture a larger range of context information and improving the detection ability for low - concentration residues.

[0212] Gradient Optimization of Residual Connections: The residual connections in each module effectively solve the problem of gradient vanishing in deep networks, enabling deeper networks to be stably trained and extract more abstract features.

[0213] Computational Optimization of Depth - wise Separable Convolution: The depth - wise separable convolution in the lightweight MobileNet module significantly reduces the computational complexity, enabling the model to be deployed on resource - constrained devices.

[0214] Balance between Feature Compression and Information Preservation: The residual compression module, through a special bottleneck structure, reduces the feature dimension while retaining key information, achieving a balance between computational efficiency and detection accuracy.

[0215] Through the above algorithm steps, the residual compression and encoding method of the present invention can effectively extract the key information in the X - ray backscattering feature map, and reduce the computational complexity through dimensionality reduction operations, providing an efficient feature representation for multi - residue co - detection of food. In practical applications, compared with traditional CNN models, this method reduces the computational amount by about 65% and the memory occupancy by about 50% while maintaining the detection accuracy, and is particularly suitable for deployment on edge devices.

[0216] It should be noted that the above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. Food multi-residue collaborative detection system, characterized by: include: The cloud module is used to build a heterogeneous data fusion network and adopt the federated distillation mode to keep synchronized updates with various detection models; A data processing module in the local area network is connected to the cloud module to retrieve data and update the detection model; The acquisition module is set at the detection site to collect the X-ray backscattering characteristic spectrum, Raman spectrum and food concentration index of the food to be tested; The communication and data acquisition module is connected to the acquisition module and the data processing module, and is used to transmit the data collected by the acquisition module to the data processing module.

2. The food multi-residue collaborative detection system according to claim 1, characterized in that: When updating the detection model, each data processing module collects the X-ray backscattering characteristic spectrum, Raman spectrum and food concentration index of the object to be tested on site, calculates the loss value of the detection model, and then packages the detection model, X-ray backscattering characteristic spectrum, Raman spectrum and food concentration training data and sends them to the cloud module.

3. The food multi-residue collaborative detection system according to claim 1, characterized in that: The detection model includes: an image recognition module, a Raman spectrum recognition module and a food concentration detection module.

4. The food multi-residue collaborative detection system according to claim 3, characterized in that: The input of the image recognition module is the X-ray backscattering feature spectrum collected by the acquisition module, and the residual compression coding method is used to reduce the dimension of the spectrum features.

5. The food multi-residue collaborative detection system according to claim 4, characterized in that: The steps of the residual compression coding method are as follows: inputting the X-ray backscatter feature map into the image recognition module, based on ResNet50 as the backbone of the image recognition module, first passing through a convolution layer and a residual bottleneck module; the output of the residual bottleneck module passes through a convolution layer, a linear bottleneck module and a residual expansion module; the output of the residual bottleneck module is spliced ​​with the output of the residual expansion module, and then passes through a convolution layer, a residual compression module and a convolution layer, and its output passes through a convolution layer and a residual compression module; the output passes through a convolution layer, a residual expansion module and a lightweight MobileNet module to output a feature map; the feature map passes through a convolution layer and serves as the input of the last two convolution blocks of ResNet50; finally, a prediction is output through a pooling layer and two fully connected layers.

6. The food multi-residue collaborative detection system according to claim 1, characterized in that: The input of the Raman spectrum recognition module is the Raman spectrum collected by the acquisition module, and the Raman spectrum data is input into the multi-layer perceptron MLP as the Raman spectrum recognition module to extract spectrum features; The last layer of the multi-layer perceptron uses a normalization layer, and the output result is the concentration of the sample to be tested.

7. The food multi-residue collaborative detection system according to claim 1, characterized in that: An attention parameter distillation mechanism is adopted between the cloud module and the data processing module. By calculating the attention coefficient weight of each sub-feature, the sub-features are weighted and then feature fusion is performed to form a heterogeneous data fusion network.

8. The food multi-residue collaborative detection system according to claim 1, characterized in that: The cloud module performs distillation training on the pre-trained teacher network Model_tea to obtain a lightweight student network Model_stu based on the image recognition module, and sends the lightweight student network Model_stu to the data processing module.

9. The food multi-residue collaborative detection system according to claim 7, characterized in that: The attention coefficient is calculated by the following formula: i,j =Softmax(W θ (i,j)·γ), where w i ,j represents the attention coefficient; Softmax(·) is the normalized exponential function, W θ (i,j) means the value of the i-th row and the j-th column in the matrix after the parameters are weighted.

10. A method using the food multi-residue collaborative detection system according to any one of claims 1 to 9, characterized in that: The following steps are involved: Step S1: collecting X-ray backscattering characteristic spectra, Raman spectra and food concentration indicators of food; Step S2: The cloud module constructs a heterogeneous data fusion network of X-ray backscattering characteristic maps and Raman spectra, and uses a federated distillation method to collect and update the detection model, and packages the latest detection model, X-ray backscattering characteristic maps, Raman spectra, food concentration indicators and training data and sends them to the cloud module to update the detection model; Wherein, the federal distillation method comprises: S2.1: The cloud module collects the image recognition modules of each detection model, constructs the image recognition model as the pre-trained teacher network Model_tea, performs distillation training on the pre-trained teacher network Model_tea, obtains the lightweight student network Model_stu based on the image recognition module, and sends the lightweight student network Model_stu to the client; S2.2: The data processing module receives the lightweight student network Model_stu sent by the cloud module; S2.3: The data processing module collects the Raman spectrum recognition modules of each detection model, performs distillation training based on the Raman software feature map, and obtains a lightweight student network as a client Raman spectrum recognition module; S2.4: The data processing module collects the food concentration detection modules of each detection module, updates the food concentration detection modules, and obtains the latest food concentration detection modules; S2.5: Through data fusion, the latest image recognition module, Raman spectrum recognition module and food concentration detection module are packaged and sent to the cloud module to update the detection model of the cloud module.