Training method of semantic segmentation model, semantic segmentation method and device

By adopting knowledge distillation technology in the semantic segmentation model and utilizing the common semantic type prediction part of the student model and the teacher model, the problem of low training efficiency and accuracy of the semantic segmentation model in the existing technology is solved, and more efficient semantic segmentation results and Reduce model dependencies.

CN114648638BActive Publication Date: 2024-09-06BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210351083.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-02
Publication Date
2024-09-06
Estimated Expiration
2042-04-02

AI Technical Summary

Technical Problem

During the training process of existing semantic segmentation models, it is difficult to obtain more accurate semantic segmentation results, and knowledge distillation usually requires complex teacher models, resulting in high training efficiency and model dependence.

Method used

A semantic segmentation model training method including the first network and the third network is adopted. Through knowledge distillation technology, the common semantic type prediction part of the student model and the teacher model is used to calculate the loss function and adjust the parameters to achieve efficient training of the student model and avoid Reliance on complex teacher models.

Benefits of technology

It achieves more accurate semantic segmentation model training, reduces dependence on complex teacher models, improves training speed and model accuracy, and avoids the occurrence of contrastive learning noise during the training process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114648638B
    Figure CN114648638B
Patent Text Reader

Abstract

The present disclosure provides a training method, a semantic segmentation method, a device, an electronic device and a medium for a semantic segmentation model, and relates to the fields of image processing and artificial intelligence, and in particular to computer vision, semantic segmentation and knowledge distillation. A training method for a semantic segmentation model includes: determining at least one sample data, each sample data including a sample image, a true semantic segmentation mask and a true semantic type; for each sample data: inputting the sample image into a first network to obtain a first image feature and a first predicted semantic segmentation mask; inputting the true semantic segmentation mask and the true semantic type into a second network to obtain a second image feature and a second predicted semantic segmentation mask; inputting the first image feature into a third network to obtain a first predicted semantic type, and inputting the second image feature into the third network to obtain a second predicted semantic type; determining a loss function; and adjusting the parameters of the first network based on the loss function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing and artificial intelligence technology, in particular to computer vision, semantic segmentation and knowledge distillation, and specifically to a training method for a semantic segmentation model, a semantic segmentation method, a device, an electronic device, a computer-readable storage medium and a computer program product. Background Art

[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0003] In image processing and computer vision, a widely used technology is called semantic segmentation. Semantic segmentation is a method that enables computers to segment images based on the semantics of the image, segmenting different objects in the image from the perspective of pixels. Semantic segmentation is widely used in various fields. Summary of the invention

[0004] The present disclosure provides a training method for a semantic segmentation model, a semantic segmentation method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] According to one aspect of the present disclosure, a training method for a semantic segmentation model is provided, wherein the semantic segmentation model is used to determine a semantic segmentation mask and a semantic type based on an input image, and the semantic segmentation model includes a first network and a third network, wherein the first network is used to determine a semantic segmentation mask and image features based on the input image, and the third network is used to determine a semantic type based on image features, and the training method includes: determining at least one sample data, each sample data including a sample image, a true semantic segmentation mask and a true semantic type; for each sample data: inputting the sample image into the first network to obtain a first image feature and a first predicted semantic segmentation mask; and inputting the true semantic segmentation mask and the true semantic type into the second network to obtain a second image feature and a second predicted semantic segmentation mask; inputting the first image feature into the third network to obtain a first predicted semantic type, and inputting the second image feature into the third network to obtain a second predicted semantic type; determining a loss function based on the first predicted semantic segmentation mask, the first predicted semantic type, the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask and the true semantic type; and adjusting the parameters of the first network based on the loss function.

[0006] According to another aspect of the present disclosure, a semantic segmentation method is provided, comprising: inputting an image to be processed into a feature extraction and semantic segmentation network to obtain image features and a semantic segmentation mask; inputting the image features into a semantic type determination network to obtain a semantic type; and determining a semantic segmentation result based on the semantic segmentation mask and the semantic type, wherein the feature extraction and semantic segmentation network is a first network trained according to a training method for a semantic segmentation model according to one or more embodiments of the present disclosure.

