CN117912599B - Food additive detection method based on artificial intelligence - Google Patents

Food additive detection method based on artificial intelligence Download PDF

Info

Publication number
CN117912599B
CN117912599B CN202410315777.0A CN202410315777A CN117912599B CN 117912599 B CN117912599 B CN 117912599B CN 202410315777 A CN202410315777 A CN 202410315777A CN 117912599 B CN117912599 B CN 117912599B
Authority
CN
China
Prior art keywords
additive
raw material
vectors
clusters
vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410315777.0A
Other languages
Chinese (zh)
Other versions
CN117912599A (en
Inventor
朱江
陈静
段晓娟
程渭峰
程红京
马维静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Daye Food Co ltd
Original Assignee
Xi'an Daye Food Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xi'an Daye Food Co ltd filed Critical Xi'an Daye Food Co ltd
Priority to CN202410315777.0A priority Critical patent/CN117912599B/en
Publication of CN117912599A publication Critical patent/CN117912599A/en
Application granted granted Critical
Publication of CN117912599B publication Critical patent/CN117912599B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • General Preparation And Processing Of Foods (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of spectrum analysis, in particular to a food additive detection method based on artificial intelligence. The method comprises the following steps: acquiring a raw material spectrum vector and an additive spectrum vector, respectively clustering to obtain a raw material cluster and an additive cluster, analyzing to obtain a raw material commonality vector and an additive commonality vector, and matching and screening to obtain a difference matching pair according to the similarity degree of the raw material commonality vector and the additive commonality vector; determining a characteristic influence value of the dimension according to the distribution of the spectral vectors of the additive clusters in the difference matching pair, and determining an error weight of each dimension of the additive according to the similarity degree and the characteristic influence value of the dimension; the method and the device can more accurately identify the composition of the obtained additive, enhance the accuracy of the additive detection and promote the additive detection effect.

Description

Food additive detection method based on artificial intelligence
Technical Field
The invention relates to the technical field of spectrum analysis, in particular to a food additive detection method based on artificial intelligence.
Background
The detection of the food additive is related to the safety of the food finished product, and the detection result has important influence effects on the classification, action, safety evaluation and the like of the food.
The existing detection of the additives in the food is often based on the spectral characteristics of the food, and detection and identification are carried out through a neural network, but due to the diversification of the food and the diversification of the additives, accurate identification of the difference between the two is difficult, and further the identification precision of the neural network is not high, the distinguishing effect of the neural network on the additives and raw materials is poor, the composition identification capability of the additives in the food is poor, and the accuracy of the additive detection is insufficient.
Disclosure of Invention
In order to solve the technical problems of low recognition accuracy of a neural network, poor distinguishing effect of the neural network on additives and raw materials, poor recognition capability on components of the additives in food and insufficient accuracy of additive detection in the related art, the invention provides an artificial intelligence-based food additive detection method, which adopts the following specific technical scheme:
The invention provides a food additive detection method based on artificial intelligence, which comprises the following steps:
Acquiring raw material spectrum vectors of different types of food raw materials and additive spectrum vectors of different types of additives, respectively clustering all the raw material spectrum vectors to obtain a preset first number of raw material class clusters, and clustering all the additive spectrum vectors to obtain a preset second number of additive class clusters;
determining raw material commonality vectors of each raw material cluster according to vector features of all raw material spectrum vectors in each raw material cluster, and determining additive commonality vectors of each additive cluster according to vector features of all additive spectrum vectors in each additive cluster; according to the similarity degree of the raw material common vector and the additive common vector, carrying out one-to-one matching on the raw material clusters and the additive clusters, and screening to obtain difference matching pairs;
Determining the characteristic influence value of each additive in each dimension according to the distribution of the spectral vectors of the additive clusters in each group of difference matching pairs, and determining the error weight of each additive in each dimension according to the similarity degree of each additive commonality vector and all raw material commonality vectors and the characteristic influence value of the same additive in each dimension;
and constructing an identification neural network according to the error weights of different dimensions of all kinds of additives, and detecting the food additives based on the identification neural network to obtain a detection result.
Further, the determining the raw material commonality vector of each raw material cluster according to the vector characteristics of the spectrum vectors of all raw materials in each raw material cluster comprises the following steps:
based on a factor analysis algorithm, carrying out data analysis on all raw material spectrum vectors in the same raw material cluster, taking the generated common factor matrix as a raw material commonality matrix, converting all data in the raw material commonality matrix into vectors in an end-to-end mode, and marking the vectors as raw material commonality vectors.
Further, the determining the additive commonality vector of each additive cluster according to the vector characteristics of the spectral vectors of all additives in each additive cluster comprises:
Based on a factor analysis algorithm, carrying out data analysis on all additive spectrum vectors in the same additive cluster, taking the generated common factor matrix as an additive commonality matrix, converting all data in the additive commonality matrix into vectors in an end-to-end connection mode, and recording the vectors as additive commonality vectors.
Further, according to the similarity degree of the raw material common vector and the additive common vector, the raw material clusters and the additive clusters are subjected to one-to-one matching, and a difference matching pair is obtained through screening, and the method comprises the following steps:
based on a cosine similarity calculation formula, calculating cosine similarity of the raw material commonality vector and the additive commonality vector as a similarity degree;
Taking the similarity degree as an edge value, performing KM matching treatment on all the raw material clusters and the additive clusters to obtain an initial matching pair comprising one raw material cluster and one additive cluster;
And screening all the initial matching pairs according to the similarity degree of the raw material clusters and the additive clusters in each initial matching pair to obtain a difference matching pair.
Further, screening all the initial matching pairs according to the similarity degree of the raw material clusters and the additive clusters in each initial matching pair to obtain difference matching pairs, including:
And taking the initial matching pair with the similarity degree of the raw material clusters and the additive clusters smaller than a preset similarity degree threshold value as a difference matching pair.
Further, the determining the characteristic influence value of each additive in each dimension according to the distribution of the spectral vectors of the additive clusters in each group of difference matching pairs comprises:
taking the occurrence frequency of the additive spectrum vector of each group of difference matching additive clusters in different dimensions as the additive frequency;
Replacing the value of the additive spectrum vector with the same dimension based on a preset replacement value, and then calculating the cosine similarity of the obtained new spectrum vector and the corresponding spectrum vector of the raw material in the same group of difference matching pairs as the additive dimension-removing similarity;
Taking the absolute value of the difference value of the similarity degree between the additive dimensionality-removing similarity degree and the corresponding difference matching pair as a dimensionality change index of the additive spectrum vector in the corresponding dimensionality, wherein the preset replacement value is 0;
And taking the dimension change index of the additive spectrum vector of each additive in each dimension as the characteristic influence value of the corresponding additive in the corresponding dimension.
Further, the determining the error weight of each additive in each dimension according to the similarity degree of the common vector of each additive and the common vector of all raw materials and the characteristic influence value of the same additive in each dimension respectively comprises the following steps:
Calculating the average value of similarity degree between additive commonality vectors of any additive and all raw material commonality vectors respectively, and mapping and normalizing the negative correlation as an influence index of the additive;
and calculating the product of the influence index of each additive and the characteristic influence value of any dimension of the corresponding additive as the error weight of the dimension corresponding to the additive.
Further, the construction of the identification neural network according to the error weights of different dimensions of all kinds of additives comprises the following steps:
Based on the pretrained VGG-NET model, the error weight of each class of additive in each dimension is used as the weight of the corresponding dimension, the loss weight is adjusted, and the updated VGG-NET model is obtained and used as the recognition neural network.
Further, the clustering of the raw material spectrum vectors to obtain a preset first number of raw material clusters includes:
and clustering all raw material spectrum vectors based on a preset first quantity according to a k-means clustering algorithm to obtain raw material clusters.
Further, the clustering of all the additive spectrum vectors to obtain a preset second number of additive clusters includes:
And clustering all the additive spectrum vectors based on a preset second quantity according to a k-means clustering algorithm to obtain additive clusters.
The invention has the following beneficial effects:
According to the invention, the raw material spectrum vectors of different types of food raw materials and the additive spectrum vectors of different types of additives are obtained, and the raw material spectrum vectors and the additive spectrum vectors are clustered to obtain different types of clusters, so that the classification of the clusters is convenient for subsequent realization of commonality analysis, and the commonality analysis efficiency is improved; according to the similarity degree of the raw material common vector and the additive common vector, the raw material clusters and the additive clusters are matched, a difference matching pair is obtained through screening, the difference matching pair is directly screened, the raw material clusters and the additive clusters with obvious differences can be directly subjected to difference analysis, so that the raw materials and the additives are effectively distinguished, then, the distribution of the spectral vectors of the additive clusters in each group of difference matching pair is analyzed, further, the characteristic influence values of the additives in different dimensions are determined, the similarity degree of the characteristic influence values is combined, the error weight is determined, the error weight is used for amplifying the difference part between the additives and the raw materials, and further, when a recognition neural network is subsequently constructed, the distinguishing effect of the recognition neural network on the additives and the raw materials is improved, the composition of the additives can be more accurately recognized, the detection accuracy of the additives is enhanced, and the detection effect of the additives is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for detecting food additives based on artificial intelligence according to an embodiment of the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following description refers to the specific implementation, structure, characteristics and effects of the food additive detection method based on artificial intelligence according to the invention by combining the accompanying drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the food additive detection method based on artificial intelligence provided by the invention with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of a method for detecting a food additive based on artificial intelligence according to an embodiment of the invention is shown, where the method includes:
S101: the method comprises the steps of obtaining raw material spectrum vectors of different types of food raw materials and additive spectrum vectors of different types of additives, respectively clustering all raw material spectrum vectors to obtain a preset first number of raw material class clusters, and clustering all additive spectrum vectors to obtain a preset second number of additive class clusters.
The method has the advantages that the spectral vectors of the food raw materials and the additives are obtained based on the spectral detector, and then the data analysis is carried out on the spectral vectors so as to analyze the raw materials and the additives which are difficult to identify and improve the detection accuracy of the food additives.
The food material may be, for example, grains, meats, vegetables, fruits, beans, etc., such as flour, wheat flour, soybean products, etc., and the food additive may be, for example, a plurality of coloring agents, preservatives, flavoring agents, etc., since the composition of the food material is substantially the same, for example: proteins, carbohydrates, etc., so that there is commonality in the spectral curves of different food materials. The food additives have certain commonalities, and some food additives are obtained by virtue of food raw materials, so that certain errors are generated in the process of distinguishing the food raw materials from the food additives, and the errors need to be analyzed, so that the raw materials and the additives are effectively distinguished.
Further, in some embodiments of the present invention, all raw material spectral vectors are clustered based on a preset first number according to a k-means clustering algorithm to obtain raw material class clusters. And clustering all the additive spectrum vectors based on a preset second quantity to obtain additive clusters.
That is, all raw material spectrum vectors are clustered by using a k-means clustering algorithm respectively to obtain raw material clusters, and additive spectrum vectors are clustered to obtain additive clusters, wherein the preset first number is the number of the raw material clusters, and the preset second number is the number of the additive clusters.
In the embodiment of the invention, a k-means clustering algorithm is used for clustering, cosine similarity of any two raw material spectrum vectors can be obtained by taking all raw material spectrum vectors as examples, and 10 raw material clusters are obtained by taking (1-cosine similarity) as a distance and adopting a k-means (k default is 10) clustering method; similarly, taking all the additive spectral vectors as an example, 10 additive clusters are also obtained by the same method, and of course, the k-means clustering algorithm is a clustering algorithm well known in the art, and the clustering process based on the k-means clustering algorithm is not further limited and described herein.
It should be noted that, for the convenience of analysis, the preset first number and the preset second number may be the same, for example, the preset first number and the preset second number are both 10, and in the embodiment of the present invention, all raw material spectral vectors may be clustered into 10 raw material clusters, and all additive spectral vectors may be clustered into 10 additive clusters.
S102: determining raw material commonality vectors of each raw material cluster according to vector features of all raw material spectrum vectors in each raw material cluster, and determining additive commonality vectors of each additive cluster according to vector features of all additive spectrum vectors in each additive cluster; and according to the similarity degree of the raw material commonality vector and the additive commonality vector, carrying out one-to-one matching on the raw material clusters and the additive clusters, and screening to obtain difference matching pairs.
After clustering, the invention can respectively carry out commonality analysis on each type of cluster. Further, in some embodiments of the present invention, determining raw material commonality vectors for each raw material class cluster based on vector features of all raw material spectral vectors in each raw material class cluster comprises: based on a factor analysis algorithm, carrying out data analysis on all raw material spectrum vectors in the same raw material cluster, taking the generated common factor matrix as a raw material commonality matrix, converting all data in the raw material commonality matrix into vectors in an end-to-end mode, and marking the vectors as raw material commonality vectors.
Further, in some embodiments of the present invention, determining the additive commonality vector for each additive cluster based on the vector features of all additive spectral vectors in each additive cluster comprises: based on a factor analysis algorithm, carrying out data analysis on all additive spectrum vectors in the same additive cluster, taking the generated common factor matrix as an additive commonality matrix, converting all data in the additive commonality matrix into vectors in an end-to-end connection mode, and recording the vectors as additive commonality vectors.
The factor analysis algorithm is a method which is known in the art and can extract the common characteristics of a plurality of vectors, so that the common characteristics of different raw materials and different additives can be obtained through factor analysis. And taking all vectors contained in any raw material cluster or additive cluster as input of a factor analysis algorithm, and processing by the factor analysis algorithm to obtain a common factor matrix corresponding to any raw material cluster or additive cluster, wherein the raw material cluster corresponds to a raw material commonality matrix, and the additive cluster corresponds to an additive commonality matrix.
The raw material commonality matrix and the additive commonality matrix in the embodiment of the invention respectively represent the common characteristics of vectors in corresponding raw material clusters or additive clusters. And then, all the data in the raw material common matrix can be converted into vectors in an end-to-end mode, and the vectors are recorded as raw material common vectors, and similarly, all the data in the additive common matrix can be converted into vectors in an end-to-end mode, and the vectors are recorded as additive common vectors. Wherein, the raw material commonality vector represents the commonality characteristic of the raw material clusters, and the additive commonality vector represents the commonality characteristic of the additive clusters.
Further, in some embodiments of the present invention, according to the similarity degree of the raw material commonality vector and the additive commonality vector, the raw material clusters and the additive clusters are matched one by one, and the screening is performed to obtain a difference matching pair, which includes: based on a cosine similarity calculation formula, calculating cosine similarity of the raw material common vector and the additive common vector as a similarity degree; performing KM matching treatment on all the raw material clusters and the additive clusters by taking the similarity degree as an edge value to obtain an initial matching pair comprising one raw material cluster and one additive cluster; and screening all initial matching pairs according to the similarity degree of the raw material clusters and the additive clusters in each initial matching pair to obtain a difference matching pair.
In the embodiment of the invention, after the raw material common vector and the additive common vector are obtained, similarity analysis can be performed based on the raw material common vector and the additive common vector, wherein the KM matching algorithm is a similarity matching algorithm well known in the art.
It should be noted that, only a plurality of vector pairs closest to the raw material common vector and the additive common vector need to be found, the difference of each vector pair is obtained, and further, a difference matching pair is obtained, so that raw materials and additives can be well distinguished according to the difference matching pair.
Specifically, based on a KM matching algorithm, matching left raw material clusters with right additive clusters is calculated, each left raw material cluster on the left is connected with all right additive clusters, and the similarity degree corresponding to two ends of a connecting line is obtained by the edge value; through KM matching, one-to-one matching of the left side raw material cluster and the right side additive cluster can be obtained and is marked as an initial matching pair.
After the initial matching pairs are obtained, the method can screen the initial matching pairs, further in some embodiments of the invention, according to the similarity degree of the raw material clusters and the additive clusters in each initial matching pair, all the initial matching pairs are screened to obtain difference matching pairs, and the method comprises the following steps: and taking the initial matching pair with the similarity degree of the raw material clusters and the additive clusters smaller than a preset similarity degree threshold value as a difference matching pair.
The preset similarity threshold is a similarity threshold, and the initial matching pair may be screened by the preset similarity threshold, where the preset similarity threshold may specifically be, for example, 0.6, or in other embodiments of the present invention, the preset similarity threshold may be set according to an actual detection requirement, which is not limited.
It should be noted that, the difference pair, namely the food commonality vector and the additive commonality vector with larger difference, can improve the subsequent neural network identification only by finding out the corresponding wave band of the difference pair or the wave band containing more difference pair information.
S103: and determining the characteristic influence value of each additive in each dimension according to the distribution of the spectral vectors of the additive clusters in each group of difference matching pairs, and determining the error weight of each additive in each dimension according to the similarity degree of each additive commonality vector and all raw material commonality vectors and the characteristic influence value of the same additive in each dimension.
Further, in some embodiments of the present invention, determining a characteristic impact value for each additive in each dimension from the distribution of spectral vectors for clusters of additive classes in each set of differential matches comprises: taking the occurrence frequency of the additive spectrum vector of each group of difference matching additive clusters in different dimensions as the additive frequency; replacing the value of the additive spectrum vector with the same dimension based on a preset replacement value, and then calculating the cosine similarity of the obtained new spectrum vector and the corresponding spectrum vector of the raw material in the same group of difference matching pairs as the additive dimension-removing similarity; taking the absolute value of the difference value of the similarity degree between the additive dimension-removing similarity degree and the corresponding difference matching pair as a dimension change index of the additive spectrum vector in the corresponding dimension, wherein the preset replacement value is 0; and taking the dimension change index of the additive spectrum vector of each additive in each dimension as the characteristic influence value of the corresponding additive in the corresponding dimension.
In the embodiment of the invention, the additive and the food raw materials need to be effectively distinguished, the additive characteristics and the raw material characteristics which are matched but have larger difference can be determined by obtaining the difference pairs, the dimension of the additive spectrum vector of the additive cluster specifically comprises the numerical dimension of different vectors, different additives have different numerical characteristics in different vector dimensions, for example, the dimension corresponding to the thickener and the emulsifier has the difference, the characteristics in the same dimension also have the difference, and the characteristic influence can be analyzed by the commonality analysis of the vector dimensions.
The frequency of occurrence of the spectral vector of the additive in each group of difference matching pairs in different dimensions is taken as the additive frequency, and it can be understood that the additive clusters contain a plurality of similar additive types, the frequency of the similarity in different dimensions can be taken as the additive frequency in the dimension, and in order to analyze the influence of the corresponding dimension on the characteristics of the additive, replacement analysis is needed, namely, after the influence is replaced by a preset numerical value, the influence on the similarity degree before and after the replacement is compared, so that the importance of the corresponding dimension is obtained.
In the embodiment of the invention, the values of the spectrum vectors of the additives with the same dimension are replaced based on the preset replacement values, and the cosine similarity of the spectrum vectors of the raw materials in the pair corresponding to the same group of difference matching is calculated as the additive dimension-removing similarity. The additive dimension-removing similarity is the similarity between the additive dimension-removing similarity and the corresponding raw material spectrum vector after removing the influence of a certain dimension, and the absolute value of the difference between the additive dimension-removing similarity and the similarity of difference matching can be used as the influence value generated by the dimension change, that is, the dimension change index is the influence value of the corresponding dimension in the additive cluster. Thus, the dimension change index of each dimension is used as the characteristic influence value of the corresponding additive in the corresponding dimension.
Further, in some embodiments of the present invention, determining the error weight of each dimension of each additive according to the similarity degree of each additive commonality vector and all raw material commonality vectors, and the characteristic influence value of the same additive in each dimension, includes: calculating the average value of similarity degree between additive commonality vectors of any additive and all raw material commonality vectors respectively, and mapping and normalizing the negative correlation to be used as an influence index of the additive; and calculating the product of the influence index of each additive and the characteristic influence value of any dimension of the corresponding additive as the error weight of the corresponding dimension of the additive.
In the embodiment of the invention, the average value of the similarity degree between the additive commonality vector of the additive and the commonality vector of all raw materials is used as the similarity characteristic value of the corresponding additive, the larger the average value is, the more difficult the additive and the raw materials are to distinguish, the negative correlation mapping and normalization are carried out to obtain the influence index of the additive, namely the larger the influence index is, the larger the difference between the additive and the raw materials is, and then, the larger the product of the influence index and the characteristic influence value is used as the error weight, the larger the error weight is, the larger the difference between the additive and the raw materials is, and the larger the influence of the additive in the corresponding dimension is.
S104: and constructing an identification neural network according to the error weights of different dimensions of all kinds of additives, and detecting the food additives based on the identification neural network to obtain a detection result.
Further, in some embodiments of the present invention, constructing the recognition neural network based on the error weights of different dimensions for all kinds of additives includes: based on the pretrained VGG-NET model, the error weight of each class of additive in each dimension is used as the weight of the corresponding dimension, the loss weight is adjusted, and the updated VGG-NET model is obtained and used as the recognition neural network.
Specifically, in the embodiment of the present invention, an initial neural network is trained first, the network is trained by adopting a VGG-NET model, and a cross entropy loss function is adopted, and the cross entropy loss function is input as a corresponding additive spectral vector, for example: [ a b c d ], where a, b, c and d are all true outputs of the corresponding dimensions, the original loss is: <0.01, where/> 、/>、/>And/>All are model output values, namely the difference between the model output values and the true values is smaller than 0.01, and the current loss is: <0.01, where/> 、/>、/>And/>All are error weights of corresponding dimensions, different dimensions are subjected to weighted analysis through the error weights, a totally new VGG-NET model is constructed, and then the recognition neural network is obtained through training, so that the detection capability of the recognition network on food additives is improved.
The invention can detect the food additive based on the recognition neural network to obtain a detection result, and the specific detection process is a process known to those skilled in the art, which is not further limited and described in detail.
According to the invention, the raw material spectrum vectors of different types of food raw materials and the additive spectrum vectors of different types of additives are obtained, and the raw material spectrum vectors and the additive spectrum vectors are clustered to obtain different types of clusters, so that the classification of the clusters is convenient for subsequent realization of commonality analysis, and the commonality analysis efficiency is improved; according to the similarity degree of the raw material common vector and the additive common vector, the raw material clusters and the additive clusters are matched, a difference matching pair is obtained through screening, the difference matching pair is directly screened, the raw material clusters and the additive clusters with obvious differences can be directly subjected to difference analysis, so that the raw materials and the additives are effectively distinguished, then, the distribution of the spectral vectors of the additive clusters in each group of difference matching pair is analyzed, further, the characteristic influence values of the additives in different dimensions are determined, the similarity degree of the characteristic influence values is combined, the error weight is determined, the error weight is used for amplifying the difference part between the additives and the raw materials, and further, when a recognition neural network is subsequently constructed, the distinguishing effect of the recognition neural network on the additives and the raw materials is improved, the composition of the additives can be more accurately recognized, the detection accuracy of the additives is enhanced, and the detection effect of the additives is improved.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.

Claims (9)

1. A method for detecting a food additive based on artificial intelligence, the method comprising:
Acquiring raw material spectrum vectors of different types of food raw materials and additive spectrum vectors of different types of additives, respectively clustering all the raw material spectrum vectors to obtain a preset first number of raw material class clusters, and clustering all the additive spectrum vectors to obtain a preset second number of additive class clusters;
determining raw material commonality vectors of each raw material cluster according to vector features of all raw material spectrum vectors in each raw material cluster, and determining additive commonality vectors of each additive cluster according to vector features of all additive spectrum vectors in each additive cluster; according to the similarity degree of the raw material common vector and the additive common vector, carrying out one-to-one matching on the raw material clusters and the additive clusters, and screening to obtain difference matching pairs;
Determining the characteristic influence value of each additive in each dimension according to the distribution of the spectral vectors of the additive clusters in each group of difference matching pairs, and determining the error weight of each additive in each dimension according to the similarity degree of each additive commonality vector and all raw material commonality vectors and the characteristic influence value of the same additive in each dimension;
constructing an identification neural network according to the error weights of different dimensions of all kinds of additives, and detecting the food additives based on the identification neural network to obtain a detection result;
The determining the characteristic influence value of each additive in each dimension according to the distribution of the spectral vectors of the additive clusters in each group of difference matching pairs comprises the following steps:
taking the occurrence frequency of the additive spectrum vector of each group of difference matching additive clusters in different dimensions as the additive frequency;
Replacing the value of the additive spectrum vector with the same dimension based on a preset replacement value, and then calculating the cosine similarity of the obtained new spectrum vector and the corresponding spectrum vector of the raw material in the same group of difference matching pairs as the additive dimension-removing similarity;
Taking the absolute value of the difference value of the similarity degree between the additive dimensionality-removing similarity degree and the corresponding difference matching pair as a dimensionality change index of the additive spectrum vector in the corresponding dimensionality, wherein the preset replacement value is 0;
And taking the dimension change index of the additive spectrum vector of each additive in each dimension as the characteristic influence value of the corresponding additive in the corresponding dimension.
2. The method for detecting a food additive based on artificial intelligence according to claim 1, wherein the determining the raw material commonality vector of each raw material cluster based on the vector characteristics of the spectral vectors of all raw materials in each raw material cluster comprises:
based on a factor analysis algorithm, carrying out data analysis on all raw material spectrum vectors in the same raw material cluster, taking the generated common factor matrix as a raw material commonality matrix, converting all data in the raw material commonality matrix into vectors in an end-to-end mode, and marking the vectors as raw material commonality vectors.
3. The method of claim 2, wherein determining the additive commonality vector for each additive cluster based on vector characteristics of spectral vectors for all additives in each additive cluster comprises:
Based on a factor analysis algorithm, carrying out data analysis on all additive spectrum vectors in the same additive cluster, taking the generated common factor matrix as an additive commonality matrix, converting all data in the additive commonality matrix into vectors in an end-to-end connection mode, and recording the vectors as additive commonality vectors.
4. The method for detecting food additives based on artificial intelligence according to claim 1, wherein the step of performing one-to-one matching of the raw material clusters and the additive clusters according to the similarity between the raw material commonality vector and the additive commonality vector, and the step of screening to obtain difference matching pairs comprises the steps of:
based on a cosine similarity calculation formula, calculating cosine similarity of the raw material commonality vector and the additive commonality vector as a similarity degree;
Taking the similarity degree as an edge value, performing KM matching treatment on all the raw material clusters and the additive clusters to obtain an initial matching pair comprising one raw material cluster and one additive cluster;
And screening all the initial matching pairs according to the similarity degree of the raw material clusters and the additive clusters in each initial matching pair to obtain a difference matching pair.
5. The method of claim 4, wherein the step of screening all the initial matching pairs to obtain differential matching pairs based on the similarity between the raw material clusters and the additive clusters in each initial matching pair comprises:
And taking the initial matching pair with the similarity degree of the raw material clusters and the additive clusters smaller than a preset similarity degree threshold value as a difference matching pair.
6. The method for detecting food additives based on artificial intelligence according to claim 1, wherein the determining the error weight of each additive in each dimension according to the similarity between the common vector of each additive and the common vector of all raw materials and the characteristic influence value of the same additive in each dimension comprises:
Calculating the average value of similarity degree between additive commonality vectors of any additive and all raw material commonality vectors respectively, and mapping and normalizing the negative correlation as an influence index of the additive;
and calculating the product of the influence index of each additive and the characteristic influence value of any dimension of the corresponding additive as the error weight of the dimension corresponding to the additive.
7. The artificial intelligence based food additive detection method according to claim 1, wherein the constructing the recognition neural network according to the error weights of different dimensions of all kinds of additives comprises:
Based on the pretrained VGG-NET model, the error weight of each class of additive in each dimension is used as the weight of the corresponding dimension, the loss weight is adjusted, and the updated VGG-NET model is obtained and used as the recognition neural network.
8. The method for detecting a food additive based on artificial intelligence according to claim 1, wherein the clustering all the raw material spectral vectors to obtain a preset first number of raw material clusters comprises:
and clustering all raw material spectrum vectors based on a preset first quantity according to a k-means clustering algorithm to obtain raw material clusters.
9. The method of claim 8, wherein clustering all of the additive spectral vectors to obtain a predetermined second number of additive clusters comprises:
And clustering all the additive spectrum vectors based on a preset second quantity according to a k-means clustering algorithm to obtain additive clusters.
CN202410315777.0A 2024-03-20 2024-03-20 Food additive detection method based on artificial intelligence Active CN117912599B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410315777.0A CN117912599B (en) 2024-03-20 2024-03-20 Food additive detection method based on artificial intelligence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410315777.0A CN117912599B (en) 2024-03-20 2024-03-20 Food additive detection method based on artificial intelligence

Publications (2)

Publication Number Publication Date
CN117912599A CN117912599A (en) 2024-04-19
CN117912599B true CN117912599B (en) 2024-05-28

Family

ID=90697185

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410315777.0A Active CN117912599B (en) 2024-03-20 2024-03-20 Food additive detection method based on artificial intelligence

Country Status (1)

Country Link
CN (1) CN117912599B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108845066A (en) * 2018-06-14 2018-11-20 贵州省产品质量监督检验院 A kind of food additives automatic testing method and system based on Internet of Things
CN113740295A (en) * 2021-07-29 2021-12-03 北京易兴元石化科技有限公司 Near-infrared modeling-based product oil additive detection and analysis method and device
CN116134527A (en) * 2020-08-10 2023-05-16 诺特可特拉华州有限责任公司 Neural network method for generating food formula
CN116908317A (en) * 2023-04-18 2023-10-20 内江市食品药品检验检测中心 Method for detecting food additives in four types of wines
CN117607120A (en) * 2023-10-08 2024-02-27 杭州海康威视数字技术股份有限公司 Food additive Raman spectrum detection method and device based on improved Resnext model

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8296077B2 (en) * 2008-10-03 2012-10-23 King Saud University Food additive detector
JP2023059181A (en) * 2021-10-14 2023-04-26 トヨタ自動車株式会社 Material kind identification system using spectral data of material

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108845066A (en) * 2018-06-14 2018-11-20 贵州省产品质量监督检验院 A kind of food additives automatic testing method and system based on Internet of Things
CN116134527A (en) * 2020-08-10 2023-05-16 诺特可特拉华州有限责任公司 Neural network method for generating food formula
CN113740295A (en) * 2021-07-29 2021-12-03 北京易兴元石化科技有限公司 Near-infrared modeling-based product oil additive detection and analysis method and device
CN116908317A (en) * 2023-04-18 2023-10-20 内江市食品药品检验检测中心 Method for detecting food additives in four types of wines
CN117607120A (en) * 2023-10-08 2024-02-27 杭州海康威视数字技术股份有限公司 Food additive Raman spectrum detection method and device based on improved Resnext model

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于BP神经网络的太赫兹时域光谱对面粉中苯甲酸定量检测研究;胡军 等;激光与光电子学进展;20191008;第1-12页 *
基于太赫兹光谱的香豆素类食品添加剂检测方法研究;马灵杰;中国优秀硕士学位论文全文数据库工程科技I辑;20230215(第2期);第5-6页 *

Also Published As

Publication number Publication date
CN117912599A (en) 2024-04-19

Similar Documents

Publication Publication Date Title
CN103048273B (en) Fruit near infrared spectrum sorting method based on fuzzy clustering
CN112288191A (en) Ocean buoy service life prediction method based on multi-class machine learning method
US20090222390A1 (en) Method, program and apparatus for generating two-class classification/prediction model
Sidehabi et al. Classification on passion fruit's ripeness using K-means clustering and artificial neural network
CN104990892A (en) Spectrum image lossless identification model establishing method for seeds and seed identification method
CN115994907B (en) Intelligent processing system and method for comprehensive information of food detection mechanism
Narendra An intelligent computer vision system for vegetables and fruits quality inspection using soft computing techniques
CN112613443A (en) Robustness communication radiation source intelligent identification method based on deep learning
Bittencourt et al. Feature selection by using classification and regression trees (CART)
Supekar et al. Multi-parameter based mango grading using image processing and machine learning techniques
CN108344701A (en) Paraffin grade qualitative classification based on hyperspectral technique and quantitative homing method
CN117912599B (en) Food additive detection method based on artificial intelligence
CN110751660B (en) Color image segmentation method
CN112836731A (en) Signal random forest classification method, system and device based on decision tree accuracy and relevance measurement
CN113495193A (en) Fault diagnosis method based on multi-wavelet transform and cluster analysis
CN115471750A (en) Hyperspectral anomaly detection method for discriminating forest based on superpixel guidance
CN111337798A (en) Insulation monitoring and partial discharge fault diagnosis method for extra-high voltage converter transformer
CN110542659A (en) pearl luster detection method based on visible light spectrum
CN114062305B (en) Single grain variety identification method and system based on near infrared spectrum and 1D-In-Resnet network
Kutlu et al. Classifying wheat genotypes using machine learning models for single kernel characterization system measurements
CN115100733A (en) RFID gesture recognition method, computer device, product and storage medium
CN112378942B (en) White spirit grade classification and identification method based on nuclear magnetic resonance fingerprint
CN115630332A (en) Wheat flour quality characteristic prediction method
CN114997216A (en) Bearing fault identification method based on tensor multi-mode feature high-order matching
CN114692773A (en) End-to-end deep learning Raman spectrum data classification method based on DRS-VGG

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant