Real scene image segmentation method based on contrastive self-supervised learning

By comparing self-supervised learning methods, using deep convolutional neural networks and fused atrous convolutions to extract features, and combining image-level and pixel-level losses, we solve the problem of ignoring pixel context in image segmentation in the existing technology, and achieve efficient Image segmentation reduces the dependence on annotation data and improves segmentation performance.

CN114283162BActive Publication Date: 2024-10-29HEBEI UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111607559.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2024-10-29
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

Existing self-supervised learning technology ignores the internal pixel context of the image in image segmentation, resulting in insufficient generalization capabilities of the model for image segmentation, and relies on a large amount of manually annotated data, which is costly.

Method used

A real-life scene image segmentation method based on contrastive self-supervised learning is designed. By comparing the self-supervised learning segmentation model and loss function, the deep convolutional neural network and the spatial pyramid pooling module fused with atrous convolution are used to extract features, combined with the image-level loss and pixel-level context alignment loss to construct spatial context relationships between image pixels.

Benefits of technology

This method reduces the dependence on annotated data, improves the generalization ability and accuracy of image segmentation, has better segmentation performance than traditional machine vision and unsupervised methods, and can effectively segment unlabeled input images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114283162B_ABST
    Figure CN114283162B_ABST
Patent Text Reader

Abstract

The present invention discloses a real-scene image segmentation method based on contrastive self-supervised learning, comprising designing a contrastive self-supervised learning segmentation model and a loss function; the contrastive self-supervised learning segmentation model comprises an upper branch and a lower branch, each branch comprises an encoder, a decoder, a feature projection module and a predictor connected in sequence; an input image is randomly cropped into two image patches with overlapping areas, and the two image patches are processed by two branches of the contrastive self-supervised learning segmentation model respectively; the designed loss function comprises an image-level loss and a pixel-level context alignment loss, the image-level loss is mainly used to calculate the loss between an output feature map of a feature projection module and a prediction map obtained by a predictor, and the pixel-level context alignment loss is mainly used to construct a spatial context relationship between image pixels by maximizing the similarity of overlapping areas of two image patches and minimizing the interference of non-overlapping areas on feature extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision, and specifically provides a real scene image segmentation method based on contrastive self-supervised learning. Background Art

[0002] With the development of intelligent automobile technology, driverless cars have become a research hotspot. Driverless vehicles usually need to be equipped with various sensors to analyze the driving environment by collecting real scene images during driving, and then guide the driverless vehicles to drive safely. In the design process of driverless systems, image analysis and scene understanding are very important links. The key to image analysis is the segmentation of real scene images.

[0003] Although image segmentation based on deep learning has achieved good results, it needs to rely on a large amount of manually annotated data, which is costly, time-consuming and labor-intensive. Self-supervised learning is a representative branch of deep unsupervised learning. It uses the information of the image itself to construct a pseudo-label training model without data annotation. Therefore, many scholars at home and abroad widely use self-supervised learning technology to segment real scene images. For example, Roh B et al. generate randomly cropped local areas based on geometric translation and scaling operations, and use the ROIAlign layer to generate pooling features of local areas, so that the model learns continuous spatial feature representation. However, in image segmentation, the model does not know how many meaningful areas should be generated in the image, that is, the spatial continuity loss is not considered. For details, see the document "Roh B, Shin W, Kim I, et al. Spatially consistent representation learning [C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2021: 1144-1153.".

[0004] In addition, existing self-supervised learning techniques usually focus on generating globally invariant representations at the image level, ignoring the relationship between pixel contexts within the image, thereby limiting the model's generalization ability for image segmentation and resulting in unsatisfactory segmentation results. Summary of the invention

[0005] In view of the deficiencies in the prior art, the technical problem that the present invention intends to solve is to provide a real scene image segmentation method based on contrastive self-supervised learning.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] A real scene image segmentation method based on contrastive self-supervised learning, characterized in that the method includes designing a contrastive self-supervised learning segmentation model and a loss function; wherein the contrastive self-supervised learning segmentation model includes an upper and a lower branch with the same structure, each branch includes an encoder, a decoder, a feature projection module and a predictor connected in sequence; the input image is randomly cropped into two image patches with overlapping areas, and the two image patches are processed by two branches of the contrastive self-supervised learning segmentation model respectively;

