Semantic segmentation model training method, device and image semantic segmentation method

By integrating pixel-level contrastive learning and cross-supervised semi-supervised learning methods, the semantic segmentation network is trained, and the labeled and unlabeled data are used for joint training, which solves the problem in the existing technology that the performance of the semantic segmentation model depends on the accuracy of the initial model. Improved model robustness and performance.

CN114565812BActive Publication Date: 2024-10-18BEIJING HORIZON ROBOTICS TECH RES & DEV CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210200623.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-01
Publication Date
2024-10-18
Estimated Expiration
2042-03-01

AI Technical Summary

Technical Problem

The performance of the semantic segmentation model of existing semi-supervised semantic segmentation methods relies too much on the accuracy of the initial model. If the accuracy of the initial model is not high, the performance of the obtained semantic segmentation model will be poor.

Method used

A semi-supervised learning method that combines pixel-level contrastive learning and cross-supervision is used to train the pre-established semantic segmentation network. Labeled and unlabeled image data are used for joint training. The robustness and accuracy of the model are improved through cross-supervision and pixel-level contrastive learning. Feature discriminability.

Benefits of technology

It effectively improves the robustness and performance of the semantic segmentation model, avoids poor performance problems caused by low initial model accuracy, and achieves higher semantic segmentation effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114565812B_ABST
    Figure CN114565812B_ABST
Patent Text Reader

Abstract

The disclosed embodiments disclose a method and device for training a semantic segmentation model and a method for semantic segmentation of an image, wherein the method comprises: obtaining training data; using the training data, training a pre-established semantic segmentation network using a training method that integrates pixel-level contrast learning and cross-supervised semi-supervised learning to obtain a semantic segmentation model. The disclosed embodiments can use labeled image data and unlabeled image data for joint training through cross-supervised semi-supervised learning to effectively improve the robustness of the semantic segmentation model, and can effectively shorten the distance between pixel features of the same type and push away the distance between pixel features of different types in combination with pixel-level contrast learning, thereby improving the discriminability of pixel features and effectively improving the performance of the semantic segmentation model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to computer vision technology, and more particularly to a method and device for training a semantic segmentation model and a method for semantic segmentation of an image. Background Art

[0002] Semi-supervised semantic segmentation is a hot topic in the field of computer vision in recent years. It can use a small amount of labeled image data and a large amount of unlabeled image data for model training to obtain a semantic segmentation model, and then classify each pixel in the image based on the semantic segmentation model. Existing semi-supervised semantic segmentation methods usually obtain an initial model through labeled image data training, and then predict the unlabeled image data based on the initial model to expand the labeled data and continue training the model. However, the performance of the semantic segmentation model of the existing semi-supervised semantic segmentation method is too dependent on the accuracy of the initial model. If the accuracy of the initial model is not high, the performance of the obtained semantic segmentation model will be poor. Summary of the invention

[0003] In order to solve the technical problem of poor performance of the above-mentioned semantic segmentation model, the present disclosure is proposed. The embodiments of the present disclosure provide a training method and device for a semantic segmentation model and a semantic segmentation method for an image.

[0004] According to one aspect of an embodiment of the present disclosure, a method for training a semantic segmentation model is provided, comprising: acquiring training data; using the training data, training a pre-established semantic segmentation network using a training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision to obtain a semantic segmentation model.

[0005] According to another aspect of an embodiment of the present disclosure, a training device for a semantic segmentation model is provided, comprising: a first acquisition module for acquiring training data; a first processing module for using the training data to train a pre-established semantic segmentation network using a training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision to obtain a semantic segmentation model.

[0006] According to another aspect of the embodiments of the present disclosure, a method for semantic segmentation of an image is provided, comprising: obtaining image data to be processed; performing semantic segmentation on the image data to be processed based on a pre-acquired semantic segmentation model to obtain a semantic segmentation result corresponding to the image data to be processed; the semantic segmentation model is obtained by the training method of the semantic segmentation model described in any of the above embodiments of the present disclosure.

[0007] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the method described in any of the above embodiments of the present disclosure.

[0008] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any of the above embodiments of the present disclosure.

[0009] Based on the training method, device and semantic segmentation method of the semantic segmentation model provided by the above embodiments of the present disclosure, a pre-established semantic segmentation training network is trained based on a training method that integrates pixel-level contrast learning and cross-supervised semi-supervised learning to obtain a semantic segmentation model. Through cross-supervised semi-supervised learning, labeled image data and unlabeled image data can be used for joint training to effectively improve the robustness of the semantic segmentation model. In combination with pixel-level contrast learning, the distance between pixel features of the same type can be effectively shortened, while the distance between pixel features of different types can be further increased, thereby improving the discriminability of pixel features and effectively improving the performance of the semantic segmentation model.

[0010] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the drawings, the same reference numerals generally represent the same components or steps.

[0012] Figure 1 This is an exemplary application scenario of the training method of the semantic segmentation model provided by the present disclosure;

[0013] Figure 2 is a flowchart of a method for training a semantic segmentation model provided by an exemplary embodiment of the present disclosure;

[0014] Figure 3 is a flowchart of step 202 provided by an exemplary embodiment of the present disclosure;

[0015] Figure 4 is a flowchart of step 202 provided by another exemplary embodiment of the present disclosure;

[0016] Figure 5 is a schematic diagram of the overall architecture of a deeplabv3+ network provided by an exemplary embodiment of the present disclosure;

[0017] Figure 6is a schematic diagram of a model training principle provided by an exemplary embodiment of the present disclosure;

[0018] Figure 7 is a flowchart of step 2029 provided by an exemplary embodiment of the present disclosure;

[0019] Figure 8 is a flowchart of a sampling process provided by an exemplary embodiment of the present disclosure;

[0020] Fig. 9 is a flowchart of step 202 provided by another exemplary embodiment of the present disclosure;

[0021] Fig.10 is a flowchart of a method for semantic segmentation of an image provided by an exemplary embodiment of the present disclosure;

[0022] Fig.11 is a structural schematic diagram of a training device for a semantic segmentation model provided by an exemplary embodiment of the present disclosure;

[0023] Fig.12 is a structural schematic diagram of a first processing module 502 provided by an exemplary embodiment of the present disclosure;

[0024] Fig.13 is a structural schematic diagram of a first processing module 502 provided by another exemplary embodiment of the present disclosure;

[0025] Fig.14 is a schematic diagram of the structure of a fifth determining unit 50229 provided by an exemplary embodiment of the present disclosure;

[0026] Fig.15 is a schematic diagram of the structure of a fourth determining unit 50228 provided by an exemplary embodiment of the present disclosure;

[0027] Fig.16 is a structural schematic diagram of an image semantic segmentation device provided by an exemplary embodiment of the present disclosure;

[0028] Fig.17 It is a structural schematic diagram of an application embodiment of the electronic device disclosed in the present invention. DETAILED DESCRIPTION

[0029] Below, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.

[0030] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0031] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.

[0032] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.

[0033] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0034] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present disclosure generally indicates that the associated objects before and after are in an "or" relationship.

[0035] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0036] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0037] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0038] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0039] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0040] The embodiments of the present disclosure can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.

[0041] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0042] SUMMARY OF THE DISCLOSURE

