A Gini index guided self-training semantic segmentation method
By using the Gini index to measure the uncertainty of output predictions to guide the selection of pseudo labels, it solves the problems of pseudo label errors and noise in unsupervised domain adaptive semantic segmentation, and improves the semantic annotation accuracy and model performance of the target domain.
Patent Information
- Application Number
- CN202110318561.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-25
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-03-25
AI Technical Summary
Existing unsupervised domain-adaptive semantic segmentation methods have problems with wrong labels and noise in pseudo-label selection, resulting in poor model expression performance, especially when the model is highly uncertain about pixel predictions. Softmax-based Self-supervised Learning and Entropy -based Self-supervised Learning methods tend to ignore categories that are difficult to classify during the optimization process, resulting in low accuracy.
The Gini index is used to measure the uncertainty of the output prediction, and based on the pixels whose Gini index is less than the threshold, the class label corresponding to the maximum softmax score is assigned as a pseudo label. The Gini index guides the selection of pseudo labels to reduce the introduction of noise and improve the prediction of the model. Probability [0.75, 0.9] IOU value in the interval.
It improves the semantic annotation accuracy of the target domain, ensures the correctness of pseudo-labels, introduces more correct supervision information, avoids the impact of noise, and improves the prediction accuracy of the model on target domain images.
Smart Images

