Food and drug inspection data processing method based on artificial intelligence technology

By generating adversarial network expansion data sets, extracting features of ecosystem optimization algorithms, sparse autoencoder dimensionality reduction and quantum encoding classification algorithms, the complexity, insufficient generalization ability and slow classification speed in food and drug inspection data processing are solved, and efficient and accurate data processing and classification are achieved.

CN120197039APending Publication Date: 2025-06-24ZHEJIANG HONGCHENG COMP SYST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510248872.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-04
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The prior art faces the problems of data complexity, insufficient data volume, insufficient diversity, difficulty in processing high-dimensional data, and difficulty in meeting the accuracy and speed of classification algorithms in large-scale complex data processing.

Method used

By generating adversarial network technology to expand the training data set, neural networks based on ecosystem optimization algorithms perform feature extraction, improved sparse autoencoder structures combine distance measurement learning to reduce feature dimensionality, and extreme learning machine classification algorithms based on quantum encoding improve the speed of data processing and classification.

Benefits of technology

It effectively solved the problems of difficulty in collecting food and drug inspection data, insufficient generalization ability of model, inaccurate feature extraction, dimensional disasters and slow classification speed, and improved data utilization, model training effectiveness, feature extraction accuracy, data processing efficiency and classification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120197039A_ABST
    Figure CN120197039A_ABST
Patent Text Reader

Abstract

The invention discloses a food and drug inspection data processing method based on an artificial intelligence technology, and relates to a data processing technology, and the method comprises the following steps: S1, obtaining food and drug data, and marking the data to obtain a pre-selected data set; expanding the pre-selected data set through the target generative adversarial network to obtain a training data set; s2, performing feature training on the training data set based on an ecological system optimization algorithm to extract feature data to construct a feature vector; s3, performing dimension reduction processing on the feature vector through a sparse self-encoding neural network in combination with a distance metric learning algorithm to obtain a target feature vector; s4, performing classification training on the target feature vectors based on an extreme learning machine classification algorithm of quantum coding to construct a target classification model; and S5, obtaining to-be-detected original test data, and sequentially performing the steps S2-S3 to obtain an original feature vector, wherein the target classification model responds to the original feature vector to obtain a data classification result. The scheme can significantly improve the training data quality to guarantee the model classification efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to data processing technologies, and more particularly, to a method for processing food and drug inspection data based on artificial intelligence technology. Background Art

[0002] Nowadays, food and drug safety has become one of the important guarantees for public health, and its inspection and quality control processes play a crucial role in protecting consumers' health and maintaining market order. With the development of technology, artificial intelligence technology has been widely used in the processing of food and drug inspection data. However, there are many challenges and deficiencies in the existing technologies: First of all, the data generated during the food and drug inspection process usually has a high degree of complexity, including data from multiple dimensions such as chemical composition analysis, microbial detection, and physical property testing. These data are not only large in quantity and complex in quality, but also have complex non-linear relationships among them. Traditional data processing methods are difficult to effectively capture and utilize these complex data features, resulting in inaccurate feature extraction and affecting the judgment of the final inspection results. Secondly, the data in the field of food and drug inspection usually faces the problems of insufficient data volume and lack of data diversity. Due to experimental conditions, cost, and time constraints, it is difficult to obtain a large amount of diverse experimental data, which directly affects the training quality and generalization ability of the data analysis model, causing the model to degrade in performance when facing new or changing data. Moreover, the processing of high-dimensional data has always been one of the difficult problems in the field of data science, and food and drug inspection data often has high-dimensional characteristics. High-dimensional data not only increases the computational complexity and resource consumption, but also may lead to the curse of dimensionality, that is, as the data dimension increases, the spatial sparsity of the data increases, resulting in low model training efficiency and weak generalization ability. In addition, fast and accurate classification prediction is a key requirement for food and drug inspection data processing. Existing classification algorithms often struggle to meet the requirements of large-scale complex data processing in terms of accuracy, speed, or stability, especially the rapid judgment of food and drug safety in emergency situations is a test of the limits of existing technologies.

[0003] In summary, the existing technologies mainly have the following deficiencies: 1. The existing technologies may face challenges in the collection and utilization of food and drug inspection data. In particular, it is difficult to obtain high-quality and large-scale experimental data, which limits the effectiveness of model training, resulting in insufficient generalization ability of the trained model and difficulty in adapting to new or unseen data; 2. Traditional feature extraction methods may not be able to fully explore the complex relationships and internal features in food and drug inspection data, resulting in insufficient or inaccurate feature information extraction, affecting the effects of subsequent data analysis and classification; 3. In the face of high-dimensional data, existing technologies may encounter the problem of the curse of dimensionality, resulting in low computational efficiency, especially limited processing performance on large-scale data sets. In addition, the processing and storage of high-dimensional data also increase the consumption of computing resources; 4. Existing classification algorithms may not achieve high classification accuracy and speed when dealing with large-scale and complex data sets. Especially in the field of food and drug inspection where extremely high accuracy is required, existing technologies may not meet the needs of fast and accurate classification.

[0004] The above information disclosed in the background art section is only used to enhance the understanding of the background of the present application, so it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention

[0005] The object of the present invention is to propose a food and drug inspection data processing method based on artificial intelligence technology for the above deficiencies. By using the generative adversarial network technology to expand the training data set, it aims to increase the scale and diversity of the data set by generating high-quality synthetic data without increasing the experimental cost and time, thereby improving the data utilization rate and the effectiveness of model training; further adopting a neural network model based on the ecosystem optimization algorithm for feature extraction, aiming to more effectively capture and extract the key information and internal features in the data, thereby improving the accuracy of subsequent data analysis and classification; further reducing the dimension of the data through an improved sparse autoencoder structure combined with distance metric learning, aiming to retain the most important information while reducing the dimension of the data, so as to improve the efficiency of data processing and the performance of the classification model; finally, the extreme learning machine classification algorithm based on quantum coding improves the speed of data processing and classification.