[0043] In the process of realizing the present disclosure, the inventors found that the existing semi-supervised semantic segmentation method usually obtains an initial model through training with labeled image data, and then predicts the unlabeled image data based on the initial model to expand the labeled data and continue to train the model. However, the performance of the semantic segmentation model of the existing semi-supervised semantic segmentation method is too dependent on the accuracy of the initial model. If the accuracy of the initial model is not high, the performance of the obtained semantic segmentation model will be poor.

[0044] Exemplary Overview

[0045] Figure 1 This is an exemplary application scenario of the training method of the semantic segmentation model provided in the present disclosure.

[0046] For the training of the semantic segmentation model, a training device of the semantic segmentation model is used to execute the training method of the semantic segmentation model disclosed in the present invention. Training can be performed based on labeled image data and unlabeled image data, combined with cross-supervised semi-supervised learning and pixel-level comparative learning. The labeled image data and the unlabeled image data are input in batches and trained together to effectively improve the robustness of the semantic segmentation model. Supervised learning is performed on the labeled image data, and cross-supervision and pixel-level comparative learning are performed on the unlabeled image data. This can effectively shorten the distance between pixel features of the same type, while increasing the distance between pixel features of different types, thereby improving the discriminability of pixel features and effectively improving the performance of the semantic segmentation model.

[0047] The semantic segmentation model training method disclosed in the present invention can be applied to the training of semantic segmentation models required in any scenario or field, such as autonomous driving scenarios, geographic information systems, medical image analysis, robotics, etc., without specific limitation.

[0048] Exemplary Methods

[0049] Figure 2 FIG. 1 is a flow chart of a method for training a semantic segmentation model provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices, such as servers or terminals, such as Figure 2 As shown, the following steps are included:

[0050] Step 201, obtaining training data.

[0051] Among them, the training data includes labeled image data and unlabeled image data, and may also include labels corresponding to the labeled image data. The training data may be collected in advance in any feasible way. For example, in the field of autonomous driving, a data collection vehicle may be used to travel on the road to be collected. The data collection vehicle is provided with a camera device, such as a camera. During the driving process, the camera collects images of the surrounding environment to obtain image data. The labels of the labeled image data may be obtained by any feasible annotation method, such as manual annotation, feasible automatic annotation, prediction by a trained classification model, etc., without specific limitation.

[0052] Step 202 , using the training data, a pre-established semantic segmentation network is trained using a training method that integrates pixel-level contrast learning and cross-supervised semi-supervised learning to obtain a semantic segmentation model.

[0053] Among them, semi-supervised refers to the combination of supervised learning and unsupervised learning. Labeled image data is used for supervised learning, and unlabeled image data is used for unsupervised learning. Cross-supervision means that for unsupervised unlabeled image data, the output results are obtained simultaneously through two semantic segmentation networks, and network 2 is supervised based on the output results of network 1, and network 1 is supervised based on the output results of network 2. Pixel-level contrast learning refers to the feature map output by the preset layers of the two networks for unlabeled image data, and the pixel-level contrast loss is determined according to the preset pixel-level contrast rules, which is used to update the network parameters to shorten the distance between pixel features of the same type, and at the same time push the distance between pixel features of different types, thereby improving the discriminability of pixel features.

[0054] The training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision refers to the comprehensive supervised learning loss, cross-supervised learning loss and pixel-level contrast loss, which are jointly used to update network parameters. That is, the labeled image data and the unlabeled image data are trained collaboratively, rather than first training with the labeled image data to obtain the initial model. Therefore, the training method of the semantic segmentation model of the present invention does not depend on the initial model. For example, the labeled image data and the unlabeled image data in the present invention can be input in batches at the same time and trained together to obtain supervised learning loss, cross-supervised learning loss and pixel-level contrast loss. The three losses are combined to update the network parameters.

[0055] The training method of the semantic segmentation model provided in this embodiment is based on the training method of integrating pixel-level contrast learning and cross-supervised semi-supervised learning to train the pre-established semantic segmentation training network to obtain the semantic segmentation model. Through cross-supervised semi-supervised learning, labeled image data and unlabeled image data can be used for joint training to effectively improve the robustness of the semantic segmentation model. In combination with pixel-level contrast learning, the distance between pixel features of the same type can be effectively shortened, while the distance between pixel features of different types can be pushed away, and the discriminability of pixel features can be improved, thereby effectively improving the performance of the semantic segmentation model. Moreover, the training method of the semantic segmentation model disclosed in the present invention does not rely on the initial model, but is based on labeled image data and unlabeled image data, and is trained collaboratively by integrating pixel-level contrast learning and cross-supervised semi-supervised learning. Therefore, there is no problem of low accuracy of the initial model, and it effectively solves the problem that the performance of the prior art model is too dependent on the accuracy of the initial model, which easily leads to poor performance.

[0056] In an alternative example, Figure 3 2 is a flow chart of step 202 provided by an exemplary embodiment of the present disclosure. In this example, the training data includes first image data, first label data corresponding to the first image data, and second image data. Step 202 may specifically include the following steps:

[0057] Step 2021a, using the first image data and the first label data, respectively perform supervised learning training on the pre-established first semantic segmentation network and the second semantic segmentation network; using the second image data, perform cross-supervised learning training on the first semantic segmentation network and the second semantic segmentation network, and perform pixel-level contrast learning training on the first semantic segmentation network and the second semantic segmentation network based on pixel-level contrast rules.

[0058] Among them, the first semantic segmentation network and the second semantic segmentation network can adopt any implementable semantic segmentation network, such as a semantic segmentation network based on deeplabv3+, a semantic segmentation network based on UNet, a semantic segmentation network based on FCN (Fully Convolutional Networks), etc., which can be set according to actual needs, and this disclosure does not limit it. It should be noted that the first semantic segmentation network has the same network structure as the second semantic segmentation network, and the initialized network parameters are different.

[0059] Step 2022a, determining the current loss based on a preset loss function, where the preset loss function includes a first loss function corresponding to supervised learning, a second loss function corresponding to cross-supervised learning, and a third loss function corresponding to pixel-level contrast learning.

[0060] Among them, the first loss function, the second loss function and the third loss function can be set according to actual needs, for example, the cross entropy loss function or any other feasible loss function can be used, which is not limited in this disclosure.

[0061] Taking the first semantic segmentation network as an example, the principle of supervised learning is: input the first image data into the first semantic segmentation network, obtain the first output result, compare it with the corresponding first label data, and determine the first loss corresponding to the supervised learning based on the first loss function corresponding to the supervised learning.

[0062] The principle of cross-supervised learning is to input the unlabeled second image data into the first semantic segmentation network and the second semantic segmentation network respectively, determine the label of the second semantic segmentation network based on the output result of the first semantic segmentation network to supervise the second semantic segmentation network, and at the same time determine the label of the first semantic segmentation network based on the output result of the second semantic segmentation network to supervise the first semantic segmentation network, thereby realizing cross-supervision, and determine the second loss corresponding to the cross-supervised learning based on the second loss function corresponding to the cross-supervised learning.

