A long-tail image classification method and system based on balanced complementary entropy

By introducing the balanced complementary entropy training algorithm of adaptive weight coefficients into the normalized complementary entropy loss function, combined with the cross-entropy loss function, the image classification problem on the category imbalance data set is solved, and the classification effect and generalization ability are improved. .

CN114821184BActive Publication Date: 2024-09-20GUANGZHOU UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210500992.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2024-09-20
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively perform image classification on category-imbalanced data sets. Traditional resampling and reweighting technologies have problems such as overfitting, underfitting, or the need for carefully designed weight factors, resulting in reduced classification performance.

Method used

The training algorithm of balanced complementary entropy is adopted, by introducing adaptive weight coefficients into the normalized complementary entropy loss function, combining the cross entropy loss function to train the classification model, using Softmax prediction probability to calculate the loss of the complementary class, and balancing different categories. loss value.

Benefits of technology

Without changing the distribution of the original data, it makes full use of the feature information of various samples, effectively avoids the neglect of complementary information, and improves the classification effect and generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114821184B
    Figure CN114821184B
Patent Text Reader

Abstract

The present invention discloses a long-tail image classification method and system based on balanced complementary entropy, and the method comprises the following steps: for the acquired long-tail image training set, read the image data and label; randomly initialize the convolutional neural network parameters, use the mini-batch method to perform forward calculation on the extracted image data, obtain the full connection layer output, and calculate the Softmax prediction probability; design a balanced complementary entropy loss function, introduce an adaptive weight coefficient into the normalized complementary entropy loss function, obtain the balanced complementary entropy loss function, and use the prediction probability to calculate the loss of the complementary class; train the classification model by combining the cross entropy loss function and the balanced complementary entropy loss function, guide the network model parameter update, and obtain the image classification model. The balanced complementary entropy training algorithm proposed by the present invention can solve the classification problem of long-tail images, can bring better classification effect, and has better generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of deep learning image classification, and in particular to a long-tail image classification method and system based on balanced complementary entropy. Background Art

[0002] In recent years, image classification technology based on deep learning has achieved great success, but most image classification technologies with superior performance rely on balanced data sets, which leads to the inability to achieve good classification performance in imbalanced data sets. In real scenarios, imbalanced data sets tend to have a long-tail distribution, in which the dominant class is called the head class and the less dominant class is called the tail class. If the long-tail distribution data set is directly used for model training, due to the large difference in the number of samples between the head class and the tail class, the traditional image classification technology model tends to be biased towards the head class with more training samples and ignore the tail class with fewer samples, resulting in a decrease in classification performance. To solve this problem, the more commonly used solutions are resampling and reweighting. The most basic resampling technology randomly increases the number of samples in the tail class through oversampling, or randomly reduces the number of samples in the head class through undersampling, so that the distribution of the long-tail data set becomes relatively balanced. The reweighting technology designs a weight factor for the loss function to balance the loss values ​​between different classes. However, these two commonly used techniques also have certain drawbacks. For example, the resampling technique can easily cause overfitting or underfitting of the model, while the reweighting technique requires a carefully designed weight factor to effectively improve the model classification performance. Summary of the invention

[0003] In view of the above problems, the present invention proposes a long-tail image classification method and system based on balanced complementary entropy. The classification problem of long-tail images can be solved through a new balanced complementary entropy training algorithm, which brings better classification results and has better generalization ability.

[0004] The present invention adopts the following technical methods to achieve:

[0005] A long-tail image classification method based on balanced complementary entropy includes the following steps:

[0006] Step 1: Obtain a long-tail image training set, and read image data and labels for the long-tail image training set;

[0007] Step 2: Randomly initialize the convolutional neural network parameters, use the mini-batch method to perform forward calculations on the extracted image data, obtain the fully connected layer output, and calculate the Softmax prediction probability;

[0008] Step 3: Design a balanced complementary entropy loss function. By introducing an adaptive weight coefficient into the normalized complementary entropy loss function, a balanced complementary entropy loss function is obtained. Then, the Softmax prediction probability is used to calculate the loss of the complementary class.

[0009] Step 4: Combine the cross entropy loss function and the balanced complementary entropy loss function to train the classification model, guide the update of the network model parameters, and obtain the image classification model.

[0010] A long-tail image classification system based on balanced complementary entropy includes the following steps:

[0011] The data set processing module is used to obtain the long-tail image training set and read the image data and labels for the long-tail image training set;

[0012] The prediction probability calculation module is used to randomly initialize the convolutional neural network parameters, perform forward calculations on the extracted image data using a mini-batch method, obtain the fully connected layer output, and calculate the Softmax prediction probability;

[0013] The balanced complementary entropy training module is used to design a balanced complementary entropy loss function. By introducing an adaptive weight coefficient into the normalized complementary entropy loss function, the balanced complementary entropy loss function is obtained, and then the Softmax prediction probability is used to calculate the loss of the complementary class.