[0006] Specifically, a technical solution provided by the present invention is a food and drug inspection data processing method based on artificial intelligence technology, including the following steps: S1. Obtain food and drug data and label it to obtain a preselected data set; expand the preselected data set through a target generative adversarial network to obtain a training data set; S2. Perform feature training on the training data set based on the ecosystem optimization algorithm to extract feature data and construct a feature vector; S3. Perform dimensionality reduction processing on the feature vector through a sparse autoencoder neural network combined with a distance metric learning algorithm to obtain a target feature vector; S4. Perform classification training on the target feature vector based on the extreme learning machine classification algorithm based on quantum coding to construct a target classification model; S5. Obtain the original test data to be detected and sequentially obtain the original feature vector through S2 - S3, and the target classification model obtains a data classification result in response to the original feature vector.

[0007] Preferably, the S1 includes the following steps: The food and drug testing data shall at least include chemical content, microbial count, shelf life, pH value, moisture content, heavy metal content, solvent residue, packaging integrity, color and texture; Labeling the collected food and drug testing data, with the labeling categories including at least: qualified, pollutant exceeding the standard, microbiological testing not meeting the standard, and quality not meeting the standard; The food and drug testing data are classified according to the labeled categories to obtain a pre-selected data set.

[0008] Preferably, the S1 further includes constructing a generative adversarial network, comprising the following steps: Initialize the network structure and initialization parameters of the generative adversarial network algorithm, and set the initial state for the generator and discriminator; Randomly sample latent feature vectors from a predefined latent space and use them as input to the generator to obtain a generated dataset; The discriminator determines the authenticity of the generated data in the generated data set relative to the real data; according to the authenticity judgment result, the parameters of the generator and the discriminator are adjusted to obtain the target generative adversarial network; The pre-selected data set is processed and expanded by the target generative adversarial network to obtain the training data set.

[0009] Preferably, before executing S2, it also includes building a feature extraction model based on the ecosystem optimization algorithm; including the following steps: Construct an initial ecosystem containing multiple populations, where the population represents a parameter set P of the neural network model i ={w i ,b i}, where w i and b i Represent the weights and biases of the neural network respectively; Construct the target fitness function F based on environmental variables, genetic factors and individual parameter sets i =f(P i ,E,G); the feature extraction model is characterized by the target fitness function.

[0010] As a preference, the objective fitness function is: F i =f(P i ,E,G)=Sig(κ·L(w i ,b i )+λ·E+μ·G(w i ,b i )+ν·D(w i ,b i ,E)); Among them, w i and b i represent the weight and bias of the i-th parameter set respectively, E is the environmental variable, G(w i , b i ) is the genetic factor function, L(w i , b i ) is the performance evaluation function, D(w i , b i , E) is the mutual environmental interaction function describing the interaction between individual parameters and environmental variables, Sig() is the Sigmoid activation function, and κ, λ, μ, ν are weight coefficients respectively, used to balance the contributions of various factors to fitness.

[0011] Preferably, the calculation formula of the genetic factor function is as follows: Among them, ρ and θ are weight coefficients used to adjust the contributions of each item, w ij、 b ij represent the interaction weights and biases of two parameter sets i and j; Var(w i , b i ) represents the variance of weights and biases, used to measure the diversity of parameters, and n is the upper limit of the parameter set.

[0012] Preferably, the calculation formula of the environmental interaction function is as follows: Among them, η is the weight coefficient, E k represents the k-th element of the environmental variable, m is the upper limit of the elements in the environmental variable, x kj represents the input feature associated with the environmental variable E k , tanh() is the hyperbolic tangent function, w ij、 b ij represent the interaction weights and biases of two parameter sets i and j.

[0013] Preferably, the calculation formula of the genetic factor function is as follows: The calculation formula of the performance evaluation function L(w i , b i ) is as follows: Among them, represents the loss function, and Y is the true label; is the model prediction, obtained by the preset Softmax function.

[0014] Preferably, S3 includes the following steps: Initialize the weights and biases of the autoencoder. The feature vectors input to the autoencoder are forward-propagated through the encoding layer to be transformed into low-dimensional feature representations. Apply sparsity constraints in the encoding layer and ensure that only some neurons are activated by participation limits. Adjust the low-dimensional feature space according to the requirements of the classification task to optimize the distance metric between different categories. Update the network parameters through backpropagation based on the reconstruction error and distance metric error to obtain the target feature vectors.

[0015] Preferably, S4 includes the following steps: Convert the target feature vectors obtained after dimensionality reduction into qubit representations through quantum encoding, with each feature corresponding to one or more qubits; randomly initialize the hidden layer weight and bias parameters of the extreme learning machine; The target feature vectors are input to the hidden layer of the extreme learning machine after quantum encoding. The hidden layer nodes process using quantum states, accelerating feature transformation and non-linear mapping through quantum operations; Optimize the output weights through quantum algorithms, and use quantum search and optimization algorithms to obtain the optimal weight configuration to minimize the classification error; if the minimization of the classification error does not meet the set value range, further optimize the classification model by adjusting the number of hidden layer nodes or re-initializing the hidden layer weight and bias parameters of the extreme learning machine to obtain the target classification model.