[0063] The pixel-level comparison rule can be set according to actual needs, and is used to perform pixel-level comparison on the feature maps generated by the first semantic segmentation network and the second semantic segmentation network, and determine the third loss corresponding to the pixel-level comparison learning based on the third loss function corresponding to the pixel-level comparison learning.

[0064] Then, the current loss is determined by combining the first loss, the second loss and the third loss, the network parameters of the first semantic segmentation network and the second semantic segmentation network are adjusted, and the next iteration is performed to realize the training of the first semantic segmentation network and the second semantic segmentation network.

[0065] Step 2023a, determining that the current loss meets a preset condition, ending the training, and using the first semantic segmentation network or the second semantic segmentation network obtained through training as a semantic segmentation model.

[0066] Among them, the preset conditions can be set according to actual needs, and the present disclosure does not limit them. For example, the current loss enters a convergence state, specifically, the current loss is less than the preset loss threshold, and the loss has been less than the preset loss threshold for N consecutive times, and so on.

[0067] When it is determined that the current loss meets the preset conditions, it means that the training can be ended. Since the first semantic segmentation network and the second semantic segmentation network are trained in the same process, the first semantic segmentation network and the second semantic segmentation network obtained by training can be used as semantic segmentation models in semantic segmentation scenarios.

[0068] The present invention uses supervised learning of labeled image data, cross-supervised learning of unlabeled image data, and pixel-level comparative learning to determine the current loss using the first loss corresponding to supervised learning, the second loss corresponding to cross-supervised learning, and the third loss corresponding to pixel-level comparative learning, and participates in the updating of network parameters, thereby achieving an effective fusion of cross-supervised semi-supervised learning and pixel-level comparative learning. On the basis of ensuring the learning value of labeled image data, the learning effectiveness of unlabeled image data is improved, the information contained in the unlabeled data is effectively utilized, and the robustness of the model is improved.

[0069] In an alternative example, Figure 4 2 is a flow chart of step 202 provided by another exemplary embodiment of the present disclosure. In this example, the training data includes first image data, first label data corresponding to the first image data, and second image data. Step 202 may specifically include the following steps:

[0070] Step 2021b: Use the first semantic segmentation network to predict the first image data to obtain first probability data corresponding to the first image data.

[0071] Among them, the first probability data includes the probability value of each pixel in the first image data belonging to each type, and the type can be set according to actual needs, for example, it can include vehicles, pedestrians, obstacles, etc., without specific limitation.

[0072] The first image data is predicted using the first semantic segmentation network, that is, the first image data is input into the first semantic segmentation network, and an output result is obtained after being processed by the first semantic segmentation network. The specific prediction principle will not be repeated here.

[0073] Optionally, the first image data may be image data that meets the input requirements of the first semantic segmentation network after preprocessing the original image data.

[0074] Step 2022b: Use the second semantic segmentation network to predict the first image data to obtain second probability data corresponding to the first image data.

[0075] The specific prediction principle can be found in the above steps and will not be repeated here.

[0076] Step 2023b: Use the first semantic segmentation network to predict the second image data to obtain a third feature map and third probability data corresponding to the second image data.

[0077] The third feature map is a feature map output by a preset layer (such as the last convolutional layer) in the first semantic segmentation network. The specific preset layer can be determined according to the specific network structure of the first semantic segmentation network, and is not limited here.

[0078] For example, Figure 5 It is a schematic diagram of the overall architecture of the deeplabv3+ network provided by an exemplary embodiment of the present disclosure. The third feature map is the feature map output by the last convolutional layer in the Encoder (the feature map of the last convolutional layer marked in the figure). The deeplabv3+ network architecture is a prior art and will not be repeated here.

[0079] The specific prediction principle can be found in the previous step and will not be elaborated here.

[0080] Step 2024b: Use the second semantic segmentation network to predict the second image data to obtain a fourth feature map and fourth probability data corresponding to the second image data.

[0081] The specific operation of this step refers to the aforementioned step 2023b, which will not be repeated here.

[0082] Among them, steps 2021b-2024b are in no particular order.

[0083] Step 2025: Determine first pseudo label data based on the third probability data as label data for the second image data under the second semantic segmentation network.

[0084] The first pseudo-label data includes a label of a type to which each pixel in the second image data belongs, which is obtained by encoding the third probability data. The specific encoding method can be set according to actual needs, such as using one-hot encoding.

[0085] Step 2026: Determine second pseudo label data based on the fourth probability data as label data for the second image data under the first semantic segmentation network.

[0086] For the specific operation of this step, please refer to step 2025 and will not be described in detail.

[0087] Step 2025 and step 2026 are performed in no particular order.

[0088] Step 2027, determining a first cross entropy loss based on the first probability data, the second probability data and the first label data.

[0089] Specifically, the predicted first probability data and the second probability data are respectively compared with the first label data, and the corresponding first cross entropy loss is determined based on the first loss function.

[0090] Exemplarily, the first loss function can be expressed as L s :

[0091]

[0092] Among them, D l is a labeled dataset (i.e., the first image data), |D l | represents the number of samples in the labeled dataset, W and H are the width and height of the image respectively, l ce It represents the cross entropy calculation. are the prediction results of the first semantic segmentation network and the second semantic segmentation network, that is, the probability value corresponding to the i-th pixel in the first probability data and the probability value corresponding to the i-th pixel in the second probability data, is the label value corresponding to the i-th pixel in the first label data. For the same pixel,

[0093] Step 2028, determining a second cross entropy loss based on the third probability data, the second pseudo label data, the fourth probability data and the first pseudo label data.

[0094] Specifically, the second cross entropy loss is determined based on the second loss function. The specific principle is similar to that of step 2027 and will not be repeated here. The difference is that in this step, the second pseudo label data is a label compared with the third probability data, and the first pseudo label data is a label compared with the fourth probability data.

[0095] Step 2029: Based on the third probability data and the fourth probability data, perform pixel-level comparison on the third feature map and the fourth feature map to obtain pixel-level comparison loss.

[0096] Specifically, the pixel-level comparison rule may be set in advance according to actual needs, the data required by the third loss function may be determined, and then the pixel-level comparison loss may be determined based on the third loss function.

[0097] Steps 2027 to 2029 are in no particular order.

[0098] Step 2030: Based on the first cross entropy loss, the second cross entropy loss and the pixel-level contrast loss, the parameters of the semantic segmentation network are adjusted until a preset training end condition is met to obtain a semantic segmentation model.

[0099] Specifically, the comprehensive loss can be obtained by weighting the first cross entropy loss, the second cross entropy loss and the pixel-level contrast loss, which is used to adjust the parameters of the semantic segmentation network (including the first semantic segmentation network and the second semantic segmentation network), and the weighted weights can be set according to actual needs. The preset training end condition can be set according to actual needs, such as when the comprehensive loss reaches convergence, and the details will not be repeated.

[0100] For example, Figure 6 is a schematic diagram of the model training principle provided by an exemplary embodiment of the present disclosure. Figure 1 and probability Figure 2 Represent the first probability data and the second probability data respectively. For unlabeled image data, the probability Figure 1 and probability Figure 2 represents the third probability data and the fourth probability data respectively; pseudo label 1 and pseudo label 2 represent the first pseudo label data and the second pseudo label data respectively. Cross-supervision and pixel-level contrast learning are performed for unlabeled image data, and supervised learning is performed for labeled image data.

