An image segmentation method based on dilated convolution
By using dilated convolution and DeConv transposed convolution layers in the image segmentation network, combined with multi-scale features, the problem of failure to fully utilize multi-scale features in the existing technology is solved, and the accuracy of image segmentation is significantly improved.
Patent Information
- Application Number
- CN202010777955.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-05
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2040-08-05
AI Technical Summary
Existing image segmentation methods fail to make full use of the multi-scale features in the image, resulting in low segmentation accuracy.
An image segmentation method based on dilated convolution is adopted. By constructing an image segmentation network and using dilated convolution operations in the network, the receptive field of the convolution kernel is adjusted to extract multi-scale features, and the transposed convolution layer and Concat layer are combined through DeConv. Feature maps to improve segmentation performance.
By changing the expansion ratio, the receptive field of the convolution kernel is effectively controlled, multi-scale image features are extracted, and the accuracy and performance of image segmentation are improved.
Smart Images

Figure CN112053311B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image segmentation method based on dilated convolution. Background Art
[0002] Image segmentation refers to the process of automatically segmenting an image into all categories and marking the pixels of each category. This technology has a wide range of applications, such as assisting doctors in making medical diagnoses, automatically marking the location of lesions in medical images, and can also be used in the field of autonomous driving to help autonomous driving systems identify various targets on the road.
[0003] In order to obtain accurate image segmentation results, the traditional method is to use manually designed features to extract features from the image and then classify pixels based on the features.
[0004] Existing image segmentation methods cannot fully utilize the multi-scale features in the image, resulting in low segmentation accuracy. Therefore, this paper proposes a method that can fully utilize multi-scale features. Summary of the invention
[0005] The technical problem to be solved by the present invention is: for an image, how to use a computer to automatically segment the categories in the image. The present invention proposes an image segmentation method based on dilated convolution.
[0006] The method of the present invention is to design a network for segmenting images and use dilated convolution in the network.
[0007] An image segmentation method based on dilated convolution specifically comprises the following steps:
[0008] Step (1). Construct an image segmentation network;
[0009] Step (2). Complete image segmentation by performing dilated convolution operation in the image segmentation network;
[0010] Step (3). Select training set data and train the image segmentation network;
[0011] The specific method of step (1) is as follows:
[0012] Construct an image segmentation network with structural parameters as shown in Table 1. First, input the image into the Conv1 convolution layer. After convolution, the resolution of the feature map is 1 / 2 of the original image. Then, a Pool1 maximum pooling layer is connected. After pooling, the resolution of the feature map is 1 / 4 of the original image. Then, Block1 is connected. After this module, the resolution of the feature map is 1 / 8 of the original image. Then, Block2 is connected. After this module, the resolution of the feature map is 1 / 16 of the original image. Then, Block3 is connected. After this module, the resolution of the feature map is 1 / 16 of the original image. Then, Block4 is connected and a dilated convolution with a dilation rate of 2 is used in this module. After this module, the resolution of the feature map is 1 / 16 of the original image. Then, Block5 is connected and a dilated convolution with a dilation rate of 4 is used in this module. After this module, the resolution of the feature map is 1 / 16 of the original image. Then the feature maps generated by Block3, Block4 and Block5 are upsampled using the DeConv transposed convolution layer. After this layer, the feature map resolution is the same as the original image. The Concat layer is then used to connect the features of the three branches in the channel dimension. The 1×1 convolution Conv1 is then used to combine the connected features into the final feature map. The next layer is a 1×1 convolution Conv2, which is used to predict the category probability of each pixel.
[0013] Table 1 Segmentation network parameters
[0014]
[0015] The specific method of step (2) is as follows:
[0016] First, the image is input into the Conv1 convolution layer, which has 64 7*7 convolution kernels and a convolution stride of 2. After convolution, the resolution of the feature map is 1 / 2 of the original image. Then, a Pool1 maximum pooling layer is connected. This pooling layer uses a 3*3 maximum pooling kernel and a pooling stride of 2. After pooling, the resolution of the feature map is 1 / 4 of the original image. Then, Block1 is connected. This module consists of 3 convolution layers. The convolution kernel size of the 3 convolution layers is 3*3. The number of convolution kernels is 64, 64, and 128 respectively, and the convolution strides are 1, 1, and 2 respectively. After this module, the resolution of the feature map is 1 / 8 of the original image. Then Block2 is connected. This module consists of 3 convolutional layers. The convolution kernel size of the 3 convolutional layers is 3*3. The number of convolution kernels is 128, 128, and 256 respectively. The convolution strides are 1, 1, and 2 respectively. After this module, the resolution of the feature map is 1 / 16 of the original image. Then Block3 is connected. This module consists of 3 convolutional layers. The convolution kernel size of the 3 convolutional layers is 3*3. The number of convolution kernels is 256. The convolution stride is 1. After this module, the resolution of the feature map is 1 / 16 of the original image. Then Block4 is connected. In this module, dilated convolution with a dilation rate of 2 is used. This module consists of 3 convolutional layers. The convolution kernel size of the 3 convolutional layers is 3*3. The number of convolution kernels is 256. The convolution stride is 1. After this module, the resolution of the feature map is 1 / 16 of the original image. Then Block5 is followed and a dilated convolution with a dilation rate of 4 is used in this module. This module consists of 3 convolution layers. The convolution kernel size of the 3 convolution layers is 3*3, the number of convolution kernels is 256, and the convolution stride is 1. After this module, the feature map resolution is 1 / 16 of the original image. Then the feature maps generated by Block3, Block4 and Block5 are upsampled using the DeConv transposed convolution layer. The transposed convolution layer has 64 3*3 transposed convolution kernels and a transposed convolution stride of 16. After this layer, the feature map resolution is the same as the original image. Then the Concat layer is followed to connect the features of the 3 branches in the channel dimension. Then the 1×1 convolution Conv1 is followed to combine the connected features into the final feature map. This layer has 256 1*1 convolution kernels and a convolution stride of 1. The next layer is a 1×1 convolution Conv2, which is used to predict the category probability of each pixel. The number of convolution kernels in this layer is equal to the number of categories to be segmented, the convolution kernel size is 1*1, and the convolution stride is 1.
[0017] In the Block4 and Block5 modules, dilated convolutions with dilation ratios of 2 and 4 are used respectively. The principle of dilated convolution is introduced in detail below.
[0018] The input feature map is x, and the convolution kernel weight is w. Then the feature y[i] at position i in the output feature map is
[0019]
[0020] In formula (1), the dilation ratio r represents the stride when sampling the input signal. Standard convolution is a special case of dilated convolution (r = 1). Dilated convolution can effectively adjust the receptive field of the convolution kernel by changing the value of r.
[0021] In the Block4 module, a dilated convolution with a ratio of 2 is used, so the receptive field of the three-layer convolution kernel is 5*5. The convolution kernel is convolved every 2 elements in the horizontal and vertical directions of the feature map. Therefore, the elements at each position of the feature map generated by Block4 are convolved from the elements in the 5*5 range in the previous feature map. Therefore, each element contains local information in the range of 5*5, which is larger than the local information of 3*3 before the dilated convolution. In the Block5 module, a dilated convolution with a ratio of 4 is used, and the receptive field of the three-layer convolution kernel is 9*9. The convolution kernel is convolved every 4 elements in the horizontal and vertical directions of the feature map. Therefore, the elements at each position of the feature map generated by Block5 are convolved from the elements in the 9*9 range in the previous feature map. Therefore, each element contains local information in the range of 9*9, which is larger than the local information of 3*3 before the dilated convolution. This larger range of information helps the network better learn larger target features in the image, so it is necessary to use dilated convolution.
[0022] The specific method of step (3) is as follows:
[0023] The network is trained using the following strategy:
[0024] The training set uses PASCAL VOC 2012. Because the number of foreground categories in this dataset is 20, plus 1 background category, there are a total of 21 categories to be segmented, so when using this dataset for training, the number of convolution kernels of 1×1 convolution Conv2 is set to 21.
[0025] The network is trained using a mini-batch normalization strategy; the mini-batch size is set to 16.
[0026] The loss function uses cross entropy loss and is trained 60k times in total.
[0027] The beneficial effects of the present invention are as follows:
[0028] The method of the present invention can improve the performance of image segmentation. By changing the size of the expansion ratio, the receptive field of the convolution kernel can be effectively controlled, thereby extracting multi-scale image features. Combining feature maps of different scales can make full use of the information in the image, which helps to improve the accuracy of image segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 The dilated convolution principle diagram of the present invention with different dilation ratios
[0030] Figure 2 The network for segmenting images of the present invention DETAILED DESCRIPTION
[0031] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0032] The present invention provides a semantic image segmentation method, in which a computer automatically segments a semantic category in an image.
[0033] An image segmentation method based on dilated convolution specifically comprises the following steps:
[0034] Step (1). Construct an image segmentation network;
[0035] Construct an image segmentation network with the following structure: Figure 2 As shown in the figure (the parameter outputstride in the figure refers to the ratio of the spatial resolution of the input original image to the output feature map), the structural parameters are shown in Table 1. First, the image is input into the Conv1 convolution layer. After convolution, the feature map resolution is 1 / 2 of the original image. Then a Pool1 maximum pooling layer is connected. After pooling, the feature map resolution is 1 / 4 of the original image. Then Block1 is connected. After this module, the feature map resolution is 1 / 8 of the original image. Then Block2 is connected. After this module, the feature map resolution is 1 / 16 of the original image. Then Block3 is connected. After this module, the feature map resolution is 1 / 16 of the original image. Then Block4 is connected and a dilated convolution with a dilation rate of 2 is used in this module. After this module, the feature map resolution is 1 / 16 of the original image. Then Block5 is connected and a dilated convolution with a dilation rate of 4 is used in this module. After this module, the feature map resolution is 1 / 16 of the original image. Then the feature maps generated by Block3, Block4 and Block5 are upsampled using the DeConv transposed convolution layer. After this layer, the feature map resolution is the same as the original image. The Concat layer is then used to connect the features of the three branches in the channel dimension. The 1×1 convolution Conv1 is then used to combine the connected features into the final feature map. The next layer is a 1×1 convolution Conv2, which is used to predict the category probability of each pixel.
[0036] Table 1 Segmentation network parameters
[0037]
[0038]
[0039] Step (2). Perform dilated convolution operation through the image segmentation network to complete image segmentation;
[0040] First, the image is input into the Conv1 convolution layer, which has 64 7*7 convolution kernels and a convolution stride of 2. After convolution, the resolution of the feature map is 1 / 2 of the original image. Then, a Pool1 maximum pooling layer is connected. This pooling layer uses a 3*3 maximum pooling kernel and a pooling stride of 2. After pooling, the resolution of the feature map is 1 / 4 of the original image. Then, Block1 is connected. This module consists of 3 convolution layers. The convolution kernel size of the 3 convolution layers is 3*3. The number of convolution kernels is 64, 64, and 128 respectively, and the convolution strides are 1, 1, and 2 respectively. After this module, the resolution of the feature map is 1 / 8 of the original image. Then Block2 is connected. This module consists of 3 convolutional layers. The convolution kernel size of the 3 convolutional layers is 3*3. The number of convolution kernels is 128, 128, and 256 respectively. The convolution strides are 1, 1, and 2 respectively. After this module, the resolution of the feature map is 1 / 16 of the original image. Then Block3 is connected. This module consists of 3 convolutional layers. The convolution kernel size of the 3 convolutional layers is 3*3. The number of convolution kernels is 256. The convolution stride is 1. After this module, the resolution of the feature map is 1 / 16 of the original image. Then Block4 is connected. In this module, dilated convolution with a dilation rate of 2 is used. This module consists of 3 convolutional layers. The convolution kernel size of the 3 convolutional layers is 3*3. The number of convolution kernels is 256. The convolution stride is 1. After this module, the resolution of the feature map is 1 / 16 of the original image. Then Block5 is followed and a dilated convolution with a dilation rate of 4 is used in this module. This module consists of 3 convolution layers. The convolution kernel size of the 3 convolution layers is 3*3, the number of convolution kernels is 256, and the convolution stride is 1. After this module, the feature map resolution is 1 / 16 of the original image. Then the feature maps generated by Block3, Block4 and Block5 are upsampled using the DeConv transposed convolution layer. The transposed convolution layer has 64 3*3 transposed convolution kernels and a transposed convolution stride of 16. After this layer, the feature map resolution is the same as the original image. Then the Concat layer is followed to connect the features of the 3 branches in the channel dimension. Then the 1×1 convolution Conv1 is followed to combine the connected features into the final feature map. This layer has 256 1*1 convolution kernels and a convolution stride of 1. The next layer is a 1×1 convolution Conv2, which is used to predict the category probability of each pixel. The number of convolution kernels in this layer is equal to the number of categories to be segmented, the convolution kernel size is 1*1, and the convolution stride is 1.
[0041] In the Block4 and Block5 modules, dilated convolutions with dilation ratios of 2 and 4 are used respectively. The principle of dilated convolution is introduced in detail below.
[0042] The input feature map is x, and the convolution kernel weight is w. Then the feature y[i] at position i in the output feature map is
[0043]
[0044] In formula (1), the dilation ratio r represents the step size when sampling the input signal. Standard convolution is a special case of dilated convolution (r = 1). Dilated convolution can effectively adjust the receptive field of the convolution kernel by changing the value of r. Figure 1 As shown in the figure, when the expansion ratio is 1, the receptive field of a 3*3 convolution kernel is 3*3, and when the expansion ratio is changed to 3, the receptive field of a 3*3 convolution kernel is 7*7. At this time, the convolution kernel is only convolved with the corresponding elements at the position of the black block in the feature map. It can be seen that after increasing the expansion ratio, the receptive field of the convolution kernel can be expanded without increasing the convolution kernel parameters (the convolution kernels are all 3*3 and have 9 weight parameters, so no additional parameters are introduced), thereby more effectively capturing the context information in the feature map.
[0045] In the Block4 module, a dilated convolution with a ratio of 2 is used, so the receptive field of the three-layer convolution kernel is 5*5. The convolution kernel is convolved every 2 elements in the horizontal and vertical directions of the feature map. Therefore, the elements at each position of the feature map generated by Block4 are convolved from the elements in the 5*5 range in the previous feature map. Therefore, each element contains local information in the range of 5*5, which is larger than the local information of 3*3 before the dilated convolution. In the Block5 module, a dilated convolution with a ratio of 4 is used, and the receptive field of the three-layer convolution kernel is 9*9. The convolution kernel is convolved every 4 elements in the horizontal and vertical directions of the feature map. Therefore, the elements at each position of the feature map generated by Block5 are convolved from the elements in the 9*9 range in the previous feature map. Therefore, each element contains local information in the range of 9*9, which is larger than the local information of 3*3 before the dilated convolution. This larger range of information helps the network better learn larger target features in the image, so it is necessary to use dilated convolution.
[0046] Step (3). Select training set data and train the image segmentation network;
[0047] The network is trained using the following strategy:
[0048] The training set uses PASCAL VOC 2012. Because the number of foreground categories in this dataset is 20, plus 1 background category, there are a total of 21 categories to be segmented, so when using this dataset for training, the number of convolution kernels of 1×1 convolution Conv2 is set to 21.
[0049] The network is trained using a mini-batch normalization strategy; the mini-batch size is set to 16.
[0050] The loss function uses cross entropy loss and is trained 60k times in total.
Claims
1. An image segmentation method based on dilated convolution, characterized in that: The specific steps include: Step (1). Construct an image segmentation network; Step (2). Complete image segmentation by performing dilated convolution operation in the image segmentation network; Step (3). Select training set data and train the image segmentation network; The specific method of step (1) is as follows: Construct an image segmentation network with structural parameters as shown in Table 1. First, input the image into the Conv1 convolution layer. After convolution, the resolution of the feature map is 1 / 2 of the original image. Then, a Pool1 maximum pooling layer is connected. After pooling, the resolution of the feature map is 1 / 4 of the original image. Then, Block1 is connected. After Block1, the resolution of the feature map is 1 / 8 of the original image. Then, Block2 is connected. After Block2, the resolution of the feature map is 1 / 16 of the original image. Then, Block3 is connected. After Block3, the resolution of the feature map is 1 / 16 of the original image. Then, Block4 is connected and a dilated convolution with a dilation rate of 2 is used in Block4. After Block4, the resolution of the feature map is 1 / 4 of the original image. After ck4, the feature map resolution is 1 / 16 of the original image; followed by Block5, in which a dilated convolution with a dilation rate of 4 is used, and the feature map resolution after Block5 is 1 / 16 of the original image; then the feature maps generated by Block3, Block4 and Block5 are upsampled using the DeConv transposed convolution layer respectively, and the feature map resolution after this layer is the same as the original image; followed by the Concat layer to connect the features of the three branches in the channel dimension; followed by a 1×1 convolution Conv1 to combine the connected features into the final feature map; followed by a layer of 1×1 convolution Conv2 to predict the category probability of each pixel; Table 1 Image segmentation network structure parameters The specific method of step (2) is as follows: First, the image is input into the Conv1 convolution layer, which has 64 7*7 convolution kernels and a convolution stride of 2. After convolution, the resolution of the feature map is 1 / 2 of the original image; followed by a Pool1 maximum pooling layer, which uses a 3*3 maximum pooling kernel and a pooling stride of 2. After pooling, the resolution of the feature map is 1 / 4 of the original image; followed by Block1, which consists of 3 convolution layers. The convolution kernel sizes of the 3 convolution layers are all 3*3, and the number of convolution kernels is 64, 64, and 128 respectively. The convolution strides are 1, 1, and 2 respectively. After Block1, the resolution of the feature map is 1 / 4 of the original image. 8; followed by Block2, Block2 consists of 3 convolutional layers, the convolution kernel size of the 3 convolutional layers is 3*3, the number of convolution kernels is 128, 128, 256, and the convolution stride is 1, 1, 2. After Block2, the feature map resolution is 1 / 16 of the original image; followed by Block3, Block3 consists of 3 convolutional layers, the convolution kernel size of the 3 convolutional layers is 3*3, the number of convolution kernels is 256, and the convolution stride is 1. After Block3, the feature map resolution is 1 / 16 of the original image; followed by Block4 and using the expansion rate of 2 in Block4 Dilated convolution, Block4 consists of 3 convolutional layers, the convolution kernel size of the 3 convolutional layers is 3*3, the number of convolution kernels is 256, the convolution stride is 1, and the feature map resolution after Block4 is 1 / 16 of the original image; followed by Block5 and using dilated convolution with a dilation rate of 4 in Block5. Block5 consists of 3 convolutional layers, the convolution kernel size of the 3 convolutional layers is 3*3, the number of convolution kernels is 256, the convolution stride is 1, and the feature map resolution after Block5 is 1 / 16 of the original image; then Block3, Block4 and Block5 are combined The generated feature maps are upsampled using the DeConv transposed convolution layer. The transposed convolution layer has 64 3*3 transposed convolution kernels and a transposed convolution stride of 16. After this layer, the feature map resolution is the same as the original image. The Concat layer is then used to connect the features of the three branches in the channel dimension. The 1×1 convolution Conv1 layer is then used to combine the connected features into the final feature map. The layer has 256 1*1 convolution kernels and a convolution stride of 1. The 1×1 convolution Conv2 layer is then used to predict the category probability of each pixel. The number of convolution kernels in this layer is equal to the number of categories to be segmented. The convolution kernel size is 1*1 and the convolution stride is 1. In Block4 and Block5 modules, dilated convolution with dilation ratios of 2 and 4 are used respectively. The principle of dilated convolution is introduced in detail below; The input feature map is x, and the convolution kernel weight is w. Then the feature y[i] at position i in the output feature map is In formula (1), the dilation ratio r represents the step size when sampling the input signal; the dilated convolution adjusts the receptive field of the convolution kernel by changing the value of r; In the Block4 module, a dilated convolution with a ratio of 2 is used, so the receptive fields of the three-layer convolution kernels are all 5*5, and the convolution kernels are convolved every 2 elements in the horizontal and vertical directions of the feature map. Therefore, the elements at each position of the feature map generated by Block4 are convolved from the elements in the 5*5 range in the previous feature map, so each element contains local information in the range of 5*5, which is larger than the local information of 3*3 before the use of dilated convolution; in the Block5 module, a dilated convolution with a ratio of 4 is used, and the receptive fields of the three-layer convolution kernels are all 9*9; the convolution kernels are convolved every 4 elements in the horizontal and vertical directions of the feature map, so the elements at each position of the feature map generated by Block5 are convolved from the elements in the 9*9 range in the previous feature map, so each element contains local information in the range of 9*9, which is larger than the local information of 3*3 before the use of dilated convolution; The specific method of step (3) is as follows: The network is trained using the following strategy: The training set uses PASCAL VOC 2012; because the number of foreground categories in the training set is 20, plus 1 background category, there are a total of 21 categories to be segmented, so when using this training set for training, the number of convolution kernels of 1×1 convolution Conv2 is set to 21; Use mini-batch normalization strategy for training in the network; set the mini-batch size to 16; The loss function uses cross entropy loss and is trained 60k times in total.