[0016] Advantages of the present invention: (1) This application uses the generative adversarial network algorithm based on latent feature transformation, randomly samples latent feature vectors from a predefined latent space as the input of the generator to generate a data set. The discriminator judges its authenticity relative to the real data and adjusts the parameters accordingly, effectively solving the problem of insufficient generalization ability of the model caused by the difficulty in collecting food and drug inspection data and the small scale of the data set. It can generate high-quality synthetic data, enhance the diversity and richness of the training data, enable the model to learn a wider range of data features, and improve the adaptability to new data; (2) This application uses a neural network based on the ecosystem optimization algorithm to construct an initial ecosystem containing multiple populations. The populations represent the parameter sets of the neural network model. A target fitness function is constructed according to environmental variables, genetic factors, and individual parameter sets to characterize the feature extraction model. The network parameters are optimized by simulating the competition and symbiosis mechanisms in the natural ecosystem. Compared with traditional methods, it can capture the complex non-linear relationships and internal features of the data more accurately, improve the efficiency and accuracy of feature extraction, and provide higher-quality feature data for subsequent data analysis; (3) This application introduces an improved sparse autoencoder structure, initializes the weights and biases of the autoencoder, and converts the input feature vectors into low-dimensional feature representations through forward propagation in the encoding layer. A sparsity constraint is applied in the encoding layer, and the low-dimensional feature space is adjusted according to the requirements of the classification task. Combining distance metric learning, the network parameters are updated through backpropagation based on the reconstruction error and distance metric error, which not only improves the sparsity and discriminability of the feature representations, but also optimizes the feature space, making the features after dimensionality reduction more conducive to subsequent classification tasks and reducing the computational complexity and resource consumption. (4) This application combines the principles of quantum computing and extreme learning machines, converts the target feature vectors after dimensionality reduction into qubit representations through quantum encoding, randomly initializes the weights and bias parameters of the hidden layer of the extreme learning machine, and inputs the feature vectors into the hidden layer after quantum encoding. The hidden layer nodes use quantum states for processing, accelerate feature transformation and non-linear mapping through quantum operations, and then optimize the output weights through quantum algorithms, improving the processing speed and accuracy of the classification algorithm, being particularly suitable for processing large-scale and complex data sets, and meeting the extremely high requirements for fast and accurate classification in the field of food and drug inspection.

[0017] The above summary of the invention content is only an overview of the technical solutions of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following specific embodiments of the present invention are specifically given. Brief Description of the Drawings

[0018] By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, purposes and advantages of the present invention will become more obvious. The drawings are only used for the purpose of showing the preferred embodiments, and are not considered as a limitation to the present invention. Moreover, throughout the drawings, the same reference signs are used to represent the same components.

[0019] Figure 1 It is a flowchart of the food and drug inspection data processing method based on artificial intelligence technology of the present invention.

[0020] Figure 2 It is a flowchart of constructing a feature extraction model based on the ecosystem optimization algorithm of the present invention. Detailed Embodiments

[0021] To make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only the best embodiments of the present invention, only used to explain the present invention, and do not limit the protection scope of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

[0022] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts depict operations (or steps) as sequential processes, many of the operations (or steps) can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operations are completed, but it can also have additional steps not included in the drawings; the process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0023] Embodiment: As Figure 1 shown, a method for processing food and drug inspection data based on artificial intelligence technology includes the following steps: S1. Obtain food and drug data and label it to obtain a preselected data set; expand the preselected data set through a target generative adversarial network to obtain a training data set.

[0024] As an alternative embodiment, the data in the present invention is derived from various detection instruments and experimental records in the food and drug inspection process, including but not limited to chemical composition analysis, microbial detection results, physical property test data, etc. The data format is mainly stored in the form of structured data. In one embodiment, the storage format is a CSV file; specifically, S1 includes the following steps: The food and drug detection data at least includes chemical composition content, microbial count, shelf life, pH value, moisture content, heavy metal content, solvent residue, packaging integrity, color, and texture. As shown in Table 1, a1 ··· a10 respectively represent the above data types; Label the collected food and drug detection data. Optionally, in this embodiment, the data labeling method is manual labeling, and the labeling categories at least include: qualified, pollutant exceeded the standard, microbial detection did not meet the standard, and quality not up to standard; Classify the food and drug detection data according to the labeling categories to obtain a preselected data set. Table 1. Data Attribute Table

[0025] It should be emphasized that this embodiment is only to illustrate a data format and type of the present invention. In practical applications, the attributes of the data are usually more than 10 attributes, and the number of data attributes may reach dozens or even hundreds. And for the text type features in the data, the present invention uses the word2vec algorithm to convert them into vector format for subsequent use.

[0026] It can be understood that in the tasks of this application, the acquisition, annotation, and preprocessing of training data are time-consuming and laborious. Moreover, insufficient training samples can easily lead to poor generalization ability of the model and affect the accuracy of the model. This application proposes a generative adversarial network algorithm based on latent feature transformation to achieve effective data augmentation. The improved generative adversarial network framework adopted in this application includes two key parts: a generator and a discriminator. The generator is responsible for generating new data that is as close as possible to real food and drug inspection data, while the discriminator attempts to distinguish between the generated data and the real data. In addition, the present invention introduces a latent feature space exploration mechanism in the generator. This mechanism guides the generation process of synthetic data by analyzing the internal feature distribution of the real data set, thereby more effectively simulating the diversity and complexity of real data.

[0027] As an alternative embodiment, constructing a generative adversarial network includes the following steps: The input is the original data set of food and drug inspection, where each sample contains multiple inspection indicators; initialize the network structure and initialization parameters of the generative adversarial network algorithm, and set the initial states for the generator and the discriminator.

[0028] Specifically, set the parameters of the generator G and the discriminator D to θ g and θ d , respectively. In one embodiment, these parameters are initialized by using small random values or the weights of a pre-trained model.

[0029] Furthermore, randomly sample latent feature vectors from a predefined latent space and use them as the input to the generator to obtain a generated data set.

[0030] Specifically, sample a vector z from the latent space Z, where z ∼ p z (z), and p z is the prior distribution of the latent space; in one embodiment, during the latent feature sampling process, the vector z in the latent space Z follows a Gaussian distribution, which can be expressed as: where μ is the mean vector of the Gaussian distribution and Σ is the covariance matrix.

[0031] In another embodiment, the latent space Z adopts a standard normal distribution, that is, μ = 0 and Σ = I (identity matrix). This setting assumes that the latent features are independent of each other, and each feature follows a normal distribution with a mean of 0 and a variance of 1.