[0101] In an alternative example, Figure 7 2029 is a flowchart of step 2029 provided by an exemplary embodiment of the present disclosure. In this example, the pixel-level contrast loss includes a first pixel-level directional contrast loss and a second pixel-level directional contrast loss. Step 2029 performs pixel-level contrast on the third feature map and the fourth feature map based on the third probability data and the fourth probability data to obtain the pixel-level contrast loss, including:

[0102] Step 20291, performing channel dimensionality reduction processing on the third feature map to obtain a fifth feature map, and performing channel dimensionality reduction processing on the fourth feature map to obtain a sixth feature map.

[0103] Among them, channel dimensionality reduction can be implemented in any feasible way, such as performing channel dimensionality reduction through a 1*1 convolutional layer, which is not limited in this disclosure.

[0104] Step 20292, based on the fifth feature map, the sixth feature map and the preset sampling rule, pixel sample pair sampling is performed to obtain a first positive sample pair set, a second positive sample pair set, a first negative sample pair set and a second negative sample pair set.

[0105] The first positive sample pair set and the first negative sample pair set are respectively the positive sample pair set and the negative sample pair set obtained by sampling the pixels in the fifth feature map as the reference samples, and the second positive sample pair set and the second negative sample pair set are respectively the positive sample pair set and the negative sample pair set obtained by sampling the pixels in the sixth feature map as the reference samples. The preset sampling rule can be set according to actual needs.

[0106] Exemplarily, pixel sample pairs are sampled based on the positional relationship and probability size between any first pixel in the fifth feature map and any second pixel in the sixth feature map.

[0107] Step 20293, determine a first pixel-level directional contrast loss based on the first positive sample pair set and the first negative sample pair set.

[0108] Specifically, the first pixel-level oriented contrast loss may be determined based on the first pixel-level oriented contrast loss function, and the first pixel-level oriented contrast loss function may be set according to actual needs.

[0109] Step 20294, determine a second pixel-level directional contrast loss based on the second positive sample pair set and the second negative sample pair set.

[0110] Specifically, the second pixel-level oriented contrast loss may be determined based on the second pixel-level oriented contrast loss function, and the second pixel-level oriented contrast loss function may be set according to actual needs.

[0111] Step 20293 and step 20294 are in no particular order.

[0112] Step 20295, obtain the pixel level contrast loss based on the first pixel level directional contrast loss and the second pixel level directional contrast loss.

[0113] Specifically, the pixel-level contrast loss may be obtained by weighting the first pixel-level directional contrast loss and the second pixel-level directional contrast loss.

[0114] The present invention further improves the distinguishability of image features through pixel-level directional contrast loss, thereby further improving model performance.

[0115] In an optional example, step 20292 performs pixel sample pair sampling based on the fifth feature map, the sixth feature map and the preset sampling rule to obtain a first positive sample pair set, a second positive sample pair set, a first negative sample pair set and a second negative sample pair set, including:

[0116] For any first pixel in the fifth feature map and any second pixel in the sixth feature map, determine that the first pixel and the second pixel are located at the same position, and the maximum probability corresponding to the first pixel is less than the maximum probability corresponding to the second pixel, and the maximum probability corresponding to the second pixel is greater than a preset probability threshold, then use the first pixel and the second pixel as a positive sample pair with the pixel in the fifth feature map as the reference sample; thereby obtaining a first positive sample pair set; determine that the first pixel and the second pixel are located at the same position, and the maximum probability corresponding to the first pixel is greater than the maximum probability corresponding to the second pixel, and the maximum probability corresponding to the first pixel is greater than a preset threshold, then use the first pixel and the second pixel as a positive sample pair with the pixel in the sixth feature map as the reference sample; thereby obtaining a second positive sample pair set; determine that the first pixel and the second pixel are located at different positions, and the maximum probability of the first pixel and the maximum probability of the second pixel are inconsistent in type, then use the first pixel and the second pixel as a negative sample pair with the pixel in the fifth feature map as the reference sample, and use the first pixel and the second pixel as a negative sample pair with the pixel in the sixth feature map as the reference sample; thereby obtaining a first negative sample pair set and a second negative sample pair set.

[0117] Among them, the probability corresponding to the first pixel can be obtained based on the third probability data, and the probability corresponding to the second pixel can be obtained based on the fourth probability data. Taking the third probability data as an example, since the third probability data includes the probability values ​​of each pixel belonging to each type, that is, each pixel corresponds to multiple types of probability values, where the type corresponding to the maximum probability may represent that the pixel belongs to this type. Since the fifth feature map and the sixth feature map are obtained by predicting the second image data through the first semantic segmentation network and the second semantic segmentation network respectively, the first pixel and the second pixel at the same position are considered to belong to the same type, or it is further confirmed whether the first pixel and the second pixel belong to the same type based on the third probability data and the fourth probability data. Then, based on the size relationship between the maximum probabilities corresponding to the first pixel and the second pixel at the same position, and the size relationship between the larger maximum probability and the preset probability threshold, the first positive sample pair set and the second positive sample pair set are determined, and based on the inconsistency of the types to which the maximum probabilities of the first pixel and the second pixel at different positions respectively belong, the first negative sample pair set and the second negative sample pair set are determined. The positive sample pair and the negative sample pair characterize whether the sample pair belongs to the same type. The positive sample pair characterizes that the two pixels in the sample pair belong to the same type, and the negative sample pair characterizes that the two pixels in the sample pair belong to different types. Therefore, the pixel-level directional contrast loss determined based on the positive sample pair set and the negative sample pair set can guide the semantic segmentation network to shorten the distance between pixel features of the same type, while pushing the distance between pixel features of different types away, thereby improving the discriminability of pixel features.

[0118] In an optional example, determining the first pixel-level directional contrast loss based on the first positive sample pair set and the first negative sample pair set in step 20293 includes:

[0119] A first positive sample pair mask is generated based on the first positive sample pair set; a first negative sample pair mask is generated based on the first negative sample pair set; and a first pixel-level directional contrast loss is determined based on the first positive sample pair mask and the first negative sample pair mask.

[0120] The first positive sample pair mask includes the position of each first positive sample pair in the feature map. Similarly, the first negative sample pair mask includes the position of each first negative sample pair in the feature map.

[0121] In an optional example, determining a second pixel-level directional contrast loss based on the second positive sample pair set and the second negative sample pair set in step 20294 includes:

[0122] A second positive sample pair mask is generated based on the second positive sample pair set; a second negative sample pair mask is generated based on the second negative sample pair set; and a second pixel-level directional contrast loss is determined based on the second positive sample pair mask and the second negative sample pair mask.

[0123] For example, Figure 8It is a flowchart of a sampling process provided by an exemplary embodiment of the present disclosure. Based on the third probability data, the fourth probability data, the fifth feature map and the sixth feature map, wherein P() represents the maximum probability of a pixel.

[0124] Exemplarily, the first pixel-level directional contrast loss can be expressed as L C1 :

[0125]

[0126] The second pixel-level directional contrast loss can be expressed as L C2 :

[0127]