[0007] According to another aspect of the present disclosure, a training device for a semantic segmentation model is provided, wherein the semantic segmentation model is used to determine a semantic segmentation mask and a semantic type based on an input image, wherein the semantic segmentation model comprises a first network and a third network, wherein the first network is used to determine a semantic segmentation mask and an image feature based on the input image, and the third network is used to determine a semantic type based on the image feature, and wherein the training device comprises: a sample data determination unit, used to determine at least one sample data, each sample data comprising a sample image, a true semantic segmentation mask and a true semantic type; and a sample data input unit, used to: for each sample data, input a sample image into the first network, obtain a first image feature and a first predicted semantic type segmentation mask; and inputting the true semantic segmentation mask and the true semantic type into the second network to obtain a second image feature and a second predicted semantic segmentation mask; a semantic type determining unit, used to input the first image feature into the third network to obtain a first predicted semantic type, and input the second image feature into the third network to obtain a second predicted semantic type; a loss function determining unit, used to determine a loss function based on the first predicted semantic segmentation mask, the first predicted semantic type, the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask and the true semantic type; and a parameter adjusting unit, used to adjust the parameters of the first network based on the loss function.

[0008] According to another aspect of the present disclosure, a semantic segmentation device is provided, comprising: an image input unit, used to input a to-be-processed image into a feature extraction and semantic segmentation network to obtain image features and a semantic segmentation mask; an image feature input unit, used to input the image features into a semantic type determination network to obtain a semantic type; and a semantic segmentation result determination unit, used to determine a semantic segmentation result based on the semantic segmentation mask and the semantic type, wherein the feature extraction and semantic segmentation network is a first network trained according to a training method for a semantic segmentation model according to one or more embodiments of the present disclosure.

[0009] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a training method for a semantic segmentation model or a semantic segmentation method according to one or more embodiments of the present disclosure.

[0010] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute a training method for a semantic segmentation model or a semantic segmentation method according to one or more embodiments of the present disclosure.

[0011] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program, when executed by a processor, implements a training method for a semantic segmentation model or a semantic segmentation method according to one or more embodiments of the present disclosure.

[0012] According to one or more embodiments of the present disclosure, a more accurate semantic segmentation model or a more accurate semantic segmentation result may be obtained.

[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0015] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;

[0016] Figure 2 A flowchart of a method for training a semantic segmentation model according to an embodiment of the present disclosure is shown;

[0017] Figure 3 A schematic diagram showing a model to which one or more embodiments of the present disclosure may be applied;

[0018] Figure 4 A flowchart of a semantic segmentation method according to an embodiment of the present disclosure is shown;

[0019] Figure 5 A structural block diagram of a training device for a semantic segmentation model according to an embodiment of the present disclosure is shown;

[0020] Figure 6 A structural block diagram of a semantic segmentation device according to an embodiment of the present disclosure is shown;

[0021] Figure 7 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0022] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0023] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0024] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0025] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0026] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.

[0027] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable execution of the training method of the semantic segmentation model or the semantic segmentation method according to the present disclosure.

[0028] In some embodiments, server 120 may also provide other services or software applications that may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.

[0029] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0030] The user may use the client devices 101, 102, 103, 104, 105 and / or 106 to train a semantic segmentation model, perform semantic segmentation, view training or segmentation results, debug the model, etc. The client device may provide an interface that enables the user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.

[0031] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0032] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0033] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0034] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0035] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.

[0036] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0037] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.

[0038] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0039] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.

[0040] Reference below Figure 2 A training method 200 of a semantic segmentation model according to an exemplary embodiment of the present disclosure is described. The semantic segmentation model can be used to determine a semantic segmentation mask and a semantic type based on an input image, and the semantic segmentation model includes a first network and a third network, wherein the first network is used to determine a semantic segmentation mask and image features based on the input image, and the third network is used to determine a semantic type based on the image features.

[0041] In step S201 , at least one sample data is determined, each sample data includes a sample image, a true semantic segmentation mask and a true semantic type.