[0008] The encoder includes a deep convolutional neural network and a spatial pyramid pooling module fused with dilated convolutions. First, the deep convolutional neural network is used to extract features from image patches to obtain shallow feature maps. Then, the shallow feature maps are optimized using the spatial pyramid pooling module fused with dilated convolutions to obtain deep feature maps.

[0009] The decoder contains two 2D convolutional layers and two upsampling layers. The deep feature map first passes through the 2D convolutional layer to change the number of channels, then passes through the first upsampling layer of the decoder and is fused with the shallow feature map after being processed by the first 2D convolutional layer of the decoder. The fused feature map passes through the second 2D convolutional layer and the second upsampling layer in turn to obtain the output feature map of the decoder.

[0010] The feature projection module includes a fully connected layer and a ReLU layer. The output feature map of the decoder passes through the fully connected layer, the ReLU layer, and the fully connected layer in sequence to obtain the output feature map of the feature projection module.

[0011] The predictor consists of a 1D convolutional module, batch normalization, and a classifier.

[0012] Furthermore, the processing of the comparative self-supervised learning segmentation model is as follows:

[0013] First, assume that the two image patches are x1 and x2, and the overlapping area is x o ; The two image patches are mapped to feature maps f1 and f2 through the corresponding encoder and decoder respectively; the feature maps f1 and f2 are mapped to feature maps φ1 and φ2 through the corresponding feature projection modules respectively, and the overlapping areas in the feature maps φ1 and φ2 are respectively φ o1 and φ o2 express;

[0014] Secondly, assuming that the number of channels of the feature map φ1 is p, the feature map φ1 passes through the one-dimensional convolution module of the predictor to obtain the response map Response Map Contains p channel response maps r n , Represents the channel response map r n The nth pixel in, N represents the channel response map rn The total number of pixels in Represents the parameter matrix of a one-dimensional convolution module;

[0015] Then, for all channel response maps r n Perform batch normalization to obtain a normalized response graph r′ n Represents the nth pixel in the normalized response map;

[0016] Finally, the classifier passes the normalized response map through the argmax function All pixels in are clustered into q clusters, and the cluster labels are obtained. c n Represents the cluster label of the nth pixel, c n =1,2,…,q.

[0017] Furthermore, the designed loss function is:

[0018] L=L s +L ca (2)

[0019] Among them, L s , L ca denote image-level loss and pixel-level context alignment loss respectively;

[0020] The expression of image-level loss is as follows:

[0021] L s =L sim ({r′ n ,c n})+μL con ({r′ n}) (3)

[0022] Among them, L sim ({r′ n ,c n})、L con ({r′ n}) represent feature similarity loss and spatial continuity loss respectively, and μ represents the weight to balance the two constraints;

[0023] Cluster label c n is further used as a pseudo-label to calculate the normalized response map through equation (4) and cluster labels The cross entropy loss between , that is, the feature similarity loss;

[0024]

[0025] in,

[0026] The expression of spatial continuity loss is:

[0027]

[0028] Where W and H represent the width and height of the normalized response map, respectively, and r′ ξ,η , r′ ξ+1,η and r′ ξ,η+1 Respectively represent the pixel values ​​at the pixel points (ξ,η), (ξ+1,η), and (ξ,η+1) in the normalized response map; || ||1 represents the L1 norm;

[0029] Let the batch size of the training batch be B, then the pixel-level context alignment loss L ca for:

[0030]

[0031] Pixel-wise contextual alignment loss for the b-th input image for:

[0032]

[0033]

[0034] in, denote the contextual alignment loss from image patch x1 to x2 and from image patch x2 to x1 respectively; r(·) denotes the exponential function of the similarity between two pixels, Respectively represent the overlapping area φ o1 and φ o2 ; M represents the number of overlapping areas in a training batch, represents the overlapping area φ o1 Negative samples of Represents the set of negative samples consisting of image patches from different input images in the same training batch; Represents a binary mask.

[0035] Furthermore, during the model training process, positive and negative samples are randomly selected as inputs of a contrastive self-supervised learning segmentation model; wherein the overlapping areas of two image patches belonging to the same input image are regarded as positive sample pairs, and the non-overlapping areas of the image patches are regarded as negative samples and two image patches belonging to different input images are regarded as negative sample pairs.