[0128] Among them, W and H are the width and height of the image respectively. represents the fifth feature map, Represents the sixth feature map, respectively, with feature maps The pixels in the image are taken as the reference samples, and N represents the number of reference samples in the positive sample pair (the first positive sample pair or the second positive sample pair). Respectively means respectively The first positive sample pair mask and the second positive sample pair mask are generated after sampling with the pixel in the middle as the reference sample. Respectively When the pixel in is used as the reference sample, the first negative sample mask and the second negative sample mask corresponding to the sampling are obtained. r() represents the exponential function of the cosine similarity. is a negative sample pair set, which can represent the first negative sample pair set or the second negative sample pair set.

[0129] Fig. 9 It is a flowchart of step 202 provided by yet another exemplary embodiment of the present disclosure.

[0130] In an optional example, determining the first pseudo label data based on the third probability data in step 2025 includes:

[0131] Step 20251, perform one-hot encoding on the third probability data to obtain first pseudo label data.

[0132] Among them, one-hot encoding is also called one-bit effective encoding, which uses an N-bit state register to encode N states. Each state has its own independent register bit, and at any time, only one of them is effective. In this disclosure, the effective bit represents the type of pixel. For example, for a certain pixel A, the probability of belonging to a pedestrian is 0.1, the probability of belonging to a vehicle is 0.6, the probability of belonging to a curb is 0.1, and the probability of belonging to an obstacle is 0.2. The pseudo label corresponding to the pixel A obtained after encoding is 0100. The specific encoding principle will not be repeated here.

[0133] Determining the second pseudo label data based on the fourth probability data in step 2026 includes:

[0134] Step 20261, perform one-hot encoding on the fourth probability data to obtain second pseudo label data.

[0135] The specific principles can be found in the above steps and will not be repeated here.

[0136] In an optional example, determining the second cross entropy loss based on the third probability data, the second pseudo label data, the fourth probability data, and the first pseudo label data in step 2028 includes:

[0137] Step 20281, based on the third probability data and the second pseudo-label data, determine the first cross entropy corresponding to each pixel of the second image data under the first semantic segmentation network.

[0138] Specifically, the second pseudo label data is used as label data for comparison with the third probability data, and the first cross entropy corresponding to each pixel is determined based on the first cross entropy calculation rule. The specific cross entropy calculation can adopt any feasible calculation method, which will not be repeated here.

[0139] Step 20282, based on the fourth probability data and the first pseudo-label data, determine the second cross entropy corresponding to each pixel of the second image data under the second semantic segmentation network.

[0140] Similarly, the first pseudo label data is used as label data for comparison with the fourth probability data, and the second cross entropy is determined based on the second cross entropy calculation rule.

[0141] Step 20281 and step 20282 are in no particular order.

[0142] Step 20283: Determine a second cross entropy loss based on the first cross entropy and the second cross entropy corresponding to each pixel of the second image data.

[0143] For example, the second cross entropy loss can be expressed as L U :

[0144]

[0145] Among them, D u represents the unlabeled dataset (i.e., the second image data), W and H are the width and height of the image respectively, are the pseudo first pseudo label (i.e., the pseudo label corresponding to the i-th pixel in the first pseudo label data) and the second pseudo label (i.e., the pseudo label corresponding to the i-th pixel in the second pseudo label data), respectively. ce It represents the cross entropy calculation. That is, it represents the first cross entropy corresponding to the i-th pixel, represents the second cross entropy corresponding to the i-th pixel, are the prediction results of the first semantic segmentation network and the second semantic segmentation network respectively, that is, the probability value corresponding to the i-th pixel in the third probability data and the probability value corresponding to the i-th pixel in the fourth probability data.

[0146] In an optional example, step 2030 adjusts the parameters of the semantic segmentation network based on the first cross entropy loss, the second cross entropy loss, and the pixel-level contrast loss until a preset training end condition is met, including:

[0147] Step 20301, weighted summing the first cross entropy loss, the second cross entropy loss and the pixel-level contrast loss is performed based on preset weights to obtain a comprehensive loss.

[0148] Step 20302, determining that the comprehensive loss does not meet the preset training end condition, adjusting the parameters of the semantic segmentation network based on the comprehensive loss; or determining that the comprehensive loss meets the preset training end condition, the training ends.

[0149] For example, the comprehensive loss can be expressed as L:

[0150] L=α1L S +α2L U +α3L C1 +α4L C2

[0151] Among them, α1, α2, α3, and α4 represent the first cross entropy loss L S , the second cross entropy loss L U , the first pixel-level directional contrast loss L C1 , the second pixel-level directional contrast loss L C2 The specific weight values ​​can be set according to actual needs. For example, they can be set to: α1=1, α2=1, α3=0.5, α4=0.5. Of course, they can also be set to other values ​​according to actual needs, and there is no specific limitation.

[0152] The present invention guides the sampling of positive and negative sample pairs based on feature maps through the prediction probability of unlabeled image data in two semantic segmentation networks, and then determines the pixel-level directional contrast loss, which participates in the parameter update of the semantic segmentation network to effectively shorten the distance between pixel features of the same type and push away the distance between pixel features of different types, thereby improving the discriminability of pixel features and effectively improving the performance of the semantic segmentation model.

[0153] The above-mentioned embodiments or optional examples of the present disclosure may be implemented separately, or may be implemented in combination in any manner without conflict.

[0154] Any of the semantic segmentation model training methods provided in the embodiments of the present disclosure can be executed by any appropriate device with data processing capabilities, including but not limited to: terminal devices and servers, etc. Alternatively, any of the semantic segmentation model training methods provided in the embodiments of the present disclosure can be executed by a processor, such as the processor executing any of the semantic segmentation model training methods mentioned in the embodiments of the present disclosure by calling corresponding instructions stored in a memory. This will not be repeated below.

[0155] Another embodiment of the present disclosure provides a method for semantic segmentation of an image, which is used to semantically segment an image. The method for semantic segmentation of an image of the present disclosure can be applied to electronic devices, such as servers or terminals, specifically, such as vehicle computing platforms in the field of autonomous driving, and of course, electronic devices in other scenarios or fields. Fig.10 FIG. 1 is a flow chart of a semantic segmentation method of an image provided by an exemplary embodiment of the present disclosure. The method comprises the following steps:

[0156] Step 301: Obtain image data to be processed.

[0157] The image data to be processed may be any image data that needs to be semantically segmented, and this embodiment does not limit this.

[0158] Step 302: semantically segment the image data to be processed based on the pre-acquired semantic segmentation model to obtain a semantic segmentation result corresponding to the image data to be processed.

[0159] Wherein, the semantic segmentation model is obtained by the training method of the semantic segmentation model provided in any of the above embodiments or examples. The specific acquisition process is referred to the above embodiments or examples, which will not be repeated here. In the case where the semantic segmentation model has been obtained, the principle of semantically segmenting the processed image data based on the semantic segmentation model is a conventional technology, which will not be repeated here.

[0160] The image semantic segmentation method disclosed in the present invention has a semantic segmentation model that is obtained based on a training method that integrates pixel-level contrast learning and cross-supervised semi-supervised learning. Through cross-supervised semi-supervised learning, labeled image data and unlabeled image data can be used for joint training, thereby effectively improving the robustness of the semantic segmentation model. In combination with pixel-level contrast learning, the distance between pixel features of the same type can be effectively shortened, while the distance between pixel features of different types can be extended, thereby improving the discriminability of pixel features, thereby effectively improving the performance of the semantic segmentation model.