[0042] At step S202, for each sample data: the sample image is input into the first network to obtain first image features and a first predicted semantic segmentation mask; and the true semantic segmentation mask and the true semantic type are input into the second network to obtain second image features and a second predicted semantic segmentation mask.

[0043] At step S203, the first image feature is input into the third network to obtain a first predicted semantic type, and the second image feature is input into the third network to obtain a second predicted semantic type.

[0044] At step S204, a loss function is determined based on the first predicted semantic segmentation mask, the first predicted semantic type, the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask, and the true semantic type.

[0045] At step S205, parameters of the first network are adjusted based on the loss function.

[0046] According to the method described in the embodiment of the present disclosure, a more accurate semantic segmentation model can be obtained.

[0047] In particular, according to an embodiment of the present disclosure, it is possible to quickly and effectively train a semantic segmentation network with the help of knowledge distillation. The first network can be regarded as a student model, and the second network can be regarded as a teacher model. The student model is trained with the help of the teacher model during training, and the trained model uses the student model when applied. Specifically, during the training process, the student model inputs the original image, and the teacher model inputs the semantic segmentation result. The student model and the teacher model share the semantic type prediction part, that is, the third network. Using the outputs of the student model, the teacher model, and the semantic type prediction network (third network) compared with the true label, the loss function can be calculated, and the parameters of the first network can be adjusted. For example, the difference between each predicted label and the corresponding true label can be calculated, and the parameters can be adjusted to minimize the difference (for example, the sum of the squares of the difference). Other methods for calculating loss functions known to those skilled in the art can also be used, and the present disclosure is not limited to this.

[0048] It is understandable that the third network can be a pre-trained semantic type recognition network, or the parameters of the third network can be adjusted based on the loss function, and the present disclosure is not limited thereto. It is also understandable that the second network can be a pre-trained network, a preliminarily trained network, or the parameters of the second network can be adjusted based on the loss function, and the present disclosure is not limited thereto.

[0049] Generally speaking, knowledge distillation requires a complex teacher network. On the contrary, according to the embodiments of the present disclosure, a better semantic segmentation model can be obtained without a particularly complex teacher model.

[0050] According to some embodiments, the loss function may include a first sub-loss part, and determining the loss function includes determining the first sub-loss part based on the first predicted semantic segmentation mask, the first predicted semantic type, the true semantic segmentation mask and the true semantic type, and the first sub-loss part identifies the difference between the first predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the first predicted semantic type and the true semantic type.

[0051] In such an embodiment, the first sub-loss portion is constructed based on the difference between the predicted value generated by the student model and the true value, and can reflect the difference between the result predicted by the student model itself (the first network, or the first network and the third network) and the true label.

[0052] According to some embodiments, the loss function may include a second sub-loss part, and determining the loss function includes determining the second sub-loss part based on the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask and the true semantic type, and the second sub-loss part identifies the difference between the second predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the second predicted semantic type and the true semantic type. In such an embodiment, the second sub-loss part constructs a loss function based on the difference between the predicted value and the true value of the second network (teacher model), and the effect of knowledge distillation is achieved through the difference of the teacher model.

[0053] According to some embodiments, the loss function may include a third sub-loss part, and determining the loss function includes determining the third sub-loss part based on the first predicted semantic segmentation mask and the second predicted semantic segmentation mask, and the third sub-loss part identifies the difference between the first predicted semantic segmentation mask and the second predicted semantic segmentation mask.

[0054] In such an embodiment, a loss function (or part of a loss function) is constructed based on the difference in results between the student model and the teacher model, thereby enabling comparative learning between the student model and the teacher model, making the student model more quickly trained and obtaining a more accurate student model.

