A two-stage noisy label image classification method and system based on dual-network collaborative training mode
Through the two-stage method of dual-network collaborative training mode, sample history information and dynamic threshold are used to select small loss samples, which solves the problems of inaccurate noise filtering and network degradation in noisy label image classification, and achieves improved model stability and generalization performance.
Patent Information
- Application Number
- CN202411359942.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2044-09-27
AI Technical Summary
When dealing with the classification of images with noisy labels, the existing technology uses a dual-network collaborative training mode in which the loss value is directly related to whether the sample is retained. This method cannot accurately filter out all noisy labels, and in the later stages of training, the network easily degenerates into a state with the same parameters, losing the advantage of multi-model joint guidance.
A two-stage method based on the dual-network collaborative training mode is adopted. The network is trained by selecting clean instances, and small loss samples are selected using sample history information and dynamic thresholds. The discriminant matrix and weight matrix are combined to reweight the samples and guide the update of network parameters.
Effectively filter out noisy labels, improve model generalization performance, avoid network overfitting, and ensure the accuracy of sample selection and model stability during training.
Smart Images

Figure CN119445196B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a two-stage noisy label image classification method and system based on a dual-network collaborative training mode. Background Art
[0002] Deep neural networks have achieved tremendous success in computer vision in recent years, but their superior performance often relies on accurately labeled, large-scale datasets. In industrial applications, obtaining such large-scale datasets often requires significant annotation costs, which is both expensive and time-consuming, especially in fields requiring specialized knowledge, such as healthcare and the military. Therefore, to reduce annotation costs, many researchers have sought alternative methods for dataset annotation. Common alternatives include crowdsourcing, web search, and automatic annotation tools. However, datasets annotated using these alternative methods often contain a high number of noisy labels. The introduction of these noisy labels can have serious consequences in practical applications, leading to numerous methods being proposed to address the noisy label problem. Furthermore, deep neural networks are prone to overfitting to noisy labels, severely degrading model generalization performance. Therefore, designing effective methods for classifying images with noisy labels is of great practical value.
[0003] Recently, co-training to select small-loss samples to address noisy labels has become a mainstream approach to addressing noisy label interference. These methods employ a direct processing approach, retaining small-loss samples for network parameter updates and discarding samples with larger loss values to prevent the network from overfitting to the noise. Furthermore, most of these methods are based on a dual-network collaborative training model, which effectively avoids the cumulative bias that can easily arise from using a single model. However, these methods still have some shortcomings. The practice of directly linking sample retention with loss values cannot accurately filter out all noise, and the dual networks can easily degenerate into two networks with identical parameters in the later stages of training, losing the advantages of joint guidance from multiple models. Summary of the Invention
[0004] In order to solve the technical problems arising from the training process of noisy labeled images in the prior art, the present invention provides a two-stage noisy labeled image classification method based on a dual-network collaborative training mode. By selecting clean examples to train the network, the interference of noisy labels can be combated, and noise can be accurately filtered.
[0005] The technical solution adopted by the method of the present invention is: a two-stage noisy label image classification method based on a dual-network collaborative training mode, comprising the following steps:
[0006] S1. Divide the dataset into multiple batches of input samples, where each input sample corresponds to a sample label used to identify image category information; create two feature extraction networks with the same structure and initialize the network parameters; pass each batch of input samples into the two feature extraction networks for training at the same time, and after feature extraction of the input samples, obtain the outputs p1 and p2 of the two feature extraction networks;
[0007] S2, calculate the total loss of the input sample in one stage based on the outputs p1 and p2 of the two feature extraction networks and the sample labels;
[0008] S3. Sort the total loss values of the input samples in one stage from small to large, and retain the input samples whose total loss values are less than the threshold. Take the average of the total loss values of the retained input samples in one stage, and use it for backpropagation to update the parameters of the two feature extraction networks.
[0009] S4. Save a record of each input sample processing to form sample history information; the record includes a mark of each input sample being retained or discarded, and a category label calculated based on the outputs p1 and p2;
[0010] S5. Perform statistical processing on the sample history information to obtain the discriminant matrix Y and the weight matrix W;
[0011] S6. Use the discriminant matrix Y as an indicator signal to calculate the total loss of the two stages for the input sample;
[0012] S7. Sort the two-stage total loss values of the input samples from small to large, and retain the input samples whose two-stage total loss values are less than the threshold;
[0013] S8. Activate the weights stored in the weight matrix W as sample weights, reweight the total loss of the two stages of the input samples retained in step S7, and average the weighted losses for backpropagation to update the parameters of the two feature extraction networks;
[0014] S9. Train until the set maximum number of iterations to obtain the final two-stage noisy label image classification model; use the two-stage noisy label image classification model to classify the image.
[0015] The technical solution adopted by the system of the present invention is: a two-stage noisy label image classification system based on a dual-network collaborative training mode, including the following modules:
[0016] The feature extraction module divides the dataset into multiple batches of input samples, where each input sample corresponds to a sample label used to identify image category information; creates two feature extraction networks with the same structure and initializes the network parameters; and simultaneously passes each batch of input samples into the two feature extraction networks for training. After feature extraction of the input samples, the outputs p1 and p2 of the two feature extraction networks are obtained;
[0017] The one-stage total loss calculation module calculates the one-stage total loss of the input sample based on the outputs p1 and p2 of the two feature extraction networks and the sample labels;
[0018] The one-stage network parameter update module sorts the one-stage total loss values of the input samples from small to large, retaining the input samples whose one-stage total loss values are less than the threshold; the one-stage total loss values of these retained input samples are averaged and used for backpropagation to update the parameters of the two feature extraction networks;
[0019] A recording module is used to save a record of each input sample processing to form sample history information; the record includes a mark indicating whether an input sample is retained or discarded each time, and a category label calculated based on the outputs p1 and p2;
[0020] Statistical processing module, used to perform statistical processing on sample historical information to obtain the discriminant matrix Y and weight matrix W;
[0021] The two-stage total loss calculation module uses the discriminant matrix Y as an indicator signal to calculate the two-stage total loss for the input sample;
[0022] The two-stage network parameter update module sorts the two-stage total loss values of the input samples from small to large, retaining the input samples whose two-stage total loss values are less than the threshold; the weight activations stored in the weight matrix W are used as sample weights to reweight the two-stage total loss of the retained input samples, and the weighted losses are averaged for backpropagation to update the parameters of the two feature extraction networks;
[0023] The classification module obtains the final two-stage noisy label image classification model when the training reaches the set maximum number of iterations; the two-stage noisy label image classification model is used to classify the image.
[0024] Compared with the prior art, the beneficial effects achieved by the present invention are mainly as follows: a dual network with the same structure is used to extract features, and the training process of the classification model includes two stages. In the first stage, the output relationship of the two networks is used to guide network training. When the output categories of the two networks are consistent, the sample features are selectively aggregated; when the output categories of the two networks are inconsistent, the sample features are selectively alienated. After that, a dynamic threshold is used to select small loss samples to update the network parameters, and the sample history information is obtained at the same time. In the second stage, the sample history information is used to determine whether the sample is a clean sample. If it is a clean sample, the two network features of the sample are guided to aggregate. If it is a noise sample, the two network features of the sample are guided to alienate. In addition, after the dynamic threshold selection, the sample history information is also used for sample reweighting, and different weights are assigned to the selected clean samples. The present invention combats the interference of noise labels by selecting clean instances to train the network, and can accurately filter noise. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 This is a flow chart of a two-stage noisy label image classification method based on a dual-network collaborative training mode in an embodiment of the present invention.
[0027] Figure 2 2 is a schematic diagram of a two-stage weight matrix W generation structure in an embodiment of the present invention.
[0028] Figure 3 2 is a flow chart of the two-stage discriminant matrix Y fusion training process in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The present invention will be further described in detail below with reference to the embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0030] Example 1
[0031] This embodiment proposes a two-stage noisy label image classification method based on a dual-network collaborative training mode. The method selects clean instances to train the network to combat the interference of noisy labels. The process framework is as follows: Figure 1 The training process consists of two phases, with a total of 200 iterations, the first 80 iterations as the first phase, and the last 120 iterations as the second phase. After the two-phase training is completed, the final noisy label image classification model is obtained.
[0032] The image classification method of this embodiment specifically includes the following steps:
[0033] S1. Divide the dataset into multiple batches of input samples (i.e., multiple mini-batch data), where each input sample corresponds to a sample label used to identify image category information; create two feature extraction networks A1 and A2 with the same structure, and initialize the network parameters; pass each batch of input samples into the feature extraction network A1 and the feature extraction network A2 at the same time for training. After feature extraction of the input samples, the outputs p1 and p2 of the two feature extraction networks are obtained.
[0034] In this step, the feature extraction network (i.e., Network A1 and Network A2) is selected based on the size of the dataset. For smaller datasets, the feature extraction network structure is simpler, while for larger datasets, the feature extraction network structure is more complex. In other words, the size of the network structure is determined by the size of the dataset. For large datasets, a ResNet18 convolutional network is used, while for small datasets, a 2-layer MLP network or a 7-layer convolutional network is used.
[0035] S2. Calculate the total loss of one stage of the input sample based on the outputs p1 and p2 of the two feature extraction networks and the sample labels.
[0036] In this step, the same category as the maximum probability values of the outputs p1 and p2 of the two feature extraction networks is used as an indicator. If the maximum probability values of p1 and p2 are the same, the input sample is considered a clean sample; if they are different, they are considered a noise sample. A supervised loss is calculated for the outputs of all input samples. A one-stage unsupervised aggregation loss is calculated for clean samples, and a one-stage unsupervised separation loss is calculated for noise samples. The weighted sum of all losses is used to obtain the total loss for the one-stage.
[0037] The total loss of one stage includes supervised loss, one stage unsupervised aggregation loss, and one stage unsupervised alienation loss. The cross entropy loss is calculated as the supervised loss using formula (1), the one stage unsupervised aggregation loss is calculated using formula (2), and the one stage unsupervised alienation loss is calculated using formula (5). The total loss of one stage is expressed by formula (6).
[0038] The supervised loss is expressed as:
[0039]
[0040] The cross entropy loss is calculated for the outputs p1 and p2 of the two feature extraction networks, x i represents the i-th input sample, y iRepresents the i-th sample label, B represents the number of input samples in each batch, k represents the number of output categories to be classified, and m is used to traverse all output categories from 1 to k, 1≤m≤k, Represents the first feature extraction network (i.e., feature extraction network A1) for the input sample x i The output probability of the prediction is class m, Indicates that the second feature extraction network (i.e., feature extraction network A2) is used to extract the input sample x i The output probability of the prediction being class m.
[0041] The one-stage unsupervised aggregation loss is expressed as:
[0042] l Se-A (x i )=1{max(p1)==max(p2)}*{D KL (p1||p2)+D KL (p2||p1)} (2)
[0043] Where 1{·} is an indicator function used to identify whether the input sample is a clean sample or a noise sample. In the above formula (2), it is specifically used to determine whether the categories of the maximum probability values output by the two feature extraction networks are the same. If the categories are the same, it is set to 1, and if the categories are different, it is set to 0; D KL = represents the calculation of the KL divergence of the outputs of two feature extraction networks. Due to the asymmetry of KL divergence, a two-part symmetric structure is used, and the specific form is expressed by formula (3) and formula (4):
[0044]
[0045] The one-stage unsupervised alienation loss is expressed as:
[0046]
[0047] Where 1{·} is an indicator function used to identify whether the input sample is a clean sample or a noise sample. In the above formula (5), it is specifically used to select samples with different categories whose maximum probability values are output by the two feature extraction networks. If the categories are different, it is set to 1, and if the categories are the same, it is set to 0. Used to calculate the cosine similarity of the outputs p1 and p2 of two feature extraction networks.
[0048] The specific expression of the total loss in one stage is:
[0049] l one-stage (x i )=(1-α)*l sup (x i ,y i )+α*l Se-A (xi )+δ*l Se-Sp (x i ) (6)
[0050] The first part is the supervised loss part, the second part is the one-stage unsupervised aggregation loss part, and the third part is the one-stage unsupervised alienation loss part. α and δ are hyperparameters.
[0051] The indicator signal in this step specifically takes the maximum probability value of the two network outputs p1 and p2 of the input sample. If the category with the maximum probability value in output p1 is the same as the category with the maximum probability value in output p2, the sample is marked as a clean sample with a value of 1; otherwise, it is marked as a noise sample with a value of 0. When calculating the unsupervised aggregation loss on clean samples, the noise samples can be effectively avoided. When calculating the unsupervised separation loss on noise samples, the labels are inverted to effectively avoid the involvement of clean samples.
[0052] S3. Sort the one-stage total loss values of the input samples from small to large, and use a dynamic threshold to retain the input samples with small loss values at the front, specifically retaining the input samples with one-stage total loss values less than the threshold; take the average of the one-stage total loss values of this part of the input samples and use it for backpropagation to update the parameters of the two feature extraction networks. The one-stage total loss values of other input samples do not participate in the update of the feature extraction network parameters.
[0053] The calculation formula of dynamic threshold R(t) is:
[0054]
[0055] Where τ is a parameter used to reflect the noise ratio, t represents the current number of iterations; T k Take a fixed value, which in this embodiment can be 10. After calculating the total loss value of the input sample in one stage, the total loss value is sorted using a dynamic threshold, and samples smaller than the threshold are retained, while the remaining samples are discarded.
[0056] In this embodiment, the dynamic threshold gradually changes with the number of training iterations. During training, input samples with a ratio below the threshold are retained, while those with a ratio above the threshold are discarded. Since the model learns simple knowledge first in the early stages of training and only learns difficult knowledge later, a higher threshold is used in the early stages to allow more input samples to be included in the training. Thereafter, the threshold remains fixed. This step uses the dynamic threshold to retain appropriate input samples, thereby filtering out noisy samples.
[0057] The operation of taking the average of the total loss value of the retained input samples in one stage is as follows:
[0058]
[0059] where l one-stage (x) represents the total loss value of the input sample in one stage, D clean Represents the input samples retained after dynamic threshold filtering in one stage.
[0060] S4. Save the record of each input sample processing to form sample history information; the record includes two parts, the first part is the mark of each input sample being retained or discarded, and the second part is the category label calculated based on the outputs p1 and p2.
[0061] The calculation process of the category label is as follows: all category output probabilities of the outputs p1 and p2 of the feature extraction network are grouped into a set, the maximum value in the set is taken, and the category label corresponding to the maximum value is used as the second part of the record.
[0062] S5. Perform statistical processing on the sample history information obtained in step S4 to obtain two key matrices: a discriminant matrix Y and a weight matrix W.
[0063] From this step, the training enters the second stage. The historical information of the samples recorded in the first stage is statistically processed, such as Figure 2 As shown in the figure, N represents the number of samples and L represents the number of training iterations.
[0064] The first part of the sample history record is the multiple labels of all input samples that were retained and discarded after multiple iterations of training. This step counts the number of times an input sample was retained and discarded and converts them into probability values. When the probability of retention is greater than the probability of discarding, the input sample is identified as a clean sample and marked as 1; otherwise, the input sample is identified as a noise sample and marked as 0. All label values are stored in the discriminant matrix Y as an indicator of whether the input sample is a clean sample.
[0065] The second part of the sample history information record is the multiple output categories (i.e., category labels) of the input samples after multiple iterative training. The number of times each output category appears is counted and converted into a probability value. The maximum value of the probability value is taken and saved in the weight matrix W as the weight value for sample reweighting.
[0066] The discriminant matrix Y stores values of 0 and 1, which are used to identify whether the sample is a noise sample; the weight matrix W stores continuous values in the range of 0 to 1, which are used for sample reweighting.
[0067] In fact, the statistics of sample history information are collected throughout the entire process. Whether in the first or second phase, sample history information will be recorded, but in the first phase, sample history information is not used, and in the second phase, sample history information is recorded at the same time as it is used.
[0068] S6. Calculate the two-stage total loss for the input sample, where the two-stage total loss consists of three parts: supervised loss, two-stage unsupervised aggregation loss, and two-stage unsupervised alienation loss.
[0069] In the second stage training, the process of fusion training using the discriminant matrix Y is as follows Figure 3 As shown in Figure 2, the discriminant matrix Y is used as an indicator signal, and the supervised loss is calculated for the output of all samples. At the same time, the two-stage unsupervised aggregation loss is calculated for the clean samples, and the two-stage unsupervised alienation loss is calculated for the noisy samples. All losses are added together to obtain the two-stage total loss.
[0070] The calculation of the supervised loss is identical to that in step S2, but the discriminant matrix Y is used as an indicator when calculating the second-stage unsupervised aggregation loss. In other words, the formulas for calculating the aggregation loss and alienation loss in step S6 are structurally identical to those in step S2, with only the indicator signals being different. While step S2 uses the same output as the indicator signal based on whether the maximum probability category is the same, step S6 uses the statistical determination of whether the sample is a noise sample based on historical sample information as an indicator.
[0071] The two-stage unsupervised aggregation loss is expressed as:
[0072] l New-Se-A (x i )=1{φ==clean}*{D KL (p1||p2)+D kL (p2||p1)} (9)
[0073] Where 1{·} is an indicator function used to determine whether the input sample is a clean sample. The indicator signal φ in the indicator function is the stored value in the discriminant matrix Y. The latter part is the same as the KL divergence calculation in the aggregation loss of step S2.
[0074] The two-stage unsupervised alienation loss is expressed as:
[0075]
[0076] Where 1{·} is an indicator function used to determine whether the input sample is a noise sample. The indicator signal φ in the indicator function is the value stored in the discriminant matrix Y. The subsequent part is also the same as the alienation loss calculation in step S2.
[0077] The total loss of the two-stage is the weighted sum of the supervised loss, the two-stage unsupervised aggregation loss, and the two-stage unsupervised alienation loss, which can be expressed as:
[0078] l two-stage (x i )=(1-α)*lsup (x i ,y i )+α*l New-Se-A (x i )+δ*l New-Se-Sp (x i ) (11)
[0079] The first part is the supervised loss, the second part is the two-stage unsupervised aggregation loss, and the third part is the two-stage unsupervised alienation loss. α and δ are hyperparameters.
[0080] S7. Sort the two-stage total loss values of the input samples from small to large, use a dynamic threshold to retain the input samples with small loss values at the front, specifically retain the input samples whose two-stage total loss values are less than the threshold, and discard the remaining input samples.
[0081] The dynamic threshold R(t) is also calculated using formula (7).
[0082] S8. The weights stored in the weight matrix W are activated with the softmax function as sample weights, and the two-stage total loss of the input samples retained in step S7 is reweighted. The weighted losses are averaged (using formula (12)) for backpropagation to update the parameters of the two feature extraction networks.
[0083]
[0084] where D′ clean represents the input samples retained after the second stage dynamic threshold filtering, w i The weight value of the i-th sample saved in the weight matrix W.
[0085] S9. Train until the set maximum number of iterations to obtain the final two-stage noisy label image classification model; use the two-stage noisy label image classification model to classify the image.
[0086] Example 2
[0087] Based on the same inventive concept as Example 1, this embodiment provides a two-stage noisy label image classification system based on a dual-network collaborative training mode, including the following modules:
[0088] The feature extraction module divides the dataset into multiple batches of input samples, where each input sample corresponds to a sample label used to identify image category information; creates two feature extraction networks with the same structure and initializes the network parameters; and simultaneously passes each batch of input samples into the two feature extraction networks for training. After feature extraction of the input samples, the outputs p1 and p2 of the two feature extraction networks are obtained;
[0089] The one-stage total loss calculation module calculates the one-stage total loss of the input sample based on the outputs p1 and p2 of the two feature extraction networks and the sample labels;
[0090] The one-stage network parameter update module sorts the one-stage total loss values of the input samples from small to large, retaining the input samples whose one-stage total loss values are less than the threshold; the one-stage total loss values of these retained input samples are averaged and used for backpropagation to update the parameters of the two feature extraction networks;
[0091] A recording module is used to save a record of each input sample processing to form sample history information; the record includes a mark indicating whether an input sample is retained or discarded each time, and a category label calculated based on the outputs p1 and p2;
[0092] Statistical processing module, used to perform statistical processing on sample historical information to obtain the discriminant matrix Y and weight matrix W;
[0093] The two-stage total loss calculation module uses the discriminant matrix Y as an indicator signal to calculate the two-stage total loss for the input sample;
[0094] The two-stage network parameter update module sorts the two-stage total loss values of the input samples from small to large, retaining the input samples whose two-stage total loss values are less than the threshold; the weight activations stored in the weight matrix W are used as sample weights to reweight the two-stage total loss of the retained input samples, and the weighted losses are averaged for backpropagation to update the parameters of the two feature extraction networks;
[0095] The classification module obtains the final two-stage noisy label image classification model when the training reaches the set maximum number of iterations; the two-stage noisy label image classification model is used to classify the image.
[0096] For the image classification system described in this embodiment, since the implementation of the technical solution corresponds to the method of Example 1, this embodiment is described relatively briefly. For the corresponding technical features, please refer to the description of each step in Example 1, and no further details will be given here.
[0097] The above disclosure is only a preferred embodiment of the present invention, and certainly cannot be used to limit the scope of the rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made in accordance with the claims of the present invention are still within the scope of the invention.
Claims
1. A two-stage noisy label image classification method based on a dual-network collaborative training model, characterized in that: The following steps are involved: S1. Divide the dataset into multiple batches of input samples, where each input sample corresponds to a sample label used to identify image category information; create two feature extraction networks with the same structure and initialize the network parameters; pass each batch of input samples into the two feature extraction networks for training at the same time, and after feature extraction of the input samples, obtain the outputs p1 and p2 of the two feature extraction networks; S2, calculate the total loss of the input sample in one stage based on the outputs p1 and p2 of the two feature extraction networks and the sample labels; S3. Sort the total loss values of the input samples in one stage from small to large, and retain the input samples whose total loss values in one stage are less than the threshold; The total loss value of the retained input samples in one stage is averaged and used for backpropagation to update the parameters of the two feature extraction networks; S4. Save a record of each input sample processing to form sample history information; the record includes a mark of each input sample being retained or discarded, and a category label calculated based on the outputs p1 and p2; S5. Perform statistical processing on the sample history information to obtain the discriminant matrix Y and the weight matrix W; S6. Use the discriminant matrix Y as an indicator signal to calculate the total loss of the two stages for the input sample; S7. Sort the two-stage total loss values of the input samples from small to large, and retain the input samples whose two-stage total loss values are less than the threshold; S8. Activate the weights stored in the weight matrix W as sample weights, reweight the total loss of the two stages of the input samples retained in step S7, and average the weighted losses for backpropagation to update the parameters of the two feature extraction networks; S9, training until the maximum number of iterations is set to obtain a final two-stage noisy label image classification model; using the two-stage noisy label image classification model to classify the image; In step S2, when calculating the total loss of one stage, whether the categories of the maximum probability values of the outputs p1 and p2 of the two feature extraction networks are the same is used as an indicator signal. If the categories of the maximum probability values of p1 and p2 are the same, the input sample is regarded as a clean sample; if they are different, they are regarded as a noise sample. The supervised loss is calculated for the output of all input samples, the one-stage unsupervised aggregation loss is calculated for the clean samples, and the one-stage unsupervised alienation loss is calculated for the noise samples. The total loss of one stage is obtained by weighted summation of all losses. Step S5 counts the number of times the input sample is retained and the number of times it is discarded, and converts it into a probability value; when the probability of being retained is greater than the probability of being discarded, the input sample is identified as a clean sample and marked as 1, otherwise the input sample is identified as a noise sample and marked as 0; all the marked values are saved in the discriminant matrix Y as an indicator signal for determining whether the input sample is a clean sample; Step S5 also counts the number of times each category label of the input sample appears, and converts it into a probability value, takes the maximum value of the probability value, and saves the maximum value in the weight matrix W as the weight value of the sample reweighting.
2. The image classification method according to claim 1, characterized in that In step S2, the supervised loss is expressed as: The cross entropy loss is calculated for the outputs p1 and p2 of the two feature extraction networks, x i represents the i-th input sample, y i Represents the i-th sample label, B represents the number of input samples in each batch, k represents the number of output categories to be classified, and m is used to traverse all output categories from 1 to k, 1≤m≤k, Represents the first feature extraction network for the input sample x i The output probability of the prediction is class m, Represents the second feature extraction network for the input sample x i Predict the output probability of category m; The one-stage unsupervised aggregation loss is expressed as: l Se-A (x i )=1{max(p1)==max(p2)}*{D KL (p1||p2)+D KL (p2||p1)} Where 1{·} is an indicator function used to determine whether the categories of the two feature extraction networks with the maximum probability output are the same. If the categories are the same, it is set to 1, and if the categories are different, it is set to 0; D KL Indicates the calculation of the KL divergence of the two feature extraction network outputs p1 and p2; The one-stage unsupervised alienation loss is expressed as: Where 1{·} is an indicator function, which is used to select samples with different categories of the maximum probability values output by the two feature extraction networks. If the categories are different, it is set to 1, and if the categories are the same, it is set to 0; Used to calculate the cosine similarity of the outputs p1 and p2 of the two feature extraction networks; The total loss of one stage is expressed as: l one-stag (x i )=(1-a)*l sup (x i ,y i )+a*l Se-A (x i )+δ*l Se-Sp (x i ) where α and δ are hyperparameters.
3. The image classification method according to claim 1, wherein: In step S3, a dynamic threshold is used to retain input samples whose total loss value in the first stage is less than the threshold. In step S7, a dynamic threshold is used to retain input samples whose total loss value in the second stage is less than the threshold. The calculation formula of dynamic threshold R(t) is: Where τ is a parameter used to reflect the noise ratio, t represents the current number of iterations; T k Take a fixed value.
4. The image classification method according to claim 1 or 3, characterized in that: Step S3 is to take the average of the total loss values of the retained input samples in one stage, specifically: where l one-stage (x i ) represents the total loss value of the input sample in one stage, D clean represents the input samples retained after threshold filtering in one stage, x i represents the i-th input sample; The expression for calculating the mean of the weighted losses in step S8 is: where l two-stag (x i ) represents the total loss value of the two stages of the input sample, D′ clean represents the input samples retained after threshold filtering in the second stage, w i The weight value of the i-th sample saved in the weight matrix W.
5. The image classification method according to claim 1, wherein: The calculation process of the category label in step S4 is as follows: all category output probabilities of the outputs p1 and p2 of the feature extraction network are grouped into a set, the maximum value in the set is taken, and the category label corresponding to the maximum value is used as the category label calculated based on the outputs p1 and p2.
6. The image classification method according to claim 1, wherein: In step S6, when calculating the total loss of the second stage, the discriminant matrix Y is used as an indicator signal, and the supervised loss is calculated for the output of all samples. At the same time, the second stage unsupervised aggregation loss is calculated for the clean samples, and the second stage unsupervised alienation loss is calculated for the noise samples. The weighted sum of all losses is obtained to obtain the total loss of the second stage.
7. The image classification method according to claim 6, characterized in that In step S6, the supervised loss is expressed as: The cross entropy loss is calculated for the outputs p1 and p2 of the two feature extraction networks, x i represents the i-th input sample, y i Represents the i-th sample label, B represents the number of input samples in each batch, k represents the number of output categories to be classified, and m is used to traverse all output categories from 1 to k, 1≤m≤k, Represents the first feature extraction network for the input sample x i The output probability of the prediction is class m, Represents the second feature extraction network for the input sample x i Predict the output probability of category m; The two-stage unsupervised aggregation loss is expressed as: Where 1{·} is the indicator function, which is used to determine whether the input sample is a clean sample. The indicator signal in the indicator function is is the stored value in the discriminant matrix Y; D KL Indicates calculating the KL divergence of the outputs of two feature extraction networks; The two-stage unsupervised alienation loss is expressed as: Where 1{·} is an indicator function used to determine whether the input sample is a noise sample. The indicator signal in the indicator function is It is the value stored in the discriminant matrix Y; Used to calculate the cosine similarity of the outputs p1 and p2 of the two feature extraction networks; The total loss in the second stage is expressed as: l two-stage (x i )=(1-a)*l sup (x i ,y i )+a*l NeW-Se-A (x i )+δ*l New-Se-Sp (x i ) Among them, α and δ are hyperparameters.
8. A two-stage noisy label image classification system based on a dual-network collaborative training model, characterized by: The classification method according to any one of claims 1 to 7 is used for implementation, wherein the classification system comprises the following modules: The feature extraction module divides the dataset into multiple batches of input samples, where each input sample corresponds to a sample label used to identify image category information; creates two feature extraction networks with the same structure and initializes the network parameters; and simultaneously passes each batch of input samples into the two feature extraction networks for training. After feature extraction of the input samples, the outputs p1 and p2 of the two feature extraction networks are obtained; The one-stage total loss calculation module calculates the one-stage total loss of the input sample based on the outputs p1 and p2 of the two feature extraction networks and the sample labels; The one-stage network parameter update module sorts the one-stage total loss values of the input samples from small to large, and retains the input samples whose one-stage total loss values are less than the threshold; The total loss value of the retained input samples in one stage is averaged and used for backpropagation to update the parameters of the two feature extraction networks; A recording module is used to save a record of each input sample processing to form sample history information; the record includes a mark indicating whether an input sample is retained or discarded each time, and a category label calculated based on the outputs p1 and p2; Statistical processing module, used to perform statistical processing on sample historical information to obtain the discriminant matrix Y and weight matrix W; The two-stage total loss calculation module uses the discriminant matrix Y as an indicator signal to calculate the two-stage total loss for the input sample; The two-stage network parameter update module sorts the two-stage total loss values of the input samples from small to large, retaining the input samples whose two-stage total loss values are less than the threshold; the weight activations stored in the weight matrix W are used as sample weights to reweight the two-stage total loss of the retained input samples, and the weighted losses are averaged for backpropagation to update the parameters of the two feature extraction networks; The classification module obtains the final two-stage noisy label image classification model when the training reaches the set maximum number of iterations; the two-stage noisy label image classification model is used to classify the image.
Citation Information
Patent Citations
Noise robust pedestrian re-identification method based on two stages
CN114022904A
Self-tag modification method for processing noise tag
CN115861625A