[0161] Any image semantic segmentation method provided by the embodiments of the present disclosure may be executed by any appropriate device with data processing capabilities, including but not limited to: a terminal device and a server, etc. Alternatively, any image semantic segmentation method provided by the embodiments of the present disclosure may be executed by a processor, such as a processor executing any image semantic segmentation method mentioned in the embodiments of the present disclosure by calling corresponding instructions stored in a memory. This will not be described in detail below.

[0162] Exemplary Devices

[0163] Fig.11 is a schematic diagram of a structure of a semantic segmentation model training device provided by an exemplary embodiment of the present disclosure. The device of this embodiment can be used to implement the corresponding semantic segmentation model training method embodiment of the present disclosure, such as Fig.11 The device shown includes: a first acquisition module 501 and a first processing module 502 .

[0164] The first acquisition module 501 is used to acquire training data.

[0165] The first processing module 502 is used to train a pre-established semantic segmentation network using the training data obtained by the first obtaining module 501 by adopting a training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision to obtain a semantic segmentation model.

[0166] In an alternative example, Fig.12 is a schematic diagram of the structure of the first processing module 502 provided by an exemplary embodiment of the present disclosure. In this example, the training data includes first image data, first label data corresponding to the first image data, and second image data; the first processing module 502 includes: a first processing unit 50211, a second processing unit 50212, and a third processing unit 50213.

[0167] The first processing unit 50211 is used to use the first image data and the first label data to perform supervised learning training on the pre-established first semantic segmentation network and the second semantic segmentation network, respectively, use the second image data to perform cross-supervised learning training on the first semantic segmentation network and the second semantic segmentation network, and perform pixel-level contrast learning training on the first semantic segmentation network and the second semantic segmentation network based on pixel-level contrast rules; the second processing unit 50212 is used to determine the current loss based on a preset loss function, the preset loss function includes a first loss function corresponding to supervised learning, a second loss function corresponding to cross-supervised learning, and a third loss function corresponding to pixel-level contrast learning; the third processing unit 50213 is used to determine whether the current loss meets the preset conditions, end the training, and use the first semantic segmentation network or the second semantic segmentation network obtained through training as a semantic segmentation model.

[0168] In an alternative example, Fig.13 is a schematic diagram of the structure of the first processing module 502 provided by another exemplary embodiment of the present disclosure. In this example, the training data includes the first image data, the first label data corresponding to the first image data, and the second image data; the first processing module 502 includes: a first prediction unit 50221, a second prediction unit 50222, a third prediction unit 50223, a fourth prediction unit 50224, a first determination unit 50225, a second determination unit 50226, a third determination unit 50227, a fourth determination unit 50228, a fifth determination unit 50229 and a parameter adjustment unit 50230.

[0169] The first prediction unit 50221 is used to predict the first image data using the first semantic segmentation network to obtain first probability data corresponding to the first image data; the second prediction unit 50222 is used to predict the first image data using the second semantic segmentation network to obtain second probability data corresponding to the first image data; the third prediction unit 50223 is used to predict the second image data using the first semantic segmentation network to obtain a third feature map and third probability data corresponding to the second image data; the fourth prediction unit 50224 is used to predict the second image data using the second semantic segmentation network to obtain a fourth feature map and fourth probability data corresponding to the second image data; the first determination unit 50225 is used to determine the first pseudo label data based on the third probability data obtained by the third prediction unit 50223 as the label data of the second image data under the second semantic segmentation network; the second determination unit 50226 is used to determine the second pseudo label data based on the fourth probability data obtained by the fourth prediction unit 50224 as the label data of the second image data under the first semantic segmentation network; the third determination unit 50227 is used to determine the second pseudo label data based on the first prediction unit 502 21, the second probability data obtained by the second prediction unit 50222 and the first label data, determine the first cross entropy loss; the fourth determination unit 50228 is used to determine the second cross entropy loss based on the third probability data obtained by the third prediction unit 50223, the second pseudo label data obtained by the second determination unit 50226, the fourth probability data obtained by the fourth prediction unit 50224 and the first pseudo label data obtained by the first determination unit 50225; the fifth determination unit 50229 is used to determine the second cross entropy loss based on the third probability data obtained by the third prediction unit 50223 According to the fourth probability data obtained by the third prediction unit 50224, a pixel-level comparison is performed on the third feature map obtained by the third prediction unit 50223 and the fourth feature map obtained by the fourth prediction unit 50224 to obtain a pixel-level contrast loss; a parameter adjustment unit 50230 is used to adjust the parameters of the semantic segmentation network based on the first cross entropy loss obtained by the third determination unit 50227, the second cross entropy loss obtained by the fourth determination unit 50228 and the pixel-level contrast loss obtained by the fifth determination unit 50229 until a preset training end condition is met to obtain a semantic segmentation model.

[0170] In an alternative example, Fig.14 It is a structural schematic diagram of the fifth determination unit 50229 provided by an exemplary embodiment of the present disclosure. In this example, the pixel-level contrast loss includes a first pixel-level directional contrast loss and a second pixel-level directional contrast loss; the fifth determination unit 50229 includes: a first processing subunit 502291, a first sampling subunit 502292, a first determination subunit 502293 and a second determination subunit 502294.

[0171] The first processing subunit 502291 is used to perform channel dimensionality reduction processing on the third feature map to obtain a fifth feature map, and to perform channel dimensionality reduction processing on the fourth feature map to obtain a sixth feature map; the first sampling subunit 502292 is used to perform pixel sample pair sampling based on the fifth feature map, the sixth feature map and the preset sampling rule obtained by the first processing subunit 502291 to obtain a first positive sample pair set, a second positive sample pair set, a first negative sample pair set and a second negative sample pair set; the first positive sample pair set and the first negative sample pair set are respectively sampled using the pixels in the fifth feature map as reference samples The first positive sample pair set and the first negative sample pair set are obtained by sampling the pixels in the sixth feature map as reference samples, the second positive sample pair set and the second negative sample pair set are respectively obtained by sampling with the pixels in the sixth feature map as reference samples; the first determining subunit 502293 is used to determine the first pixel-level directional contrast loss based on the first positive sample pair set and the first negative sample pair set obtained by the first sampling subunit 502292; the second determining subunit 502294 is used to determine the second pixel-level directional contrast loss based on the second positive sample pair set and the second negative sample pair set obtained by the first sampling subunit 502292.

