Data enhancement method for food image recognition aiming at long-tail distribution characteristics, program, equipment and storage medium

By designing a data enhancement method in food image recognition, using synchronized balanced samplers and data enhancement technology to generate new samples, and combining consistency learning and supervised learning, the class imbalance problem under long-tail distribution is solved and the generalization of the model is improved. Ability and robustness improve the accuracy of food image recognition.

CN118691925APending Publication Date: 2024-09-24HARBIN ENG UNIV

Patent Information

Application Number
CN202410722931.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The class imbalance problem in the existing food classification system under the long-tail distribution characteristics causes the classification to be biased towards head classification, and the generalization ability of identifying tail food classes is poor, which affects the application performance of image-based diet assessment.

Method used

A data enhancement method is designed to generate a new sample data set through synchronous balanced sampler, TrivialAugment and RandomAugment data enhancement technology, and Mixup fusion. It uses convolutional neural network for training, combines consistency learning and supervised learning, and automatically adjusts the training process. weights to prevent overfitting.

Benefits of technology

It improves the generalization ability and robustness of the model, generates more representative features, prevents overfitting of the tail class, while retaining the characteristics of the head class, and improves the accuracy of food image recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691925A
    Figure CN118691925A
Patent Text Reader

Abstract

The invention discloses a data enhancement method, program and equipment for food image recognition aiming at long-tail distribution characteristics, and a storage medium, which promote effective cooperation among samples by combining global and local sampling strategies and mining implicit relation among the samples. According to the characteristics of long-tail distribution, an original data set is expanded by generating diversified virtual samples, and a more multivariate and comprehensive training set is created. In addition, a joint cumulative learning strategy is adopted, the consistency of an original sample and a virtual sample is enhanced, the capability of capturing rich semantic features of the model is improved, supervised learning of a classifier is kept, and the robustness of the model is enhanced by introducing a new sample, so that the visual effect and accuracy of image recognition are improved. The data enhancement method not only improves the recognition capability of the model on the food image, but also enhances the visual effect of the image, and provides a new solution for the development of the food recognition technology based on the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer vision and image processing, and specifically relates to a data enhancement method, program, device and storage medium for food image recognition with long-tail distribution characteristics. Background Art

[0002] Recent Advances,Dietary assessment is very important for healthcare-related applications. In addition, in recent years, the application of image-based dietary assessment on mobile devices has received increasing attention, which can serve as a more efficient platform to reduce the burden on participants. Food is the first necessity of human life and plays a vital role in human physical health and quality of life. Accurate identification of food is crucial for image-based dietary assessment, which helps to match food with the appropriate identification of corresponding nutrients in the nutrition database. This connection makes it possible to determine the association between diet and health and diseases such as diabetes. Therefore, due to the enhanced adaptability to various real-world situations caused by new computing methods and new sensor devices. The performance of image-based dietary assessment relies on the accurate prediction of food in the captured eating scene images. However, most of the current food classification systems are developed based on class-balanced food image datasets, such as Food-101, in which each food class contains the same amount of training data. However, this situation rarely occurs in the real world because food images usually have a long-tail distribution, in which a small number of food classes (i.e., head classes) contain abundant training samples, while most food classes (i.e., tail classes) have only a few samples, such as Figure 1 As shown. Long-tail classification is therefore defined as an extreme class imbalance problem, resulting in classification biased towards the head class and poor generalization ability in identifying the tail food classes. Therefore, if the class imbalance problem is not considered, the performance of food classification in the real world may drop significantly, thus restricting the application of image-based dietary assessment. This paper analyzes the long-tail class distribution problem for food image classification and designs a data augmentation scheme to address it, with the goal of minimizing the performance gap when applying food-related applications in real life.

[0003] From the perspective of visual food image recognition, an intuitive way to address the class imbalance problem is to undersample the head class and oversample the tail class to obtain a balanced training set with a similar number of samples for all classes. However, there are two main challenges: (1) how to use the head class to help the tail class without affecting the original performance. (2) how to oversample the tail class to improve the generalization ability of the model, because naive repeated random oversampling will further aggravate the overfitting problem and lead to poor performance, especially in heavy-tailed distributions. In addition, it is well known that food images are more complex than general objects in downstream tasks such as classification, segmentation, and image generation due to their inter-class similarity and intra-class diversity, which is even more challenging in long-tailed data distributions with severe class imbalance. Summary of the invention