[0032] The generator G takes the latent vector z as input and outputs the generated data x g , and the generation process can be expressed as: x g = G(z; θ g ) The architecture of the generator G is selected as a deep convolutional neural network, and the specific parameter settings include the number of layers, the number of neurons in each layer, etc. In one embodiment, the depth of the generator is set to 5 layers, and the number of neurons in each layer is 1024, 512, 256, 128, and the dimension of the food and drug inspection data, respectively, to match the structure of the output data. In this embodiment, the learning rate α of the generator g is set to 0.0002.

[0033] The discriminator judges the authenticity of the generated data in the generated dataset relative to the real data; the parameters of the generator and the discriminator are adjusted according to the authenticity judgment result to obtain the target generative adversarial network.

[0034] Specifically, the discriminator D evaluates the generated data x g and the real data x r for authenticity, and the output is the probability that the discriminator believes the data comes from the real dataset. The output of the discriminator can be expressed as: D(x g ; θ d ) and D(x r ; θ d ) The discriminator D also adopts a convolutional neural network structure. The depth and layer settings are similar to those of the generator, but are constructed in reverse to gradually extract the features of the input data and finally evaluate its authenticity. In one embodiment, the learning rate α d is set to 0.0002 to ensure a stable training process.

[0035] The preselected dataset is processed and expanded by the target generative adversarial network to obtain the training dataset.

[0036] Specifically, the present invention adopts an improved loss function and combines perceptual loss to optimize the parameters of G and D. For the discriminator, the loss function L d can be expressed as: For the generator, combining the perceptual loss L perceptual , the loss function L g can be expressed as: where L perceptual is the feature difference between the real data x r at a specific layer, and λ is a balance factor used to adjust the weight of the perceptual loss in the total loss. In one embodiment, λ is set to 10.

[0037] Furthermore, for the loss function L of the discriminator d, it can be further decomposed into two parts, corresponding to the losses of real data and generated data respectively, and can be expressed as: The above two expressions calculate the evaluation losses of the discriminator for real data and generated data respectively, where the integral is carried out over the distribution of the corresponding data.

[0038] In one embodiment, for the perceptual loss L in the loss function of the generator perceptual , it is calculated based on the Euclidean distance between feature representations and can be expressed as: Among them, f() represents the feature representation function extracted from a preset deep network, represents the square of the Euclidean distance.

[0039] The model is iteratively trained until the maximum number of iterations is satisfied. In each step, the update of the parameters follows the gradient descent method and can be expressed as: Among them, α d and α g are the learning rates of the discriminator and the generator respectively.

[0040] Furthermore, in the process of parameter update, the parameter updates of the discriminator and the generator are realized by the gradient descent method, where the calculation of the gradient involves the partial derivative of the loss function with respect to the parameters. Taking the discriminator as an example, the partial derivative of its parameter update can be expressed as: The above formula calculates the gradient of the loss function with respect to the discriminator parameters.

[0041] In this embodiment, the output is an augmented dataset, which contains new food and drug inspection data generated by the generative adversarial network. These data are similar to the original dataset in statistical characteristics but different in specific values, increasing the diversity of the data.

[0042] The augmented samples are input into the feature extraction model for training the feature extraction model. In the present invention, a neural network is used as the feature extraction model to extract features from data. However, traditional neural network parameter optimization methods use gradient descent, which is prone to falling into local optima during parameter optimization and also easily leads to gradient vanishing and gradient explosion phenomena. Inspired by the mechanism in which species in an ecosystem survive and reproduce through mutual competition, symbiosis, and adaptation to environmental changes, this application proposes a neural network parameter optimization method based on ecosystem optimization. In the ecosystem optimization algorithm, each parameter (weight w and bias b) of the neural network is regarded as an individual organism in an ecosystem, and its survival and reproduction ability are determined by its fitness (i.e., the difference from the expected output). These parameters are optimized by simulating the natural selection and genetic variation processes in the ecosystem, thereby improving the performance of the neural network. In addition, the ecosystem optimization algorithm adopts a diversity preservation mechanism based on the niche theory, aiming to prevent premature convergence and local optima by maintaining the diversity of the parameter population to explore a broader solution space.

[0043] As an alternative embodiment, S2. Feature training is performed on the training data set based on the ecosystem optimization algorithm to extract feature data and construct a feature vector.

[0044] As Figure 2 shown, before executing S2, it also includes constructing a feature extraction model based on the ecosystem optimization algorithm; including the following steps: Construct an initial ecosystem containing multiple populations, where a population represents a parameter set P i ={w i , b i}, where w i and b i represent the weight and bias of the neural network respectively; Construct a target fitness function F i =f(P i , E, G); the feature extraction model is characterized by the target fitness function.

[0045] Specifically, the structure of the neural network is as follows: 1. Input layer: The number of neurons is set according to the number of features of the input data. 2. Hidden layer: It contains 2 hidden layers, with 50 and 80 neurons in each hidden layer respectively. 3. Output layer: The number of neurons in the output layer is set to 100.

[0046] Specifically, the process of neural network training based on ecosystem optimization is as follows: Generate an initial ecosystem that contains multiple populations, where each population represents a set of parameters in a neural network, and the fitness of each individual is determined by its performance on a specific task. Perform an initialization operation on this ecosystem. Specifically, construct an ecosystem containing N individuals, where each individual represents a parameter set P i ={w i ,b i}, where w i and b i represent the weights and biases of the neural network respectively. The initial fitness F i of an individual is determined by its performance on a specific task and is evaluated through a non-linear function f(). This function takes into account various ecological and genetic factors. The non-linear function f() calculates using environmental variables (E), genetic factors (G), and the individual's parameter set (including weights w and biases b). The target fitness function can be expressed as: F i =f(P i ,E,G)=Sig(κ·L(w i ,b i )+λ·E+μ·G(w i ,b i )+ν·D(w i ,b i ,E)); where w i and b i represent the weights and biases of the i-th parameter set respectively, E is the environmental variable, G(w i ,b i ) is the genetic factor function, L(w i ,b i ) is the performance evaluation function, D(w i ,b i ,E) is the function describing the mutual environmental interaction between the individual parameters and the environmental variable, Sig() is the Sigmoid activation function, and κ, λ, μ, ν are weight coefficients used to balance the contributions of various factors to the fitness.