[0172] In an optional example, the first sampling subunit 502292 is specifically used to: for any first pixel in the fifth feature map and any second pixel in the sixth feature map, determine that the first pixel and the second pixel are located at the same position, and the maximum probability corresponding to the first pixel is less than the maximum probability corresponding to the second pixel, and the maximum probability corresponding to the second pixel is greater than a preset probability threshold, then use the first pixel and the second pixel as a positive sample pair with the pixel in the fifth feature map as the reference sample; thereby obtaining a first positive sample pair set; determine that the first pixel and the second pixel are located at the same position, and the maximum probability corresponding to the first pixel is greater than the maximum probability corresponding to the second pixel, and the maximum probability corresponding to the first pixel is greater than a preset threshold, then use the first pixel and the second pixel as a positive sample pair with the pixel in the sixth feature map as the reference sample; thereby obtaining a second positive sample pair set; determine that the first pixel and the second pixel are located at different positions, and the maximum probability of the first pixel and the maximum probability of the second pixel are inconsistent in type, then use the first pixel and the second pixel as a negative sample pair with the pixel in the fifth feature map as the reference sample, and use the first pixel and the second pixel as a negative sample pair with the pixel in the sixth feature map as the reference sample; thereby obtaining a first negative sample pair set and a second negative sample pair set.

[0173] In an optional example, the first determination subunit 502293 is specifically used to: generate a first positive sample pair mask based on the first positive sample pair set; generate a first negative sample pair mask based on the first negative sample pair set; determine a first pixel-level directional contrast loss based on the first positive sample pair mask and the first negative sample pair mask;

[0174] In an optional example, the second determination subunit 502294 is specifically used to: generate a second positive sample pair mask based on a second positive sample pair set; generate a second negative sample pair mask based on a second negative sample pair set; and determine a second pixel-level directional contrast loss based on the second positive sample pair mask and the second negative sample pair mask.

[0175] In an optional example, the first determination unit 50225 is specifically used to: perform one-hot encoding on the third probability data to obtain first pseudo label data.

[0176] In an optional example, the second determination unit 50226 is specifically used to: perform one-hot encoding on the fourth probability data to obtain second pseudo label data.

[0177] In an alternative example, Fig.15 is a structural diagram of a fourth determination unit 50228 provided by an exemplary embodiment of the present disclosure; in this example, the fourth determination unit 50228 includes: a second processing subunit 502281, a third processing subunit 502282 and a fourth processing subunit 502283.

[0178] The second processing subunit 502281 is used to determine the first cross entropy corresponding to each pixel of the second image data under the first semantic segmentation network based on the third probability data and the second pseudo-label data; the third processing subunit 502282 is used to determine the second cross entropy corresponding to each pixel of the second image data under the second semantic segmentation network based on the fourth probability data and the first pseudo-label data; the fourth processing subunit 502283 is used to determine the second cross entropy loss based on the first cross entropy corresponding to each pixel of the second image data obtained by the second processing subunit 502281 and the second cross entropy corresponding to each pixel of the second image data obtained by the third processing subunit 502282.

[0179] In an optional example, the parameter adjustment unit 50230 is specifically used to: perform weighted summation of the first cross entropy loss, the second cross entropy loss and the pixel-level contrast loss based on preset weights to obtain a comprehensive loss; determine that the comprehensive loss does not meet the preset training end conditions, and adjust the parameters of the semantic segmentation network based on the comprehensive loss; or, determine that the comprehensive loss meets the preset training end conditions, and end the training.

[0180] Another embodiment of the present disclosure further provides a semantic segmentation device for an image. The device of this embodiment can be used to implement the corresponding semantic segmentation method embodiment of the present disclosure. Fig.16 6 is a schematic diagram of a structure of an image semantic segmentation device provided by an exemplary embodiment of the present disclosure. The image semantic segmentation device comprises: a second acquisition module 601 and a second processing module 602.

[0181] The second acquisition module 601 is used to acquire the image data to be processed; the second processing module 602 is used to perform semantic segmentation on the image data to be processed based on a pre-acquired semantic segmentation model to obtain a semantic segmentation result corresponding to the image data to be processed; wherein the semantic segmentation model is obtained by the training method of the semantic segmentation model provided in any of the above embodiments or examples.

[0182] Exemplary Electronic Devices

[0183] The embodiment of the present disclosure also provides an electronic device, including: a memory for storing a computer program;

[0184] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method described in any of the above embodiments of the present disclosure is implemented.

[0185] Fig.17 FIG. 1 is a schematic diagram of a structure of an application embodiment of the electronic device disclosed in the present invention. In this embodiment, the electronic device 10 includes one or more processors 11 and a memory 12.

[0186] The processor 11 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.

[0187] The memory 12 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may run the program instructions to implement the methods of the various embodiments of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0188] In one example, the electronic device 10 may further include: an input device 13 and an output device 14, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0189] For example, the input device 13 may be the microphone or microphone array mentioned above, which is used to capture the input signal of the sound source.

[0190] In addition, the input device 13 may also include, for example, a keyboard, a mouse, and the like.

[0191] The output device 14 can output various information to the outside, including the determined distance information, direction information, etc. The output device 14 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0192] Of course, to simplify, Fig.17 Only some of the components related to the present disclosure in the electronic device 10 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 10 may also include any other appropriate components.

[0193] Exemplary computer program products and computer-readable storage media

[0194] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the method according to various embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of this specification.

[0195] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0196] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enable the processor to execute the steps of the method according to various embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.

[0197] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0198] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.

[0199] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0200] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.

[0201] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.

[0202] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.

[0203] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0204] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A method for training a semantic segmentation model, comprising: Get training data; Using the training data, a pre-established semantic segmentation network is trained using a training method that integrates pixel-level contrastive learning and cross-supervised semi-supervised learning to obtain a semantic segmentation model; Among them, the training data includes first image data, first label data corresponding to the first image data, and second image data; the semantic segmentation network includes a first semantic segmentation network and a second semantic segmentation network; the training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision refers to using supervised learning loss, cross-supervised learning loss and pixel-level contrast loss together to update network parameters; the pixel contrast learning refers to determining the pixel-level contrast loss according to a preset pixel-level contrast rule for the feature map output by the preset layer of the first semantic segmentation network and the second semantic segmentation network for the second image data.

2. The method according to claim 1, wherein: The method of using the training data to train the pre-established semantic segmentation network by adopting a training method of integrating pixel-level contrast learning and cross-supervised semi-supervised learning to obtain a semantic segmentation model includes: Using the first image data and the first label data, respectively, a first semantic segmentation network and a second semantic segmentation network established in advance are trained in supervised learning; Using the second image data, training the first semantic segmentation network and the second semantic segmentation network by cross-supervised learning, and training the first semantic segmentation network and the second semantic segmentation network by pixel-level contrast learning based on a pixel-level contrast rule; Determine the current loss based on a preset loss function, wherein the preset loss function includes a first loss function corresponding to the supervised learning, a second loss function corresponding to the cross-supervised learning, and a third loss function corresponding to the pixel-level contrastive learning; Determine that the current loss meets a preset condition, end the training, and use the first semantic segmentation network or the second semantic segmentation network obtained through training as the semantic segmentation model.