[0055] It is understood that the above description that the loss function may include a specific sub-loss part does not require that the loss function must be composed of more than one "sub-loss function", and the use of the term "sub-loss function" does not mean that the sub-loss function must be only a part of the loss function. For example, the loss function may include only one of the first sub-loss part, the second sub-loss part, or the third sub-loss part. Alternatively, at certain accuracy requirements or certain training stages (e.g., early stages), the loss function may include one or more of these sub-loss parts, and at other accuracy requirements or different training stages, the loss function may include one or more additional sub-loss parts, and so on. It is further understood that the above first sub-loss part, the second sub-loss part, or the third sub-loss part are only examples, and the loss function may include more or different forms of parts. As a non-limiting example, the loss function may not include the second sub-loss part as described above, but include a loss part that identifies the difference between the second predicted semantic segmentation mask and the true semantic segmentation mask, and so on, and the present disclosure is not limited thereto.

[0056] According to some embodiments, determining a third loss function based on the first predicted semantic segmentation mask and the second predicted semantic segmentation mask may include: determining a first matching mask set based on the first predicted semantic segmentation mask and the true semantic segmentation mask; determining a second matching mask set based on the second predicted semantic segmentation mask and the true semantic segmentation mask; determining mask similarity based on the first matching mask set and the second matching mask set; and determining the third loss function based on the mask similarity.

[0057] In such an optional embodiment, the loss function can be calculated at the mask level, which can more accurately reflect the differences, thereby more efficiently training to obtain an accurate model. More specifically, since there is no overlap between different masks of the same image, no noise will appear during the comparative learning process, thereby achieving better training results. The similarity at the mask level can use the dice value, and this will be further described in conjunction with specific embodiments below.

[0058] According to some embodiments, the first predicted semantic segmentation mask and the second predicted semantic segmentation mask may have a first dimension, the true semantic segmentation mask, the first matching mask set and the second matching mask set may have a second dimension, and the first dimension is greater than the second dimension.

[0059] The specific data format is constructed, that is, the semantic segmentation mask output by the third model has redundant dimensions, so that it can be applied to a variety of different samples and facilitate training.

[0060] According to some embodiments, the method may further include adjusting the parameters of the second network based on the loss function. In such an embodiment, the teacher model may be trained while the student model is being trained, thereby achieving a self-distillation effect. The teacher model may be partially pre-trained, so that a more accurate teacher model can facilitate the realization of a more accurate student model. Furthermore, optionally, the teacher model may adopt initial parameters and be trained together with the student model, so that self-distillation no longer requires a prior pre-training process for the teacher model and can still achieve a distillation effect.

[0061] According to some embodiments, the first network and the second network may have the same network structure and initial parameters. In such an embodiment, the teacher model and the student model share the structure and initial parameters, and the effect of knowledge distillation can be achieved without a complex teacher model.

[0062] According to some embodiments, the method may further include adjusting parameters of the third network based on the loss function. The third network may be trained simultaneously, so that the network has a better training effect.

[0063] It is understood that in some optional embodiments, the first network, the second network and the third network can all be adjusted during the training process, thereby eliminating the need for pre-training of any part of the network. In other embodiments, each network part can also be pre-trained or pre-partially trained, and the present disclosure is not limited thereto.

[0064] According to some embodiments, the third network may include a transformer model and a fully connected layer network connected after the transformer model. Through such a third network, on the one hand, the transformer model can be used to accurately focus on the features that need to be paid attention to through the attention mechanism, so it is suitable for prediction from features to semantic types, and the subsequent fully connected layer network is suitable for further classification and identification of parameters, thereby obtaining better results. It is understandable that the present disclosure is not limited to this, and other types of networks that can be thought of by those skilled in the art can also be used as the third network here.

[0065] According to one or more embodiments of the present disclosure, the problem that knowledge distillation has too high requirements for an excellent teacher model in semantic segmentation can be solved. According to one or more embodiments of the present disclosure, the semantic segmentation annotation of the image can be input into the backbone network of the teacher model, and the semantic type determination part (third network) whose parameters are shared by the teacher model and the student model is used to perform conventional semantic segmentation training on the original image input, reconstruct the input of the semantic segmentation label, and optionally, comparative learning can be performed between the masks of the two. According to one or more embodiments of the present disclosure, it is no longer necessary to use a very large teacher model. In particular, it avoids the problem of excessive reliance on excellent teacher models that often exist in knowledge distillation, and the need to spend a lot of time in advance to train a teacher model, and such a model training process can better integrate the distilled information into the model through comparative self-distillation.