[0004] The object of the present invention is to provide a data enhancement method, program, device and storage medium for food image recognition with long-tail distribution characteristics.

[0005] The purpose of the present invention is achieved through the following technical solutions:

[0006] A data enhancement method for food image recognition with long-tail distribution characteristics comprises the following steps:

[0007] Step 1: Design a synchronous balanced sampler based on the characteristics of long-tail distribution data, which includes two samplers for sampling original sample pairs;

[0008] Step 2: Use the data enhancement techniques TrivialAugment and RandomAugment to enhance the original sample pairs and construct an enhanced data set;

[0009] Step 3: Use Mixup to fuse the enhanced sample pairs and generate a new sample data set while ensuring that the original samples are not destroyed;

[0010] Step 4: Update the original dataset with the newly generated dataset and input it into the convolutional neural network. Use the optimizer to train the convolutional neural network until the total loss L of the network converges, and finally obtain a trained convolutional neural network for food image classification based on long-tail distribution.

[0011] Furthermore, the step 1 is specifically as follows:

[0012] First, set the global sampler to preserve the characteristics of the original distribution, and then randomly sample a sample X from the dataset g ;

[0013] Secondly, set the local sampler and set the sampling probability of each class to be proportional to the inverse of the size of its sample, that is, the more samples there are in a class, the smaller the sampling probability of the class is; in the formula, let n iRepresents the number of samples of category i, and the maximum number of samples of all categories is N max ;

[0014] Construct the reverse sampler:

[0015] (1) Calculate the sampling probability P of category i according to the following formula i :

[0016]

[0017] in

[0018] (2) According to P i Randomly select a class;

[0019] (3) Uniformly remove a sample from the i-th class and replace it by repeating the reverse sampling process to obtain a small batch of data sample sets;

[0020] (4) Then randomly select a sample X based on local sampling l ;

[0021] Finally, construct the original sample pair (X g ,X l ).

[0022] Furthermore, the data enhancement technology TrivialAugment in step 2 is used to process head-type samples. For the sampled head-type images, TrivialAugment uniformly samples a data enhancement function and an intensity value, and then returns the enhanced image; for the sampled N tail-type images, RA uses a parameter-free process to transform K N potential strategies, where K represents the type of transformation.

[0023] Furthermore, the step 3 converts the sample pair (X g ,X l ) are fused and a new sample is constructed formally according to the following formula:

[0024] λ=Beta(β,β)

[0025]

[0026] where λ is sampled from a β distribution parameterized by a β hyperparameter; the generated new samples are denoted by

[0027] Furthermore, the step 4 is specifically as follows:

[0028] (1) Consistency learning;

[0029] By minimizing the original sample x and the new sample Negative cosine similarity of :

[0030]

[0031] (2) supervised learning;

[0032] After constructing the new dataset, calculate the cross entropy loss:

[0033]

[0034] Where N represents the size of the sampling batch, and f(·) represents the predicted probability of x;

[0035] (3) Joint cumulative learning;

[0036] Use the bilateral branch structure to adaptively learn the rebalancing branch; the loss L of the unweighted classification branch c Multiply by α, the consistency learning branch loss L sim Multiply by 1-α; α automatically decreases as the current training period T increases:

[0037]

[0038] Where T max is the maximum training epoch;

[0039] (4) The total loss is defined as the loss L c and L sim Combination of:

[0040] L total =αL c +(1-α)L sim .

[0041] A computer device / equipment / system comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of a data enhancement method for food image recognition with long-tail distribution characteristics.

[0042] A computer-readable storage medium stores a computer program / instruction thereon, which, when executed by a processor, implements the steps of a data enhancement method for food image recognition with long-tail distribution characteristics.

[0043] A computer program product includes a computer program / instruction, which, when executed by a processor, implements the steps of a data enhancement method for food image recognition with long-tail distribution features.

[0044] The beneficial effects of the present invention are:

[0045] 1. A stable and excellent interactive learning framework is introduced for the long-tailed food image recognition task. The present invention utilizes the entire dataset information to promote knowledge interaction between the head and tail classes, thereby improving the generalization ability of the model and enhancing its robustness.