Figure CN113095328B
Abstract
Description
Technical Field
[0001] The present invention relates to a domain adaptive semantic annotation method based on self-training. The method is different from the traditional method in the selection of pseudo labels. The pseudo labels are determined based on the Gini index. The method belongs to the field of pattern recognition and computer vision and can be applied to autonomous driving and robot visual navigation technology. Background Art
[0002] The self-training domain adaptive semantic segmentation method uses two types of data: labeled source domain data and unlabeled target domain data. The source domain uses labels as supervision information, and the target domain uses pseudo labels as supervision information. The network is trained based on the supervision information to learn a model that has a good semantic annotation effect on the target domain image. Accurate unsupervised domain adaptive semantic segmentation is crucial for applications where there is a significant data difference between the model learning stage and the use stage, such as autonomous driving, robot navigation, etc.
[0003] The main idea of unsupervised domain adaptation based on self-training is to create pseudo-labels and use the pseudo-labels as the true labels of the target domain images in the training phase. The biggest problem that unsupervised domain adaptation methods based on self-training need to solve is how to obtain correct pseudo-labels. Wrong pseudo-labels may eventually lead to "confirmation bias", that is, wrong pseudo-labels become noise when used as supervisory information, making the performance of the trained model worse.
[0004] In order to effectively obtain pseudo labels that are as accurate as possible, existing strategies include: selecting pseudo labels based on the prediction of network output; selecting pseudo labels based on the measure of uncertainty of network output prediction. Softmax-based Self-supervised Learning (SSL) selects pseudo labels based on the prediction of network output. This method sets a threshold in advance. Pixels with softmax scores greater than the threshold are assigned the class label corresponding to the maximum prediction score as the pseudo label of the pixel. This method will produce incorrect labels in the initial stage of iteration, but as the number of iterations increases, the performance of the classifier on the test data set improves, and thus the accuracy of the label is improved. The problem with this method is that it is easy to make mistakes when the model predicts pixels with high uncertainty (such as boundary pixels), that is, a softmax score higher than the threshold does not mean that the corresponding predicted label is correct. To address this problem, researchers proposed to measure the uncertainty of network output prediction and select pseudo labels based on uncertainty. Entropy-based Self-supervised Learning (ESL) is a typical method of this type. This method calculates the entropy value of the network output prediction to measure the uncertainty of the prediction, and selects pseudo labels based on the entropy value to improve the reliability of the pseudo labels. However, in the entropy-based gradient back-propagation optimization process, this type of method tends to optimize categories that are easy to classify, that is, the optimization weight of categories that are not easy to classify is smaller than that of categories that are easy to classify, resulting in the problem of low accuracy of pixels that are not easy to classify. Summary of the invention
[0005] In order to effectively improve the accuracy of unsupervised domain adaptive semantic segmentation based on a self-training framework, the present invention proposes to use the Gini index to measure the uncertainty of output prediction, and use the Gini index to guide the selection of pseudo-labels, that is, pixels with a Gini index less than a set threshold are assigned the class label corresponding to the maximum softmax score as a pseudo-label. Figure 1 The horizontal axis is the output prediction probability, and the vertical axis is the gradient based on the uncertainty measure (entropy information or Gini index) during back propagation. Figure 1The gradient of back propagation in the two intervals of prediction probability [0.75, 0.9] and prediction probability [0.9, 1]: When the uncertainty of the output prediction is calculated based on entropy information, the gradient used for back propagation in the prediction probability [0.9, 1] interval is much larger than that in the prediction probability [0.75, 0.9] interval; when the uncertainty of the output prediction is calculated using the Gini index, the gradient used for back propagation in the prediction probability [0.9, 1] interval is not much different from that in the prediction probability [0.75, 0.9] interval. That is, the gradient calculated based on the Gini index will not pay too much attention to the points in the [0.9, 1] interval during the back propagation process, and the model assigns a relatively larger update weight to the categories in the prediction probability [0.75, 0.9] interval. Existing research results have pointed out that the IOU value of a category is positively correlated with the prediction probability of the category. Since the Gini index pays more attention to the points corresponding to the output prediction probability [0.75, 0.9] interval during model training than the entropy index, the IOU value of the prediction probability in the [0.75, 0.9] interval can be improved. Because the pseudo-labels selected in the interval [0.9, 1] are already relatively accurate, ensuring the accuracy of category predictions in the interval [0.75, 0.9] ensures the correctness of the pseudo-labels, which is conducive to introducing more correct supervisory information and avoiding the introduction of noise.
[0006] In this invention, the source domain refers to the synthetic dataset, and the target domain refers to the real dataset. The network contains two sub-networks with the same structure and different parameters, namely G te and G st During training, the network G te Input source domain and target domain images for training. After training, use G te Perform semantic segmentation on the target domain image based on G te The output target domain image predicts the calculation of the Gini index and uses the Gini index to guide the acquisition of pseudo labels for the target domain image. The pseudo labels obtained are used to train G st .
[0007] The specific steps are as follows:
[0008] Step (1): randomly select one RGB image from the source domain dataset and the target domain dataset as a batch and input it into the semantic segmentation network G. te ;
[0009] Step (2), for the source domain image, the cross entropy loss is calculated based on the output prediction map of the last two layers of the network and the groundtruth, and the loss of the last two layers is weighted summed;
[0010] Step (3), for the target domain image, the output prediction graphs of the last two layers are used to calculate the Gini index and uncertainty loss respectively, and the losses of the last two layers are weighted summed;
[0011] Step (4), sum the weighted loss calculated in step (2) and the weighted loss calculated in step (3), use error back propagation to optimize the model, and iterate until the loss of the model is less than a certain threshold, then the training of this batch of data ends;
[0012] Step (5), return to step 1 to continue selecting new batch data, repeat steps 1 to 5 until 2000 batches of training are completed and the trained model is saved;
[0013] Step (6): repeat steps (1) to (5) until a total of 120,000 batches of data are trained, i.e., a total of 60 models are saved;
[0014] Step (7), testing the 60 saved models on the target domain validation set, using the model with the best accuracy on the validation set to calculate the output prediction of the target domain training set images, calculating the Gini index corresponding to the output prediction and assigning pseudo labels to the target domain training set images based on the Gini index;
[0015] Step (8): randomly select one RGB image from the source domain dataset and the target domain dataset as a batch as input to train the semantic segmentation network G st ;
[0016] Step (9), for the source domain image, the cross entropy loss is calculated based on the output prediction map of the last two layers and the groundtruth, and the loss of the last two layers is weighted summed;
[0017] Step (10), for the target domain image, the output prediction graphs of the last two layers are used to calculate the cross entropy loss with the pseudo labels respectively, and the losses of the last two layers are weighted summed;
[0018] Step (11), for the target domain image, the output prediction graphs of the last two layers respectively calculate the Gini index and uncertainty loss, and weighted sum the losses of the last two layers of the target domain;
[0019] Step (12), sum the weighted losses of step (9), step (10) and step (11), optimize the model using error back propagation, and iterate until the loss of the model is less than a certain threshold, then the training of this batch of data ends;
[0020] Step (13), return to step 8 to continue selecting new batch data, repeat steps 8 to 12 until 2000 batches of training are completed and the trained model is saved, a total of 120,000 batches of data are trained, that is, a total of 60 models are saved;
[0021] Step (14), during testing, the 60 saved models are tested on the target domain test set to obtain the best segmentation result.
[0022] Compared with the prior art, the pseudo-labels of target domain images selected by the present invention using the uncertainty of the Gini index measurement are more reliable, thereby improving the accuracy of semantic annotation of the target domain. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 : Gradient value VS predicted probability.
[0024] Figure 2 : Network structure diagram for self-supervised domain adaptive semantic segmentation.
[0025] Figure 3 :Semantic Segmentation Network (G te and G st ) structure diagram.
[0026] Figure 4 : ASPP module structure diagram. DETAILED DESCRIPTION
[0027] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0028] The present invention uses synthetic datasets as source domains and real datasets as target domains. The network contains two sub-networks with the same structure and different parameters, namely G te and G st During training, the semantic segmentation network G te Input source domain and target domain images for training. After training, the semantic segmentation network G te Calculate the prediction of the target domain training image, calculate the Gini index of the target domain training image prediction and use the Gini index to guide the acquisition of the target domain image pseudo label. The target domain image pseudo label is used to train the semantic segmentation network G st .
[0029] The specific steps are as follows:
[0030] Step (1): randomly select one RGB image from the source domain dataset and the target domain dataset as a batch and input it into the semantic segmentation network G. te ;
[0031] Step (2), for the source domain image, the cross entropy loss is calculated based on the output prediction map of the last two layers of the network and the groundtruth, and the loss of the last two layers of the source domain is weighted summed;
[0032] Step (3), for the target domain image, the output prediction graphs of the last two layers are used to calculate the Gini index and uncertainty loss respectively, and the losses of the last two layers of the target domain are weighted summed;
[0033] Step (4), sum the weighted loss calculated in step (2) and the weighted loss calculated in step (3), use error back propagation to optimize the model, and iterate until the loss of the model is less than a certain threshold, then the training of this batch of data ends;
[0034] Step (5), return to step 1 to continue selecting new batch data, repeat steps 1 to 5 until 2000 batches of training are completed and the trained model is saved;
[0035] Step (6): repeat steps (1) to (5) until a total of 120,000 batches of data are trained, i.e., a total of 60 models are saved;
[0036] Step (7), testing the 60 saved models on the target domain validation set, using the model with the best accuracy to calculate the output prediction of the target domain training set image, calculating the Gini index corresponding to the output prediction and assigning pseudo labels to the target domain training set images based on the Gini index;
[0037] Step (8): randomly select one RGB image from the source domain dataset and the target domain dataset as a batch as input to train the semantic segmentation network G st ;
[0038] Step (9), for the source domain image, the cross entropy loss is calculated based on the output prediction map of the last two layers and the groundtruth, and the loss of the last two layers of the source domain is weighted summed;
[0039] Step (10), for the target domain image, the output prediction images of the last two layers are respectively calculated with the pseudo-labels for the cross entropy loss, and the losses of the last two layers of the target domain are weighted summed;
[0040] Step (11), for the target domain image, the output prediction graphs of the last two layers respectively calculate the Gini index and uncertainty loss, and weighted sum the losses of the last two layers of the target domain;
[0041] Step (12), sum the weighted losses of step (9), step (10) and step (11), optimize the model using error back propagation, and iterate until the loss of the model is less than a certain threshold, then the training of this batch of data ends;
[0042] Step (13), return to step 8 to continue selecting new batch data, repeat steps 8 to 12 until 2000 batches of training are completed and the trained model is saved, and a total of 120,000 batches of data are trained, that is, a total of 60 models are saved; step (14), during testing, the 60 saved models are tested on the target domain test set to obtain the optimal segmentation result.
[0043] The model constructed by the method proposed in the present invention is an unsupervised domain adaptive network, and the overall structure of the network is as follows: Figure 2 As shown, it includes two sub-networks G te and G st First, train the network G te ; Then according to the network G te The uncertainty measurement result of the target domain prediction selects the pseudo label of the target domain image, assigns the pseudo label to the corresponding target domain image, and then trains the semantic segmentation network G st , improving the prediction accuracy of target domain images by adding effective supervision information.
[0044] 1. Semantic Segmentation Network G te and G st The network structure is:
[0045] Semantic segmentation network G te and G st The network structure is the same as that of Deeplab-V2, which is composed of an encoder and a decoder. The specific network structure is shown in the figure below. Figure 3 shown.
[0046] The encoder uses Resnet101 as the basic network, and the network structure parameters are shown in Table 1. The encoder consists of a convolutional layer Conv_1 and four blocks Conv_2, Conv_3, Conv_4, and Conv_5. Each block includes 3, 4, 23, and 3 residual modules respectively, and the activation function is the ReLU function.
[0047] The convolution layer Conv_1 contains 64 7*7 filters with stride=2 and padding=3. Among the four blocks, Conv_2 contains a 3*3 maximum pooling layer and 3 residual modules; the 1*1 filter of the first residual module of Conv_3 has stride=2 and no padding; the 3*3 filter of the first residual module of Conv_4 is a dilated convolution with stride=1, dilation=2, and padding=2; the 3*3 filter of the first residual module of Conv_5 is a dilated convolution with stride=1, dilation=4, and padding=4; in the remaining residual modules not specifically mentioned above, the 3*3 filters are all convolutions with stride=1 and padding=1, and the 1*1 filters are all convolutions with stride=1 and no padding.
[0048] The decoder inputs the feature maps obtained by Conv_4 and Conv_5 into the ASPP module respectively. The final feature map output by ASPP is 1 / 8 of the original image. It is restored to the original image size using bilinear interpolation, and finally the boundary is smoothed using CRF to obtain the final semantic segmentation result. The structure of the ASPP module is as follows Figure 4 The detailed parameters are shown in Table 2.
[0049] 2. Select pseudo labels based on the Gini index
[0050] For the target domain training set image, the target domain image x t ∈R H×W×3 The final predicted segmentation map Based on the semantic segmentation network G te Calculation, as shown in formula (1): The specific calculation method for predicting the selected pseudo label is as follows:
[0051]
[0052] in, is the semantic segmentation network G te The target domain image x output by Conv_5 t The predicted segmentation map, is the semantic segmentation network G te The target domain image x output by Conv_4 t The predicted segmentation map of , β3 is a hyperparameter.
[0053] Target domain image x t The pixel at position (h, w) belongs to class c if and only if the predicted value of this pixel belonging to class c is the largest and the Gini index value corresponding to this pixel is ( The calculation method is shown in formula (7), (8), (9)) is less than v (c) , v (c) is a hyperparameter. The specific calculation method is as shown in formula (2), where is the target domain image x t The prediction for the pixel at position (h,w).
[0054]
[0055] 3. Semantic Segmentation Network G te The loss function
[0056] The loss of the unsupervised domain adaptation network includes the source domain segmentation loss and the target domain prediction uncertainty loss.
[0057] i. Source domain segmentation loss
[0058] For source domain data, this paper uses the traditional cross entropy as the loss function to calculate the segmentation loss, and calculates the corresponding segmentation loss based on the prediction output of Conv_5 and Conv_4 respectively. and The sum of these two segmentation losses is the source domain segmentation loss L seg (x s ,y s ):
[0059]
[0060] Among them, x s ∈R H×W×3 is the source domain RGB image with resolution H×W; s ∈R H×W×C is the source domain image x s of groundtruth, C is the number of classes; is the semantic segmentation network G te The source domain image x output by Conv_5 s The predicted segmentation map of is the semantic segmentation network G te The source domain image x output by Conv_4 s The predicted segmentation map of ; β1 is a hyperparameter.
[0061] ii. Uncertainty loss for target domain prediction
[0062] The present invention adopts the Gini index to measure the uncertainty of target domain prediction, and obtains a high-confidence prediction result for the target domain image by minimizing the Gini index to constrain the inter-domain adaptive network.
[0063] Calculate the pixel-level Gini index for the target domain image output by Conv_5 and Conv_4 respectively and The pixel-level Gini index is calculated as follows:
[0064]
[0065] x t ∈R H×W×3 is the target domain RGB image with resolution H×W; It is based on the semantic segmentation network G te The target domain image x output by Conv_5 t The Gini index graph calculated from the predicted segmentation graph, is the corresponding pixel-level Gini index; It is based on the semantic segmentation network G te The target domain image x output by Conv_4 t The Gini index graph calculated from the predicted segmentation graph, is the corresponding pixel-level Gini index; is the semantic segmentation network G te The target domain image x output by Conv_5 t The predicted segmentation map of is the semantic segmentation network G te The target domain image x output by Conv_4 t The predicted segmentation map.
[0066] Target domain image x t The pixel-level Gini index is calculated as follows:
[0067]
[0068] Where C is the number of classes and β2 is a hyperparameter.
[0069] Uncertainty loss for target domain prediction:
[0070]
[0071] Semantic segmentation network G te The total loss L(x s ,x t )for:
[0072]
[0073] Where μ1 is a hyperparameter.
[0074] 4. Semantic Segmentation Network G st The loss function
[0075] Semantic segmentation network G st The loss includes the source domain segmentation loss, the target domain prediction uncertainty loss and the target domain pseudo-label segmentation loss.
[0076] The pseudo-label of the target domain is calculated using the traditional cross entropy loss function, and the corresponding segmentation loss is calculated based on the prediction output of Conv_5 and Conv_4. and The sum of these two segmentation losses is the target domain segmentation loss
[0077]
[0078] Among them, x t ∈R H×W×3 is the target domain RGB image with resolution H×W; is the target domain image x t Pseudo-labels, C is the number of classes; is the semantic segmentation network Gst The target domain image x output by Conv_5 t The predicted segmentation map of is the semantic segmentation network G st The target domain image x output by Conv_4 s The predicted segmentation map of ; β2 is a hyperparameter.
[0079] Semantic segmentation network G st The total loss L(x s ,x t )for:
[0080]
[0081] Where μ2 and μ3 are hyperparameters.
[0082] Example
[0083] 1. Experimental Dataset
[0084] The proposed method is experimented on the commonly used unsupervised adaptive dataset GTA5-Cityscapes, where the synthetic dataset GTA5 is used as the source domain and the real dataset Cityscapes is used as the target domain. The model is evaluated on the Cityscapes validation set.
[0085] GTA5: The synthetic dataset GTA5 contains 24966 synthetic images with a resolution of 1914×1052 and the corresponding ground-truth. These synthetic images are collected from a cityscape video game based on the city of Los Angeles. The automatically generated ground-truth contains 33 categories. Methods experimenting on GTA5-Cityscapes generally only consider 19 categories compatible with the Cityscapes dataset, and this invention is no exception.
[0086] Cityscapes: As a dataset collected from the real world, Cityscapes provides 3975 images with fine segmentation annotations. The training set contains 2975 images and the validation set contains 500 images.
[0087] 2. Experimental evaluation indicators
[0088] The present invention uses the Intersection-over-Union (IoU) to evaluate the performance of semantic segmentation. The IoU value is between [0, 1]. The larger the value, the better the segmentation effect. The IoU is defined as follows:
[0089] IoU = TP / (TP+FP+FN)
[0090] Where TP, FP and FN are the number of true positive, false positive and false negative pixels respectively. The mIoU in Tables 3 and 4 is the average IoU of 19 categories.
[0091] 3. Network training
[0092] The batch size of the unsupervised domain adaptation network is 2. The resolution of the source domain input image is 1280×720, and the resolution of the target domain input image is 1024×512, which need to be resized to 321×321 respectively. During training, the label is reduced by 8 times and the loss is calculated with the output prediction map of the network; during testing, the output prediction map of the network is enlarged by 8 times and compared with the label. β1 and β3 are set to 0.1; β2 is set to 0.2, and μ1, μ2, and μ3 are set to 0.01. Semantic segmentation network G te And the semantic segmentation network G st The encoder ResNet-101 is pre-trained based on ImageNet, and we use the SGD optimizer to train G st and G st , the initial learning rate is 2.5×10 -4 .
[0093] 4. Experimental results
[0094] The present invention conducts experiments on the commonly used unsupervised adaptive dataset GTA5-Cityscapes. Tables 3 and 4 respectively show the self-supervised methods guided by the Gini index on the MinEnt method (a network that Vu et al. directly minimizes using entropy as a measure) and the AdvEnt method (a network that Vu et al. use entropy as a measure to confront). It can be seen that the mIoU of the present invention is significantly improved when the target domain pseudo-label is added on the basis of the commonly used method, and the semantic segmentation effect is improved compared with the commonly used SSL and ESL pseudo-label self-training methods.
[0095] Table 1: Encoder structure parameters
[0096]
[0097] Table 2: Decoder structure parameters
[0098]
[0099] Table 3 Comparison of improved experimental results
[0100]
[0101] Table 4 Comparison of improved experimental results
[0102]
[0103]
Claims
1. A Gini index-guided self-training semantic segmentation method, characterized by: The synthetic dataset is used as the source domain and the real dataset is used as the target domain. During training, the source domain and target domain images are input into the inter-domain adaptive network for training. After the training is completed, the target domain images are divided and input into the intra-domain adaptive network for training to obtain the optimal segmentation result. The specific steps are as follows: Step (1): randomly select one RGB image from the source domain dataset and the target domain dataset as a batch and input it into the semantic segmentation network G. te ; Step (2), for the source domain image, the cross entropy loss is calculated based on the output prediction map of the last two layers of the network and the groundtruth, and the loss of the last two layers of the source domain is weighted summed; Step (3), for the target domain image, the output prediction graphs of the last two layers are used to calculate the Gini index and uncertainty loss respectively, and the losses of the last two layers of the target domain are weighted summed; Step (4), sum the weighted loss calculated in step (2) and the weighted loss calculated in step (3), use error back propagation to optimize the model, and iterate until the loss of the model is less than a certain threshold, then the training of this batch of data ends; Step (5), return to step (1) to continue selecting new batch data, repeat steps (1) to (5) until 2000 batches of training are completed and the trained model is saved; Step (6): repeat steps (1) to (5) until a total of 120,000 batches of data are trained, i.e., a total of 60 models are saved; Step (7), testing the 60 saved models on the target domain validation set, using the model with the best accuracy to calculate the output prediction of the target domain training set image, calculating the Gini index corresponding to the output prediction and assigning pseudo labels to the target domain training set images based on the Gini index; Step (8): randomly select one RGB image from the source domain dataset and the target domain dataset as a batch as input to train the semantic segmentation network G st ; Step (9), for the source domain image, the cross entropy loss is calculated based on the output prediction map of the last two layers and the groundtruth, and the loss of the last two layers of the source domain is weighted summed; Step (10), for the target domain image, the output prediction images of the last two layers are respectively calculated with the pseudo-labels for the cross entropy loss, and the losses of the last two layers of the target domain are weighted summed; Step (11), for the target domain image, the output prediction graphs of the last two layers respectively calculate the Gini index and uncertainty loss, and weighted sum the losses of the last two layers of the target domain; Step (12), sum the weighted losses of step (9), step (10) and step (11), optimize the model using error back propagation, and iterate until the loss of the model is less than a certain threshold, then the training of this batch of data ends; Step (13), return to step (8) to continue selecting new batch data, repeat steps (8) to (12) until 2000 batches of training are completed and the trained model is saved, a total of 120,000 batches of data are trained, that is, a total of 60 models are saved; Step (14), during testing, the 60 saved models are tested on the target domain test set to obtain the final segmentation results.
2. The Gini index-guided self-training semantic segmentation method according to claim 1, characterized in that: The model built is an unsupervised domain adaptive network. The overall network structure includes two sub-networks G te and G st ; First train the network G te ; Then according to the network G te The uncertainty measurement result of the target domain prediction selects the pseudo label of the target domain image, assigns the pseudo label to the corresponding target domain image, and then trains the semantic segmentation network G st , improving the prediction accuracy of target domain images by adding effective supervision information.