[0014] The classification model acquisition module is used to train the classification model by combining the cross entropy loss function and the balanced complementary entropy loss function, guide the update of the network model parameters, and obtain the image classification model.

[0015] The long-tail image classification method and system based on balanced complementary entropy provided by the present invention have the following advantages over the existing technology:

[0016] 1. The long-tail image classification method and system based on balanced complementary entropy provided by the present invention can make full use of the feature information of various samples without changing the distribution of the original data. In the present invention, we use the cross entropy loss function to perform classification training on the main target (i.e., the ground-truth class). At the same time, complementary entropy is used to perform information entropy calculations on the secondary target (i.e., the complementary class) to obtain useful feature information. Compared with the traditional algorithm that only uses cross entropy loss for training, this training for complementary classes can effectively avoid the situation where a large amount of complementary class sample information is ignored during the training of the model due to One-Hot encoding.

[0017] 2. The present invention can balance the complementary class loss and reduce the inhibitory effect of the complementary class on the true value class by designing a simple but effective weight coefficient in the complementary entropy loss function. Experiments have shown that the balanced complementary entropy training algorithm proposed in the present invention can further solve the classification problem of long-tail images based on existing technologies, and can bring better classification results and better generalization ability compared with traditional methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The present invention is further described using the accompanying drawings, but the embodiments in the accompanying drawings do not constitute any limitation to the present invention. A person skilled in the art can obtain other drawings based on the following drawings without creative work.

[0019] Figure 1 It is a flowchart of a long-tail image classification method based on balanced complementary entropy provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The specific embodiments of the present invention are further described below in conjunction with the accompanying drawings. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0021] Example:

[0022] See also Figure 1 The long-tail image classification method based on balanced complementary entropy provided in this embodiment includes the following steps:

[0023] S101. Obtain a long-tail image training set, and read image data and labels for the long-tail image training set.

[0024] Read the pixel matrix of the input image for subsequent image visual feature processing.

[0025] S102. Randomly initialize the convolutional neural network parameters, use the mini-batch method to perform forward calculations on the extracted image data, obtain the fully connected layer output, and calculate the Softmax prediction probability.

[0026] The convolutional neural network model is used to extract the pixel matrix of the input image in S101, and the convolution layer, activation function layer, and pooling layer are processed to obtain the fully connected layer input X; the fully connected layer input X is matrix multiplied with the classifier weight W to obtain the fully connected layer output where b jis the bias; then the Softmax calculation is performed on the output of the fully connected layer to obtain the predicted probability of the image being classified into each category, where the output result of the Softmax activation function is a K×1 vector, and the sum of the Softmax predicted probabilities is 1, and K is the number of categories;

[0027] S103. Design a balanced complementary entropy loss function. By introducing an adaptive weight coefficient into the normalized complementary entropy loss function, a balanced complementary entropy loss function is obtained. Then, the Softmax prediction probability is used to calculate the loss of the complementary class.

[0028] This embodiment designs an adaptive weight factor to balance the loss values ​​of different complementary classes. The adaptive weight factor gives a smaller weight to the complementary class with a larger number of samples and a larger weight to the complementary class with a smaller number of samples, so that the loss values ​​of different complementary classes are relatively balanced, thereby increasing the probability of the tail class being correctly classified.

[0029] In this embodiment, the expression of the designed adaptive weight coefficient is:

[0030]

[0031] Among them, w j represents the weight coefficient of complementary class j, n j represents the number of samples of complementary class j, n sum Represents the total number of samples, and α is a hyperparameter setting.

[0032] In this embodiment, the balanced complementary entropy loss function introducing the adaptive weight factor is:

[0033]

[0034] Among them, N represents the total number of samples; K represents the number of categories; represents the probability that the sth sample is correctly classified as ground-truth class i; represents the probability that the sth sample is incorrectly classified as complementary class j.

[0035] S104. The classification model is trained by combining the cross entropy loss function and the balanced complementary entropy loss function to guide the update of the network model parameters and obtain an image classification model.

[0036] In this embodiment, the formula of the cross entropy loss function is as follows:

[0037]

[0038] Among them, p si Indicates the probability that the current sample belongs to the ground-truth class i.

[0039] In this embodiment, the final classification model is:

[0040]

[0041] in, It is a balancing factor used for normalization, which is mainly used to balance the numerical ratio between cross entropy and complementary entropy.

[0042] The present invention introduces an adaptive weight coefficient into the complementary entropy loss function to design a balanced complementary entropy loss function classification algorithm. Then, the cross entropy loss function is used as the main training target to learn sample information from the ground-truth class; at the same time, the balanced complementary entropy loss function is used as the secondary training target to learn sample information from the complementary class. Finally, the cross entropy loss and the balanced complementary entropy loss are combined for training to guide the parameter update of the network model. The present invention not only effectively uses samples of the ground-truth class and the complementary class for training, but also can further improve the classification performance of the model.