3. The method according to claim 1, wherein: The method of using the training data to train the pre-established semantic segmentation network by adopting a training method of integrating pixel-level contrast learning and cross-supervised semi-supervised learning to obtain a semantic segmentation model includes: Predicting the first image data using a first semantic segmentation network to obtain first probability data corresponding to the first image data; Using a second semantic segmentation network to predict the first image data, to obtain second probability data corresponding to the first image data; Using the first semantic segmentation network to predict the second image data, to obtain a third feature map and third probability data corresponding to the second image data; Using the second semantic segmentation network to predict the second image data, to obtain a fourth feature map and fourth probability data corresponding to the second image data; Determine first pseudo label data based on the third probability data as label data of the second image data under the second semantic segmentation network; Determine second pseudo label data based on the fourth probability data as label data of the second image data under the first semantic segmentation network; Determining a first cross entropy loss based on the first probability data, the second probability data, and the first label data; Determining a second cross entropy loss based on the third probability data, the second pseudo label data, the fourth probability data, and the first pseudo label data; Based on the third probability data and the fourth probability data, performing pixel-level comparison on the third feature map and the fourth feature map to obtain a pixel-level comparison loss; Based on the first cross entropy loss, the second cross entropy loss and the pixel-level contrast loss, the parameters of the semantic segmentation network are adjusted until a preset training end condition is met to obtain the semantic segmentation model.

4. The method according to claim 3, wherein: The pixel-level contrast loss includes a first pixel-level directional contrast loss and a second pixel-level directional contrast loss; The performing pixel-level comparison on the third feature map and the fourth feature map based on the third probability data and the fourth probability data to obtain a pixel-level comparison loss includes: Performing channel dimensionality reduction processing on the third feature map to obtain a fifth feature map, and performing channel dimensionality reduction processing on the fourth feature map to obtain a sixth feature map; Based on the fifth feature map, the sixth feature map and the preset sampling rule, pixel sample pairs are sampled to obtain a first positive sample pair set, a second positive sample pair set, a first negative sample pair set and a second negative sample pair set; the first positive sample pair set and the first negative sample pair set are respectively a positive sample pair set and a negative sample pair set obtained by sampling with pixels in the fifth feature map as reference samples, and the second positive sample pair set and the second negative sample pair set are respectively a positive sample pair set and a negative sample pair set obtained by sampling with pixels in the sixth feature map as reference samples; Determining the first pixel-level directional contrast loss based on the first positive sample pair set and the first negative sample pair set; The second pixel-level oriented contrast loss is determined based on the second positive sample pair set and the second negative sample pair set.

5. The method according to claim 4, wherein: The pixel sample pair sampling is performed based on the fifth feature map, the sixth feature map and the preset sampling rule to obtain a first positive sample pair set, a second positive sample pair set, a first negative sample pair set and a second negative sample pair set, including: For any first pixel in the fifth feature map and any second pixel in the sixth feature map, determine that the first pixel and the second pixel are located at the same position, and the maximum probability corresponding to the first pixel is less than the maximum probability corresponding to the second pixel, and the maximum probability corresponding to the second pixel is greater than a preset probability threshold, then use the first pixel and the second pixel as a positive sample pair with the pixel in the fifth feature map as a reference sample; thereby obtaining the first positive sample pair set; Determining that the first pixel and the second pixel are located at the same position, and the maximum probability corresponding to the first pixel is greater than the maximum probability corresponding to the second pixel, and the maximum probability corresponding to the first pixel is greater than a preset threshold, then taking the first pixel and the second pixel as a positive sample pair with the pixel in the sixth feature map as a reference sample; thereby obtaining the second positive sample pair set; It is determined that the first pixel and the second pixel are located at different positions, and the maximum probability of the first pixel and the maximum probability of the second pixel are inconsistent in type, then the first pixel and the second pixel are used as a negative sample pair with the pixels in the fifth feature map as the reference sample, and the first pixel and the second pixel are used as a negative sample pair with the pixels in the sixth feature map as the reference sample; thereby obtaining the first negative sample pair set and the second negative sample pair set.

6. The method according to claim 4, wherein: The determining the first pixel-level directional contrast loss based on the first positive sample pair set and the first negative sample pair set includes: generating a first positive sample pair mask based on the first positive sample pair set; generating a first negative sample pair mask based on the first negative sample pair set; Determining the first pixel-level directional contrast loss based on the first positive sample pair mask and the first negative sample pair mask; The determining the second pixel-level directional contrast loss based on the second positive sample pair set and the second negative sample pair set includes: generating a second positive sample pair mask based on the second positive sample pair set; generating a second negative sample pair mask based on the second negative sample pair set; The second pixel-level oriented contrast loss is determined based on the second positive sample pair mask and the second negative sample pair mask.

7. The method according to claim 3, wherein: The determining the first pseudo label data based on the third probability data comprises: Performing one-hot encoding on the third probability data to obtain the first pseudo label data; The determining the second pseudo label data based on the fourth probability data comprises: Perform one-hot encoding on the fourth probability data to obtain the second pseudo label data.

8. The method according to claim 3, wherein: The determining a second cross entropy loss based on the third probability data, the second pseudo label data, the fourth probability data and the first pseudo label data comprises: Determine, based on the third probability data and the second pseudo-label data, first cross entropies corresponding to each pixel of the second image data under the first semantic segmentation network; Determine, based on the fourth probability data and the first pseudo-label data, second cross entropies corresponding to each pixel of the second image data under the second semantic segmentation network; The second cross entropy loss is determined based on the first cross entropy and the second cross entropy respectively corresponding to each pixel of the second image data.

9. The method according to claim 3, wherein: The adjusting the parameters of the semantic segmentation network based on the first cross entropy loss, the second cross entropy loss and the pixel-level contrast loss until a preset training end condition is met includes: Performing a weighted summation of the first cross entropy loss, the second cross entropy loss, and the pixel-level contrast loss based on a preset weight to obtain a comprehensive loss; Determine that the comprehensive loss does not meet the preset training end condition, and adjust the parameters of the semantic segmentation network based on the comprehensive loss; or determine that the comprehensive loss meets the preset training end condition, and end the training.

10. A method for semantic segmentation of an image, comprising: Obtain image data to be processed; Performing semantic segmentation on the image data to be processed based on a pre-acquired semantic segmentation model to obtain a semantic segmentation result corresponding to the image data to be processed; The semantic segmentation model is obtained by the training method of the semantic segmentation model as described in any one of claims 1-9.

11. A training device for a semantic segmentation model, comprising: A first acquisition module, used to acquire training data; A first processing module is used to train a pre-established semantic segmentation network using the training data by adopting a training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision to obtain a semantic segmentation model; Among them, the training data includes first image data, first label data corresponding to the first image data, and second image data; the semantic segmentation network includes a first semantic segmentation network and a second semantic segmentation network; the training method of semi-supervised learning that integrates pixel-level contrast learning and cross-supervision refers to using supervised learning loss, cross-supervised learning loss and pixel-level contrast loss together to update network parameters; the pixel contrast learning refers to determining the pixel-level contrast loss according to a preset pixel-level contrast rule for the feature map output by the preset layer of the first semantic segmentation network and the second semantic segmentation network for the second image data.

12. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the method according to any one of claims 1 to 10.

13. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1-10.

Citation Information

Patent Citations

  • Image Semantic Segmentation Method Based on Deep Full Convolutional Network and Conditional Random Field

    AU2020103901A4

  • Semi-supervised semantic segmentation method based on maximum confidence

    CN110837836A

  • Tidal zone surveying and mapping method and device based on semantic segmentation

    CN111666953A

  • Unsupervised domain adaptive semantic segmentation method

    CN112699892A

  • Unsupervised semantic segmentation method and system for large-scale data

    CN113223037A