[0066] Reference Figure 3 A specific non-limiting embodiment according to the present disclosure is described, in which a first network (student model) part 310, a second network (teacher model) part 320 and a third network part 330 are shown. The student model part 310 may include a backbone network 311, one or more layers 312, a pixel decoder network 313, one or more layers 314, a label prediction part 315 and a matching part 316. The teacher model 320 may similarly include a backbone network 321, one or more layers 322, a pixel decoder network 323, one or more layers 324, a label prediction part 325 and a matching part 326, and its structure may be optionally the same as the structure of the corresponding part of the student model. It can be understood that the above structures are all examples, and any one of the teacher model and the student model may include more or less parts, or completely different sub-network parts, as long as it can achieve the corresponding function (feature extraction, etc.).

[0067] The original image in the sample data can be input into the student model. Specifically, given a calibrated sample data, it can be an image label pair {x s ,z gt}, x s It's a picture, gt is the corresponding annotation, and where z gt It can also further include category labels c gt and m gt Mask label m gt .

[0068] For example, let W and H represent the width and height of the image.s The third network 330 and the student model 310 can output the predicted probability p respectively. s and the predicted mask label m s , where the probability distribution p s Contains an empty class label and K true labels.

[0069] In the prediction set p s m s and c gt m gt Between, the optimal binary matching is performed for the student model 310 to calculate the supervision loss:

[0070]

[0071] Where Q represents the empty class and σ(i) represents the optimal binary matching.

[0072] For the teacher model 320, the sample data and the image x s The corresponding z gt Input to the teacher model. Here, it can be considered that the student model and the teacher model share the same third network part. In other words, the teacher model outputs the predicted mask label m t , and the third network part is the probability p corresponding to the output of the teacher model t For example, z can be reconstructed by the same loss as the student model gt , and the supervision loss can be calculated:

[0073]

[0074] It is understandable that although Figure 3 The third network part 330 is shown to include two sub-network parts, namely a transformer network 331 and multiple layers (e.g., a fully connected network MLP) 332, but it is understood that the present disclosure is not limited thereto. The third network can use other networks that generate prediction probabilities (prediction semantics) based on image features, and can include more or fewer sub-parts.

[0075] In the case where the third network portion 330 includes a transformer model, the input dimension of the transformer model, i.e., the dimension of the object query, can be set to a larger value (e.g., 50, 100, or other values ​​greater than the number of different semantic types that can be segmented in a common image). The input dimension here can be understood as the first dimension as described above. For example, the first dimension can be 100, meaning that up to 100 different categories can be identified from the image, and the second dimension may be 3 or 4 (e.g., the semantic segmentation results include four categories: people, horses, sky, and ground). The above is just an example.

[0076] Further, based on some optional embodiments, the output of the teacher model and the student model can be t and m s Do comparative learning between them to better allow the student model to distill the information of the teacher model.

[0077] In general, contrastive learning can be based on image feature level (image classification) or pixel level (semantic segmentation). Some optional embodiments of the present disclosure propose mask-level contrastive learning, and specifically may include completing training by comparing the similarity between 0-1 masks. The advantage of mask-level contrastive learning is that since there is no overlap between different masks of the same image, no noise will appear in the contrastive learning process. The loss function can be set so that the model (the first network part, and optionally, the second network part and / or the third network part) is adjusted to increase the similarity of masks of the same category between the outputs of the teacher model and the student model, and reduce the similarity between mismatched mask pairs.

[0078] More specifically, a mask-level contrastive learning (MC) loss is proposed. The class values ​​(logits) and mask embeddings (mask embeddings) are obtained from the outputs of the teacher network and the student network, and the class values ​​and mask embeddings can be multiplied by matrix multiplication to obtain the corresponding mask prediction results. t and m s By performing optimal binary matching with the semantic segmentation annotation, i.e. the real result, we can get the matched set Where N is the number of masks in the input image, and σ(i) represents the optimal binary match. The MaskContrastive loss function can be defined as follows:

