Method and device for identifying food materials
By combining type probability statistics and location probability statistics records for food association identification, the problem of high misidentification and missed identification rates of food ingredients is solved, and the accuracy and management efficiency of food identification are improved.
Patent Information
- Application Number
- CN202011067662.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-30
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-09-30
Smart Images

Figure CN113486913B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of smart home appliances, and in particular to a method and device for identifying food. Background Art
[0002] In recent years, with the continuous development of smart home appliances, food management based on image recognition has become a development trend in the home appliance industry. However, due to factors such as lighting, occlusion, similarity between ingredients, and user usage methods, the misidentification rate / missed identification rate of ingredients often remains high, resulting in food management based on image recognition being unable to meet the actual usage needs of users.
[0003] In the prior art, household appliances usually rely solely on image recognition results, which still cannot avoid the problems of misidentification and missed identification of food ingredients, and the accuracy of food ingredient recognition is not high.
[0004] Therefore, it is necessary to provide a solution to solve the problem of high misidentification rate and missed identification rate in food identification. Summary of the invention
[0005] The embodiments of the present invention provide a food identification method and device, which are used to solve the problems of high misidentification rate and missed identification rate in food identification.
[0006] In a first aspect, an embodiment of the present invention provides a method for identifying food materials, comprising:
[0007] Based on the image obtained by taking photos, image recognition is performed to obtain image recognition results of each food ingredient;
[0008] For the first food at the first position in the image recognition result, if it is determined that the first food does not exist in the food data record at the first position, an associative recognition result is determined according to a type probability statistical record and a position probability statistical record; the type probability statistical record is used to record the posterior probability that the j-th food is identified as the i-th food among all types of food; the position probability statistical record is used to record the posterior probability that the j-th position is identified as the i-th position among all positions;
[0009] The food material data record is updated according to the associative recognition result.
[0010] Through the above method, for the image recognition results of each ingredient, by adopting the type probability statistical record and the location probability statistical record, combined with the ingredient data record, inference analysis is performed to determine the association result of the ingredient type and the ingredient location, thereby avoiding the problem of low ingredient recognition accuracy that simply relies on image recognition results, improving the ingredient recognition accuracy, and enhancing the accuracy of ingredient management.
[0011] In a possible design, the associative recognition result is determined based on the category probability statistical record and the position probability statistical record, including:
[0012] Determine a second ingredient from the category probability statistical record; the second ingredient is an ingredient whose posterior probability of being identified as the first ingredient is greater than a first threshold;
[0013] Determine a second position from the position probability statistical record; the second position is a position identified as the first position with a posterior probability greater than a second threshold;
[0014] determining whether the second ingredient exists at the first position in the ingredient data record, and if so, taking the second ingredient at the first position as the associative recognition result;
[0015] Determine whether the first ingredient exists at the second position in the ingredient data record; if so, use the first ingredient at the second position as the associative recognition result.
[0016] Through the above method, the associative recognition method is used for the identification results of the ingredients to judge the type and location of the ingredients, which reduces the misidentification and missed identification of the ingredients and further improves the accuracy of ingredient identification.
[0017] In one possible design, if the second ingredient is not present at the first position in the ingredient data record and the first ingredient is not present at the second position, determining whether the second ingredient is present at the second position in the ingredient data record;
[0018] If the second ingredient is present at the second position, the second ingredient at the second position is used as the associative recognition result.
[0019] Through the above method, when it is determined that there is no second ingredient at the first position and no first ingredient at the second position, the second ingredient at the second position in the ingredient data record is further determined, thereby reducing the missed identification rate of ingredients and improving the accuracy of ingredient identification.
[0020] In a possible design, updating the food data record according to the associative recognition result includes:
[0021] If it is determined that the second ingredient exists at the first position in the ingredient data record, obtaining a first probability that the second ingredient is identified as the first ingredient from the category probability statistics record;
[0022] If it is determined that the first ingredient is present at the second location in the ingredient data record, obtaining a second probability that the second location is identified as the first location from the location probability statistics;
[0023] If it is determined that the second ingredient does not exist at the first position in the ingredient data record and the first ingredient does not exist at the second position, determining a third probability according to the first probability and the second probability;
[0024] Determine a recognition result with the highest probability among the associative recognition results based at least on the second probability of each second position, the first probability of each second ingredient, and the third probability that each second position has the second ingredient;
[0025] The food material data record is updated according to the recognition result with the highest probability among the associative recognition results.
[0026] Through the above method, the probability of each second position and each second ingredient is sorted, the corresponding recognition result with the highest probability of associative recognition result is determined, and the ingredient data record is updated, thereby improving the recognition efficiency of the associative result and thus improving the recognition efficiency of ingredient image recognition.
[0027] In a possible design, the associative recognition result is determined based on the category probability statistical record and the position probability statistical record, including:
[0028] Determine a third ingredient at a third position from the ingredient data record; the third position is an adjacent position to the first position; the third ingredient is any ingredient at the third position;
[0029] Determine a fourth probability that the third ingredient is identified as the first ingredient from the category probability statistical record; determine a fifth probability that the third location is identified as the first location from the location probability statistical record; and determine a sixth probability based on the fourth probability and the fifth probability;
[0030] The associative recognition result is determined based on the fifth probability of the first position, the fourth probability of any third ingredient, and the sixth probability that the first position has any third ingredient.
[0031] Through the above method, for any ingredient at an adjacent position to the first position, the fourth probability, fifth probability and sixth probability of any ingredient at the adjacent position are determined to determine the associative recognition result, thereby improving the recognition efficiency of ingredient image recognition and the ingredient management efficiency.
[0032] In a possible design, the category probability statistical record and the first position probability statistical record are obtained in the following manner:
[0033] Based on the image recognition results, the initial category probability statistics record and the initial position probability statistics record are calculated;
[0034] According to continuous iterations of image recognition, the initial category probability statistical record and the initial location probability statistical record are updated;
[0035] After the image recognition result meets the set conditions, the type probability statistical record and the position probability statistical record are obtained.
[0036] Through the above method, according to the continuous iteration of image recognition, the initial type probability statistical record and the initial position probability statistical record are updated, so that the obtained type probability statistical record and the position probability statistical record are continuously optimized type probability statistical record and position probability statistical record, which provides reliability for using the type probability statistical record and the position probability statistical record to determine the associative recognition result of the food.
[0037] In a possible design, the category probability statistical record and the location probability statistical record are obtained through Bayesian probability.
[0038] Through the above method, Bayesian probability is used to obtain type probability statistical records and location probability statistical records, which realizes the probability statistics of actual food identification as identified food and the probability statistics of actual food location identification as identified location, providing a way to use the results of identified food and identified location to analyze and find out the actual type and location of the food.
[0039] In a second aspect, an embodiment of the present invention provides a food identification device, including an image collector and a processor;
[0040] The image collector is used to take pictures to obtain images to be processed;
[0041] The processor is used to perform image recognition to obtain image recognition results of each ingredient; for the first ingredient at the first position in the image recognition result, if it is determined that the first ingredient does not exist at the first position in the ingredient data record, an associative recognition result is determined based on a type probability statistical record and a position probability statistical record; the type probability statistical record is used to record the posterior probability that the jth type of ingredient is identified as the ith type of ingredient in each type of ingredient; the position probability statistical record is used to record the posterior probability that the jth position is identified as the ith position in each position; and the ingredient data record is updated based on the associative recognition result.
[0042] In a possible design, the processor is further configured to determine a second ingredient from the category probability statistical record; the second ingredient is an ingredient whose posterior probability of being identified as the first ingredient is greater than a first threshold;
[0043] Determine a second position from the position probability statistical record; the second position is a position identified as the first position with a posterior probability greater than a second threshold;
[0044] determining whether the second ingredient exists at the first position in the ingredient data record, and if so, taking the second ingredient at the first position as the associative recognition result;
[0045] Determine whether the first ingredient exists at the second position in the ingredient data record; if so, use the first ingredient at the second position as the associative recognition result.
[0046] In one possible design, the processor is specifically configured to determine whether the second ingredient is present at the second location in the ingredient data record if the second ingredient is not present at the first location in the ingredient data record and the first ingredient is not present at the second location;
[0047] If the second ingredient is present at the second position, the second ingredient at the second position is used as the associative recognition result.
[0048] In one possible design, the processor is further configured to obtain a first probability that the second ingredient is identified as the first ingredient from the category probability statistics record if it is determined that the second ingredient exists at the first position in the ingredient data record;
[0049] If it is determined that the first ingredient is present at the second location in the ingredient data record, obtaining a second probability that the second location is identified as the first location from the location probability statistics;
[0050] If it is determined that the second ingredient does not exist at the first position in the ingredient data record and the first ingredient does not exist at the second position, determining a third probability according to the first probability and the second probability;
[0051] Determine the recognition result with the highest probability among the associative recognition results at least based on the second probability of each second position, the first probability of each second ingredient, and the third probability that each second position has the second ingredient; and update the ingredient data record based on the recognition result with the highest probability among the associative recognition results.
[0052] In a possible design, the processor is specifically configured to determine a third ingredient at a third position from the ingredient data record; the third position is an adjacent position to the first position; the third ingredient is any ingredient at the third position;
[0053] Determine a fourth probability that the third ingredient is identified as the first ingredient from the category probability statistical record; determine a fifth probability that the third location is identified as the first location from the location probability statistical record; and determine a sixth probability based on the fourth probability and the fifth probability;
[0054] The associative recognition result is determined based on the fifth probability of the first position, the fourth probability of any third ingredient, and the sixth probability that the first position has any third ingredient.
[0055] In a possible design, the processor is used to calculate an initial category probability statistical record and an initial position probability statistical record based on the image recognition result;
[0056] According to continuous iterations of image recognition, the initial category probability statistical record and the initial location probability statistical record are updated;
[0057] After the image recognition result meets the set conditions, the type probability statistical record and the position probability statistical record are obtained.
[0058] In one possible design, the processor obtains the category probability statistical record and the location probability statistical record through Bayesian probability.
[0059] In a third aspect, an embodiment of the present invention further provides a computing device, comprising: a memory for storing a computer program; a processor for calling the computer program stored in the memory, and executing the method described in the various possible designs of the first aspect according to the obtained program.
[0060] In a fourth aspect, an embodiment of the present invention further provides a computer-readable non-volatile storage medium, comprising a computer-readable program. When a computer reads and executes the computer-readable program, the computer executes the method described in the various possible designs of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0062] Figure 1 A flowchart of a food identification method provided by an embodiment of the present invention;
[0063] Figure 2 A flow chart of a model for constructing type probability statistical records and location probability statistical records provided by an embodiment of the present invention;
[0064] Figure 3 A flowchart of food associative recognition provided by an embodiment of the present invention;
[0065] Figure 4 A flowchart of a food identification method provided by an embodiment of the present invention;
[0066] Figure 5 A schematic diagram of the structure of a food identification device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0068] This article mentions the following deep learning methods for training and identifying food types: Region Proposal Network (RPN), Convolutional Neural Network (CNN), Region Of Interest (ROI) in image processing, and Selective Search based on target detection.
[0069] like Figure 1 As shown, an embodiment of the present invention provides a method for identifying food, comprising the following steps:
[0070] Step 101, performing image recognition based on the image obtained by taking a photo, and obtaining image recognition results of each food ingredient;
[0071] Step 102, for the first food at the first position in the image recognition result, if it is determined that the first food does not exist in the food data record at the first position, determining an associative recognition result according to the type probability statistical record and the position probability statistical record;
[0072] Step 103: update the food data record according to the associative recognition result.
[0073] In the specific implementation process of step 101, a possible scenario is that the storage device takes photos of each type of food and the user's access actions before and after through its built-in camera group, and performs image recognition on the obtained images to obtain image recognition results of each food, and the image recognition results at least include the type information of food recognition and the location information of food recognition. It should be noted that the image recognition results also include a variety of food information such as whether the food is wrapped in plastic wrap or plastic bags, whether the food is cut, and the size of the food. Those skilled in the art can modify the content contained in the image recognition or add other food information according to the actual food recognition needs, and the present invention does not make specific restrictions on this.
[0074] In step 102, the image recognition result is compared with the food data record to determine whether the first food is in the first position in the food data record. If not, it means that the image recognition is a misidentification. For example, a user takes out an apple from the first layer of the refrigerator's cold storage room. Based on the images taken before and after the user's grabbing action in the refrigerator, image recognition is performed, and the image recognition result is that the apple is taken out from the second layer. In the image recognition result, the first food is an apple and the first position is the second layer; further, the image recognition result is compared with the food data record in the refrigerator to determine whether the second layer in the food data record has an apple. If not, it means that the image recognition result is inconsistent with the food data record, and the image recognition result is misidentified.
[0075] Furthermore, the associative recognition result is determined based on the category probability statistical record and the position probability statistical record. The category probability statistical record is used to record the posterior probability that the j-th category of food is identified as the i-th category of food in various categories of food; the position probability statistical record is used to record the posterior probability that the j-th position is identified as the i-th position in various positions. The posterior probability can be understood as the possibility that something has happened and the reason for the occurrence of this thing is caused by a certain factor. It should be noted that j and i include both equal and unequal situations, that is, the j-th category and the i-th category include equal category and unequal category situations, and the j-th position and the i-th position include equal position and unequal position situations.
[0076] The category probability statistical records and the position probability statistical records can be explained by the following examples. The category probability statistical records record the posterior probability of apples being identified as tomatoes among various types of ingredients, the posterior probability of apples being identified as watermelons among various types of ingredients, the posterior probability of mangoes being identified as bananas among various types of ingredients, and other food category information and the corresponding posterior probabilities. The position probability statistical records are used to record the posterior probability of the first layer being identified as the second layer at each position, the posterior probability of the first layer being identified as the third layer at each position, and the posterior probability of the third layer being identified as the third layer at each position, and other location information and the corresponding posterior probabilities.
[0077] According to the type probability statistical record and the position probability statistical record, the associative recognition result including the type information of the ingredient and the position information of the ingredient can be determined. That is to say, through the type probability statistical record, the correct type information can be determined based on the first ingredient in the image recognition result; through the position probability statistical record, the correct position information of the ingredient can be determined based on the first position in the image recognition result; by confirming the associative recognition result, it is guaranteed that the associative recognition result is the correct position information and the correct type of ingredient at the time of user action, thereby ensuring the accuracy of ingredient recognition.
[0078] It should be noted that those skilled in the art can construct different probability statistical records according to actual needs. For example, they can construct size probability statistical records for the size of the food, and further determine the associative recognition results of food ingredients with similar appearance but different sizes through size probability statistical records and type probability statistical records, etc. This application will not go into details.
[0079] In step 103, the food data record is updated according to the associative recognition results determined in steps 101 and 102, thereby ensuring the reliability and accuracy of the food data record each time the image recognition result is compared with the food data record. It should be noted that those skilled in the art can modify or add other data information of the food according to the actual needs of the food data record.
[0080] By utilizing the probability statistics records of types and locations, combined with the food data records, the image recognition results of each food are inferred and analyzed, thus avoiding the problem of low food recognition accuracy caused by relying solely on image recognition results, improving the accuracy of food recognition and the accuracy of food management.
[0081] With respect to the category probability statistics and the location probability statistics, a possible implementation method is: obtaining the category probability statistics record and the location probability statistics record through Bayesian probability.
[0082] Bayesian Probability is an explanation of probability provided by Bayesian theory, which adopts the concept of defining probability as the degree to which someone believes in a proposition. In layman's terms, it works on "inferring the cause from the result". For example, if a result "S" has occurred, find out which one of the many possible "causes" caused this result "S".
[0083] like Figure 2 The figure shows a flow chart of a model for constructing species probability statistics records and location probability statistics records through Bayesian probability, which specifically includes the following steps:
[0084] Step 201, food type identification test and access location identification test;
[0085] From a technical perspective, the food type recognition test can be divided into two types: one is to use a traditional feature extractor to realize feature extraction of food images, and use a classifier for learning, training and test recognition; the feature extractor can be a Histogram of Oriented Gradient (HOG), a Local Binary Pattern (LBP) or a Deformable Part Model (DPM), etc.; the classifier can also be a Support Vector Machine (SVM), an iterative algorithm Adaboost, a decision tree, a Bayesian network or a neural network, etc.; another method can use a deep learning method to train and identify food types, for example, Fast R-CNN (Selective Search+CNN+ROI), Faster R-CNN (RPN+CNN+ROI), an object detection algorithm YOLO and YOLO 90000, etc. It should be noted that the specific food type recognition method used is not limited in this application, as long as the selected method can realize the test of food types.
[0086] For the access position recognition test, since the actual access positions are diverse, such as the horizontal grids or drawer positions in different areas such as the refrigerator, freezer, temperature-changing room, door body, etc. in the refrigerator, it can also be the first layer of the refrigerator, the first layer of the left door of the refrigerator, the first layer on the left side of the freezer, etc. Therefore, the access position recognition test method can be divided into two categories from a technical perspective: for static recognition, it can be based on comparing the changes in the image recognition results before and after. When a new image recognition result is added, the new food is put in, and the current position of the food is the storage position. If the image recognition result is reduced, the reduced food is taken out, and the original position of the food is the take-out position; for dynamic recognition, it can be based on the action recognition and position recognition of the target tracking algorithm. The target can be an image recognition result, or it can be a hand area detected by a color camera or a depth camera. The image recognition result of the target is usually a rectangular frame position coordinate with target category information. Then, the image recognition result of the target is tracked based on the target tracking algorithm. The tracking algorithm includes Kalman filtering, particle filtering, etc. Finally, the trajectory is tracked according to the image recognition result of the target to identify the access action. It should be noted that the present application does not limit the specific location identification method to be adopted, as long as the selected method can realize the access location identification test.
[0087] Step 202, food type identification test record and access location identification test record;
[0088] In the specific implementation process of step 202, the food type identification test and the access position identification test of step 201 are used to obtain the food type identification test record and the access position identification test record. Table 1 is the food type identification test record, and Table 2 is the position identification test record. Ingredients i, m, and j correspond to different food identification types, Nii represents the number of times that food i is identified as food i, Nnn represents the number of times that negative samples are identified as negative samples (negative samples are represented by n), and similarly, Pii represents the number of times that position i is identified as position i, and Pnn represents the number of times that negative samples are identified as negative samples (negative samples are represented by n).
[0089] Table 1 Food type identification test record
[0090]
[0091] Table 2 Location recognition test records
[0092]
[0093]
[0094] Step 203, calculating the posterior probability of food type recognition and location recognition;
[0095] In step 203, the posterior probabilities of food type identification and location identification are calculated through the food type identification test records and access location identification test records obtained in step 201 and step 202. Taking the Bayesian probability formula calculation as an example, the posterior probabilities of each food type in the food type identification test record and the posterior probabilities of each location in the access location identification test record in step 202 are calculated.
[0096] Assume that event A is a positive sample, Ai is a positive sample i, is a negative sample, event B is identified as a positive sample, Bi is identified as a positive sample i, To identify as a negative sample, the sample includes a food type sample and an access location sample, then the posterior probability of food type identification is:
[0097]
[0098] Among them, P(Aj|Bi) represents the probability that a sample is identified as ingredient i, but is actually ingredient j, Nji represents the number of times ingredient j is identified as ingredient i, Nii+Nmi+Nji+…+Nni represents the number of times all ingredient samples are identified as ingredient i, that is, the total number of times they are identified as ingredient i.
[0099] Likewise,
[0100]
[0101] in, represents the probability of identifying as a negative sample, that is, a non-ingredient sample or unidentified, but the sample is actually ingredient j, Njn represents the number of times ingredient j is mistakenly identified as a negative sample, and Nin+Nmn+Njn+…+Nnn represents the number of times all ingredient samples are identified as negative samples, that is, the total number of times they are identified as negative samples. For example, the mask with a banana pattern in the refrigerator is the non-ingredient sample. The user takes out a banana from the first layer of the refrigerator. After image processing, the image recognition result is a negative sample taken from the first layer, that is, a mask with a banana pattern that is not an ingredient sample. Therefore, the recognition result is a negative sample, and the probability that the sample is actually a banana is: P(banana|negative sample).
[0102] Similarly, assuming event C is a positive sample, Ci is a positive sample i, is a negative sample, event D is identified as a positive sample, Di is identified as a positive sample i, To identify it as a negative sample, the posterior probability of access location recognition is:
[0103]
[0104] Among them, P(Cj|Di) represents the probability that the sample is identified as position i, but is actually at position j, Pji represents the number of times position j is mistakenly identified as position i, and Pii+Pmi+Pji+…+Pni represents the number of times all position samples are identified as position i, that is, the total number of times they are identified as position i.
[0105] Likewise,
[0106]
[0107] in, It represents the probability of being identified as a negative sample, that is, a non-position sample or unrecognized, but the sample is actually at position j. Pjn represents the number of times position j is mistakenly identified as a negative sample. Pin+Pmn+Pjn+…+Pnn represents the number of times all position samples are identified as negative samples, that is, the total number of times they are identified as negative samples.
[0108] Step 204: record the category probability statistics and the location probability statistics.
[0109] In step 204, the posterior probabilities of the type recognition of each ingredient and the posterior probabilities of the position recognition calculated in step 203 are used to construct the type probability statistical record as shown in Table 3, and the posterior probabilities of the position recognition are used to construct the position probability statistical record as shown in Table 4. Through the constructed type probability statistical record and position probability statistical record, the probability statistics of the actual ingredient recognition as the recognized ingredient and the probability statistics of the actual ingredient position recognition as the recognized position are realized, which provides a way to analyze and find out the actual ingredient type and position by using the results of the recognized ingredient and the recognized position.
[0110] Table 3 Probability statistics of species
[0111]
[0112]
[0113] Table 4 Position probability statistics records
[0114]
[0115] Similarly, the prior probability of the type identification and location identification of the ingredients obtained through step 201 and step 202 can be calculated. The prior probability can be understood as the probability of the event occurring before the event occurs. The prior probability and the posterior probability together characterize the performance indicators of the ingredient type identification and location identification algorithm itself. Taking the calculation based on the Bayesian probability formula as an example, the prior probability of each ingredient type identification and each location identification is calculated, and Table 5 is the type probability prior record and Table 6 is the location probability prior record.
[0116] The prior probability of identifying the type of food is:
[0117]
[0118] Among them, P(Bi|Aj) represents the probability of identifying ingredient j as ingredient i when it is known that ingredient j is known, Nji represents the number of times ingredient j is mistakenly identified as ingredient i, and Nji+Njm+Njj+…+Njn represents the total number of samples of ingredient j.
[0119] Likewise,
[0120]
[0121] in, It represents the probability of knowing that ingredient j is identified as a negative sample, that is, it is identified as non-ingredient or unrecognized. Njn represents the number of times ingredient j is mistakenly identified as a negative sample. Nji+Njm+Njj+…+Njn represents the total number of samples of ingredient j.
[0122] Similarly, the prior probability of access location recognition is:
[0123]
[0124] Among them, P(Di|Cj) represents the probability of knowing position j but identifying it as position i, Pji represents the number of times position j is mistakenly identified as position i, and Pji+Pjm+Pjj+…+Pjn represents the total number of samples at position j.
[0125] Likewise,
[0126]
[0127] in, represents the probability of knowing position j but identifying it as a negative sample, that is, a non-position sample or unrecognized, Pjn represents the number of times position j is mistakenly identified as a negative sample, and Pji+Pjm+Pjj+…+Pjn represents the total number of samples at position j.
[0128] Table 5. Prior records of species probability
[0129]
[0130]
[0131] Table 6 Location probability prior records
[0132]
[0133] Another possible implementation method is to use the Bayesian probability formula in combination with the total probability formula to obtain the type probability statistical record and the location probability statistical record, so as to provide a method for analyzing and finding out the actual type and location of the food using the image recognition results.
[0134] With respect to the type probability statistical record and the position probability statistical record shown, a possible implementation method is: with respect to the image recognition result, calculate an initial type probability statistical record and an initial position probability statistical record; according to continuous iterations of image recognition, update the initial type probability statistical record and the initial position probability statistical record; after the image recognition result meets the set conditions, obtain the type probability statistical record and the position probability statistical record.
[0135] For example, for the image recognition result, if the calculated initial category probability recognition statistical record and the initial location probability statistical record do not have a high enough recognition rate for apples as apples, then apples are called difficult samples. According to the continuous iteration of the image recognition with apples, the initial category probability statistical record is updated. After the set conditions are met, for example, the set condition is that the probability of apples being recognized as apples is greater than 90%, then after continuous iteration and updating, the category probability statistical record and the location probability statistical record are obtained. For ingredients or locations with low recognition rates, they are generally called difficult samples. For difficult samples, the recognition algorithm can be increased in number and the recognition algorithm can be appropriately adjusted to improve the recognition algorithm's overall recognition ability for difficult samples. The category probability statistical record and the location probability statistical record are continuously optimized category probability statistical records and location probability statistical records, which provide reliability for using the category probability statistical records and location probability statistical records to determine the associative recognition results of ingredients.
[0136] Based on the category probability statistics record and the location probability statistics record, the associative recognition result is determined. Two specific implementation methods are provided as follows:
[0137] Implementation method one, after step 101, determine the second ingredient from the type probability statistical record; the second ingredient is an ingredient whose posterior probability of being identified as the first ingredient is greater than a first threshold; determine the second position from the position probability statistical record; the second position is a position whose posterior probability of being identified as the first position is greater than a second threshold; determine whether the second ingredient exists at the first position in the ingredient data record, and if so, use the second ingredient at the first position as the associative recognition result; determine whether the first ingredient exists at the second position in the ingredient data record; if so, use the first ingredient at the second position as the associative recognition result.
[0138] For example, a user's refrigerator has a three-layer structure, as shown in Table 7, which is a data record of the three layers of food in the refrigerator. The user takes out an apple from the first layer of the refrigerator. Based on the images taken before and after the user's grabbing action in the refrigerator, image recognition is performed, and the image recognition result of the food in the refrigerator is that the apple is taken out from the second layer, that is, the first food is an apple, and the first position is the second layer; after comparison with the food data record in the refrigerator, it is determined that there is no apple in the second layer in the food data record of the refrigerator, and the association recognition is entered.
[0139] Table 7 Data record of food materials on the third floor of refrigerator refrigerator
[0140] First floor Watermelon Apple Mango Second floor Eggplant Snake Mask Third floor Chicken with tomatoes and bananas
[0141] Table 8 is a category probability statistical record, and Table 9 is a position probability statistical record. From the category probability statistical record, the second ingredient is determined to be tomatoes and red apples, that is, tomatoes and red apples are identified as apples with a posterior probability greater than the first threshold; from the position probability statistical record, the second position is determined to be the first layer, that is, the position with a posterior probability greater than the second threshold for the first layer to be identified as the second layer. Further, in the food data record of the refrigerator, whether there are tomatoes or red apples in the second layer is determined, referring to Table 7, if there are red apples in the second layer, then the second layer has red apples as the associative recognition result; in the food data record of the refrigerator, whether there are apples in the first layer is determined, referring to Table 7, if there are apples in the first layer, then the first layer has apples as the associative recognition result.
[0142] If there is no second ingredient at the first position in the ingredient data record and there is no first ingredient at the second position, a possible implementation method is: determine whether there is a second ingredient at the second position in the ingredient data record; if there is a second ingredient at the second position, take the second ingredient at the second position as the associative recognition result.
[0143] For example, the user's refrigerator compartment is still a three-layer structure as in the above example, as shown in Table 7, which is a data record of three layers of food materials in the refrigerator compartment. The user takes out bananas from the third layer of the refrigerator compartment, and after image recognition, it is found that the user takes out mangoes from the second layer. Then, the first food material is mango, and the first position is the second layer. According to the category probability statistics record, the second food material is determined to be banana, and according to the position probability statistics record, the second position is determined to be the third layer. By determining that there are no bananas on the second layer and no mangoes on the third layer, it is further determined whether there is a second food material in the second position, that is, whether there are bananas on the third layer. If yes, the presence of bananas on the third layer is taken as the associative recognition result.
[0144] Table 8 Probability statistics of species
[0145]
[0146]
[0147] Table 9 Position probability statistics record
[0148]
[0149] Implementation method 2, after step 101, determine the third ingredient at the third position from the ingredient data record; the third position is an adjacent position to the first position; the third ingredient is any ingredient at the third position; determine the fourth probability that the third ingredient is identified as the first ingredient from the type probability statistical record; determine the fifth probability that the third position is identified as the first position from the position probability statistical record; determine the sixth probability based on the fourth probability and the fifth probability; determine the associative recognition result based on the fifth probability of the first position, the fourth probability of any third ingredient and the sixth probability that any third ingredient is present at the first position.
[0150] For example, the user's refrigerator compartment is still a three-layer structure of the above example, as shown in Table 7, which is a three-layer food data record of the refrigerator compartment. The user takes out an apple from the first layer of the refrigerator compartment, and the image recognition result shows that the first food is an apple, and the first position is the second layer; then the third position is determined to be the first layer from the food data record, and the third food is watermelon, apple and mango respectively, and the fourth probability that the third food is identified as the first food is determined from the category probability statistics record; the fifth probability that the third position is identified as the first position is determined from the position probability statistics record; the sixth probability is determined based on the fourth probability and the fifth probability; it can be seen that according to the different third food ingredients, there are three groups of the fourth probability, the fifth probability and the sixth probability, and the associative recognition results are:
[0151] The first group is: the fourth probability: P = P (Aj | Bi) = P (watermelon | apple) = 30%, the fifth probability: P = P (Cj | Di) = P (1 | 2) = 70%, the sixth probability: P = P (Aj | Bi) * P (Cj | Di) = P (watermelon | apple) * P (1 | 2) = 21%;
[0152] The second group is: fourth probability: P = P (Aj | Bi) = P (mango | apple) = 20%, fifth probability: P = P (Cj | Di) = P (1 | 2) = 70%, sixth probability: P = P (Aj | Bi) * P (Cj | Di) = P (mango | apple) * P (1 | 2) = 14%;
[0153] The third group is: Fourth probability: P=P(Aj|Bi)=P(apple|apple)=95%, fifth probability: P=P(Cj|Di)=P(1|2)=70%, sixth probability: P=P(Aj|Bi)*P(Cj|Di)=P(apple|apple)*P(Cj|Di)=67%.
[0154] Therefore, according to the fourth probability, the fifth probability and the sixth probability in the above three groups, the associative recognition results can be determined as: the first layer has watermelon, the first layer has apple and the first layer has mango.
[0155] For any ingredient at an adjacent position to the first position, the fourth probability, fifth probability and sixth probability of any ingredient at the adjacent position are determined to determine the associative recognition result, thereby improving the recognition efficiency of ingredient image recognition and the ingredient management efficiency.
[0156] A possible implementation method of determining the associative recognition result by using the category probability statistical record and the location probability statistical record and updating the food data record is as follows:
[0157] If it is determined that the second ingredient exists at the first position in the ingredient data record, a first probability that the second ingredient is identified as the first ingredient is obtained from the category probability statistical record; if it is determined that the first ingredient exists at the second position in the ingredient data record, a second probability that the second position is identified as the first position is obtained from the position probability statistical record; if it is determined that the second ingredient does not exist at the first position and the first ingredient does not exist at the second position in the ingredient data record, a third probability is determined based on the first probability and the second probability; and a recognition result with the highest probability among the associative recognition results is determined based on at least the second probability of each second position, the first probability of each second ingredient, and the third probability of each second position having the second ingredient;
[0158] The food material data record is updated according to the recognition result with the highest probability among the associative recognition results.
[0159] For example, the user's refrigerator compartment is still a three-layer structure as in the above example, as shown in Table 7. The three-layer food data record of the refrigerator compartment is shown in Table 7. The user takes out an apple from the first layer of the refrigerator compartment, and the image recognition result of the food in the refrigerator is that the apple is taken out from the second layer, that is, the first food is an apple, and the first position is the second layer; after comparing with the food data record in the refrigerator, it is determined that there is no apple in the second layer in the food data record of the refrigerator, and the association recognition is entered.
[0160] From the category probability statistics record in Table 8, it is determined that the second food is tomato and snake fruit. If it is determined that there is tomato in the second layer in the food data record, P=P(Aj|Bi)=P(tomato|apple)=60% is obtained from the category probability statistics record, that is, the first probability of tomato being identified as apple is 60%; if it is determined that there is snake fruit in the second layer in the food data record, P=P(Aj|Bi)=P(snake fruit|apple)=50% is obtained from the category probability statistics record, that is, the first probability of snake fruit being identified as apple is 50%; from the position probability statistics record in Table 9, it is determined that the second position is the first layer. If it is determined that there is apple in the first layer in the food data record, P=P(Cj|Di)=P(1|2)=70% is obtained from the category probability statistics record, that is, the second probability of the first layer being identified as the second layer is 70%.
[0161] If it is determined that there are no tomatoes in the second layer and no apples in the first layer in the food data record, the third probability is determined based on the first probability and the second probability, that is, P=P(Aj|Bi)*P(Cj|Di)=P(tomato|apple)*P(1|2)=42%; if it is determined that there are no red apples in the second layer and no apples in the first layer in the food data record, the third probability is determined based on the first probability and the second probability, that is, P=P(Aj|Bi)*P(Cj|Di)=P(red apple|apple)*P(1|2)=35%.
[0162] In this example, the associative recognition result is that there are apples in the first layer and red apples in the second layer. The maximum recognition result in the associative recognition result can be determined based on the first probability, the second probability and the third probability obtained. According to the general formula of food association:
[0163] P = argmax{(P(Aj|Bi)∩(Position i has food j),P(Cj|Di)∩
[0164] (Position j has ingredient i), (P(Aj|Bi)*P(Cj|Di))∩(Position j has ingredient j)}.....Formula 9
[0165] calculate:
[0166] P = arg max {P (tomato | apple) ∩ (there are tomatoes on the second layer), P (1 | 2)
[0167] ∩(There are apples on the first layer), P(tomato|apple)*P(1|2)
[0168] ∩(The first layer has tomatoes)}
[0169] Therefore, according to the food data record of the refrigerator, which shows that there is apple on the first layer, P=arg max{P(tomato|apple)∩0,P(1|2)∩1,P(tomato|apple)*P(1|2)∩0}, and P=arg max{0%,70%,0%}=70%.
[0170] calculate:
[0171] P = arg max {P (snake fruit | apple) ∩ (there is a snake fruit on the second layer), P (1 | 2)
[0172] ∩(There is an apple on the first layer), P(Snake|Apple)*P(1|2)∩(There is a Snake on the first layer)}
[0173] Therefore, according to the food data record of the refrigerator, there are red apples on the second layer and apples on the first layer, P = argmax{P(red apple|apple)∩1,P(1|2)∩1,P(red apple|apple)*P(1|2)∩0}, and P = arg max{50%,70%,0%} = 70% is determined;
[0174] Therefore, the food data record is updated according to the recognition result of the second probability in the association result—that there is apple in the first layer.
[0175] By sorting the probabilities of the second positions and the second ingredients, determining the corresponding recognition result with the highest probability of the associative recognition result, and updating the ingredient data record, the recognition efficiency of the associative results is improved, thereby improving the recognition efficiency of the ingredient image recognition.
[0176] Another possible way to update the food data record based on the associative recognition result is to set a probability threshold, compare the set probability threshold with the first probability, the second probability and the third probability respectively, eliminate the probability values less than the probability threshold, sort the probability values of the first probability, the second probability and the third probability that are greater than and equal to the probability threshold, and determine the recognition result with the highest probability in the associative recognition result; update the food data record based on the recognition result with the highest probability in the associative recognition result.
[0177] Figure 3 A flowchart of a food identification method provided by an embodiment of the present invention specifically includes the following steps:
[0178] Step 301, determining the image recognition result;
[0179] Step 302, read food data record;
[0180] Step 303, determining whether the food is present at the location;
[0181] Step 304, outputting the recognition result;
[0182] Step 305, complete food input;
[0183] Step 306, reading the category probability statistics record and the location probability statistics record;
[0184] Step 307, determining a first probability, a second probability and a third probability;
[0185] Step 308, determining the associative recognition result;
[0186] Step 309, determining whether the food exists at the location in the associative recognition result;
[0187] Step 310, output "unknown".
[0188] Based on capturing the user's grabbing action and performing image recognition on the image, by executing step 301, it is determined that the image recognition result is that there is a first ingredient at a first position; further executing step 302, reading the location information and ingredient information of the ingredient data record; and by step 303, determining whether the first ingredient is at the first position in the ingredient data record.
[0189] If yes, execute 304 to output the recognition result, which is that there is a first ingredient at the first position; and based on the first ingredient at the first position, update the ingredient data record, execute step 305, and complete the ingredient entry.
[0190] If not, enter the food associative identification process. Execute step 306, read the category probability statistical record and the position probability statistical record, determine the second food from the category probability statistical record, determine the second position from the position probability statistical record, and execute step 307, obtain the first probability that the second food is identified as the first food from the category probability statistical record; obtain the second probability that the second position is identified as the first position from the position probability statistical record; and determine the third probability based on the first probability and the second probability.
[0191] In step 308, the associative recognition result is determined according to the first probability, the second probability and the third probability obtained in step 307, and the associative recognition results are sorted from large to small according to the order of the corresponding probability values. For example, the current order is: second probability>first probability>third probability, that is, according to the order of the recognition results: the second position has the first ingredient, the first position has the second ingredient, and the second position has the second ingredient, and step 309 is executed.
[0192] According to the recognition result of the associative recognition result determined in step 308 and the food data record read in step 302, step 309 is executed to determine whether the position in the associative recognition result has the food, that is, whether the second position has the first food, whether the first position has the second food, and whether the second position has the second food; if it is determined that the second position has the first food, step 304 is executed to output the recognition result, and according to the recognition result that the second position has the first food, the food data record is updated, and step 305 is executed to complete the food entry.
[0193] If the image-based food associative recognition still fails to enter, that is, if step 309 is executed and it is determined that there is no first food at the second position, no second food at the first position, and no second food at the second position, step 310 is executed to output the food type as "unknown". At the same time, voice prompts can be given, and users can choose to enter by voice or APP, so as to confirm or correct the food type and access location by voice or manual methods such as voice interaction and APP operation, thereby ensuring the accuracy and closed loop of food entry.
[0194] Figure 4 A flowchart of a food identification method provided by an embodiment of the present invention specifically includes the following steps:
[0195] Steps 401 to 405 (same as steps 301 to 305), if step 403 is executed and it is determined that the first ingredient and the first position in the image recognition result are in the ingredient data record, the image recognition result is output and the ingredient entry is completed.
[0196] Step 406, reading the category probability statistics record and the location probability statistics record;
[0197] Step 407, determining a fourth probability, a fifth probability and a sixth probability;
[0198] Step 408, determining the associative recognition result.
[0199] If step 403 is executed and it is determined that there is no first ingredient at the first position in the ingredient data record, the ingredient association recognition process is entered.
[0200] In executing step 407, according to executing step 402, the third position and the third ingredient in the ingredient data record are determined, the third position is an adjacent position to the first position, and the third ingredient is any ingredient in the third position; at the same time, step 406 is executed, the third ingredient is determined from the type probability statistical record, the third position is determined from the position probability statistical record, and the fourth probability that the third ingredient is identified as the first ingredient is read from the type probability statistical record, and the fifth probability that the third position is identified as the first position is read from the position probability statistical record, and the sixth probability is determined based on the fourth probability and the fifth probability.
[0201] In step 408, according to the fourth probability, the fifth probability and the sixth probability in step 407, the maximum probability value among the fourth probability, the fifth probability and the sixth probability is determined, and the associative recognition result is determined. The associative recognition result may be: the first ingredient is in the third position, the third ingredient is in the first position, and the third ingredient is in the third position. For example, if the fourth probability value is the maximum value, the recognition result of the ingredient corresponding to the fourth probability: the third ingredient is in the first position is used as the associative recognition result, that is, the associative recognition result is determined.
[0202] According to the recognition result of the associative recognition result, step 404 is executed to output the recognition result, and according to the recognition result that there is a third ingredient in the first position, the ingredient data record is updated, and step 405 is executed to complete the ingredient entry.
[0203] From the above content, it can be seen that: an embodiment of the present invention provides a food identification method and device, which performs image recognition based on the image obtained by taking a photo, and obtains the image recognition results of each food; for the first food at the first position in the image recognition result, if it is determined that the first food does not exist in the food data record at the first position, then the association recognition result is determined according to the type probability statistical record and the position probability statistical record; the type probability statistical record is used to record the posterior probability that the jth food is identified as the ith food in each type of food; the position probability statistical record is used to record the posterior probability that the jth position is identified as the ith position in each position; according to the association recognition result, the food data record is updated. For the image recognition results of each food, by using the type probability statistical record and the position probability statistical record, combined with the food data record for reasoning analysis, the association result of the food type and the food position is determined, which avoids the problem of low food recognition accuracy that relies solely on image recognition results, improves food recognition accuracy, reduces food missed recognition rate and misrecognition rate, and improves food management accuracy.
[0204] Figure 5 The structural diagram of a food identification device provided by an embodiment of the present invention. The food identification device 500 comprises: an image collector 501 and a processor 502, wherein:
[0205] The image collector 501 is used to take pictures to obtain images to be processed;
[0206] The processor 502 is used to perform image recognition to obtain image recognition results of each ingredient; for the first ingredient at the first position in the image recognition result, if it is determined that the first ingredient does not exist at the first position in the ingredient data record, an associative recognition result is determined based on the type probability statistical record and the position probability statistical record; the type probability statistical record is used to record the posterior probability that the j-th ingredient is identified as the i-th ingredient in each type of ingredient; the position probability statistical record is used to record the posterior probability that the j-th position is identified as the i-th position in each position; and the ingredient data record is updated based on the associative recognition result.
[0207] In a possible design, the processor 502 is further configured to determine a second ingredient from the category probability statistical record; the second ingredient is an ingredient whose posterior probability of being identified as the first ingredient is greater than a first threshold;
[0208] Determine a second position from the position probability statistical record; the second position is a position identified as the first position with a posterior probability greater than a second threshold;
[0209] determining whether the second ingredient exists at the first position in the ingredient data record, and if so, taking the second ingredient at the first position as the associative recognition result;
[0210] Determine whether the first ingredient exists at the second position in the ingredient data record; if so, use the first ingredient at the second position as the associative recognition result.
[0211] In one possible design, the processor 502 is specifically configured to determine whether the second ingredient is present at the second location in the ingredient data record if the second ingredient is not present at the first location in the ingredient data record and the first ingredient is not present at the second location;
[0212] If the second ingredient is present at the second position, the second ingredient at the second position is used as the associative recognition result.
[0213] In one possible design, the processor 502 is further configured to obtain a first probability that the second ingredient is identified as the first ingredient from the category probability statistics record if it is determined that the second ingredient exists at the first position in the ingredient data record;
[0214] If it is determined that the first ingredient is present at the second location in the ingredient data record, obtaining a second probability that the second location is identified as the first location from the location probability statistics;
[0215] If it is determined that the second ingredient does not exist at the first position in the ingredient data record and the first ingredient does not exist at the second position, determining a third probability according to the first probability and the second probability;
[0216] Determine the recognition result with the highest probability among the associative recognition results at least based on the second probability of each second position, the first probability of each second ingredient, and the third probability that each second position has the second ingredient; and update the ingredient data record based on the recognition result with the highest probability among the associative recognition results.
[0217] In a possible design, the processor 502 is specifically configured to determine a third ingredient at a third position from the ingredient data record; the third position is an adjacent position to the first position; the third ingredient is any ingredient at the third position;
[0218] Determine a fourth probability that the third ingredient is identified as the first ingredient from the category probability statistical record; determine a fifth probability that the third location is identified as the first location from the location probability statistical record; and determine a sixth probability based on the fourth probability and the fifth probability;
[0219] The associative recognition result is determined based on the fifth probability of the first position, the fourth probability of any third ingredient, and the sixth probability that the first position has any third ingredient.
[0220] In a possible design, the processor 502 is used to calculate an initial category probability statistical record and an initial position probability statistical record based on the image recognition result;
[0221] According to continuous iterations of image recognition, the initial category probability statistical record and the initial location probability statistical record are updated;
[0222] After the image recognition result meets the set conditions, the type probability statistical record and the position probability statistical record are obtained.
[0223] In one possible design, the processor 502 obtains the category probability statistical record and the location probability statistical record through Bayesian probability.
[0224] Based on the same inventive concept, the embodiment of the present invention also provides another computer device, which can be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. The computer device may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.
[0225] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In an embodiment of the present invention, the memory may be used to store the program of the above-mentioned food identification method.
[0226] The processor calls the program instructions stored in the memory, and the processor is used to execute the above-mentioned food identification method according to the obtained program instructions.
[0227] Based on the same inventive concept, an embodiment of the present invention provides a computer storage medium for storing computer program instructions used by the above-mentioned computer device, which includes a program for executing the above-mentioned food identification method.
[0228] The computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drives (SSDs)), etc.
[0229] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present invention without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A food identification method, characterized in that: The method comprises: Based on the image obtained by taking photos, image recognition is performed to obtain image recognition results of each food ingredient; For the first ingredient at the first position in the image recognition result, if it is determined that the first ingredient does not exist in the ingredient data record at the first position, then the associative recognition result is determined according to the type probability statistical record and the position probability statistical record; the type probability statistical record is used to record the posterior probability that the jth type of ingredient is identified as the ith type of ingredient in each type of ingredient; the position probability statistical record is used to record the posterior probability that the jth position is identified as the ith position in each position; wherein, determining the associative recognition result according to the type probability statistical record and the position probability statistical record includes: determining the second ingredient from the type probability statistical record; the second ingredient is an ingredient whose posterior probability of being identified as the first ingredient is greater than a first threshold; determining the second position from the position probability statistical record; the second position is a position whose posterior probability of being identified as the first position is greater than a second threshold; determining whether the second ingredient exists in the first position in the ingredient data record, and if so, taking the second ingredient in the first position as the associative recognition result; determining the second ingredient in the ingredient data record in the first position whether the first ingredient exists in the second position; if so, taking the first ingredient in the second position as the associative recognition result; if the second ingredient does not exist in the first position and the second position in the ingredient data record, determining whether the second ingredient exists in the second position in the ingredient data record; if the second ingredient exists in the second position, taking the second ingredient in the second position as the associative recognition result; or, determining the third ingredient in the third position from the ingredient data record; the third position is an adjacent position to the first position; the third ingredient is any ingredient in the third position; determining the fourth probability that the third ingredient is identified as the first ingredient from the type probability statistical record; determining the fifth probability that the third position is identified as the first position from the position probability statistical record; determining the sixth probability based on the fourth probability and the fifth probability; determining the associative recognition result based on the fifth probability of the first position, the fourth probability of any third ingredient and the sixth probability that any third ingredient exists in the first position; The food material data record is updated according to the associative recognition result.
2. The method according to claim 1, characterized in that According to the associative recognition result, updating the food data record includes: If it is determined that the second ingredient exists at the first position in the ingredient data record, obtaining a first probability that the second ingredient is identified as the first ingredient from the category probability statistics record; If it is determined that the first ingredient is present at the second location in the ingredient data record, obtaining a second probability that the second location is identified as the first location from the location probability statistics record; If it is determined that the second ingredient does not exist at the first position in the ingredient data record and the first ingredient does not exist at the second position, determining a third probability according to the first probability and the second probability; Determine a recognition result with the highest probability among the associative recognition results based at least on the second probability of each second position, the first probability of each second ingredient, and the third probability that each second position has the second ingredient; The food material data record is updated according to the recognition result with the highest probability among the associative recognition results.
3. The method according to any one of claims 1 to 2, characterized in that The type probability statistical record and the location probability statistical record are obtained in the following manner: Based on the image recognition results, the initial category probability statistics record and the initial position probability statistics record are calculated; According to continuous iterations of image recognition, the initial category probability statistical record and the initial location probability statistical record are updated; After the image recognition result meets the set conditions, the type probability statistical record and the position probability statistical record are obtained.
4. The method according to any one of claims 1 to 2, characterized in that The category probability statistical record and the location probability statistical record are obtained through Bayesian probability.
5. A food identification device, characterized in that: include: Image collector and processor; The image collector is used to take pictures to obtain images to be processed; The processor is used to perform image recognition to obtain image recognition results of each ingredient; for the first ingredient at the first position in the image recognition result, if it is determined that the first ingredient does not exist in the ingredient data record at the first position, then determine the associative recognition result according to the type probability statistical record and the position probability statistical record; the type probability statistical record is used to record the posterior probability that the jth ingredient is identified as the ith ingredient in each type of ingredient; the position probability statistical record is used to record the posterior probability that the jth position is identified as the ith position in each position; wherein, determining the associative recognition result according to the type probability statistical record and the position probability statistical record includes: determining the second ingredient from the type probability statistical record; the second ingredient is an ingredient whose posterior probability of being identified as the first ingredient is greater than a first threshold; determining the second position from the position probability statistical record; the second position is a position whose posterior probability of being identified as the first position is greater than a second threshold; determining whether the second ingredient exists in the first position in the ingredient data record, and if so, taking the second ingredient in the first position as the associative recognition result; determining the second ingredient in the ingredient data record at the first position whether the first ingredient exists in the second position; if so, taking the first ingredient in the second position as the associative recognition result; if the second ingredient does not exist in the first position and the first ingredient does not exist in the second position in the ingredient data record, determining whether the second ingredient exists in the second position in the ingredient data record; if the second ingredient exists in the second position, taking the second ingredient in the second position as the associative recognition result; or, determining a third ingredient in a third position from the ingredient data record; the third position is an adjacent position to the first position; the third ingredient is any ingredient in the third position; determining a fourth probability that the third ingredient is identified as the first ingredient from the type probability statistical record; determining a fifth probability that the third position is identified as the first position from the position probability statistical record; determining a sixth probability based on the fourth probability and the fifth probability; determining the associative recognition result based on the fifth probability of the first position, the fourth probability of any third ingredient and the sixth probability that any third ingredient exists in the first position; and updating the ingredient data record based on the associative recognition result.
6. A computing device, characterized in that include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory and execute the method according to any one of claims 1 to 4 according to the obtained program.
7. A computer-readable storage medium, characterized in that: The storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 4.