[0036] Furthermore, the method also includes setting parameters, training a comparative self-supervised learning segmentation model, transplanting the trained comparative self-supervised learning segmentation model into a segmentation program, and in actual application, inputting the collected real scene images into the trained comparative self-supervised learning segmentation model to segment the real scene images.

[0037] Compared with the prior art, the present invention has the following beneficial effects:

[0038] 1. The present invention applies contrastive self-supervised learning to image segmentation in real-world scenarios such as autonomous driving, constructs a contrastive self-supervised learning segmentation model, and uses the excellent feature extraction ability of the self-supervised learning model to alleviate the dependence of deep learning on labeled data. Under the premise of ensuring recognition accuracy and real-time performance, there is no need to label the input image, which greatly reduces labor costs. The trained contrastive self-supervised segmentation model has better generalization ability for real-world scene images, and the segmentation performance is far superior to traditional machine vision and general unsupervised methods.

[0039] 2. Randomly crop two image patches from the unlabeled input image, and extract features from the two image patches by comparing the upper and lower branches of the self-supervised learning segmentation model; during the model training process, the overlapping areas of the two image patches belonging to the same input image are regarded as positive sample pairs, the non-overlapping areas of the image patches are regarded as negative samples, and the two image patches belonging to different input images are regarded as negative sample pairs. The spatial contextual relationship between the two image patches is constructed by shortening the distance between the positive sample pairs and separating the features of the overlapping areas from those of other areas, while making full use of the relationship between the image pixel-level context. Even if the true label of the input image is unknown, the consistency of the features extracted by the self-supervised segmentation model under different environments can still be maintained, because there is a one-to-one correspondence at the pixel level between the overlapping areas of the two image patches.

[0040] 3. The designed loss function includes image-level loss and pixel-level context alignment loss. The image-level loss is mainly used to calculate the loss between the output feature map of the feature projection module and the predicted map obtained by the predictor. The image-level loss mainly considers the feature similarity constraint and the spatial continuity constraint. The spatial continuity constraint is mainly used to enhance the consistency of the clustering labels of the current pixel and the adjacent pixels, so that the clustering labels of the pixels of the same category are denser and unique, which effectively integrates the image pixels in space and improves the image segmentation accuracy. The pixel-level context alignment loss mainly constructs the spatial context relationship between image pixels by maximizing the similarity of the overlapping areas of the two image patches and minimizing the interference of the non-overlapping areas on feature extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a structural diagram of the contrastive self-supervised learning segmentation model of the present invention;

[0042] Figure 2 A structural diagram of one branch of the contrastive self-supervised learning segmentation model of the present invention;

[0043] Figure 3 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0044] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments, but the protection scope of the present application is not limited thereto.

[0045] The present invention is a real scene image segmentation method based on contrastive self-supervised learning, which includes the following contents:

[0046] 1. Design and compare self-supervised segmentation modules:

[0047] The contrastive self-supervised learning segmentation model includes two branches with the same structure, each of which includes an encoder, a decoder, a feature projection module and a predictor connected in sequence; the input image is randomly cropped into two image patches with overlapping areas, and the two image patches are processed by the two branches of the contrastive self-supervised learning segmentation model respectively;

[0048] The encoder includes a deep convolutional neural network and a spatial pyramid pooling module fused with dilated convolutions. First, a deep convolutional neural network (DCNN) is used to extract features from image patches to obtain shallow feature maps. Then, an atrous spatial pyramid pooling (ASPP) module fused with dilated convolutions is used to optimize the shallow feature maps to obtain deep feature maps.

[0049] The decoder contains two 2D convolutional layers and two upsampling layers; the deep feature map first passes through a 2D convolutional layer with a convolution kernel of 1×1 to change the number of channels, and then passes through the first upsampling layer of the decoder and is fused with the shallow feature map extracted by DCNN after being processed by the first 2D convolutional layer of the decoder. The shallow feature map is used to optimize the position information that cannot be restored by upsampling; the fused feature map passes through the second 2D convolutional layer and the second upsampling layer in turn to obtain the output feature map of the decoder; the convolution kernel size of the first 2D convolutional layer is 1×1, which is used to change the number of channels of the shallow feature map for fusion; the convolution kernel size of the second 2D convolutional layer is 3×3; the step size of the two upsampling layers is 4;