[0079]

[0080] in, is used to measure the local similarity between masks. As will be appreciated by those skilled in the art, τ m Represents the temperature parameter in distillation learning. Its meaning is not repeated here.

[0081] Based on the example above, the overall loss function can be defined as:

[0082] L total =L student +L teacher +αL contrastive

[0083] Wherein, α can be a constant used to balance the contrast loss and the regular training loss. As a non-limiting example, α can be 0.2, 0.5, 0.8, etc.

[0084] According to such an embodiment, the segmentation accuracy of the semantic segmentation system based on deep learning can be effectively improved. It can be understood that the above network model, function construction and parameter values ​​are only examples, and the present disclosure is not limited thereto.

[0085] Reference below Figure 4 A semantic segmentation method 400 according to an exemplary embodiment of the present disclosure is described.

[0086] At step 401, the image to be processed is input into a feature extraction and semantic segmentation network to obtain image features and a semantic segmentation mask.

[0087] At step 402, the image features are input into a semantic type determination network to obtain a semantic type.

[0088] At step 403, a semantic segmentation result is determined based on the semantic segmentation mask and the semantic type, wherein the feature extraction and semantic segmentation network is a first network trained according to the training method of the semantic segmentation model of an embodiment of the present disclosure.

[0089] According to the method described in the embodiment of the present disclosure, a more accurate semantic segmentation result can be obtained.

[0090] According to some embodiments, the semantic type determination network is a third network trained according to the training method of the semantic segmentation model of an embodiment of the present disclosure.

[0091] Reference now Figure 5A training device 500 for a semantic segmentation model according to an embodiment of the present disclosure is described. The semantic segmentation model is used to determine a semantic segmentation mask and a semantic type based on an input image, and the semantic segmentation model includes a first network and a third network, the first network is used to determine a semantic segmentation mask and image features based on the input image, and the third network is used to determine a semantic type based on image features. The device 500 may include a sample data determination unit 501, a sample data input unit 502, a semantic type determination unit 503, a loss function determination unit 504, and a parameter adjustment unit 505.

[0092] The sample data determining unit 501 may be configured to determine at least one sample data, each sample data including a sample image, a true semantic segmentation mask and a true semantic type.

[0093] The sample data input unit 502 can be used to: for each sample data, input the sample image into the first network to obtain first image features and a first predicted semantic segmentation mask; and input the true semantic segmentation mask and the true semantic type into the second network to obtain second image features and a second predicted semantic segmentation mask.

[0094] The semantic type determination unit 503 may be configured to input the first image feature into the third network to obtain a first predicted semantic type, and input the second image feature into the third network to obtain a second predicted semantic type.

[0095] The loss function determination unit 504 may be configured to determine a loss function based on the first predicted semantic segmentation mask, the first predicted semantic type, the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask, and the true semantic type.

[0096] The parameter adjustment unit 505 may be configured to adjust the parameters of the first network based on the loss function.

[0097] According to the device described in the embodiment of the present disclosure, a more accurate semantic segmentation model can be obtained.

[0098] According to some embodiments, the loss function may include a first sub-loss part, and determining the loss function includes determining the first sub-loss part based on the first predicted semantic segmentation mask, the first predicted semantic type, the true semantic segmentation mask and the true semantic type, and the first sub-loss part identifies the difference between the first predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the first predicted semantic type and the true semantic type.

[0099] According to some embodiments, the loss function may include a second sub-loss part, and determining the loss function includes determining the second sub-loss part based on the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask and the true semantic type, and the second sub-loss part identifies the difference between the second predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the second predicted semantic type and the true semantic type.

[0100] According to some embodiments, the loss function may include a third sub-loss part, and determining the loss function includes determining the third sub-loss part based on the first predicted semantic segmentation mask and the second predicted semantic segmentation mask, and the third sub-loss part identifies the difference between the first predicted semantic segmentation mask and the second predicted semantic segmentation mask.