[0047] Furthermore, the genetic factor function G(w i ,b i ) considers the diversity and complexity of the parameters, and its calculation method can be expressed as: where ρ and θ are weight coefficients used to adjust the contributions of each term, w ij、 b ij represent the interaction weights and biases of two parameter sets i and j; Var(w i ,b i) Represents the variances of weights and biases, used to measure the diversity of parameters, where n is the upper limit of the parameter set.

[0048] The environmental interaction function D(w i ,b i ,E) simulates the interaction between individual parameters and the environment and can be expressed as: where η is the weight coefficient, and E k represents the k-th element of the environmental variable, m is the upper limit of the elements in the environmental variable, and x kj represents the input feature associated with the environmental variable E k , tanh() is the hyperbolic tangent function, and w ij、 b ij represents the interaction weights and biases between two parameter sets i and j.

[0049] The performance evaluation function L(w i ,b i ) is based on the performance of the neural network on a specific task. Considering that generally, the better the performance, the smaller the loss function value, the present invention uses the negative value or the reciprocal of the loss function to represent the performance and can be expressed as: where, represents the loss function, and Y is the true label; is the model prediction obtained by the preset Softmax function.

[0050] Calculate the fitness of each individual to determine its viability in the ecosystem. Individuals with higher fitness will have a greater chance of reproducing offspring.

[0051] Specifically, the calculation of fitness is based on the current state of the individual and its interaction with other individuals within the ecosystem. Let S ij be the interaction strength between individuals i and j. The fitness function of the individual can be expressed as: where F′ i is the fitness after considering ecological interactions; α is the weight adjustment coefficient, representing the degree of influence of the interaction between individuals; C′ ij and S′ ij are the self-adaptively adjusted ecological interaction parameters. In one embodiment, α is set to 0.5.

[0052] Furthermore, the self-adaptive adjustment of C′ ij and S′ ij is adjusted according to the ecological network state evaluation Φ, that is, the competition intensity C ij and the symbiosis intensity Sij Perform adaptive adjustment, and the adjustment method can be expressed as: C′ ij = C ij ·θ(Φ,ΔΦ) S′ ij = S ij ·ψ(Φ,ΔΦ) where θ and ψ are adaptive functions for adjusting competition and symbiosis intensities respectively, Φ is the performance feedback function, and ΔΦ represents the change in Φ, that is, the difference between the current evaluation and the previous evaluation.