[0050] The feature projection module contains a fully connected layer and a ReLU layer. The output feature map of the decoder passes through the fully connected layer, the ReLU layer, and the fully connected layer in sequence to obtain the output feature map of the feature projection module. The feature projection module helps to identify the invariant features in the image patch and maximizes the ability of the contrastive self-supervised learning segmentation model to recognize the same image after different transformations.

[0051] The predictor consists of a one-dimensional convolution module, batch normalization, and a classifier; the predictor is used to re-express features in the latent space, and the classifier clusters pixels in the image.

[0052] The process of comparing the self-supervised learning segmentation model is as follows:

[0053] First, the input image x is randomly cropped into two image patches x1 and x2, and the two image patches have an overlapping area x o ; The image patches x1 and x2 are subjected to data enhancement processing such as color distortion and Gaussian blur. The two image patches after data enhancement are mapped to feature maps f1 and f2 through the corresponding encoder and decoder respectively; the encoder and decoder both use the DeepLabv3+ network structure, which is based on the ResNet-101 model; the feature maps f1 and f2 are respectively mapped to feature maps φ1=Φ(f1) and φ2=Φ(f2) through the corresponding feature projection module Φ, i.e., the output feature maps of the feature projection module, and the overlapping areas in the feature maps φ1 and φ2 are respectively represented by φ o1 and φ o2 express;

[0054] Secondly, the feature maps φ1 and φ2 are processed by the corresponding predictors respectively. The processing of the predictor is explained by taking the feature map φ1 as an example. The number of channels of the feature map φ1 is p. The feature map φ1 passes through the one-dimensional convolution module of the predictor to obtain the response map That is, the pixels of the feature map φ1 are mapped to the cluster space coordinate system for the measurement and alignment of spatial continuity; the response map Contains p channel response maps r n , Represents the channel response map r n The nth pixel in, N represents the channel response map r n The total number of pixels in Represents the parameter matrix of a one-dimensional convolution module;

[0055] Then, for all channel response maps r n Perform batch normalization, that is, normalize each channel response map within the axis to obtain a normalized response map Make the normalized response plot The mean and variance on each axis are zero, r n ′ represents the nth pixel in the normalized response map;

[0056] Finally, the classifier passes the normalized response map through the argmax function All pixels in are clustered into q clusters, i.e., q cluster labels, and the cluster labels are obtained. c n Represents the cluster label of the nth pixel, c n =1,2,…,q; Normalized response graph The i-th cluster in can be written as:

[0057]

[0058] Among them, r′ n,i , r′ n,j Represents the normalized response graph The pixel points belonging to the i-th and j-th cluster labels in , is equivalent to assigning each pixel point to the nearest point among the q representative points that are infinitely far away on their respective coordinate axes in the q-dimensional clustering space; represents any value of j; it is worth noting that C i It can be an empty set, indicating that the number of unique cluster labels can vary arbitrarily between 1 and q;

[0059] During the prediction process, the classifier should assign the same cluster label to pixels belonging to the same cluster, so the following three conditions need to be met: (a) pixels with similar features should be assigned the same cluster label; (b) spatially continuous pixels should be assigned the same cluster label; (c) cluster labels are densely unique, that is, the model does not know how many regions should be generated in the image; therefore, the number of unique cluster labels should be adapted to the image content; during each iteration of the model training process, the classifier classifies all pixels in the normalized response map into q (1≤q≤Q) clusters, where Q is the maximum value that q can take; a larger q value indicates over-segmentation, while a smaller q value indicates under-segmentation; the initial value of q is Q, and the number of clusters gradually decreases during the iteration process, and finally q clusters are obtained; if only the above conditions (a) and (b) are met, it will only help to group the pixels, which may lead to a simple solution of q=1; in order to prevent this under-segmentation, condition (c) is introduced, that is, a larger q is preferred; through batch normalization, each pixel r′ is made n,i are likely to become pixel r′ n The maximum value across the axis; although batch normalization cannot guarantee that the pixels of each cluster index reach the total number of pixels N, it can make the pixels of most cluster indexes infinitely close to the total number of pixels N.

[0060] 2. Design loss function:

