A heterogeneous dual-branch voting semi-supervised image segmentation method
Pseudo labels are generated through heterogeneous network collaboration, using feature communication modules and dynamic voting strategies to solve the problem of unreliable pseudo labels in semi-supervised semantic segmentation and improve the accuracy and performance of the model.
Patent Information
- Application Number
- CN202410715183.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-04
AI Technical Summary
Existing semi-supervised semantic segmentation methods generate unreliable pseudo labels in complex areas and lack deep collaboration, resulting in insufficient model performance.
Heterogeneous networks are used to collaborate to generate pseudo-labels. By introducing feature exchange modules and dynamic voting strategies, the quality of pseudo-labels is enhanced and mutual reinforcement between networks is promoted.
It improves the quality of pseudo labels in semi-supervised semantic segmentation tasks, reduces confirmation bias, and improves model accuracy and performance in complex scenarios.
Smart Images

Figure CN118279332B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing methods, and in particular relates to a heterogeneous dual-branch voting semi-supervised image segmentation method integrating convolution and attention mechanisms. Background Art
[0002] Recent advances in artificial intelligence have benefited from deep neural networks and large-scale, high-quality training data. However, in dense pixel-level annotation tasks such as semantic segmentation, collecting high-quality annotated data requires a lot of work. Therefore, researchers have begun to focus on using mostly unlabeled images and a small number of annotated images to improve segmentation performance, namely semi-supervised semantic segmentation. A solution to this problem is to introduce teacher-student networks into semi-supervised segmentation. For example, Wang et al. generate pseudo labels for unlabeled data as negative samples through a teacher network in Semi-supervised Semantic Segmentation Using Unreliable Pseudo-labels, while the student model updates the parameters of the teacher model through exponential moving average. However, this method of using only a single network for pseudo-label reconstruction introduces noise and confirmation bias. In Semi-supervised Semantic Segmentation with Cross Pseudo Supervision, Chen et al. introduced a cross-supervision strategy in a collaborative training method to capture different features of pseudo labels through two networks with the same architecture but different initial values. However, the same network architecture is not enough to capture features with sufficiently diverse distributions. In the subsequent work Diverse Cotraining Makes Strong Semi-supervised Segmentor, Li et al. proposed using models with different initializations and applying multiple perturbations to expand the diversity of feature distributions, thereby improving network performance. However, this method lacks deep collaborative exploration of these diverse elements, resulting in unreliable labels constructed in complex areas.
[0003] Therefore, in response to the problems in the above research, the present invention innovatively introduces a feature exchange module and a dynamic voting strategy in heterogeneous networks to enhance the quality of pseudo-label generation in complex scenarios and promote mutual reinforcement between networks, thereby effectively improving the effect of semi-supervised semantic segmentation. Summary of the invention
[0004] The present invention proposes a strategy for generating pseudo-labels by collaboratively utilizing heterogeneous networks, which can effectively improve the quality of pseudo-labels in semi-supervised semantic segmentation tasks, reduce confirmation bias problems, and thus improve the accuracy of the model.
[0005] The technical solution of the present invention:
[0006] A heterogeneous dual-branch voting semi-supervised image segmentation method comprises the following steps:
[0007] (1) Dataset selection and cropping: Use the enhanced version of Pascal VOC 2012 dataset and Cityscapes dataset;
[0008] The enhanced Pascal VOC 2012 dataset consists of the classic Pascal VOC 2012 dataset and the semantic boundary dataset; the classic Pascal VOC 2012 dataset includes high-quality manually annotated training images and verification images, and the semantic boundary dataset contains coarse manually annotated images; the images in the enhanced Pascal VOC 2012 dataset are cropped to a resolution of 513×513, and the images in the Cityscapes dataset are cropped to a resolution of 801×801;
[0009] (2) Dataset division: First, the training set in the enhanced Pascal VOC 2012 dataset is divided according to the classic protocol and hybrid protocol of semi-supervised semantic segmentation. The division methods are as follows: 1) Using the classic protocol division: Data is selected from the high-quality manually annotated training images in the classic Pascal VOC 2012 dataset training set and divided into labeled training subsets, and the remaining data is divided into unlabeled training subsets. Specifically, 1 / 16, 1 / 8, 1 / 4, and 1 / 2 of the total number of images in the training set containing high-quality manually annotated images are used as labeled training subsets, and the rest are used as unlabeled training subsets. 2) Using the hybrid protocol division: Data is selected from the enhanced Pascal VOC Data from the entire training set of 2012 was selected and divided into labeled training subsets, and the rest of the data was used as unlabeled training subsets; specifically, 1 / 16, 1 / 8, and 1 / 4 of the total number of images in the training set were used as manually labeled training subsets, and the rest were used as unlabeled training subsets; 1 / 16, 1 / 8, 1 / 4, and 1 / 2 of the total number of images in the training set of the Cityscapes dataset were used as labeled training subsets, and the rest were used as unlabeled training subsets;
[0010] (3) Data augmentation: Two data augmentation methods are used for all input images in the dataset, including weak augmentation and strong augmentation. Weak augmentation is to use random cropping and flipping on the input images of the training sets in the two datasets. Strong augmentation is to splice different images of the same batch through the CutMix method based on weak augmentation. First, weak augmentation is applied to a batch of input images, and the weakly enhanced images are passed through a heterogeneous network to generate pseudo labels. Then, strong augmentation is applied to the same batch of images, and the strongly enhanced images are input into the network for supervised prediction.
[0011] Step 2: Construction of pseudo labels
[0012] (1) Constructing a heterogeneous network: The heterogeneous network includes two parallel first networks and second networks. The first network uses the DeepLabV3+ structure, and its encoder uses the ResNet structure, which is ResNet-50 or ResNet-101. The decoder uses a two-dimensional convolution combined with an upsampling layer. The second network uses the SegFormer network with an attention mechanism. The first network and the second network are used as their respective original branches. Communication branches are added between the encoder and decoder of the original branches. The original branch is responsible for processing the image after data enhancement and generating segmentation results. The communication branch is responsible for using the feature communication module to fuse the image features extracted by the encoder of the other network of the two parallel networks. A voting module is introduced after the decoders of the first network and the second network, which predicts the confidence of the output of the decoders of the first network and the second network and generates pseudo labels according to the rules.
[0013] The implementation process of the feature communication module: First, through linear interpolation and 1 1 The convolution operation processes the image features extracted by the other network encoder from the two parallel networks, and introduces a dropout probability of 0.5 to enhance the diversity of image features; then the processed image features are weightedly fused with the image features extracted by the network encoder to optimize the complementary information of the image features. The specific process is expressed by the following formula:
[0014]
[0015] in, Indicates images, represents the input image features, Indicates the network ID. represents the fused image features, is an adjustable scaling factor, which is 0.01 in the first network and 0.1 in the second network. represents linear interpolation and convolution operations, It means to find the remainder;
[0016] (2) Network prediction and pseudo-label optimization: After establishing the heterogeneous network, the weakly enhanced image is predicted by the first network and the second network respectively, and the prediction results are sent to the voting module; the voting module uses the torch max function to determine the category of each pixel and predict the confidence of the prediction results; then Softmax is used to normalize the prediction confidence; the pseudo-label is generated according to the normalized confidence of each pixel and the generated random number according to the rules. The specific process is as follows:
[0017] First, the images in the unlabeled training subsets after weak data enhancement in the two datasets are sent to the original branch of the heterogeneous network for prediction, and the prediction results on the first network and the second network are obtained. and ; These two prediction results are fed into the voting module, which uses the torch.max function to determine the category of each pixel and predict the confidence:
[0018]
[0019] in, and Respectively represent the prediction results of the model and the corresponding category labels, Indicates images, Indicates pixel positions;
[0020] For each pixel position in the prediction result, the output of the first network and the second network is first processed by the Softmax function to calculate the probability result corresponding to each network. and , and then use the torch.rand() function to generate a random number between 0 and 1 To determine the pixel category label, the prediction result of the first network or the second network is determined by comparing the normalized probability and the size of the random number. The formula of this process is expressed as follows:
[0021]
[0022] in, and Respectively represent the probability of the category with the highest prediction probability of the first network and the second network of the model, and The category corresponding to the maximum probability prediction of the first network and the second network, Represents the final pseudo label, and C represents the total number of categories;
[0023] Step 3: Model training
[0024] (1) Unlabeled image training: When training two datasets, the heterogeneous network sends the images in the unlabeled training subset of the training set to the two networks. Each network first extracts image features through the encoder to obtain the corresponding feature map. Then, each network predicts the feature map generated by the encoder through the communication branch and the original branch respectively. The two networks obtain two prediction results respectively, and finally obtain four prediction results in total. Then, the pseudo labels generated in step 2 are used to calculate the cross entropy loss with the four prediction results:
[0025]
[0026] in, represents the set of unlabeled images, represents the cross entropy loss, and Respectively represent the prediction results on the original branch and the feature exchange branch, H and W represent the length and width of the feature map, Indicates no marked loss, It means to find the remainder;
[0027] (2) Training with labeled images: This process is the same as training with unlabeled images, and four prediction results are obtained, but the actual labels of the images are used instead of pseudo labels to calculate the prediction results:
[0028]
[0029] in, represents a collection of annotated images, Indicates that there are annotated image labels, Indicates that there is a marked loss;
[0030] (3) Loss calculation and optimization: Calculate the loss of labeled images and unlabeled images. The prediction results of labeled images are supervised by the true labeled labels and the cross entropy loss is calculated. The prediction results of unlabeled images are supervised by the pseudo labels generated in step 2 and the cross entropy loss is calculated. The total loss is obtained by weighting the loss of labeled images and the loss of unlabeled images, and the model is back-propagated and optimized. The loss ratio weight is determined by the parameter Control; the specific formula is as follows:
[0031]
[0032] in, is the proportionality coefficient for controlling loss.
[0033] Beneficial effects of the present invention:
[0034] (1) By combining heterogeneous networks to learn complementary knowledge, high-confidence and low-confidence regions are identified, thereby further enhancing the joint supervision process.
[0035] (2) An innovative voting module is proposed, which uses a dynamic voting mechanism to enable the system to fuse the confidence scores output by the two networks, thereby more accurately generating pseudo labels for unsupervised data. The generated high-fidelity pseudo labels provide robust supervisory feedback for the two branches, promoting mutual reinforcement of the learning process.
[0036] (3) Communication branch and feature communication module: Add a communication branch inside each model and add a feature communication module to the feature branch. Comprehensively integrate features from the two architectures and make full use of the advantages of heterogeneous networks to obtain accurate pseudo-labels. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is an overall flow chart of the heterogeneous dual-branch voting semi-supervised image segmentation method involved in this application.
[0038] Figure 2 This is a flow chart of the feature exchange module within the heterogeneous dual-branch voting semi-supervised image segmentation method involved in this application.
[0039] Figure 3 This is a comparison chart of the quality of pseudo-label generation between the heterogeneous dual-branch voting semi-supervised image segmentation method involved in this application and the current mainstream method.
[0040] Figure 4 This is a pseudo-label quality comparison chart for an ablation study of the effectiveness of various components in the heterogeneous dual-branch voting semi-supervised image segmentation method involved in this application. The cross-supervision structure in CPS is used in the model, and the same pseudo-label filtering strategy and parameter configuration as the heterogeneous dual-branch voting semi-supervised image segmentation method are used. and They refer to semi-supervised models using dual CNN and dual Transformer networks, respectively. A heterogeneous structure of CNN + Transformer is adopted. exist Based on , a voting module for generating pseudo labels is added. HDVS refers to the heterogeneous dual-branch voting semi-supervised image segmentation method in this example. DETAILED DESCRIPTION
[0041] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and technical solutions.
[0042] Reference Figure 1 , a heterogeneous dual-branch voting semi-supervised image segmentation method, comprising the following steps:
[0043] Step 1: Data preprocessing, including the following steps:
[0044] (1) Dataset selection and cropping: The enhanced Pascal VOC 2012 dataset and the Cityscapes dataset are used. The enhanced Pascal VOC 2012 dataset consists of the classic Pascal VOC 2012 dataset and the Semantic Boundary (SBD) dataset. The Pascal VOC 2012 dataset contains 1,464 high-quality manually annotated training images and 1,449 validation images, and the SBD dataset contains 9,118 roughly manually annotated images. The Cityscapes dataset contains 2,975 training images and 500 validation images of 19 categories. The images in the enhanced Pascal VOC 2012 dataset are cropped to a resolution of 513×513. For the Cityscapes dataset, due to the complex urban scenes, the images are cropped to a resolution of 801×801 to retain more detailed information.
[0045] (2) Dataset division: First, the training set in the enhanced Pascal VOC 2012 dataset is divided according to the classic protocol and hybrid protocol of semi-supervised semantic segmentation. The specific division methods are as follows: (1) Using the classic protocol division: select data from the high-quality labeled data of the enhanced Pascal VOC 2012 training set (i.e., the classic Pascal VOC 2012 training set) and divide it into labeled training subsets, and the remaining data is divided into unlabeled training subsets. Specifically, 1 / 16, 1 / 8, 1 / 4, and 1 / 2 of the total number of images in the training set containing high-quality manual annotations (the classic Pascal VOC 2012 training set) are used as labeled training subsets, and the rest are used as unlabeled training subsets; (2) Using the hybrid protocol division: select data from the entire training set of the enhanced Pascal VOC 2012 and divide it into labeled training subsets, and the rest are used as unlabeled training subsets. Specifically, 1 / 16, 1 / 8, and 1 / 4 of the total number of images in the training set are used as training subsets with manual annotations, and the rest are used as unlabeled training subsets.
[0046] Then, 1 / 16, 1 / 8, 1 / 4, and 1 / 2 of the total number of images in the training set of the Cityscapes dataset are used as labeled training subsets, and the rest are used as unlabeled training subsets;
[0047] (3) Data augmentation: Two data augmentation methods are used for all input data, including weak augmentation and strong augmentation. Weak augmentation is to use random cropping and flipping on the input images of the training sets in the two datasets. Strong augmentation is to splice different images of the same batch through the CutMix method based on weak augmentation. First, weak augmentation is applied to a batch of input images, and the weakly enhanced images are passed through a heterogeneous network to generate pseudo labels. Then, strong augmentation is applied to the same batch of images, and the strongly enhanced images are input into the network for supervised prediction.
[0048] Step 2: Construction of pseudo labels, including the following steps:
[0049] (1) Constructing heterogeneous networks: Constructing a parallel dual-branch network of CNN and Transformer. The CNN branch, i.e., the first network, adopts the DeepLabv3+ structure. Its encoder adopts the ResNet50 or ResNet101 structure, and the decoder is implemented by a simple combination of convolution and upsampling layers. The Transformer branch, i.e., the second network, adopts the SegFormer network based on the attention mechanism. The specific implementation includes versions with Mit-b2 and Mit-b3 as the backbone network. In addition to the original branch, a feature communication branch is added between the encoder and decoder in the first and second networks. The original branch is responsible for processing the data-augmented input image introduced in step 1 (3) and producing basic segmentation results, while the feature communication branch uses the feature communication module to fuse the features extracted by the encoder of another network.
[0050] The specific details of the feature communication module are as follows: in the width and height directions, linear interpolation is used for feature maps of different scales, and a learnable 1 1 convolution is used for dimension alignment, and a dropout probability of 0.5 is introduced to enhance the diversity of features. To control the strength of feature communication, a proportional coefficient is selected to multiply the features input from another branch and add them to the features extracted by the encoder of this network. The strength adjustment formula is as follows:
[0051]
[0052] in, Indicates images, represents the input features, and the superscripts 1 and 2 are the network identifiers of the first network and the second network (the same meanings are used in the following formulas). represents the fused features, P represents the interpolation and convolution operations, , It is an adjustable scaling factor used to control the strength of feature fusion.
[0053] (2) Network prediction and pseudo-label optimization: First, weak data enhancement is performed on the input unlabeled image, and then each network receives the weakly enhanced data on the original branch. , make predictions and get the prediction results:
[0054]
[0055] in and Represent two network structures respectively. Indicates the result on the original branch, and the superscripts 1 and 2 represent the first network and the second network respectively. The above prediction results are sent to the voting module for pseudo-label optimization. Specifically, the max function provided by torch is first used to determine the category and corresponding confidence according to the prediction confidence:
[0056]
[0057] in, and Respectively represent the prediction results of the model and the corresponding category labels, Indicates images, Indicates pixel positions.
[0058] The prediction confidence is then normalized using the Softmax operation to calculate the probability results corresponding to each model:
[0059]
[0060] in, and Respectively represent the probability of the category with the highest prediction probability by the first network and the second network of the model.
[0061] Then, according to the prediction confidence of the heterogeneous network, the pseudo-label is optimized, and the torch.rand() function is used to generate a random number between 0 and 1, which is recorded as The final pseudo label is determined by comparing the magnitude of this random number to the normalized probability level:
[0062]
[0063] in, and The category corresponding to the maximum probability prediction of the first network and the second network, represents the final pseudo label, and C represents the total number of categories.
[0064] Step 3: Model training. This part trains the labeled and unlabeled images respectively. The specific steps are as follows:
[0065] (1) Unlabeled image training: First, the unlabeled image is sent to the heterogeneous network. Each network extracts the image features through the encoder to obtain the corresponding feature map. Then, each network predicts the feature map through the feature exchange branch and the original branch respectively, and obtains two prediction results. The two networks obtain four prediction results in total. Then, the pseudo labels generated in step 2 are used to calculate the cross entropy loss with the four prediction results:
[0066]
[0067] in, represents the set of unlabeled images, represents the cross entropy loss, and Respectively represent the prediction results on the original branch and the feature exchange branch, H and W represent the length and width of the feature map, Indicates no marked loss, Indicates finding the remainder.
[0068] (2) Training with labeled images. This step is similar to the unlabeled training step. The model sends the images to two models respectively. Each model predicts the images on the original branch and the feature exchange branch respectively. Figure 2 The feature exchange module is also used in the feature exchange branch to integrate and align features from another network, thereby obtaining features after feature exchange. and , and send it to the decoder of the corresponding model to obtain the prediction result. The features obtained by the encoder are directly used on the original branch and Send it to the corresponding model decoder to get the prediction result.
[0069] Through the above process, for one image, the heterogeneous model obtains four prediction results on two networks respectively, and then uses the prediction results and manual annotations to calculate the cross entropy loss of the annotated image:
[0070]
[0071] in, represents a collection of annotated images, Indicates that there are annotated image labels, Indicates that there is a label loss.
[0072] (3) Total loss calculation and optimization: The loss of labeled images plus the loss of unlabeled images multiplied by the proportional coefficient to obtain the total loss and back-propagate the optimization model:
[0073]
[0074] in, is the proportionality coefficient for controlling loss.
[0075] This example method is used for experimental verification:
[0076] 1. Verification details:
[0077] The method combines two segmentation model architectures: the first one is based on the Deeplabv3+ model and uses ResNet as the backbone network, while the second one uses the SegFormer model. Specifically, when combining the two-branch network, experiments are conducted using ResNet-50 and Mit-b2 or ResNet-101 and Mit-b3. The scaling factor of the feature communication module in the CNN and Transformer models is set to , . Both feature communication modules use dropout technology with a probability of 0.5. Referring to the previous U2PL and CPS research, lightweight data enhancement techniques such as flipping and random cropping are introduced, and CutMix technology is applied for enhanced data enhancement. Stochastic gradient descent (SGD) is selected as the optimizer, and synchronized batch normalization (Sync-BN) is used.
[0078] For the enhanced PASCAL VOC 2012 dataset, the initial learning rate is set to 0.001, the weight decay is 0.0001, and the crop size is 513. 513, the batch size is 4, and the training epochs are set to 150. For the Cityscapes dataset, the training uses the Online Hard Example Mining (OHEM) loss, the adjusted initial learning rate is 0.00075, the weight decay is set to 0.0005, the modified crop size is 801×801, the batch size is set to 2, and the training epochs are set to 300. Following previous studies, a polynomial learning rate adjustment strategy is adopted, that is, the initial learning rate is multiplied by .
[0079] The mean intersection over union (mIoU) metric is used to evaluate segmentation performance. To ensure fairness, for the enhanced PASCAL VOC 2012 validation set, the image center is cropped to 513 The resolution is 513. For the Cityscapes dataset, a sliding window technique is applied for evaluation on the validation images.
[0080] Table 1: Comparison results of ResNet-50 and ResNet-101 backbone networks with the most advanced semi-supervised methods on the enhanced Pascal VOC 2012 dataset.
[0081]
[0082] Table 2: Comparison results of using ResNet-50 backbone network with the most advanced semi-supervised methods on the Cityscapes dataset.
[0083]
[0084] Table 3: Ablation experiment comparison results of the effectiveness of various components in the heterogeneous two-branch voting semi-supervised image segmentation method in this example using the ResNet-50 backbone network on the enhanced Pascal VOC 2012 dataset.
[0085]
[0086] Table 3 The cross-supervision structure in CPS is used in the model, and the same pseudo-label filtering strategy and parameter configuration as the heterogeneous dual-branch voting semi-supervised image segmentation method in this example are used. and They refer to semi-supervised models using dual CNN and dual Transformer networks, respectively. A heterogeneous structure of CNN + Transformer is adopted. exist Based on , a voting module for generating pseudo labels is added. In the table, HDVS refers to the heterogeneous dual-branch voting semi-supervised image segmentation method in this example.
[0087] 2. Qualitative results:
[0088] Table 1 shows that the performance of the model designed in this application surpasses the previous state-of-the-art (SOTA) methods through classic and hybrid partitioning schemes. Regardless of the amount of data and whether the backbone network used is ResNet-50 or ResNet-101, the heterogeneous dual-branch voting semi-supervised image segmentation method in this example performs well, surpassing the recent SOTA methods in four of the five classic partitions and leading in all hybrid partitions. HDVS in the table refers to the heterogeneous dual-branch voting semi-supervised image segmentation method in this example.
[0089] Table 2 presents the results achieved on the Cityscapes dataset across 1 / 16, 1 / 8, 1 / 4, and 1 / 2 data partitions using ResNet-50 as the backbone. The heterogeneous dual-branch voting semi-supervised image segmentation method achieves competitive results under different partitioning schemes. In addition, its mIoU under 1 / 8 and 1 / 2 partitioning protocols exceeds the previous SOTA by 0.6% and 0.4%, respectively. HDVS in the table refers to the heterogeneous dual-branch voting semi-supervised image segmentation method in this example.
[0090] In Table 3, the effectiveness of each component of the heterogeneous dual-branch voting semi-supervised image segmentation method in this example is evaluated on the enhanced PASCAL VOC 2012 dataset. While keeping the pseudo-label filtering, parameter settings, and learning rate adjustment consistent with the heterogeneous dual-branch voting semi-supervised image segmentation method, experiments were conducted based on the CPS framework, which uses a dual-branch structure to generate pseudo-labels to provide mutual supervision, expressed as . and They refer to semi-supervised models using dual CNN and dual Transformer networks, respectively. A heterogeneous structure of CNN + Transformer is adopted. exist In the classic partitioning setting with 1464 training images, a voting module for generating pseudo labels is added. Compare and They are 3.4% and 1.3% higher respectively. The introduction of the feature communication module and the feature exchange branch further enhances the performance of HDVS by an additional 0.9%. Through the integration of different modules, the overall performance of the model is effectively enhanced. HDVS in the table refers to the heterogeneous dual-branch voting semi-supervised image segmentation method in this example.
[0091] Figure 2 The comparison between the heterogeneous dual-branch voting semi-supervised image segmentation method and the current collaborative training structured semi-supervised semantic segmentation method represented by CPS and the teacher-student structured semi-supervised semantic segmentation method represented by U2PL is shown. The results shown in the figure are obtained by using the classic Pascal VOC 2012 training set of 1464 finely annotated images under the classic segmentation protocol and using ResNet-50 as the backbone network for training. In the face of complex scenes, the heterogeneous dual-branch voting semi-supervised image segmentation method shows more robust performance. For example, in the first row, the heterogeneous dual-branch voting semi-supervised image segmentation model did not mistake the decorations on both sides of the computer as people. In the second row, when dealing with multiple small objects, it also shows more accurate segmentation results.
[0092] Figure 4 To combine the pseudo-label visualization analysis of the model with different components, the results shown in the figure are obtained under the classic partitioning protocol, using 1464 finely annotated classic Pascal VOC 2012 datasets, and using ResNet-50 as the backbone network training results. With the addition of heterogeneous networks, feature exchange branches, feature communication modules, and voting modules, the model performance continues to improve. Finally, the heterogeneous dual-branch voting semi-supervised image segmentation method in this example shows excellent performance, especially in the areas with multiple small objects in the first and second rows, and in the areas where the edges of objects overlap, such as around the legs of people in the third and fourth rows.
Claims
1. A heterogeneous dual-branch voting semi-supervised image segmentation method, characterized in that: The steps include: Step 1: Data Preprocessing (1) Dataset selection and cropping: Use the enhanced version of Pascal VOC 2012 dataset and Cityscapes dataset; The enhanced Pascal VOC 2012 dataset consists of the classic Pascal VOC 2012 dataset and the semantic boundary dataset; the classic Pascal VOC 2012 dataset includes high-quality manually annotated training images and verification images, and the semantic boundary dataset contains coarse manually annotated images; the images in the enhanced Pascal VOC 2012 dataset are cropped to a resolution of 513×513, and the images in the Cityscapes dataset are cropped to a resolution of 801×801; (2) Dataset partitioning: First, the training set in the enhanced Pascal VOC 2012 dataset is partitioned according to the classical protocol and hybrid protocol of semi-supervised semantic segmentation. The partitioning methods are as follows: 1) Using the classical protocol partitioning: Data is selected from the high-quality manually annotated training images in the classical Pascal VOC 2012 dataset training set and partitioned into annotated training subsets, and the remaining data is partitioned into unannotated training subsets; Specifically, 1 / 16, 1 / 8, 1 / 4, and 1 / 2 of the total number of images in the training set containing high-quality manual annotations are used as labeled training subsets, and the rest are used as unlabeled training subsets; 2) Use hybrid protocol partitioning: select data from the entire training set of the enhanced version of Pascal VOC 2012 and divide it into labeled training subsets, and the rest of the data is used as unlabeled training subsets; Specifically, 1 / 16, 1 / 8, and 1 / 4 of the total number of images in the training set are used as manually annotated training subsets, and the rest are used as unannotated training subsets; 1 / 16, 1 / 8, 1 / 4, and 1 / 2 of the total number of images in the training set of the Cityscapes dataset are used as labeled training subsets, and the rest are used as unlabeled training subsets; (3) Data augmentation: Two data augmentation methods are used for all input images in the dataset, including weak augmentation and strong augmentation; Weak augmentation uses random cropping and flipping on the input images of the training sets in both datasets; Strong enhancement is to splice different images of the same batch through the CutMix method on the basis of weak enhancement. First, weak enhancement is applied to a batch of input images, and the weakly enhanced images are passed through a heterogeneous network to generate pseudo labels. Then, strong enhancement is applied to the same batch of images, and the strongly enhanced images are input into the network for supervised prediction. Step 2: Construction of pseudo labels (1) Constructing a heterogeneous network: The heterogeneous network includes two parallel first networks and second networks. The first network uses the DeepLabV3+ structure, and its encoder uses the ResNet structure, which is ResNet-50 or ResNet-101. The decoder uses a two-dimensional convolution combined with an upsampling layer; the second network uses a SegFormer network with an attention mechanism; The first network and the second network are used as their respective original branches, and a communication branch is added between the encoder and the decoder of the original branch. The original branch is responsible for processing the image after data enhancement and generating segmentation results, and the communication branch is responsible for fusing the image features extracted by the encoder of the other network of the two parallel networks using the feature communication module; a voting module is introduced after the decoders of the first network and the second network, which predicts the confidence of the outputs of the decoders of the first network and the second network and generates pseudo labels according to the rules; The implementation process of the feature communication module: First, through linear interpolation and The convolution operation processes the image features extracted by the other network encoder from the two parallel networks, and introduces a dropout probability of 0.5 to enhance the diversity of image features; then the processed image features are weightedly fused with the image features extracted by the network encoder to optimize the complementary information of the image features. The specific process is expressed by the following formula: in, Indicates images, represents the input image features, Indicates the network ID. represents the fused image features, is an adjustable proportionality factor, which is 0.01 in the first network and 0.1 in the second network. represents linear interpolation and convolution operations, Represents the remainder; (2) Network prediction and pseudo-label optimization: After the heterogeneous network is established, the image after weak enhancement is predicted by the first network and the second network respectively, and the prediction results are sent to the voting module; the voting module uses the max function of torch to determine the category of each pixel and predict the confidence; then Softmax is used to normalize the prediction confidence; the pseudo-label is generated according to the normalized confidence of each pixel and the generated random number according to the rules. The specific process is as follows: First, the images in the unlabeled training subsets after weak data enhancement in the two datasets are sent to the original branch of the heterogeneous network for prediction, and the prediction results on the first network and the second network are obtained. and ; These two prediction results are fed into the voting module, which uses the torch.max function to determine the category of each pixel and predict the confidence: in, and Respectively represent the prediction results of the model and the corresponding category labels, Indicates images, Indicates For each pixel position in the prediction result, the output of the first network and the second network is first processed by the Softmax function to calculate the probability result corresponding to each network. and , and then use the torch.rand() function to generate a random number between 0 and 1 To determine the pixel category label, the prediction result of the first network or the second network is determined by comparing the normalized probability and the size of the random number. The formula of this process is expressed as follows: in, and Respectively represent the probability of the category with the highest prediction probability of the first network and the second network of the model, and The category corresponding to the maximum probability prediction of the first network and the second network, Represents the final pseudo label, and C represents the total number of categories; Step 3: Model training (1) Unlabeled image training: When training two datasets, the heterogeneous network sends the images in the unlabeled training subset of the training set to the two networks. Each network first extracts image features through the encoder to obtain the corresponding feature map. Then, each network predicts the feature map generated by the encoder through the communication branch and the original branch respectively. The two networks obtain two prediction results respectively, and finally obtain four prediction results in total. Then, the pseudo labels generated in step 2 are used to calculate the cross entropy loss with the four prediction results: in, represents the set of unlabeled images, represents the cross entropy loss, and Respectively represent the prediction results on the original branch and the feature exchange branch, H and W represent the length and width of the feature map, Indicates no marked loss; (2) Training with labeled images: This process is the same as training with unlabeled images, and four prediction results are obtained, but the actual labels of the images are used instead of pseudo labels to calculate the prediction results: in, represents a collection of annotated images, Indicates that there are annotated image labels, Indicates that there is a marked loss; (3) Loss calculation and optimization: Calculate the loss of labeled images and unlabeled images. The prediction results of labeled images are supervised by the true labeled labels and the cross entropy loss is calculated. The prediction results of unlabeled images are supervised by the pseudo labels generated in step 2 and the cross entropy loss is calculated. The total loss is obtained by weighting the loss of labeled images and the loss of unlabeled images, and the model is back-propagated and optimized. The loss ratio weight is determined by the parameter Control; the specific formula is as follows: in, is the proportionality coefficient for controlling loss.