[0101] Reference now Figure 6 The semantic segmentation apparatus 600 according to an embodiment of the present disclosure is described. The semantic segmentation apparatus 600 may include an image input unit 601 , an image feature input unit 602 , and a semantic segmentation result determination unit 603 .

[0102] The image input unit 601 can be used to extract features of the image to be processed and input it into a semantic segmentation network to obtain image features and a semantic segmentation mask.

[0103] The image feature input unit 602 may be used to input the image feature into a semantic type determination network to obtain a semantic type.

[0104] The semantic segmentation result determination unit 603 can be used to determine the semantic segmentation result based on the semantic segmentation mask and the semantic type, wherein the feature extraction and semantic segmentation network can be the first network trained according to the training method of the semantic segmentation model of an embodiment of the present disclosure.

[0105] According to the device described in the embodiment of the present disclosure, more accurate semantic segmentation results can be obtained.

[0106] In the technical solution disclosed herein, the collection, acquisition, storage, use, processing, transmission, provision and public application of user personal information involved are in compliance with the relevant laws and regulations and do not violate public order and good morals.

[0107] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.

[0108] refer to Figure 7, a block diagram of an electronic device 700 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0109] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0110] Multiple components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device that can input information to the electronic device 700. The input unit 706 can receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 707 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 can include but is not limited to a disk, an optical disk. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0111] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as methods 200 and / or 400 and their variants, etc. For example, in some embodiments, methods 200 and / or 400 and their variants, etc. may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the methods 200 and / or 400 and their variants, etc. described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to execute the methods 200 and / or 400 and their variations, etc., in any other appropriate manner (eg, by means of firmware).

[0112] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0113] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0114] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0116] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0117] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0119] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A training method for a semantic segmentation model, wherein the semantic segmentation model is used to determine a semantic segmentation mask and a semantic type based on an input image, wherein the semantic segmentation model comprises a first network and a third network, wherein the first network is used to determine a semantic segmentation mask and an image feature based on the input image, and the third network is used to determine a semantic type based on the image feature, wherein the training method comprises: Determine at least one sample data, each sample data includes a sample image, a true semantic segmentation mask and a true semantic type; For each sample data: Inputting the sample image into the first network to obtain a first image feature and a first predicted semantic segmentation mask; and Inputting the true semantic segmentation mask and the true semantic type into the second network to obtain a second image feature and a second predicted semantic segmentation mask; Inputting the first image feature into the third network to obtain a first predicted semantic type, and inputting the second image feature into the third network to obtain a second predicted semantic type; determining a loss function based on the first predicted semantic segmentation mask, the first predicted semantic type, the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask, and the true semantic type; and Parameters of the first network are adjusted based on the loss function.

2. The method according to claim 1, wherein: The loss function includes a first sub-loss part, and determining the loss function includes determining the first sub-loss part based on the first predicted semantic segmentation mask, the first predicted semantic type, the true semantic segmentation mask and the true semantic type, and the first sub-loss part identifies the difference between the first predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the first predicted semantic type and the true semantic type.

3. The method according to claim 1, wherein: The loss function includes a second sub-loss part, and determining the loss function includes determining the second sub-loss part based on the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask and the true semantic type, and the second sub-loss part identifies the difference between the second predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the second predicted semantic type and the true semantic type.

4. The method according to any one of claims 1 to 3, wherein: The loss function includes a third sub-loss part, and determining the loss function includes determining the third sub-loss part based on the first predicted semantic segmentation mask and the second predicted semantic segmentation mask, and the third sub-loss part identifies the difference between the first predicted semantic segmentation mask and the second predicted semantic segmentation mask.

5. The method according to claim 4, wherein: Determining a third loss function based on the first predicted semantic segmentation mask and the second predicted semantic segmentation mask includes: Determining a first matching mask set based on the first predicted semantic segmentation mask and the true semantic segmentation mask; Determining a second matching mask set based on the second predicted semantic segmentation mask and the true semantic segmentation mask; determining mask similarity based on the first set of matching masks and the second set of matching masks; and The third loss function is determined based on the mask similarity.