[0061] During the model training process, the loss function L of formula (2) is used to calculate the total loss of the self-supervised learning segmentation model:

[0062] L=L s +L ca (2)

[0063] Among them, L s , L ca denote image-level loss and pixel-level context alignment loss respectively;

[0064] Image level loss L s It is mainly used to calculate the loss between the output feature map of the feature projection module and the predicted map obtained by the predictor. The image-level loss mainly considers the feature similarity constraint and the spatial continuity constraint. Its expression is as follows:

[0065] L s =L sim ({r′ n ,c n})+μL con ({r′ n}) (3)

[0066] Among them, L sim ({r′ n ,c n})、L con ({r′ n}) represent feature similarity loss and spatial continuity loss respectively, and μ represents the weight to balance the two constraints;

[0067] Cluster label c n is further used as a pseudo-label to calculate the normalized response map through equation (4) and cluster labels The cross entropy loss between , that is, the feature similarity loss;

[0068]

[0069] in,

[0070] The purpose of the feature similarity constraint is to enhance the similarity of similar features. Once the image pixels are clustered according to the features, the features in the same cluster should be similar, and the features in different clusters should be different. During the model training process, the weights of the contrastive self-supervised learning segmentation model are updated by minimizing the feature similarity constraint to promote the contrastive self-supervised learning segmentation model to extract more effective features.

[0071] The basic idea of ​​image pixel clustering is to group similar pixels into clusters. In image segmentation, clusters are preferably continuous in space. Therefore, this paper uses the L1 norm of the width and height differences of the normalized response map as a spatial continuity constraint, so that the cluster label of the current pixel is the same as the cluster label of the adjacent pixel. The spatial continuity loss can suppress excessive clustering categories caused by complex patterns or textures; the expression of spatial continuity loss is:

[0072]

[0073] Where W and H represent the width and height of the normalized response map, respectively, and r′ ξ,η , r′ ξ+1,η and r′ ξ,η+1 Respectively represent the pixel values ​​at the pixel points (ξ,η), (ξ+1,η), and (ξ,η+1) in the normalized response map; || ||1 represents the L1 norm;

[0074] Pixel-level context alignment loss L ca The spatial contextual relationship between image pixels is constructed mainly by maximizing the similarity of the overlapping areas of two image patches and minimizing the interference of non-overlapping areas on feature extraction;

[0075] The overlapping region φ of two image patches belonging to the same input image is o1 and φ o2 As a positive sample pair, the non-overlapping area of ​​the image patch is regarded as a negative sample and the two image patches belonging to different input images are regarded as a negative sample pair; since many different pixels in the input image may belong to the same category, especially when the background accounts for a large proportion, such as the sky, the sea surface, etc., the positive and negative samples are selected as the input of the comparative self-supervised learning segmentation model. The probability of selecting false negative samples and invalid positive samples is very high, which will affect the model's ability to learn image representation; this method uses pseudo labels as inspiration to eliminate very likely false negative samples. Specifically, when selecting negative samples, the feature map f k (k=1,2) is input into the classifier to calculate the feature map f k The probability value of each pixel belonging to each category in the cluster is used, and the maximum probability value is used as the confidence of each clustering result. The category corresponding to the pixel with the highest probability value is used as the class index of argmax clustering. The calculation formula is as follows:

[0076]

[0077] in, represents a classifier;

[0078] The class index corresponding to the overlapping area As pseudo labels, the selected negative samples should be different from the pseudo labels of the overlapping regions, i.e. is the pseudo label corresponding to the negative sample;

[0079] If the above probability value calculation is not accurate enough, the selection of pseudo labels will be greatly biased, thereby providing erroneous supervision signals and affecting the training process. To avoid this situation, the probability value is used as the confidence corresponding to the class index, and the confidence threshold γ is set. The positive sample is converted into a binary mask consisting of 0 and 1 through formula (7): when When all the elements in are 0, the positive sample is filtered out and not included in the training process, thereby filtering out positive samples with low confidence;

[0080]

[0081] in, Respectively represent the overlapping area φ o1 and φ o2 Pseudo labels for all pixels in ;