[0046] 2. The head-tail knowledge interaction adopted by the present invention can generate more diverse samples for network learning of more representative features without introducing new models, preventing the model from overfitting the tail class while retaining the features of the head class. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 A schematic diagram of a food image with a long tail distribution according to the present invention;

[0048] Figure 2 It is a flow chart of the solution of the present invention. DETAILED DESCRIPTION

[0049] The present invention is further described below in conjunction with the accompanying drawings.

[0050] The present invention is a data enhancement method for food image recognition with long-tail distribution characteristics. First, global and local samplers are designed to obtain original samples; then, a generator is designed to enhance the original samples using data enhancement techniques TrivialAugment (TA) and RandomAugment (RA), and then a new sample data set is generated using fusion technology; finally, the original data set is updated with the newly generated data set and input into a convolutional neural network for learning, updating model parameters and learning rich features. The specific description is as follows:

[0051] 1. The synchronous sampler obtains the original sample pair;

[0052] A long-tail training dataset D∈{D1,D2,...,D K}, where D K is a sub-dataset containing only samples of the Kth class, where K represents the index of the class. The number of sub-datasets is represented by N1, N2, ..., N K Indicates. Following the long-tail distribution characteristics N1≥N2≥...≥N K In particular, N1 refers to the class with the largest number of samples, called the largest class C max (D max ∈D1). The other categories are called non-maximal categories C non-max , which are defined as D non-max ∈D2,D3,...,D K For local-based sampling, from the subset D non-max Select local samples (x l ,y l ). non-maxThe sampling probability of each sample in each class is defined as where n k represents the number of samples in the kth class. At the same time, for global sampling, global samples (x g ,y g ). The sampling probability of each instance in the data set D is determined as follows:

[0053]

[0054] 2. Perform TrivialAugment (TA) and RandomAugment (RA) enhancement on local samples and global samples respectively;

[0055] For local samples (x l ,y l ) to perform TrivialAugment (TA) enhancement to obtain samples For the global sample (x g ,y g ) is enhanced by RandomAugment (RA) to obtain

[0056] 3. Fusion samples to obtain new samples;

[0057] The sample and adopt Input Mix to generate new samples The form is as follows:

[0058] λ=Beta(β,β)

[0059]

[0060] where λ is sampled from a β distribution parameterized by a β hyperparameter. The generated new samples are represented as

[0061] The specific implementation of the above DiversityMix module is as follows:

[0062] Input: two images and their label pairs (x l ,y l ) and (x g ,y g ).

[0063] 1) For x l Apply the transformation TAug and keep the label y l :

[0064]

[0065] 2) For x gApply the transformation RAug and preserve the label y g :

[0066]

[0067] 3) Beta distribution and mixed operations:

[0068] λ = Beta(β,β);

[0069]

[0070] 5) Output: a new image and its label (x',y').

[0071] 4. Input the convolutional neural network to start joint cumulative learning;

[0072] 1) Consistency learning: The goal is to enhance the consistency between the original sample and the fused new sample. The specific form is:

[0073]

[0074] 2) Supervised learning, calculating cross entropy loss:

[0075]

[0076] 3) According to Figure 2 , we use a bilateral branch structure to adaptively learn the rebalancing branch. Specifically, the loss L of the unweighted classification branch c Multiply by α, the consistency learning branch loss L sim Multiply by 1-α. α automatically decreases as the current training period T increases:

[0077]

[0078] Where T max is the maximum training epoch;

[0079] The joint cumulative learning loss is of the following form:

[0080] L total =αL c +(1-α)L sim

[0081] 4) Output the trained convolutional neural network model f for recognition.

[0082] The specific training process description steps are as follows:

[0083] 1. For each training epoch e, perform the following steps:

[0084] 2. Initialize the update times D'=0.

[0085] 3. For k=2 to K, perform the following steps:

[0086] 4. Initialize the number of samples Δ = N1-N K .

[0087] 5. For i=1 to Δ, perform the following steps:

[0088] 6. Perform instance sampling:

[0089] From the dataset D K Sampling an instance (x l ,y l ).

[0090] 7. Sample a different instance (x g ,y g ).

