Multi-type target object full-automatic fast detection method and system based on food traceability
By combining microscopic image acquisition and ingredient detection in food traceability detection, a set of food characteristic equations was constructed, which solved the problem of single detection methods and low efficiency in the existing technology, and achieved rapid and accurate analysis of finished food product characteristics and ingredient list verification. Improve the perfection of food safety and traceability system.
Patent Information
- Application Number
- CN202510060935.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the food traceability detection, the prior art has a single detection method, low efficiency, and the inability to fully obtain food particle characteristics and ingredient information, resulting in low detection efficiency and inaccurate results, making it difficult to identify adulteration behavior or ingredient abnormalities in complex foods.
Using a fully automatic quick detection method of multi-type target objects based on food traceability, we collect the finished food products through a microscope, combine image analysis and component detection, extract particle characteristics and target component information, construct food characteristic equations, and judge the ingredients list and actual raw materials used. consistency.
It has achieved rapid acquisition of particle characteristics and target ingredient information of finished food products, helped identify fraudulent behaviors in food processing, improved the perfection of food safety guarantee and traceability system, and ensured the authenticity and accuracy of the ingredients list.
Smart Images

Figure CN119478928A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of food safety, and more specifically, to a method and system for fully automatic rapid detection of multiple types of targets based on food traceability. Background Art
[0002] The traceability detection technology of raw materials in finished food products can accurately track the source and composition of raw materials and identify adulteration through scientific traceability methods. Traditional traceability technology is often limited to a single detection method, such as chemical analysis or microscopic observation, and cannot fully and systematically reveal the true composition information of finished food products. Especially when dealing with complex food adulteration, there are problems such as incomplete data coverage, long detection time, and inaccurate results. Therefore, there is an urgent need for a fully automatic detection system that integrates multiple dimensions and multiple technical means to achieve comprehensive analysis from microstructure to chemical composition to improve the efficiency and accuracy of detection.
[0003] The existing Chinese patent application with publication number CN116109325A proposes a food safety and traceability system and method based on the Internet of Things. The method includes: by pasting traceability QR codes on the outer packaging of basic raw materials, intermediate products and finished products of food, each traceability QR code can be scanned to obtain the corresponding basic production information; further, by pre-collecting the raw material ratio of each intermediate product and finished product, and then tracking the material purchase, inventory changes and number of products produced by the food manufacturer to analyze whether there is counterfeiting in the product production process; then, based on the comparison between the logistics traceability code and the end point and the origin of the traceability QR code, analyze whether there is counterfeiting in the product manufacturing process; while tracing the product, the possibility of counterfeiting by food manufacturers by passing inferior products as good ones is reduced.
[0004] Although the above method can meet most scenarios, research and practical application of the above method and existing technology have found that the above method and existing technology have at least the following defects:
[0005] The existing detection methods are single and inefficient. They are unable to fully obtain the characteristics and composition information of food particles, and it is difficult to quantitatively verify the consistency between the ingredient list and the actual ingredients, resulting in low detection efficiency and inaccurate results. For multiple types of targets in complex foods, the existing technology lacks a systematic detection method and is unable to effectively identify adulteration or abnormal ingredients in the ingredient list, resulting in insufficient accuracy and scientificity of the traceability results, making it difficult to meet the needs of diversified food testing and traceability, which significantly restricts the perfection of the food safety assurance and traceability system. Summary of the invention
[0006] In order to overcome the above-mentioned defects of the prior art and to achieve the above-mentioned purpose, the present invention provides the following technical solutions:
[0007] The fully automatic rapid detection method for multiple types of targets based on food traceability includes:
[0008] Use microscopes to capture images of finished food products;
[0009] Analyzing and processing the finished food product image to obtain a first finished product image;
[0010] Analyzing and processing the first finished product image to obtain first feature data;
[0011] Conduct ingredient testing on finished food products, extract target ingredients, and the corresponding target ingredient content;
[0012] Analyzing and processing the target detection component to obtain second feature data;
[0013] Get the ingredient list corresponding to the finished food product;
[0014] A food characteristic equation group is constructed according to the first characteristic data and the second characteristic data, and it is determined whether the ingredient list is consistent with the raw materials actually used in the finished food product according to the solutions of the food characteristic equation group.
[0015] Furthermore, according to the solution of the food characteristic equation group, the method for judging whether the ingredient list is consistent with the raw materials actually used in the food product includes:
[0016] Solve the food characteristic equations;
[0017] If there is a non-zero solution to the food characteristic equation system, it means that the ingredient list is consistent with the raw materials actually used in the finished food product;
[0018] If the food characteristic equation group has only zero solution, it means that the ingredient list is inconsistent with the raw materials actually used in the finished food product.
[0019] Furthermore, the method for constructing the food characteristic equation group is:
[0020]
[0021] Indicates the type of particles, Indicates the number of particles, represents the particle density, Indicates the particle distribution mode, , , , , , , , , , , and They are , , and The linear weight coefficient of , and To detect the content of target ingredients, , , , , , , , and They are , and The linear weight coefficient of , and Ingredients for the ingredient list.
[0022] Furthermore, the method for acquiring the first finished product image includes:
[0023] S100: removing noise and enhancing the finished food product image to obtain a processed finished food product image; using an edge detection algorithm to identify particle edges; and constructing the particle edges into particle contour areas;
[0024] S101: Obtain the number of particle contour areas in the finished food image, denoted as KLZL, wherein the initial value of i is preset to be 1, and the value range of i is 1 to KLZL; the particle contour areas in the finished food image include overlapping particle areas and non-overlapping particle areas;
[0025] S102: Acquire the i-th particle contour area in the finished food product image;
[0026] S103: extracting the area of the particle region from the particle contour region, and recording it as the particle area; extracting the perimeter of the particle region from the particle contour region, and recording it as the particle perimeter;
[0027] S104: Calculate the particle roundness according to the particle area and the particle perimeter; calculate the particle edge smoothness of the particle according to the particle position coordinates;
[0028] S105: Calculate the particle overlap according to the particle roundness and the particle edge smoothness; if the particle overlap is greater than or equal to a preset overlap threshold, the particles are deemed to overlap, and S106 is executed; if the particle overlap is less than the preset overlap threshold, the particles are deemed to not overlap, and S107 is executed;
[0029] S106: Use the Watershed segmentation algorithm to segment the overlapping parts of the particles to obtain segmented particles, and execute S107;
[0030] S107: Let i=i+1. If i is less than or equal to KLZL, continue to execute S102 to S105; if i is greater than KLZL, execute S108;
[0031] S108: The segmented particles and the non-overlapping particles are combined to form a first finished product image.
[0032] Furthermore, the method for calculating the particle overlap includes:
[0033] ;
[0034] ;
[0035] ;
[0036] is the particle roundness, is a constant, is the particle area, is the particle circumference; is the particle edge smoothness, is the horizontal coordinate of the particle position, is the ordinate of the particle position, t is the parameterized variable, for The first derivative of for The second-order derivative of for The first derivative of for The second derivative of is the particle overlap, is a constant, and is a constant coefficient, is the weight coefficient of particle roundness, is the weight coefficient of particle edge smoothness; is a logarithmic function.
[0037] Furthermore, the method for acquiring the first characteristic data includes:
[0038] S111: Obtain the number of particle contour areas in the first finished product image, recorded as DESL; the initial value of j is preset to 1, and the value range of j is 1 to DESL;
[0039] S112: obtaining the jth particle contour region in the first finished product image, inputting the particle contour region into a pre-built type recognition model, and obtaining the particle type corresponding to the jth particle contour region;
[0040] S113: If the particle type corresponding to the j-th particle contour area is in the particle type object set, obtain the particle type object corresponding to the particle type corresponding to the j-th particle contour area from the particle type object set, and increase the number of particles in the particle type object by one on the original basis;
[0041] If the particle type corresponding to the j-th particle contour area is not in the particle type object set, create a particle type object for the particle type corresponding to the j-th particle contour area, and add the particle type object to the particle type object set; the particle type object includes the number of particles, the particle density, and the particle distribution mode;
[0042] S114: Let j = j + 1. If j is less than or equal to DESL, continue to execute S112 to S113. If j is greater than DESL, execute S115.
[0043] S115: The particle density and the particle distribution mode corresponding to the particle type objects in the particle type object set are updated in sequence. After the updating is completed, the first characteristic data is obtained.
[0044] Furthermore, the method for sequentially updating the particle density and particle distribution mode corresponding to the particle type objects in the particle type object set includes:
[0045] S1151: Record the number of particle type objects in the particle type object set as DXSL, preset an initial value of h to be 1, and the value range of h is 1 to DXSL;
[0046] S1152: Obtain an h-th particle type object; calculate the quotient of the number of particles in the h-th particle type object and the number of particle contour areas in the first finished product image to obtain a particle density corresponding to the h-th particle type object, which is recorded as a particle density variable; input the particle type corresponding to the h-th particle type object and the first finished product image into a distribution recognition model to obtain a corresponding particle distribution mode, which is recorded as a particle distribution mode variable;
[0047] S1153: updating the particle density in the h-th particle type object to a particle density variable, and updating the particle distribution mode in the h-th particle type object to a particle distribution mode variable;
[0048] S1154: Let h=h+1. If h is less than or equal to DXSL, continue to execute S1152 to S1153. If h is greater than DXSL, end the current process.
[0049] Furthermore, the training method of the type recognition model includes:
[0050] G groups of type recognition training data are collected in advance, where G is an integer greater than 1, and the type recognition training data includes a first finished product image and a particle type corresponding to the first finished product image; each group of type recognition training data is converted into a feature vector, and all feature vectors are used as inputs of a type recognition model, wherein the type recognition model uses the particle type corresponding to each group of type recognition training data as output, and uses the actual particle type corresponding to each group of type recognition training data as a prediction target, and uses minimizing the sum of prediction accuracies of all predicted particle types as a training target; and training is stopped when the sum of prediction accuracies converges; the type recognition model is a CNN model;
[0051] The training method of the distribution recognition model includes:
[0052] M groups of distribution recognition training data are collected in advance, where M is an integer greater than 1, and the distribution recognition training data include particle types and a first finished product image, and particle distribution modes corresponding to the particle types and the first finished product image; each group of distribution recognition training data is converted into a feature vector, and all feature vectors are used as inputs of a distribution recognition model, the distribution recognition model uses the particle distribution mode corresponding to each group of distribution recognition training data as output, uses the actual particle distribution mode corresponding to each group of distribution recognition training data as a prediction target, and uses minimizing the sum of prediction accuracies of all predicted particle distribution modes as a training target; and training is stopped when the sum of prediction accuracies converges; the distribution recognition model is a CNN model.
[0053] Furthermore, the method for acquiring the second characteristic data includes:
[0054] S121: Mark the number of types of target detection components as CFSL; preset the initial value of r to be 1, and the value range of r is 1 to CFSL;
[0055] S122: Obtain the rth target detection component and the corresponding target detection component content;
[0056] S123: constructing the target detection component and the corresponding target detection component content into a target component object corresponding to the rth target detection component, and adding the target component object to the target component object set;
[0057] S124: Let r=r+1. If r is less than or equal to CFSL, continue to execute S122 to S123. If r is greater than CFSL, end the current process and the target component object set is the second feature data.
[0058] The multi-type target object fully automatic rapid detection system based on food traceability implements the multi-type target object fully automatic rapid detection method based on food traceability, including:
[0059] The first acquisition module uses a microscope to acquire images of finished food products;
[0060] A first processing module, used for analyzing and processing the finished food image to obtain a first finished food image;
[0061] A second processing module is used to analyze and process the first finished product image to obtain first feature data;
[0062] The second acquisition module is used to perform component detection on the finished food product, extract the target detection component, and the corresponding target detection component content;
[0063] A third processing module is used to analyze and process the target detection component to obtain second feature data;
[0064] The third collection module is used to obtain the ingredient list corresponding to the finished food product;
[0065] The traceability diagnosis module is used to construct a food characteristic equation group based on the first characteristic data and the second characteristic data, and determine whether the ingredient list is consistent with the raw materials actually used in the food product based on the equation solutions of the food characteristic equation group.
[0066] The technical effects and advantages of the fully automatic rapid detection method and system for multiple types of targets based on food traceability of the present invention are as follows:
[0067] By combining microscopic image analysis with ingredient detection, the particle characteristics and target ingredient information of finished food products can be quickly obtained. The combined analysis of particle characteristics and target ingredients can help regulatory agencies identify counterfeiting in food processing and provide a technical basis for food anti-counterfeiting and certification. Analysis of particle types, quantities, densities, distribution patterns, and detection ingredients can accurately trace the source and use of food raw materials, effectively identify possible adulteration, and improve supply chain transparency. A food characteristic equation group is established to scientifically verify the authenticity of the food ingredient list. By solving the food characteristic equation group, the consistency between the food test ingredients and the ingredients indicated on the ingredient list is verified, and the authenticity of the ingredient list is judged in a scientific and quantitative manner to avoid infringement of consumer rights by counterfeiting the ingredient list.
[0068] This solution is based on multi-dimensional and multi-method detection technology, combining particle feature analysis and ingredient detection, and provides an innovative and practical solution for food raw material traceability, quality control, and adulteration identification. It has significant technological advancement and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1This is a schematic diagram of a fully automatic rapid detection system for multiple types of targets based on food traceability according to Example 1 of the present invention;
[0070] Figure 2 This is a flow chart of a method for fully automatic rapid detection of multiple types of targets based on food traceability according to Example 2 of the present invention;
[0071] Figure 3 is a flow chart of a method for acquiring a first finished product image;
[0072] Figure 4 This is a flow chart of a method for obtaining first characteristic data. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0074] Example 1
[0075] See also Figure 1 As shown, the fully automatic rapid inspection system for multiple types of targets based on food traceability described in this embodiment includes a first acquisition module, a first processing module, a second processing module, a second acquisition module, a third processing module, a third acquisition module and a traceability diagnosis module, and each module is connected through wired and / or wireless connections to achieve data transmission.
[0076] The first acquisition module uses a microscope to acquire images of finished food products.
[0077] It should be noted that the microscope may be an optical microscope, a polarizing microscope or an electron microscope depending on the type of food, and no specific limitation is made here.
[0078] The first processing module is used to analyze and process the finished food image to obtain a first finished food image.
[0079] like Figure 3 As shown, the method for acquiring the first finished product image includes:
[0080] S100: removing noise and enhancing the finished food product image to obtain a processed finished food product image; using an edge detection algorithm to identify particle edges; and constructing the particle edges into particle contour areas;
[0081] It should be noted that noise removal and image enhancement are commonly used processing methods in image preprocessing.
[0082] S101: Obtain the number of particle contour areas in the finished food image, denoted as KLZL, wherein the initial value of i is preset to be 1, and the value range of i is 1 to KLZL; the particle contour areas in the finished food image include overlapping particle areas and non-overlapping particle areas;
[0083] It should be noted that the particles refer to the tiny structural units composed of raw materials or ingredients in the finished food. Common types of particles include starch particles, fat particles, protein particles, fiber particles and crystal particles. The particle characteristics in food are important indicators of food ingredients and quality. Its microscopic analysis combined with chemical testing can effectively identify adulteration and verify the authenticity of the ingredient list.
[0084] S102: Acquire the i-th particle contour area in the finished food product image;
[0085] S103: extracting the area of the particle region from the particle contour region, and recording it as the particle area; extracting the perimeter of the particle region from the particle contour region, and recording it as the particle perimeter;
[0086] S104: Calculate the particle roundness according to the particle area and the particle perimeter; calculate the particle edge smoothness of the particle according to the particle position coordinates;
[0087] S105: Calculate the particle overlap according to the particle roundness and the particle edge smoothness; if the particle overlap is greater than or equal to a preset overlap threshold, the particles are deemed to overlap, and S106 is executed; if the particle overlap is less than the preset overlap threshold, the particles are deemed to not overlap, and S107 is executed;
[0088] S106: Use the Watershed segmentation algorithm to segment the overlapping parts of the particles to obtain segmented particles, and execute S107;
[0089] S107: Let i=i+1. If i is less than or equal to KLZL, continue to execute S102 to S105; if i is greater than KLZL, execute S108;
[0090] S108: The segmented particles and the non-overlapping particles are combined to form a first finished product image.
[0091] The method for calculating the particle roundness includes:
[0092] ;
[0093] in, is the particle roundness, is a constant, is the particle area, is the particle circumference. The closer the particle roundness is to 1, the closer the particle is to a circle. It can be used to describe the regularity of the particle shape. A lower particle roundness value indicates that the particle is irregular in shape. It can also be used to determine whether there is overlap.
[0094] In the embodiments of the present application, since the raw materials that are passed off as inferior products are actually still of the same type, for example, cocoa butter substitute is used instead of cocoa butter, from the perspective of a single component, the image method is basically unrecognizable. However, the present application finds that when the inferior raw materials that are passed off as superior products are mixed with other components, there will be differences in the mixing details, and the differences are relatively subtle. Based on this, the present application uses the image method to take the smallest unit particles in the food as each observation object, thereby expanding the difference in features.
[0095] Furthermore, in a preferred embodiment of the present application, in order to avoid the impact of agglomeration between particles, the embodiment of the present application can interpolate multiple particles that are close to each other (with relatively high local density) as a whole large particle, and enhance the characteristics of the whole large particle from the surface morphology to expand the difference in characteristics, thereby making it easier to identify the differences between different materials.
[0096] Specifically, since the large particle as a whole is composed of multiple particles, its surface forms a "multi-pit" structure. As a result, in the embodiment of the present application, the raw material and the inferior raw material may have a low degree of difference in themselves, but when they are combined with other raw materials, there will be differences in their surface properties. The difference in surface properties will make the contact angles of the two particles different when they are combined together. The embodiment of the present application uses a multi-pit structure and an image recognition method to identify the depth and bottom curvature corresponding to each pit in the multi-pit structure, and compares the depth and bottom curvature to achieve the comparison between the raw material and the inferior raw material.
[0097] It should be noted that the present application requires taking a physical picture of the food that is not made from inferior raw materials in advance as a preset image for subsequent comparison.
[0098] It should be further explained that the image recognition method of the present application can use a target detection algorithm such as YOLOv5 to take the pit structure as a target, thereby identifying the characteristics of the pit structure.
[0099] This application further optimizes and improves the YOLOv5 algorithm. Specifically, for curvature detection, one or more fully connected layers are added to construct the regression branch of the bottom surface curvature based on the original detection of YOLOv5. For example, assuming that after the previous backbone network and feature fusion operations, the output feature map dimension is [batch_size, feature_size] (where batch_size represents the number of images processed at a time, and feature_size is the dimension of the feature vector). You can first connect a fully connected layer to map the feature vector of feature_size dimension to an intermediate dimension, such as intermediate_size. The weight matrix dimension of the fully connected layer is [feature_size, intermediate_size], and its bias item dimension is intermediate_size. Then connect another fully connected layer to further map the intermediate_size dimensional vector to a one-dimensional output representing the curvature value (such as the radius of curvature). The weight matrix dimension of this fully connected layer is [intermediate_size, 1], and the bias item dimension is 1.
[0100] In other embodiments, in addition to the simple two-layer fully connected layer setting, a more complex multi-layer perceptron structure can also be constructed. For example, a three-layer fully connected MLP is used. After the first mapping to the intermediate_size dimension, a fully connected layer is connected to map it to another intermediate dimension new_intermediate_size (the weight matrix dimension is [intermediate_size, new_intermediate_size], and the bias item dimension is new_intermediate_size). Finally, another fully connected layer is passed to output the curvature value. The weight matrix dimension is [new_intermediate_siz, 1], and the bias item dimension is 1. By increasing the number of layers and adjusting the number of neurons in each layer, the model can have stronger nonlinear fitting capabilities and more accurately map the extracted image features to specific values of curvature. Furthermore, a similar method as above can be used for depth detection, which will not be elaborated in this application.
[0101] Furthermore, when performing curvature detection, the present application uses a light beam in a specific direction to perform fill light when collecting images. Due to different curvatures, the directions of reflected light are also different, so the grayscale and brightness displayed are different. Therefore, by calibrating the curvatures corresponding to pit structures with different grayscales and brightnesses, the abstract curvature that cannot be directly extracted is converted into pixel features for extraction and identification, so that curvature identification can be performed in combination with YOLOv5.
[0102] The calculation method of the particle edge smoothness includes:
[0103] Mark the horizontal coordinate of the current particle position as , the vertical coordinate of the current particle position is marked as , t is a parameterized variable, and the coordinate of the first particle adjacent to the current particle is marked as , the horizontal coordinate of the second particle adjacent to the current particle is marked as , the vertical coordinate of the first particle adjacent to the current particle is marked as , the vertical coordinate of the second particle adjacent to the current particle is marked as ;
[0104] according to and Calculated The first-order derivative of and Calculated The first derivative of ;
[0105] Said The calculation methods of the first-order derivative include:
[0106] ;
[0107] Said The calculation methods of the first-order derivative include:
[0108] ;
[0109] according to , and Calculated The second-order derivative of , and Calculated The second derivative of
[0110] Said The calculation methods of the second-order derivative include:
[0111] ;
[0112] Said The calculation methods of the second-order derivative include:
[0113] ;
[0114] according to , , , , and The particle edge smoothness is calculated.
[0115] The calculation method of the particle edge smoothness includes:
[0116] ;
[0117] in, The smoothness of the particle edge.
[0118] It should be noted that the particle edge smoothness is an indicator of the degree of curvature of the particle edge. Each point on the particle edge has a particle edge smoothness value. The smaller the particle edge smoothness value, the smoother the edge. The larger the particle edge smoothness value, the greater the curvature or folding of the edge.
[0119] Particle overlap usually refers to the inability to clearly separate the areas between two or more particles (food ingredient particles) in an image, causing them to form an irregular merged area visually or analytically. This situation affects the accurate identification and feature extraction of particles, so a group of features, such as particle roundness and particle edge smoothness, are used to determine whether particles overlap.
[0120] The calculation method of the particle overlap degree includes:
[0121] ;
[0122] in, is the particle overlap, is a constant, and is a constant coefficient, is the weight coefficient of particle roundness, is the weight coefficient of particle edge smoothness; is a logarithmic function.
[0123] The second processing module is used to analyze and process the first finished product image to obtain first feature data.
[0124] like Figure 4 As shown, the method for obtaining the first feature data includes:
[0125] S111: Obtain the number of particle contour areas in the first finished product image, recorded as DESL; the initial value of j is preset to 1, and the value range of j is 1 to DESL;
[0126] S112: obtaining the jth particle contour region in the first finished product image, inputting the particle contour region into a pre-built type recognition model, and obtaining the particle type corresponding to the jth particle contour region;
[0127] S113: If the particle type corresponding to the j-th particle contour area is in the particle type object set, obtain the particle type object corresponding to the particle type corresponding to the j-th particle contour area from the particle type object set, and increase the number of particles in the particle type object by one on the original basis;
[0128] If the particle type corresponding to the j-th particle contour area is not in the particle type object set, create a particle type object for the particle type corresponding to the j-th particle contour area, and add the particle type object to the particle type object set; the particle type object includes the number of particles, the particle density, and the particle distribution mode;
[0129] S114: Let j = j + 1. If j is less than or equal to DESL, continue to execute S112 to S113. If j is greater than DESL, execute S115.
[0130] S115: The particle density and the particle distribution mode corresponding to the particle type objects in the particle type object set are updated in sequence. After the updating is completed, the first characteristic data is obtained.
[0131] The method for sequentially updating the particle density and particle distribution mode corresponding to the particle type objects in the particle type object set includes:
[0132] S1151: Record the number of particle type objects in the particle type object set as DXSL, preset an initial value of h to be 1, and the value range of h is 1 to DXSL;
[0133] S1152: Obtain an h-th particle type object; calculate the quotient of the number of particles in the h-th particle type object and the number of particle contour areas in the first finished product image to obtain a particle density corresponding to the h-th particle type object, which is recorded as a particle density variable; input the particle type corresponding to the h-th particle type object and the first finished product image into a distribution recognition model to obtain a corresponding particle distribution mode, which is recorded as a particle distribution mode variable;
[0134] S1153: updating the particle density in the h-th particle type object to a particle density variable, and updating the particle distribution mode in the h-th particle type object to a particle distribution mode variable;
[0135] S1154: Let h=h+1. If h is less than or equal to DXSL, continue to execute S1152 to S1153. If h is greater than DXSL, end the current process.
[0136] The training method of the category recognition model includes:
[0137] G groups of type recognition training data are collected in advance, where G is an integer greater than 1, and the type recognition training data includes a first finished product image, and a particle type corresponding to the first finished product image; each group of type recognition training data is converted into a feature vector, and all feature vectors are used as inputs of a type recognition model, the type recognition model uses the particle type corresponding to each group of type recognition training data as output, and the actual particle type corresponding to each group of type recognition training data as a prediction target, and minimizes the sum of prediction accuracies of all predicted particle types as a training target; training is stopped when the sum of prediction accuracies converges; the type recognition model is a CNN model.
[0138] The training method of the distribution recognition model includes:
[0139] M groups of distribution recognition training data are collected in advance, where M is an integer greater than 1, and the distribution recognition training data include particle types and a first finished product image, and particle distribution modes corresponding to the particle types and the first finished product image; each group of distribution recognition training data is converted into a feature vector, and all feature vectors are used as inputs of a distribution recognition model, the distribution recognition model uses the particle distribution mode corresponding to each group of distribution recognition training data as output, uses the actual particle distribution mode corresponding to each group of distribution recognition training data as a prediction target, and uses minimizing the sum of prediction accuracies of all predicted particle distribution modes as a training target; and training is stopped when the sum of prediction accuracies converges; the distribution recognition model is a CNN model.
[0140] It should be noted that determining the specific types of particles in the finished food (such as protein particles, fiber particles, crystal particles, etc.) can infer the raw materials used in the food. For example, protein particles are directly related to specific sources (such as milk, soy). Raw material adulteration can cause unexpected particles or abnormal particle distribution in the particle type. For example, adding syrup to honey may cause additional crystal particles to appear. Analyzing whether the density and number of particles in the finished food are consistent with the expected values of the production formula can verify the authenticity of the formula. The particle distribution pattern is directly related to the raw materials and processing technology, which can help identify whether the correct raw materials and processes are used. By obtaining and analyzing the collection of particle type objects, food companies can establish a more refined traceability system, which not only improves food quality and safety, but also effectively prevents adulteration, increases brand trust, and provides consumers with more transparent and reliable food information.
[0141] The second acquisition module is used to perform ingredient detection on the finished food product, extract the target detection ingredients, and the corresponding target detection ingredient content.
[0142] It should be noted that when conducting ingredient testing on finished food products, specific target detection ingredients can be extracted, where the selection of target detection ingredients is not limited to specific species or types, but is based on the actual needs of food raw material traceability and is reasonably determined by technical personnel in the field according to specific circumstances. The selection of target detection ingredients can include nutritional ingredients, functional ingredients, characteristic markers or potential adulterants to ensure that the food traceability process is scientific, targeted and practical, and to provide accurate and reliable data support for the authenticity verification, source tracing and quality control of finished food products.
[0143] The third processing module is used to analyze and process the target detection component to obtain second feature data.
[0144] The method for acquiring the second characteristic data includes:
[0145] S121: Mark the number of types of target detection components as CFSL; preset the initial value of r to be 1, and the value range of r is 1 to CFSL;
[0146] S122: Obtain the rth target detection component and the corresponding target detection component content;
[0147] S123: constructing the target detection component and the corresponding target detection component content into a target component object corresponding to the rth target detection component, and adding the target component object to the target component object set;
[0148] S124: Let r=r+1. If r is less than or equal to CFSL, continue to execute S122 to S123. If r is greater than CFSL, end the current process and the target component object set is the second feature data.
[0149] The third collection module is used to obtain the ingredient list corresponding to the finished food product.
[0150] The traceability diagnosis module is used to construct a food characteristic equation group based on the first characteristic data and the second characteristic data, and determine whether the ingredient list is consistent with the raw materials actually used in the food product based on the equation solutions of the food characteristic equation group.
[0151] The method for constructing the food characteristic equation group is:
[0152]
[0153] in, Indicates the type of particles, Indicates the number of particles, represents the particle density, Indicates the particle distribution mode, , , , , , , , , , , and They are , , and The linear weight coefficient of , and To detect the content of target ingredients, , , , , , , , and They are , and The linear weight coefficient of , and Ingredients for the ingredient list.
[0154] The method for judging whether the ingredient list is consistent with the raw materials actually used in the finished food product according to the solution of the food characteristic equation group includes:
[0155] Solve the food characteristic equations;
[0156] If there is a non-zero solution to the food characteristic equation system, it means that the ingredient list is consistent with the raw materials actually used in the finished food product;
[0157] If the food characteristic equation group has only zero solution, it means that the ingredient list is inconsistent with the raw materials actually used in the finished food product.
[0158] It should be noted that a zero solution means that the values of all unknowns in the solution of the linear equations are zero, that is, each component is equal to 0; a non-zero solution means that the values of all unknowns in the solution of the linear equations are not all zero. If the established equations have a non-zero solution, it means that the test components extracted from the finished food product are consistent with the components indicated in the ingredient list; if the equations only have a zero solution, it means that the test components do not match the components declared in the ingredient list. Through the properties of the solution of the equations, the authenticity and accuracy of the ingredient list can be scientifically verified, providing a quantitative basis for the traceability of food raw materials, thereby effectively identifying adulteration and improving the reliability of food quality management and the authority of the traceability system.
[0159] The present application combines image recognition with component analysis, and is particularly suitable for identifying inferior products of the same material as good ones, and can achieve the effect of rapid and fully automatic detection.
[0160] Example 2
[0161] See also Figure 2 As shown, this embodiment provides a method for fully automatic rapid detection of multiple types of targets based on food traceability, and also includes:
[0162] Use microscopes to capture images of finished food products;
[0163] Analyzing and processing the finished food product image to obtain a first finished product image;
[0164] Analyzing and processing the first finished product image to obtain first feature data;
[0165] Conduct ingredient testing on finished food products, extract target ingredients, and the corresponding target ingredient content;
[0166] Analyzing and processing the target detection component to obtain second feature data;
[0167] Get the ingredient list corresponding to the finished food product;
[0168] A food characteristic equation group is constructed according to the first characteristic data and the second characteristic data, and it is determined whether the ingredient list is consistent with the raw materials actually used in the finished food product according to the solutions of the food characteristic equation group.
[0169] Example 3
[0170] The present application also provides an electronic device. The electronic device may include one or more processors and one or more memories. The memories store computer-readable codes, and when the computer-readable codes are executed by the one or more processors, the security verification method of multi-source heterogeneous data as described above may be executed.
[0171] The electronic device may include a bus, one or more CPUs, ROM, RAM, a communication port connected to a network, input / output, a hard disk, etc. A storage device in the electronic device, such as a ROM or a hard disk, may store a security verification method for multi-source heterogeneous data provided in the present application. Furthermore, the electronic device may also include a user interface. Of course, the architecture described above is only exemplary. When implementing different devices, one or more components in the electronic device described above may be omitted according to actual needs.
[0172] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0173] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A fully automatic rapid detection method for multiple types of targets based on food traceability, characterized in that: include: Use microscopes to capture images of finished food products; Analyzing and processing the finished food product image to obtain a first finished product image; Analyzing and processing the first finished product image to obtain first feature data; Conduct ingredient testing on finished food products, extract target test ingredients, and the corresponding target test ingredient content; Analyzing and processing the target detection component to obtain second feature data; Get the ingredient list corresponding to the finished food product; A food characteristic equation group is constructed according to the first characteristic data and the second characteristic data, and it is determined whether the ingredient list is consistent with the raw materials actually used in the finished food product according to the solutions of the food characteristic equation group.
2. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 1 is characterized in that: The method for judging whether the ingredient list is consistent with the raw materials actually used in the finished food product according to the solution of the food characteristic equation group includes: Solve the food characteristic equations; If there is a non-zero solution to the food characteristic equation system, it means that the ingredient list is consistent with the raw materials actually used in the finished food product; If the food characteristic equation group has only zero solution, it means that the ingredient list is inconsistent with the raw materials actually used in the finished food product.
3. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 2 is characterized in that: The method for constructing the food characteristic equation group is: ; Indicates the type of particles, Indicates the number of particles, represents the particle density, Indicates the particle distribution mode, , , , , , , , , , , and They are , , and The linear weight coefficient of , and To detect the content of target ingredients, , , , , , , , and They are , and The linear weight coefficient of , and Ingredients for the ingredient list.
4. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 1 is characterized in that: The method for acquiring the first finished product image includes: S100: removing noise and enhancing the finished food product image to obtain a processed finished food product image; using an edge detection algorithm to identify particle edges; and constructing the particle edges into particle contour areas; S101: Obtain the number of particle contour areas in the finished food image, denoted as KLZL, wherein the initial value of i is preset to be 1, and the value range of i is 1 to KLZL; the particle contour areas in the finished food image include overlapping particle areas and non-overlapping particle areas; S102: Acquire the i-th particle contour area in the finished food product image; S103: extracting the area of the particle region from the particle contour region, and recording it as the particle area; extracting the perimeter of the particle region from the particle contour region, and recording it as the particle perimeter; S104: Calculate the particle roundness according to the particle area and the particle perimeter; calculate the particle edge smoothness of the particle according to the particle position coordinates; S105: Calculate the particle overlap according to the particle roundness and the particle edge smoothness; if the particle overlap is greater than or equal to a preset overlap threshold, the particles are deemed to overlap, and S106 is executed; if the particle overlap is less than the preset overlap threshold, the particles are deemed to not overlap, and S107 is executed; S106: Use the Watershed segmentation algorithm to segment the overlapping parts of the particles to obtain segmented particles, and execute S107; S107: Let i=i+1. If i is less than or equal to KLZL, continue to execute S102 to S105; if i is greater than KLZL, execute S108; S108: The segmented particles and the non-overlapping particles are combined to form a first finished product image.
5. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 4 is characterized in that: The calculation method of the particle overlap degree includes: ; ; ; is the particle roundness, is a constant, is the particle area, is the particle circumference; is the particle edge smoothness, is the horizontal coordinate of the particle position, is the ordinate of the particle position, t is the parameterized variable, for The first derivative of for The second-order derivative of for The first derivative of for The second derivative of is the particle overlap, is a constant, and is a constant coefficient, is the weight coefficient of particle roundness, is the weight coefficient of particle edge smoothness; is a logarithmic function.
6. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 5 is characterized in that: The method for acquiring the first characteristic data includes: S111: Obtain the number of particle contour areas in the first finished product image, recorded as DESL; the initial value of j is preset to 1, and the value range of j is 1 to DESL; S112: obtaining the jth particle contour region in the first finished product image, inputting the particle contour region into a pre-built type recognition model, and obtaining the particle type corresponding to the jth particle contour region; S113: If the particle type corresponding to the j-th particle contour area is in the particle type object set, obtain the particle type object corresponding to the particle type corresponding to the j-th particle contour area from the particle type object set, and increase the number of particles in the particle type object by one on the original basis; If the particle type corresponding to the j-th particle contour area is not in the particle type object set, create a particle type object for the particle type corresponding to the j-th particle contour area, and add the particle type object to the particle type object set; the particle type object includes the number of particles, the particle density, and the particle distribution mode; S114: Let j = j + 1. If j is less than or equal to DESL, continue to execute S112 to S113. If j is greater than DESL, execute S115. S115: The particle density and the particle distribution mode corresponding to the particle type objects in the particle type object set are updated in sequence. After the updating is completed, the first characteristic data is obtained.
7. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 6 is characterized in that: The method for sequentially updating the particle density and particle distribution mode corresponding to the particle type objects in the particle type object set includes: S1151: Record the number of particle type objects in the particle type object set as DXSL, preset an initial value of h to be 1, and the value range of h is 1 to DXSL; S1152: Obtain an h-th particle type object; calculate the quotient of the number of particles in the h-th particle type object and the number of particle contour areas in the first finished product image to obtain a particle density corresponding to the h-th particle type object, which is recorded as a particle density variable; input the particle type corresponding to the h-th particle type object and the first finished product image into a distribution recognition model to obtain a corresponding particle distribution mode, which is recorded as a particle distribution mode variable; S1153: updating the particle density in the h-th particle type object to a particle density variable, and updating the particle distribution mode in the h-th particle type object to a particle distribution mode variable; S1154: Let h=h+1. If h is less than or equal to DXSL, continue to execute S1152 to S1153. If h is greater than DXSL, end the current process.
8. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 7 is characterized in that: The training method of the category recognition model includes: G groups of type recognition training data are collected in advance, where G is an integer greater than 1, and the type recognition training data includes a first finished product image and a particle type corresponding to the first finished product image; each group of type recognition training data is converted into a feature vector, and all feature vectors are used as inputs of a type recognition model, wherein the type recognition model uses the particle type corresponding to each group of type recognition training data as output, and uses the actual particle type corresponding to each group of type recognition training data as a prediction target, and uses minimizing the sum of prediction accuracies of all predicted particle types as a training target; and training is stopped when the sum of prediction accuracies converges; the type recognition model is a CNN model; The training method of the distribution recognition model is the same as the training method of the category recognition model, and the distribution recognition model is a CNN model.
9. The method for fully automatic rapid detection of multiple types of targets based on food traceability according to claim 1 is characterized in that: The method for acquiring the second characteristic data includes: S121: Mark the number of types of target detection components as CFSL; preset the initial value of r to be 1, and the value range of r is 1 to CFSL; S122: Obtain the rth target detection component and the corresponding target detection component content; S123: constructing the target detection component and the corresponding target detection component content into a target component object corresponding to the rth target detection component, and adding the target component object to the target component object set; S124: Let r=r+1. If r is less than or equal to CFSL, continue to execute S122 to S123. If r is greater than CFSL, end the current process and the target component object set is the second feature data.
10. A fully automatic rapid detection system for multiple types of targets based on food traceability, implementing the fully automatic rapid detection method for multiple types of targets based on food traceability according to any one of claims 1 to 9, characterized in that: include: The first acquisition module uses a microscope to acquire images of finished food products; A first processing module, used for analyzing and processing the finished food image to obtain a first finished food image; A second processing module is used to analyze and process the first finished product image to obtain first feature data; The second acquisition module is used to perform component detection on the finished food product, extract the target detection component, and the corresponding target detection component content; A third processing module is used to analyze and process the target detection component to obtain second feature data; The third collection module is used to obtain the ingredient list corresponding to the finished food product; The traceability diagnosis module is used to construct a food characteristic equation group based on the first characteristic data and the second characteristic data, and determine whether the ingredient list is consistent with the raw materials actually used in the food product based on the solution of the food characteristic equation group.
Citation Information
Patent Citations
System and method for managing and controlling food safety and traceability based on Internet of Things
CN116109325A
Cited By
Standardized food fast inspection information pushing method and system
CN121436631A
A food fast inspection information standardization pushing method and system
CN121436631B