[0082] The contrastive self-supervised learning segmentation model is implemented through pixel-level context alignment loss. The contrastive supervised learning at the pixel level not only forces the positive samples to have the characteristics of the same category, but also makes the negative samples belonging to the potential same category closer, so as to separate the negative samples belonging to other categories. Moreover, the maximum probability value is used as the confidence of the clustering result. Since the prediction with high confidence is usually more accurate, the prediction with low confidence in the two image patches is aligned to the prediction with higher confidence, which effectively prevents the high confidence clustering result from turning to lower confidence.

[0083] In addition, negative samples are selected not only from the current input image, but also from all input images of the current training batch, so as to balance the positive and negative samples and enable the contrastive self-supervised learning segmentation model to achieve better segmentation performance; specifically, the pixel-level context alignment loss of the b-th input image It can be defined as:

[0084]

[0085]

[0086] in, denote the contextual alignment loss from image patch x1 to x2 and from image patch x2 to x1 respectively; r(·) denotes the exponential function of the similarity between two pixels, Respectively represent the overlapping area φ o1 and φ o2 ; M represents the number of overlapping areas in a training batch, represents the overlapping area φ o1 Negative samples of Represents the set of negative samples consisting of image patches from different input images in the same training batch;

[0087] Let the batch size of the training batch be B, then the pixel-level context alignment loss L ca for:

[0088]

[0089] The method further includes:

[0090] 1) Data preparation: This example uses the Cityscapes dataset, which contains 3,975 real-world scene images and detailed pixel-level annotations;

[0091] 2) Model training:

[0092] The input image is randomly cropped into two image patches, which are respectively input into the two branches of the contrastive self-supervised segmentation model for forward propagation to train the model. The total loss of the model training is calculated by formula (2) until the loss function converges. The upper branch structure of the contrastive self-supervised segmentation model is back-propagated to minimize the model loss. The model parameters of the lower branch structure are updated by the slow moving average vector of the upper branch back-propagation. The parameters are set as follows: the input image size is 1914×1052 pixels, the training batch size is 16, the cyclic training cycle is 12000, 200 batches per training cycle, and the learning rate is 0.0001.

[0093] The setting of parameters in training is related to the specific data set. For example, the cycle of cyclic training is determined by the convergence degree of the loss function. If the convergence is early and fast, the cycle of cyclic training can be appropriately reduced, otherwise it can be increased. When training the model, a larger cycle of cyclic training is set based on experience to ensure that the loss function can converge within the cycle of cyclic training; the size of the training batch should not be too small;

[0094] After the model training is completed, the model parameters are saved, and the trained contrastive self-supervised segmentation model is transplanted into the segmentation program. In actual application, the collected real scene images are input into the trained contrastive self-supervised segmentation model to segment the real scene images.

[0095] This embodiment experiments on 19 types of urban street scenes, including roads, sidewalks, buildings, walls, fences, pedestrians, and cars. The mIoU recognition accuracy rates for roads, buildings, and cars are 69.92%, 77.57%, and 85.05%, respectively. The recognition rates of other real scenes are all above 40%, and the target classification accuracy rates in real scenes are all above 85%, which can meet the segmentation needs of real scenes and alleviate the dependence of deep learning on labeled data. The trained comparative self-supervised learning segmentation model has better generalization ability for images in real scenes.

[0096] Any matters not described in the present invention are applicable to the prior art.

Claims

1. A real scene image segmentation method based on contrastive self-supervised learning, characterized in that: The method includes designing a contrastive self-supervised learning segmentation model and a loss function; wherein the contrastive self-supervised learning segmentation model includes two upper and lower branches with the same structure, each branch includes an encoder, a decoder, a feature projection module and a predictor connected in sequence; the input image is randomly cropped into two image patches with overlapping areas, and the two image patches are processed by the two branches of the contrastive self-supervised learning segmentation model respectively; The encoder includes a deep convolutional neural network and a spatial pyramid pooling module fused with dilated convolutions. First, the deep convolutional neural network is used to extract features from image patches to obtain shallow feature maps. Then, the shallow feature maps are optimized using the spatial pyramid pooling module fused with dilated convolutions to obtain deep feature maps. The decoder contains two 2D convolutional layers and two upsampling layers. The deep feature map first passes through the 2D convolutional layer to change the number of channels, then passes through the first upsampling layer of the decoder and is fused with the shallow feature map after being processed by the first 2D convolutional layer of the decoder. The fused feature map passes through the second 2D convolutional layer and the second upsampling layer in turn to obtain the output feature map of the decoder. The feature projection module includes a fully connected layer and a ReLU layer. The output feature map of the decoder passes through the fully connected layer, the ReLU layer, and the fully connected layer in sequence to obtain the output feature map of the feature projection module. The predictor consists of a 1D convolutional module, batch normalization, and a classifier.