[0043] A long-tail image classification system based on balanced complementary entropy includes the following modules:

[0044] The data set processing module is used to obtain the long-tail image training set and read the image data and labels for the long-tail image training set;

[0045] The prediction probability calculation module is used to randomly initialize the convolutional neural network parameters, perform forward calculations on the extracted image data using a mini-batch method, obtain the fully connected layer output, and calculate the Softmax prediction probability;

[0046] The balanced complementary entropy training module is used to design a balanced complementary entropy loss function. By introducing an adaptive weight coefficient into the normalized complementary entropy loss function, the balanced complementary entropy loss function is obtained, and then the Softmax prediction probability is used to calculate the loss of the complementary class.

[0047] The classification model acquisition module is used to train the classification model by combining the cross entropy loss function and the balanced complementary entropy loss function, guide the update of the network model parameters, and obtain the image classification model.

[0048] The present invention proposes a method and a system, which adopts a balanced complementary entropy training algorithm that can solve the classification problem of long-tail images, can bring better classification results, and has better generalization ability.

[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.

Claims

1. A long-tail image classification method based on balanced complementary entropy, characterized in that: include: Step 1: Obtain a long-tail image training set, and read image data and labels for the long-tail image training set; Step 2: Randomly initialize the convolutional neural network parameters, use the mini-batch method to perform forward calculations on the extracted image data, obtain the fully connected layer output, and calculate the Softmax prediction probability; Step 3: Design a balanced complementary entropy loss function. By introducing an adaptive weight coefficient into the normalized complementary entropy loss function, a balanced complementary entropy loss function is obtained. Then, the Softmax prediction probability is used to calculate the loss of the complementary class. The expression of the adaptive weight coefficient is: Among them, w j represents the weight coefficient of complementary class j, n j represents the number of samples of complementary class j, n sum Represents the total number of samples, α is a hyperparameter setting; Step 4: Combine the cross entropy loss function and the balanced complementary entropy loss function to train the classification model, guide the update of the network model parameters, and obtain the image classification model.

2. The long-tail image classification method based on balanced complementary entropy according to claim 1 is characterized in that: The reading of image data comprises: Read the pixel matrix of the input image for subsequent image visual feature processing.

3. The long-tail image classification method based on balanced complementary entropy according to claim 1 is characterized in that: The fully connected layer output is obtained and the Softmax prediction probability is calculated, including: A convolutional neural network model is used to extract the pixel matrix of the long-tail image input in step 1, and forward calculations such as convolution layer, activation function layer and pooling layer are performed to obtain the fully connected layer input. The fully connected layer output is obtained based on the fully connected layer input, and then the Softmax activation function is used to calculate the Softmax prediction probability of the image.

4. The long-tail image classification method based on balanced complementary entropy according to claim 1 is characterized in that: The introduction of the adaptive weight coefficient obtains the balanced complementary entropy loss function as follows: Among them, N represents the total number of samples; K represents the number of categories; represents the probability that the sth sample is correctly classified as ground-truth class i; represents the probability that the sth sample is incorrectly classified as complementary class j.

5. The long-tail image classification method based on balanced complementary entropy according to claim 4 is characterized in that: The joint cross entropy loss function and the balanced complementary entropy loss function are trained to guide the update of model parameters, wherein the formula of the cross entropy loss function is as follows: Among them, p si Indicates the probability that the current sample belongs to the ground-truth class i.

6. The long-tail image classification method based on balanced complementary entropy according to claim 5 is characterized in that: The image classification model is: in, It is a balancing factor used for normalization, which is mainly used to balance the numerical ratio between the cross entropy loss and the complementary entropy loss.

7. A long-tail image classification system based on balanced complementary entropy, characterized in that: It includes the following modules: The data set processing module is used to obtain the long-tail image training set and read the image data and labels for the long-tail image training set; The prediction probability calculation module is used to randomly initialize the convolutional neural network parameters, perform forward calculations on the extracted image data using a mini-batch method, obtain the fully connected layer output, and calculate the Softmax prediction probability; The balanced complementary entropy training module is used to design a balanced complementary entropy loss function. By introducing an adaptive weight coefficient into the normalized complementary entropy loss function, the balanced complementary entropy loss function is obtained, and then the Softmax prediction probability is used to calculate the loss of the complementary class. The expression of the adaptive weight coefficient is: Among them, w j represents the weight coefficient of complementary class j, n j represents the number of samples of complementary class j, n sum Represents the total number of samples, α is a hyperparameter setting; The classification model acquisition module is used to train the classification model by combining the cross entropy loss function and the balanced complementary entropy loss function, guide the update of the network model parameters, and obtain the image classification model.