[0053] Furthermore, the performance feedback function Φ is based on the performance of the neural network on the validation set (to evaluate the overall state of the current ecological network. In one embodiment, the calculation method of the performance feedback function Φ can be expressed as: Φ = w1·F accuracy (P) - w2·F complexity (C) + w3·F diversity (D) - w4·F time (T) where w1, w2, w3, w4 are weight coefficients used to balance the contributions of different metrics.

[0054] The component functions are respectively: Accuracy function F accuracy (P): F accuracy (P) = log(1 + P) Complexity function F complexity (C): Diversity function F diversity (D): F diversity (D) = tanh(D) Time function F time (T): F time (T) = log(1 + T) where P is the accuracy, L is the average loss value; C is the network complexity, which is proportional to the number of parameters in this embodiment; D is the data diversity index, which is proportional to the variance of data features; T is the training time, which is proportional to the number of iterations.

[0055] Furthermore, the ecological interaction intensity S ij refers to the degree of mutual influence between two individuals i and j in the ecosystem, including the competition intensity C ij and the symbiosis intensity S ij , and can be expressed as: S ij = λC ij + (1 - λ)S ij Among them, λ is the intensity adjustment balance factor, which is used to adjust the relative importance of competition and symbiotic effects. In one embodiment, λ is set to 0.6.

[0056] Furthermore, the competition intensity C ij is calculated according to the resource requirements and the degree of overlap, and the calculation method can be expressed as: where C ij is the competition intensity between individuals i and j, and respectively represent the demands of individuals i and j for the r-th resource, R is the total number of resource categories, and the exponential function functions to smooth the influence of the demand differences between individuals, ensuring that even small demand differences can be reflected in the competition intensity.

[0057] The symbiotic intensity S ij reflects the degree of mutual cooperation between two individuals and is measured by the efficiency of their shared resources, and can be expressed as: where S ij is the symbiotic intensity between individuals i and j.

[0058] Simulate the natural selection process, select individuals with higher fitness for reproduction, and at the same time eliminate individuals with lower fitness. The probability P i that individual i is selected can be calculated as: where P i is the probability that individual i is selected.

[0059] Perform regeneration and reproduction, simulate the genetic variation process of organisms, and individuals with higher fitness produce offspring through crossover and mutation operations in the genetic algorithm. Specifically, let P′ i and P′ j be the parent individuals, and their offspring P k is generated through the following crossover formula: P k =γP′ i +(1 - γ)P′ j where γ is the crossover coefficient, which determines the fusion ratio of the genetic information of the parent generation; P′ i and P′ j are the parameter sets of the parent individuals. In one embodiment, γ is set to 0.7.

[0060] Furthermore, the mutation operation is realized by adding a random perturbation ΔP, and its magnitude is controlled by the mutation rate μ, and can be expressed as: P' k = P k + μΔP where P k is the parameter set of the offspring individual; μ is the mutation rate, controlling the amplitude of the mutation operation; in one embodiment, the mutation rate μ is set to 0.1.

[0061] Furthermore, the role of the genetic mutation perturbation ΔP is to increase the diversity of the population, and the calculation method of this perturbation term can be expressed as: ΔP = ζ·(U - 0.5) where ΔP is the random perturbation in the mutation operation, ζ is the perturbation amplitude control coefficient, and U is a random vector with the same dimension as P, and its elements are drawn from the uniform distribution U(0, 1). In one embodiment, ζ is set to 0.05 to control the amplitude of the mutation.

[0062] Simulate the ecological interactions between individuals, such as competition and symbiotic relationships, which affect the fitness and survival ability of individuals. Specifically, the present invention sets an ecological interaction matrix I, where the element I ij represents the relationship type between individuals i and j, and this relationship will affect the fitness update of individuals, and can be expressed as: where F″ i is the fitness update function considering ecological interactions.

[0063] Simulate the impact of environmental changes on the ecosystem, such as changes in resources, new adaptation challenges, etc., forcing individuals to adapt to the new environment, resulting in further optimization of the parameters within the ecosystem. Specifically, the environmental changes are simulated by modifying the environmental complexity coefficient ∈, thereby affecting the fitness calculation of individuals, and the fitness adjustment caused by environmental pressure can be expressed as: F″′ i = F″ i ·(1 + ∈ΔE) where F″′ i is the finally adjusted fitness, ∈ is the environmental complexity coefficient preset by humans; ΔE is the environmental change factor, which describes the degree of environmental change from the previous generation to the current generation, and the calculation method can be expressed as: where F′ i is the fitness of individual i in the current environment, F i is the fitness in the previous generation environment, and ΔE is the environmental change factor.

[0064] Update the parameters of the neural network according to the fitness of individuals in the ecosystem and ecological dynamics to reflect the evolution of biological individuals in the ecosystem. Specifically, update the parameters of the individual based on the fitness F″′ adjusted by ecological interactions and environmental pressures i , which can be expressed as: where is the updated set of individual parameters, η is the learning rate, representing the step size of parameter update; G i is the gradient pointing in the direction of the maximum increase in fitness. In one embodiment, η is set to 0.01.

[0065] Perform dimensionality reduction on the feature vectors after feature extraction. In this embodiment, an improved sparse autoencoder neural network structure is adopted and combined with distance metric learning to achieve more effective feature dimensionality reduction. Traditional autoencoders convert high-dimensional data into low-dimensional representations through an encoding process and then reconstruct the data through a decoding process. In this embodiment, a sparsity constraint is introduced on this basis to prompt the model to learn more meaningful and discriminative low-dimensional representations. At the same time, the autoencoder structure in this embodiment further enhances sparsity through participation limit. During the encoding process, only some neurons are activated, making the representation more concentrated and effective. In addition, to make the features after dimensionality reduction more conducive to subsequent classification tasks, this embodiment integrates distance metric learning to optimize the distance metric between samples in the feature space to improve the discrimination between different classes.

[0066] S3. Perform dimensionality reduction on the feature vectors through a sparse autoencoder neural network combined with a distance metric learning algorithm to obtain the target feature vectors.

[0067] As an alternative embodiment, S3 includes the following steps: Initialize the weights and biases of the autoencoder. The feature vectors input to the autoencoder are forward propagated through the encoding layer to be converted into low-dimensional feature representations; apply sparsity constraints in the encoding layer to ensure that only some neurons are activated through participation limit; adjust the low-dimensional feature space according to the requirements of the classification task to optimize the distance metric between different classes; update the network parameters through backpropagation according to the reconstruction error and distance metric error to obtain the target feature vectors.

[0068] Specifically, the training process of the improved sparse autoencoder neural network is as follows: 1. Initialization: Initialize the weights and biases of the autoencoder. In the initialization stage, the weights eW and biases eb of the autoencoder are set to small random values to break symmetry and start an effective learning process, which can be expressed as: where Denotes a normal distribution with a mean of 0 and a variance of σ 2 . In one embodiment, σ is set to 0.01.

[0069] 2. Forward propagation: The input data (feature vector) is converted into a low-dimensional feature representation through the encoding layer. Specifically, the input data ex to the autoencoder undergoes forward propagation through the encoding layer and is converted into a low-dimensional feature representation ez. That is, ez is the low-dimensional feature representation output by the encoding layer and can be expressed as: ez = Sig(eW·ex + eb) where Sig() is the Sigmoid activation function.

[0070] 3. Sparsity constraint: Apply a sparsity constraint in the encoding layer to ensure that only some neurons are activated by means of participation limit. In the present invention, during the encoding process, a sparsity constraint is adopted to ensure that only some neurons are activated, which can be expressed as: where KL represents the Kullback-Leibler divergence, ρ is the target sparsity, is the actual sparsity, and Sparse() is the sparsity function. In one embodiment, ρ is set to 0.05.

[0071] Furthermore, the Kullback-Leibler divergence is an index for measuring the difference between two probability distributions, that is, it is used to quantify the difference between the actual sparsity and the target sparsity ρ, and its calculation method can be expressed as: where is the average activation degree of the i-th neuron in the encoding layer, usually calculated by averaging the activation degrees of all training samples.

[0072] 4. Distance metric optimization: Adjust the low-dimensional feature space according to the requirements of the classification task to optimize the distance metric between different classes. Specifically, in order to optimize the distance metric between different classes, the present invention adopts a feature-based distance metric learning method, which can be expressed as: where L distance is the distance metric loss function, ez i and ez j are the low-dimensional feature representations of different classes, and η ij is the class-based weight factor used to distinguish the importance of different classes. In one embodiment, η ij is set to the inverse of the distance between classes.

[0073] Furthermore, the distance metric loss function L distance is calculated through a similarity metric, and the calculation method can be expressed as: where · represents the dot product of vectors, ∥∥ represents the Euclidean norm of vectors, and ey is the label or category information for distance metric learning.

[0074] 5. Backpropagation and parameter update: According to the reconstruction error and the distance metric error, the network parameters are updated through backpropagation. Specifically, by combining the reconstruction error and the distance metric error, the network parameters are updated through backpropagation, which can be expressed as: where L reconstruct is the reconstruction error and α is the learning rate. In one embodiment, α is set to 0.001.

[0075] Furthermore, during the backpropagation process, the gradients of the weights eW and biases eb of the autoencoder are calculated through the chain rule. For example, the gradient of the weights can be expressed as: where and are the partial derivatives of the reconstruction loss and the distance metric loss with respect to the low-dimensional feature representation ez respectively, is the partial derivative of the low-dimensional feature representation with respect to the weights.

[0076] 6. Iterative training: Repeat the above steps until the convergence condition is met; based on this, the data after dimensionality reduction is the low-dimensional feature representation ez.

[0077] The data after dimensionality reduction is input into a classifier for training. The present invention further proposes a classification algorithm for an extreme learning machine based on quantum coding, which combines the principle of quantum computing with the efficient learning ability of the extreme learning machine, aiming to improve the classification accuracy and processing speed, and is particularly suitable for large-scale and complex food and drug inspection data sets. The present invention introduces the principle of quantum computing into the data representation of the extreme learning machine, encodes the data features through quantum bits, and utilizes the superposition and entanglement characteristics of quantum states to enhance the data expression ability and processing efficiency. In addition, in combination with quantum coding, the weights and biases of the extreme learning machine are optimized, and the probability amplitudes of quantum states are used to directly affect the weight adjustment to achieve a fast and accurate classification training process.

[0078] S4. Classify and train the target feature vector using the classification algorithm for an extreme learning machine based on quantum coding to construct a target classification model.

[0079] As an alternative embodiment, S4 includes the following steps: The obtained target feature vector after dimensionality reduction is converted into qubit representation through quantum encoding, where each feature corresponds to one or more qubits; the hidden layer weights and bias parameters of the extreme learning machine are randomly initialized; The target feature vector is input into the hidden layer of the extreme learning machine after quantum encoding, and the hidden layer nodes process it using quantum states, accelerating feature transformation and non-linear mapping through quantum operations; The output weights are optimized through a quantum algorithm, and the optimal weight configuration is obtained using a quantum search and optimization algorithm to minimize the classification error; if the minimized classification error does not meet the set value range, the classification model is further optimized by adjusting the number of hidden layer nodes or re-initializing the hidden layer weights and bias parameters of the extreme learning machine to obtain the target classification model.

[0080] Specifically, the training process of the extreme learning machine classification algorithm based on quantum encoding is as follows: 1. The dimensionality-reduced data ez is converted into qubit representation through quantum encoding, where each feature corresponds to one or more qubits, and efficient data representation is achieved using the superposition of quantum states.

[0081] Specifically, let the dimensionality-reduced data ez = [x1, x2, …, x n , where n is the number of features. The quantum encoding process maps each feature x i to the qubit q i and can be expressed as: where θ i and φ i are respectively the polar angle and azimuth angle on the Bloch sphere of the qubit q i , corresponding to the quantization representation of the feature x i .

[0082] In one embodiment, the calculations of θ i and φ i are determined according to the normalized value of the feature x i . Specifically, for the feature x i , its normalization process can be expressed as: Furthermore, mapping x′ i to θ i and φ i can be expressed as: θ i = πx′ i φ i = 2πx′ i Based on this, the normalized value of each feature is associated with two angles on a qubit, thus completing the encoding process of data into qubits.

[0083] 2. The hidden layer weights and bias parameters of the extreme learning machine are randomly initialized at the beginning of training. Considering the characteristics of quantum encoding, the initialization process also incorporates the principles of quantum computing to adapt to data represented in quantum states. Specifically, the way to randomly initialize the hidden layer weights W and bias b of the extreme learning machine can be expressed as: W = rand(η, m) b = rand(η) where η is the number of hidden layer nodes, m is the number of input layer nodes, and rand() represents a function that generates random numbers in a given dimension.

[0084] 3. After quantum encoding, the data is input into the hidden layer of the extreme learning machine. The hidden layer nodes process it using quantum states, accelerating feature transformation and non - linear mapping through quantum operations. The output H of the hidden layer is expressed as: H = Φ(Wq + b) where q = [q1, q2, …, q n is the input vector after quantum encoding, and Φ() is the hidden layer activation function, which is selected as the sigmoid function in one embodiment, and its expression is: For the input z of each hidden layer node, Φ(z) calculates the output of this node.

[0085] 4. Different from the traditional extreme learning machine that only optimizes the output layer weights, the present invention optimizes the output weights through a quantum algorithm, and uses quantum search and optimization algorithms to quickly find the optimal weight configuration to minimize the classification error.

[0086] Specifically, in the quantum extreme learning machine, the optimization of the output weight β is obtained by solving a least - squares problem, which can be expressed as: where T is the target output matrix of the training samples, is the Moore - Penrose pseudoinverse of the hidden layer output matrix H, which is calculated through singular value decomposition and can be expressed as: H = UΣV * where U and V are orthogonal matrices, Σ is a diagonal matrix containing singular values, Σ -1 is the result after taking the reciprocal of the non - zero elements in Σ, and * represents conjugate transpose.

[0087] 5. Evaluate the performance of the trained classifier on the validation set. If the performance does not meet the preset threshold, manually adjust the hyperparameters. The output O of the model can be expressed as: O = Hβ In one embodiment, the performance of the model is evaluated by comparing O and T, and metrics such as accuracy and recall can be used. If the performance is insufficient, it can be optimized by adjusting the number of hidden layer nodes η or re - initializing W and b.

[0088] After the model training is completed, the output of the model is the classification result of each sample.

[0089] S5. Obtain the original inspection data to be detected, and sequentially obtain the original feature vectors through S2 - S3. The target classification model obtains the data classification result in response to the original feature vector.

[0090] It can be understood that for newly collected food and drug inspection data, during inspection and analysis, feature extraction is first performed, and the data is input into the trained feature extraction model. This model converts the original data into a more advanced and abstract feature representation, which can better capture the internal structure and relationships of the data. Further, use the improved sparse auto - encoding neural network trained in step S3 to perform dimensionality reduction on the extracted features, reduce the dimensionality of the features, improve the calculation efficiency, and at the same time retain the information most useful for classification. Further, input the dimensionality - reduced feature vector into the classifier trained in step five. In one embodiment, the possible output categories include: qualified, pollutant exceeded the standard, microbial test did not meet the standard, quality not up to standard.

[0091] The above - mentioned specific implementation manners are the preferred implementation manners of the food and drug inspection data processing method based on artificial intelligence technology of the present invention, and do not limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to this specific implementation manner. All equivalent changes made according to the shape and structure of the present invention are within the protection scope of the present invention.

Claims

1. A method for processing food and drug inspection data based on artificial intelligence technology, characterized in that: The steps include: S1. Obtain food and drug data and annotate them to obtain a pre-selected data set; expand the pre-selected data set through a target generative adversarial network to obtain a training data set; S2, performing feature training on the training data set based on the ecosystem optimization algorithm to extract feature data and construct a feature vector; S3, reducing the dimension of the feature vector by combining a sparse autoencoder neural network with a distance metric learning algorithm to obtain a target feature vector; S4, based on quantum coding extreme learning machine classification algorithm, classify and train the target feature vector to build a target classification model; S5. Obtain the original inspection data to be detected and obtain the original feature vector in sequence through S2 to S3. The target classification model obtains the data classification result in response to the original feature vector.

2. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 1 is characterized in that: The S1 includes the following steps: The food and drug testing data shall at least include chemical content, microbial count, shelf life, pH value, moisture content, heavy metal content, solvent residue, packaging integrity, color and texture; Labeling the collected food and drug testing data, with the labeling categories including at least: qualified, pollutant exceeding the standard, microbiological testing not meeting the standard, and quality not meeting the standard; The food and drug testing data are classified according to the labeled categories to obtain a pre-selected data set.

3. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 1 or 2, characterized in that: The S1 also includes constructing a generative adversarial network, including the following steps: Initialize the network structure and initialization parameters of the generative adversarial network algorithm, and set the initial state for the generator and discriminator; Randomly sample latent feature vectors from a predefined latent space and use them as input to the generator to obtain a generated dataset; The discriminator determines the authenticity of the generated data in the generated data set relative to the real data; according to the authenticity judgment result, the parameters of the generator and the discriminator are adjusted to obtain the target generative adversarial network; The pre-selected data set is processed and expanded by the target generative adversarial network to obtain the training data set.

4. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 1, characterized in that: Before executing S2, it also includes building a feature extraction model based on the ecosystem optimization algorithm; the steps include: Construct an initial ecosystem containing multiple populations, where the population represents a parameter set P of the neural network model i ={w i ,b i }, where w i and b i Represent the weights and biases of the neural network respectively; Construct the target fitness function F based on environmental variables, genetic factors and individual parameter sets i =f(P i ,E,G); the feature extraction model is characterized by the target fitness function.

5. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 4 is characterized in that: Objective fitness function: F i =f(P i ,E,G)=Sig(κ·L(w i ,b i )+λ·E+μ·G(w i ,b i )+ν·D(w i ,b i ,E)); Among them, w i and b i Represent the weight and bias of the i-th parameter set, E is the environment variable, G(w i ,b i ) is the genetic factor function, L(w i ,b i ) is the performance evaluation function, D(w i ,b i ,E) is the interaction function between individual parameters and environmental variables, Sig() is the Sigmoid activation function, κ, λ, μ, ν are weight coefficients, which are used to balance the contribution of various factors to fitness.

6. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 5 is characterized in that: The calculation formula of the genetic factor function is as follows: Among them, ρ and θ are weight coefficients used to adjust the contribution of each item, w ij、 b ij represents the interaction weight and bias of two parameter sets i and j; Var(w i ,b i ) represents the variance of weights and biases, which is used to measure the diversity of parameters, and n is the upper limit of the parameter set.

7. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 5 is characterized in that: The environmental interaction function is calculated as follows: Among them, η is the weight coefficient, E k represents the kth element of the environment variable, m is the upper limit of the elements in the environment variable, x kj Represents the environment variable E k The associated input features, tanh() is the hyperbolic tangent function, w ij、 b ij represents the interaction weights and biases of two parameter sets i and j.

8. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 5 is characterized in that: The calculation formula of the genetic factor function is as follows: Performance evaluation function L(w i ,b i ) is calculated as follows: in, represents the loss function, and Y is the true label; It is the model prediction, obtained by the preset Softmax function.

9. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 1, characterized in that: S3 includes the following steps: Initialize the weights and biases of the autoencoder, and convert the feature vector input to the autoencoder into a low-dimensional feature representation through forward propagation through the encoding layer; apply sparsity constraints in the encoding layer to ensure that only some neurons are activated through participation restrictions; adjust the low-dimensional feature space according to the requirements of the classification task to optimize the distance metric between different categories; based on the reconstruction error and distance metric error, update the network parameters through back propagation to obtain the target feature vector.

10. The method for processing food and drug inspection data based on artificial intelligence technology according to claim 1, characterized in that: S4 includes the following steps: The target feature vector obtained after dimensionality reduction is converted into a qubit representation through quantum coding, where each feature corresponds to one or more qubits; the hidden layer weights and bias parameters of the extreme learning machine are randomly initialized; The target feature vector is input into the hidden layer of the extreme learning machine after quantum encoding. The hidden layer nodes are processed using quantum states, and feature transformation and nonlinear mapping are accelerated through quantum operations. The output weights are optimized through quantum algorithms, and the optimal weight configuration is obtained using quantum search and optimization algorithms to minimize the classification error. If the minimized classification error does not meet the set value range, the classification model is further optimized by adjusting the number of hidden layer nodes or reinitializing the hidden layer weights and bias parameters of the extreme learning machine to obtain the target classification model.

Citation Information

Cited By

  • Probe digital intelligent food thermometer with host receiving and wireless transmitting functions

    CN121026366A