2. The real scene image segmentation method based on contrastive self-supervised learning according to claim 1 is characterized in that: The process of comparing the self-supervised learning segmentation model is as follows: First, assume that the two image patches are x1 and x2, and the overlapping area is x o ; The two image patches are mapped to feature maps f1 and f2 through the corresponding encoder and decoder respectively; the feature maps f1 and f2 are mapped to feature maps φ1 and φ2 through the corresponding feature projection modules respectively, and the overlapping areas in the feature maps φ1 and φ2 are respectively φ o1 and φ o2 express; Secondly, assuming that the number of channels of the feature map φ1 is p, the feature map φ1 passes through the one-dimensional convolution module of the predictor to obtain the response map Response Map Contains p channel response maps r n , Represents the channel response map r n The nth pixel in, N represents the channel response map r n The total number of pixels in Represents the parameter matrix of a one-dimensional convolution module; Then, for all channel response maps r n Perform batch normalization to obtain a normalized response graph r n ′ represents the nth pixel in the normalized response map; Finally, the classifier passes the normalized response map through the argmax function All pixels in are clustered into q clusters, and the cluster labels are obtained. c n Represents the cluster label of the nth pixel, c n =1,2,…,q.

3. The real scene image segmentation method based on contrastive self-supervised learning according to claim 2 is characterized in that: The designed loss function is: L=L s +L ca (2) Among them, L s , L ca denote image-level loss and pixel-level context alignment loss respectively; The expression of image-level loss is as follows: L s =L sim ({r′ n ,c n })+μL con ({r′ n }) (3) Among them, L sim ({r′ n ,c n })、L con ({r′ n }) represent feature similarity loss and spatial continuity loss respectively, and μ represents the weight to balance the two constraints; Cluster label c n is further used as a pseudo-label to calculate the normalized response map through equation (4) and cluster labels The cross entropy loss between , that is, the feature similarity loss; in, The expression of spatial continuity loss is: Where W and H represent the width and height of the normalized response map, respectively, and r′ ξ,η , r′ ξ+1,η and r′ ξ,η+1 Respectively represent the pixel values ​​at the pixel points (ξ,η), (ξ+1,η), and (ξ,η+1) in the normalized response map; ||||1 represents the L1 norm; Let the batch size of the training batch be B, then the pixel-level context alignment loss L ca for: Pixel-wise contextual alignment loss for the b-th input image for: in, denote the contextual alignment loss from image patch x1 to x2 and from image patch x2 to x1 respectively; r(·) denotes the exponential function of the similarity between two pixels, Respectively represent the overlapping area φ o1 and φ o2 ; M represents the number of overlapping areas in a training batch, represents the overlapping area φ o1 Negative samples of Represents the set of negative samples consisting of image patches from different input images in the same training batch; Represents a binary mask.

4. The real scene image segmentation method based on contrastive self-supervised learning according to claim 3 is characterized in that: During the model training process, positive and negative samples are randomly selected as inputs of the contrastive self-supervised learning segmentation model; the overlapping areas of two image patches belonging to the same input image are regarded as positive sample pairs, the non-overlapping areas of image patches are regarded as negative samples, and two image patches belonging to different input images are regarded as negative sample pairs.

5. The real scene image segmentation method based on contrastive self-supervised learning according to any one of claims 1 to 4, characterized in that: The method also includes setting parameters, training a comparative self-supervised learning segmentation model, transplanting the trained comparative self-supervised learning segmentation model into a segmentation program, and in actual application, inputting the collected real scene images into the trained comparative self-supervised learning segmentation model to segment the real scene images.

Citation Information

Patent Citations

  • Unsupervised cross-domain self-adaptive medical image segmentation method based on deep adversarial learning

    AU2020103905A4

  • Image semantic division method based on depth full convolution network and condition random field

    CN108062756A