[0091] 8. Apply the DiversityMix operation:

[0092]

[0093] 9. Update the dataset:

[0094]

[0095] 10. End the inner loop.

[0096] 11. End the outer loop.

[0097] 12. Merge the updated dataset D' with the original dataset D:

[0098] D e ←D∪D g

[0099] 13. Training Model:

[0100] Update model parameters f←f

[0101] 14. End the training cycle.

[0102] The present invention discloses a data enhancement method for long-tail distributed food image recognition, which is used to train a convolutional neural network, and can improve the feature extraction capability and robustness of the model and the effect of image batch processing.

[0103] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data enhancement method for food image recognition with long-tail distribution characteristics, characterized by: The following steps are involved: Step 1: Design a synchronous balanced sampler based on the characteristics of long-tail distribution data, which includes two samplers for sampling original sample pairs; Step 2: Use the data enhancement techniques TrivialAugment and RandomAugment to enhance the original sample pairs and construct an enhanced data set; Step 3: Use Mixup to fuse the enhanced sample pairs and generate a new sample data set while ensuring that the original samples are not destroyed; Step 4: Update the original dataset with the newly generated dataset and input it into the convolutional neural network. Use the optimizer to train the convolutional neural network until the total loss L of the network converges, and finally obtain a trained convolutional neural network for food image classification based on long-tail distribution.

2. The data enhancement method for food image recognition with long-tail distribution characteristics according to claim 1, characterized in that: The step 1 is specifically as follows: First, set the global sampler to preserve the characteristics of the original distribution, and then randomly sample a sample X from the dataset g ; Secondly, set the local sampler and set the sampling probability of each class to be proportional to the inverse of the size of its sample, that is, the more samples there are in a class, the smaller the sampling probability of the class is; in the formula, let n i Represents the number of samples of category i, and the maximum number of samples of all categories is N max ; Construct the reverse sampler: (1) Calculate the sampling probability P of category i according to the following formula i : in (2) According to P i Randomly select a class; (3) Uniformly remove a sample from the i-th class and replace it by repeating the reverse sampling process to obtain a small batch of data sample sets; (4) Then randomly select a sample X based on local sampling l ; Finally, construct the original sample pair (X g ,X l ).

3. The data enhancement method for food image recognition with long-tail distribution characteristics according to claim 1, characterized in that: The data enhancement technology TrivialAugment in step 2 is used to process head-type samples. For the sampled head-type images, TrivialAugment uniformly samples a data enhancement function and an intensity value, and then returns the enhanced image. For the sampled N tail-type images, RA uses a parameter-free process to transform K N potential strategies, where K represents the type of transformation.

4. The data enhancement method for food image recognition with long-tail distribution characteristics according to claim 1 or 2, characterized in that: The step 3 converts the sample pair (X g ,X l ) are fused and a new sample is constructed formally according to the following formula: λ=Beta(β,β) where λ is sampled from a β distribution parameterized by a β hyperparameter; the generated new samples are denoted by 5. The data enhancement method for food image recognition with long-tail distribution characteristics according to claim 1, characterized in that: The step 4 is specifically as follows: (1) Consistency learning; By minimizing the original sample x and the new sample Negative cosine similarity of : (2) supervised learning; After constructing the new dataset, calculate the cross entropy loss: Where N represents the size of the sampling batch, and f(·) represents the predicted probability of x; (3) Joint cumulative learning; Use bilateral branch structure to adaptively learn rebalancing branches;The loss L of the unweighted classification branch c Multiply by α, the consistency learning branch loss L sim Multiply by 1-α; α automatically decreases as the current training period T increases: Where T max is the maximum training epoch; (4) The total loss is defined as the loss L c and L sim Combination of: L total =αL c +(1-α)L sim 。 6. A computer device / equipment / system comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 5.

7. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer program product comprising a computer program / instructions, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Mixup-based class imbalance training sample sampling method

    CN115512150A

  • Mixup-based long-tail data enhancement processing method

    CN115861970A

  • Long-tail image recognition method based on representation data enhancement and loss rebalance

    CN116030302A

  • Method and system of image hashing object detection for image processing

    US20230368493A1

Cited By

  • Long-tail virtual sample generation method and system based on multi-scale long-tail kernel function

    CN121637077A