6. The method according to claim 5, wherein: The first predicted semantic segmentation mask and the second predicted semantic segmentation mask have a first dimension, the true semantic segmentation mask, the first matching mask set, and the second matching mask set have a second dimension, and the first dimension is greater than the second dimension.

7. The method according to any one of claims 1-3, further comprising adjusting parameters of the second network based on the loss function.

8. The method according to claim 7, wherein: The first network and the second network have the same network structure and initial parameters.

9. The method according to any one of claims 1 to 3, wherein: The method also includes adjusting parameters of the third network based on the loss function.

10. The method according to any one of claims 1 to 3, wherein: The third network includes a transformer model and a fully connected layer network connected after the transformer model.

11. A semantic segmentation method, comprising: Input the image to be processed into the feature extraction and semantic segmentation network to obtain image features and semantic segmentation masks; Inputting the image features into a semantic type determination network to obtain a semantic type; and determining a semantic segmentation result based on the semantic segmentation mask and the semantic type, The feature extraction and semantic segmentation network is a first network trained according to the method described in any one of claims 1 to 10.

12. The semantic segmentation method according to claim 11, wherein: The semantic type determination network is the third network according to claim 9 or 10.

13. A training device for a semantic segmentation model, the semantic segmentation model is used to determine a semantic segmentation mask and a semantic type based on an input image, the semantic segmentation model comprises a first network and a third network, the first network is used to determine a semantic segmentation mask and an image feature based on the input image, the third network is used to determine a semantic type based on the image feature, the training device comprises: A sample data determination unit, used to determine at least one sample data, each sample data including a sample image, a true semantic segmentation mask and a true semantic type; The sample data input unit is used for each sample data: Inputting the sample image into the first network to obtain a first image feature and a first predicted semantic segmentation mask; and Inputting the true semantic segmentation mask and the true semantic type into the second network to obtain a second image feature and a second predicted semantic segmentation mask; a semantic type determination unit, configured to input the first image feature into the third network to obtain a first predicted semantic type, and input the second image feature into the third network to obtain a second predicted semantic type; a loss function determining unit, configured to determine a loss function based on the first predicted semantic segmentation mask, the first predicted semantic type, the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask, and the true semantic type; and A parameter adjustment unit is used to adjust the parameters of the first network based on the loss function.

14. The device according to claim 13, wherein: The loss function includes a first sub-loss part, and determining the loss function includes determining the first sub-loss part based on the first predicted semantic segmentation mask, the first predicted semantic type, the true semantic segmentation mask and the true semantic type, and the first sub-loss part identifies the difference between the first predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the first predicted semantic type and the true semantic type.

15. The device according to claim 13, wherein: The loss function includes a second sub-loss part, and determining the loss function includes determining the second sub-loss part based on the second predicted semantic segmentation mask, the second predicted semantic type, the true semantic segmentation mask and the true semantic type, and the second sub-loss part identifies the difference between the second predicted semantic segmentation mask and the true semantic segmentation mask and the difference between the second predicted semantic type and the true semantic type.

16. The device according to any one of claims 13 to 15, wherein: The loss function includes a third sub-loss part, and determining the loss function includes determining the third sub-loss part based on the first predicted semantic segmentation mask and the second predicted semantic segmentation mask, and the third sub-loss part identifies the difference between the first predicted semantic segmentation mask and the second predicted semantic segmentation mask.

17. A semantic segmentation device, comprising: An image input unit is used to extract features of the image to be processed and input them into a semantic segmentation network to obtain image features and a semantic segmentation mask; An image feature input unit, used for inputting the image feature into a semantic type determination network to obtain a semantic type; as well as a semantic segmentation result determining unit, configured to determine a semantic segmentation result based on the semantic segmentation mask and the semantic type, The feature extraction and semantic segmentation network is a first network trained according to the method described in any one of claims 1 to 10.

18. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10 and 11-12.

19. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10 and 11-12.

20. A computer program product comprising a computer program, wherein: The computer program implements the method of any one of claims 1-10 and 11-12 when executed by a processor.