Target segmentation method and related device

By fusing different levels of feature maps and applying spatial and channel attention mechanisms in the target segmentation method, the problem of inaccurate target segmentation in complex environments is solved and more accurate segmentation results are achieved.

CN111815639BActive Publication Date: 2024-08-30ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010634962.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-03
Publication Date
2024-08-30
Estimated Expiration
2040-07-03

AI Technical Summary

Technical Problem

Existing target segmentation methods can easily lead to inaccurate segmentation in complex environments, especially because the target area may be occluded or similar to non-target areas, resulting in poor segmentation results.

Method used

By obtaining different levels of feature maps of the target image for fusion, the fused feature map is processed by combining the spatial attention mechanism and the channel attention mechanism to generate an attention feature map, and finally achieve segmentation of the target image. Specific steps include: fusing feature maps at different levels and using the attention mechanism for correction to obtain more accurate segmentation results.

Benefits of technology

It improves the accuracy of target segmentation, can better handle occlusion and similar area problems in complex environments, and enhances the accuracy of segmentation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111815639B
    Figure CN111815639B
Patent Text Reader

Abstract

The present application provides a target segmentation method and related devices. The target segmentation method includes: obtaining feature maps of different levels of the target image; fusing at least some of the feature maps of different levels to obtain a fused feature map; processing the fused feature map using a spatial attention mechanism and a channel attention mechanism to obtain an attention feature map; processing the attention feature map to obtain a segmentation result of the target image. The method of the present application can make the segmentation result more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image segmentation, and in particular to a target segmentation method and related devices. Background Art

[0002] At present, target segmentation algorithms are usually used to extract the target area in the target image. However, due to the complex and changeable environment in actual monitoring scenes, the target area is easily blocked, resulting in inaccurate segmentation. In addition, there may be at least some non-target areas that are similar to the target area, which will also lead to poor segmentation results. Summary of the invention

[0003] The present application provides a target segmentation method and related devices to solve the problem that the current target segmentation method has poor segmentation effect.

[0004] To solve the above problems, the present application provides a target segmentation method, which includes:

[0005] Obtain feature maps of different levels of the target image;

[0006] Fusing at least some of the feature maps at different levels to obtain a fused feature map;

[0007] The fused feature map is processed using the spatial attention mechanism and the channel attention mechanism to obtain the attention feature map;

[0008] The attention feature map is processed to obtain the segmentation result of the target image.

[0009] Among them, the feature maps at different levels include n-layer feature maps;

[0010] Fusing at least some of the feature maps in the feature maps at different levels, including: fusing the feature map of the nth layer and the feature map of the n-1th layer to obtain a fused feature map;

[0011] Fuse the fused feature map with the y-th layer feature map to obtain a new fused feature map;

[0012] When y>1, the feature map of the y-1th layer is used as the feature map of the yth layer, and the fused feature map and the feature map of the yth layer are fused to obtain a new fused feature map.

[0013] Here, y is initially n-2.

[0014] The step of fusing the feature map of the nth layer and the feature map of the n-1th layer to obtain a fused feature map comprises: processing the feature map of the nth layer and / or the feature map of the n-1th layer so that the width and height of the feature map of the nth layer are respectively equal to the width and height of the feature map of the n-1th layer; fusing the feature map of the nth layer and the feature map of the n-1th layer to obtain a fused feature map;

[0015] The fused feature map and the y-th layer feature map are fused to obtain a new fused feature map, including: using a spatial attention mechanism and a channel attention mechanism to process the fused feature map to obtain a first attention feature map; processing the first attention feature map and / or the y-th layer feature map to make the width and height of the first attention feature map equal to the width and height of the y-th layer feature map respectively; fusing the first attention feature map and the y-th layer feature map to obtain a new fused feature map.

[0016] Among them, the spatial attention mechanism and the channel attention mechanism are used to process the fusion feature map to obtain the attention feature map, including:

[0017] Determine the spatial attention weight of the fused feature map, multiply the spatial attention weight and the fused feature map to obtain the first feature map;

[0018] Determine the channel attention weight of the fused feature map, multiply the channel attention weight and the fused feature map to obtain a second feature map;

[0019] The first feature map and the second feature map are fused to obtain the attention feature map.

[0020] Wherein, determining the spatial attention weight of the fused feature map includes: performing convolution and first activation function processing on the fused feature map to obtain a spatial attention weight of 1 for the channel; and / or,

[0021] Determining the channel attention weight of the fused feature map includes: performing global average pooling processing on the fused feature map to obtain a first eigenvector with a width of 1 and a height of 1, and the number of channels of the first eigenvector is equal to the number of channels of the fused feature map; performing 1*1 convolution and a second activation function processing on the first eigenvector to obtain a second eigenvector with a channel number half of the number of channels of the fused feature map; performing 1*1 convolution and a third activation function processing on the second eigenvector to obtain a channel attention weight with a channel number equal to the number of channels of the fused feature map.

[0022] The method realizes target segmentation based on the target segmentation network, which includes a feature extraction layer, a fusion attention layer and a target segmentation layer;

[0023] Obtaining feature maps of different levels of the target image, including: obtaining feature maps of different levels of the target image through a feature extraction layer;

[0024] Fusing at least some of the feature maps in the feature maps at different levels to obtain a fused feature map, including: fusing at least some of the feature maps in the feature maps at different levels through a fused attention layer to obtain a fused feature map;

[0025] Processing the attention feature map, including: processing the attention feature map through a target segmentation layer;

[0026] The segmentation result of the target image is obtained, and then the following steps include: using a cross entropy loss function and a focal loss loss function to calculate the loss based on the segmentation result of the target image and the annotation mask;

[0027] Train the target segmentation network based on the loss.

[0028] The target segmentation network is trained based on the loss, including: optimizing the loss using an Adam optimizer until the target segmentation network converges to obtain a trained target segmentation network.

[0029] Among them, the attention feature map is processed to obtain the segmentation result of the target image, including:

[0030] The attention feature map is convolved and upsampled to obtain a third feature map with 2 channels. The width and height of the third feature map are equal to the width and height of the target image respectively.

[0031] Based on the pixel values ​​of the two channels at each position in the third feature map, confirm whether each position of the target image is the target area;

[0032] The segmentation result of the target image is obtained based on the judgment result of whether each position of the target image is the area where the target is located.

[0033] To solve the above problems, the present application also provides a target segmentation device, which includes a memory and a processor coupled to each other, the memory is used to store program instructions, and the processor is used to execute the program instructions to implement any of the above methods.

[0034] To solve the above problems, the present application also provides a computer-readable storage medium, which includes a program file storing therein a method capable of implementing any one of the above methods.

[0035] The method of the present application is: obtaining feature maps of different levels of the target image, and fusing at least part of the feature maps in the feature maps of different levels to obtain a fused feature map, which combines the characteristics of precise position in the shallow feature map and the characteristics of strong semantic information in the deep feature map, which is conducive to improving the accuracy of the segmentation result; then using the spatial attention mechanism and the channel attention mechanism to process the fused feature map, the fused feature map can be corrected to make the segmentation result more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the implementation modes of the present application, the drawings required for use in the description of the implementation modes will be briefly introduced below. Obviously, the drawings described below are only some implementation modes of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0037] Figure 1 It is a flowchart of the first implementation method of the target segmentation method of the present application;

[0038] Figure 2 is a schematic diagram of the spatial attention mechanism in the target segmentation method of this application;

[0039] Figure 3 It is a schematic diagram of the channel attention mechanism in the target segmentation method of this application;

[0040] Figure 4 It is a flowchart of the second implementation method of the target segmentation method of the present application;

[0041] Figure 5 It is a structural schematic diagram of an implementation method of a target segmentation device of the present application;

[0042] Figure 6 It is a structural schematic diagram of an implementation method of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the technical solution of the present application, the target segmentation method and related devices provided by the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0044] Please refer to Figure 1 , Figure 1 1 is a flow chart of the first embodiment of the target segmentation method of the present application. The target segmentation method can be used to segment out the portion corresponding to the target in the target image. The target can be various objects such as people, animals, plants, etc. The target image refers to an image containing the target. For example, the target segmentation method can be used to segment out the portion corresponding to a person in the target image. The target segmentation method of this embodiment includes the following steps.

[0045] S101: Obtain feature maps of different levels of the target image.

[0046] Extract the features of the target image and obtain feature maps of different levels of the target image.

[0047] The features of the target image can be extracted through any network with feature extraction function to obtain feature maps of different levels of the target image.

[0048] For example, the features of the target image can be extracted by a feature extraction unit in VGG16, resnet18, or resnet50.

[0049] Exemplarily, the target image is first downsampled twice through the 7*7 convolution layer in resnet18 and layer1 of resnet18 to obtain a twice-sampled first-layer feature map f1, the number of channels of the first-layer feature map is 32, the first-layer feature map f1 is twice downsampled through layer2 of resnet18 to obtain a four-fold sampled second-layer feature map f2, the number of channels of the second-layer feature map is 64, the second-layer feature map f2 is twice downsampled through layer3 of resnet18 to obtain an eight-fold sampled third-layer feature map f3, the number of channels of the third-layer feature map is 128, the third-layer feature map f3 is twice downsampled through layer4 of resnet18 to obtain a sixteen-fold sampled fourth-layer feature map f4, the number of channels of the fourth-layer feature map is 256. That is, by extracting the features of the target image through resnet18, 4 layers of feature maps of the target image can be obtained.

[0050] The feature maps of different levels may include n layers of feature maps, where n is an integer and n≥2. In addition, the sizes of the n layers of feature maps may not be the same. In other implementations, the sizes of at least some of the feature maps of the n layers of feature maps may be the same.

[0051] It is understood that the size of the feature map of the present application refers to the width, height and number of channels of the feature map. When at least one of the width, height and number of channels of two feature maps is different, it can represent that the sizes of the two feature maps are different. When the width, height and number of channels of two feature maps are the same, it can represent that the sizes of the two feature maps are the same.

[0052] S102: Fusing at least some of the feature maps at different levels to obtain a fused feature map.

[0053] At least some of the feature maps at different levels can be fused through a variety of methods to obtain a fused feature map, so as to combine the shallow features with the deep features, combining the precise location characteristics of the shallow feature map and the strong semantic information characteristics of the deep feature map.

[0054] In one implementation, at least part of the feature maps at different levels are directly fused in one step.

[0055] In another implementation, at least part of the feature maps in the feature maps of different levels are gradually fused. For example, when the feature maps of different levels include n layers of feature maps, the feature map of the nth layer and the feature map of the n-1th layer are fused to obtain the current fused feature map; the current fused feature map and the feature map of the yth layer are fused to obtain a new fused feature map, and the new fused feature map is used as the current fused feature map; when y>1, the feature map of the y-1th layer is used as the feature map of the yth layer, and the step of fusing the current fused feature map and the feature map of the yth layer is returned to obtain a new fused feature map, and the new fused feature map is used as the current fused feature map; when y≤1, the current fused feature map is used as a fused feature map obtained by fusing at least part of the feature maps of the feature maps of different levels, where y is initially n-2. Exemplarily, when the 4 layers of feature maps (f1, f2, f3 and f4) of the target image obtained by resnet18 are fused, the feature maps of the fourth layer f4 and the third layer f3 are first fused to obtain a fused feature map d1. Then, the fused feature map d1 and the second-layer feature map f2 are fused to obtain a new fused feature map d2. Then, the fused feature map d2 and the first-layer feature map f1 are fused to obtain a new fused feature map d3.

[0056] In addition, feature maps of different layers can be fused by merging them in the channel dimension, by adding them, or by weighted fusion.

[0057] It is understandable that fusing feature maps of different layers may also include processing at least one of the feature maps to be fused to unify the width and height of the feature maps to be fused, so as to facilitate the fusion of feature maps of different layers. For example, in the process of fusing f4 and f3 obtained by resnet18, f4 may be upsampled so that the width and height of f4 after upsampling are the same as the width and height of f3; or f3 may be downsampled so that the width and height of f3 after downsampling are the same as the width and height of f4. That is, in the process of fusing the feature map of the nth layer and the feature map of the n-1th layer, it is necessary to process the feature map of the nth layer and / or the feature map of the n-1th layer so that the width and height of the feature map of the nth layer are respectively equal to the width and height of the feature map of the n-1th layer. Accordingly, in the process of fusing f2 obtained by resnet18 and the fused feature map b1, f2 and / or b1 also need to be processed so that the width and height of b1 and f2 are the same after processing; in the process of fusing f1 obtained by resnet18 and the fused feature map b2, f1 and / or b2 also need to be processed so that the width and height of b2 and f1 are the same after processing. Furthermore, the size of the feature maps to be fused can be unified, that is, the width, height and number of channels of the feature maps to be fused can be unified.

[0058] S103: Use the spatial attention mechanism and the channel attention mechanism to process the fused feature map to obtain an attention feature map.

[0059] By using the spatial attention mechanism and the channel attention mechanism to process the fused feature map, the fused feature map can be corrected to make the segmentation result more accurate, and the effect of improving the accuracy of the segmentation result can be achieved with a small number of parameters.

[0060] In one implementation, the fused feature map may be first processed using a spatial attention mechanism to obtain a spatial attention feature map; and then the spatial attention feature map may be processed using a channel attention mechanism to obtain an attention feature map.

[0061] In another implementation, the fused feature map may be first processed using a channel attention mechanism to obtain a channel attention feature map; and then the channel attention feature map may be processed using a spatial attention mechanism to obtain an attention feature map.

[0062] In another implementation, the fused feature map may be processed using a spatial attention mechanism and a channel attention mechanism respectively to obtain a first feature map and a second feature map; and the first feature map and the second feature map are fused to obtain an attention feature map. Exemplarily, the step of processing the fused feature map using a spatial attention mechanism and a channel attention mechanism may include: determining a spatial attention weight of the fused feature map, multiplying the spatial attention weight and the fused feature map to obtain a first feature map; determining a channel attention weight of the fused feature map, multiplying the channel attention weight and the fused feature map to obtain a second feature map; and fusing the first feature map and the second feature map to obtain an attention feature map.

[0063] Optionally, the first feature map and the second feature map may be fused by merging the first feature map and the second feature map in a channel dimension, or by adding the first feature map and the second feature map, or by weightedly fusing the first feature map and the second feature map.

[0064] Among them, Figure 2 As shown, the step of determining the spatial attention weight of the fused feature map may include: performing convolution and a first activation function on the fused feature map to obtain a spatial attention weight of 1 for the channel.

[0065] In addition, if Figure 3As shown, the step of determining the channel attention weight of the fused feature map may include: performing global average pooling on the fused feature map to obtain a first eigenvector with a width of 1 and a height of 1, and the number of channels of the first eigenvector is equal to the number of channels of the fused feature map; performing 1*1 convolution and a second activation function on the first eigenvector to obtain a second eigenvector with a channel number half the number of channels of the fused feature map; performing 1*1 convolution and a third activation function on the second eigenvector to obtain a channel attention weight with a channel number equal to the number of channels of the fused feature map.

[0066] The first activation function, the second activation function, and the third activation function may be the same or different. The first activation function, the second activation function, and the third activation function may be a sigmoid activation function, a tanh activation function, a Relu activation function, a Leaky ReLU function, an ELU (Exponential Linear Units) activation function, or a MaxOut function, but are certainly not limited thereto. For example, the first activation function is a sigmoid activation function, the second activation function is a Relu activation function, and the third activation function is a sigmoid activation function.

[0067] S104: Process the attention feature map to obtain a segmentation result of the target image.

[0068] In this embodiment, feature maps of different levels of the target image are obtained, and at least part of the feature maps of different levels are fused to obtain a fused feature map, which combines the precise position characteristics of the shallow feature map and the strong semantic information characteristics of the deep feature map, which is beneficial to improving the accuracy of the segmentation result; then, the fused feature map is processed using the spatial attention mechanism and the channel attention mechanism, and the fused feature map can be corrected to make the segmentation result more accurate.

[0069] Optionally, in step S102, in the process of gradually fusing at least part of the feature maps in the feature maps of different levels, each time a current fused feature map is obtained, the newly obtained current fused feature map can be corrected by using the spatial attention mechanism and the channel attention mechanism. That is, the step of fusing the current fused feature map with the y-th layer feature map to obtain a new fused feature map may include: processing the current fused feature map using the spatial attention mechanism and the channel attention mechanism to obtain a first attention feature map; processing the first attention feature map and / or the y-th layer feature map so that the width and height of the first attention feature map are respectively equal to the width and height of the y-th layer feature map; fusing the first attention feature map with the y-th layer feature map to obtain a new fused feature map.

[0070] In addition, the target segmentation method of the present application can realize target segmentation based on the target segmentation network, which includes a feature extraction layer, a fusion attention layer and a target segmentation layer. Of course, the target segmentation network can also be trained by the target segmentation method of the present application. For details, please refer to Figure 4 , Figure 4 It is a flowchart of the second implementation method of the target segmentation method of the present application.

[0071] S201: Obtain feature maps of different levels of the target image through the feature extraction layer.

[0072] The target image may be a target image in a training set, or other target images that require target segmentation.

[0073] Among them, the training set may include the target image and its annotation mask. The target image in the training set can be obtained by collecting images of the target in the actual scene and applying the target and tracking method. The annotation mask of the target image can be annotated by the target image by cutting out the image, and then the pixel value of the target area is set to the first value, and the pixel value of the non-target area is set to the second value to obtain the annotation mask of the target image. Among them, the first value and the second value can be set to any value, as long as the first value and the second value are not the same. For example, the first value is 1 and the second value is 0. For example, when the target is a pedestrian, the target image can be annotated by cutting out the image, wherein the human body area (including the pedestrian's attachments) is annotated as a point with a pixel value of 1, and the non-human area is annotated as a point with a pixel value of 0, to obtain the annotation mask of the target image.

[0074] In addition, data enhancement processing such as random flipping, random scaling, and random blurring can be performed on the target images and their annotation masks in the training set to enrich the training samples in the training set. The sizes of the pedestrian images and their annotation masks in the training set can be unified, for example, the pedestrian images and their annotation masks in the training set can be unified into images of 384*160 size.

[0075] S202: Fusing at least part of the feature maps at different levels through a fusion attention layer to obtain a fused feature map.

[0076] Please refer to step S102 for details, which will not be elaborated here.

[0077] S203: Use the spatial attention mechanism and the channel attention mechanism to process the fused feature map to obtain an attention feature map.

[0078] Please refer to step S103 for details, which will not be elaborated here.

[0079] S204: Use the target segmentation layer to process the attention feature map to obtain the segmentation result of the target image.

[0080] The attention feature map is processed by the target segmentation layer to obtain a segmentation result of the target image, including: processing the attention feature map to obtain a third feature map with a channel number of 2, and the width and height of the third feature map are respectively equal to the width and height of the target image; based on the pixel values ​​of the two channels of each position in the third feature map, confirming whether each position of the target image is the target area; based on the judgment result of whether each position of the target image is the target area, obtaining the segmentation result of the target image.

[0081] Among them, the attention feature map can be convolved and upsampled to obtain a third feature map. The two channels of the third feature map are the target area prediction result and the non-target area prediction result, respectively, so that by comparing the values ​​of the two channels at each position, it can be determined whether each position of the target image is the target area. For example, using the target segmentation method to segment pedestrians, the 0th channel is the human area prediction result, and the 1st channel is the non-human area prediction result (background area prediction result). Based on the values ​​of the two channels at each position, it can be judged whether each position of the target image is a human area; if the value of the 0th channel of a position is greater than the value of the 1st channel of the position, it can be judged that the position is the human area, and if the value of the 1st channel of a position is greater than the value of the 0th channel of the position, it can be judged that the position is not the human area.

[0082] In addition, the pixel value of the corresponding pixel point in the segmentation result of the target image in the target area is a third value, and the pixel value of the corresponding pixel point in the segmentation result of the target image in the non-target area is a fourth value. The third value and the fourth value can be set to any value as long as the third value and the fourth value are different. For example, the third value is 255 and the fourth value is 0.

[0083] S205: Calculate the loss based on the segmentation result and the annotation mask of the target image.

[0084] The loss can be calculated based on the feature vector using any loss function.

[0085] The loss can be calculated based on the segmentation result and the annotation mask of the target image using at least one of the square loss function, hinge loss function, cross entropy loss function, logarithmic loss function and triple loss function, but is certainly not limited thereto. For example, the loss can be calculated based on the feature vector using the cross entropy loss function and the focal loss function.

[0086] Because for the target image, the target area usually occupies most of the area of ​​the target image, and most areas are easy-to-classify samples, resulting in too many positive samples in the data set and a large number of easy-to-classify samples. In order to alleviate the problem of imbalance in the ratio of positive and negative samples when training the target segmentation network, the cross entropy loss function and focal loss function are applied when calculating the loss. The focal loss function can suppress more positive easy-to-classify samples in pedestrian images.

[0087] The formula of the focal loss function is as follows:

[0088] Loss1=-α(1-p t ) γ log(p t )

[0089] where p t represents the confidence of the final output of the target segmentation network. When a sample is misclassified, p t is small, on the contrary, when a sample is paired, p t Larger, for easy-to-divided samples, p t Close to 1. γ is a hyperparameter. When p t Approaching 1 (i.e., easy-to-divided samples), (1-p t ) γ It is close to 0, which means it contributes less to the total loss. α is used to control the ratio of positive and negative samples.

[0090] S206: Training a target segmentation network based on the loss.

[0091] Any optimizer can be used to optimize the loss until the target segmentation network converges to obtain the trained target segmentation network.

[0092] Among them, the optimizer can be selected from a batch gradient descent (BGD) optimizer, a stochastic gradient descent (SGD) optimizer, a mini-batch gradient descent (MBGD) optimizer, or an adaptive moment estimation (Adam) optimizer, etc., but of course not limited to these.

[0093] See also Figure 5 , Figure 5 The target segmentation device 10 includes a memory 11 and a processor 12 coupled to each other, the memory 11 is used to store program instructions, and the processor 12 is used to execute the program instructions to implement the method of any of the above-mentioned embodiments.

[0094] The logical process of the above object segmentation method is presented in a program file. In terms of the program file, if it is sold or used as an independent software product, it can be stored in a computer-readable storage medium. Therefore, this application proposes a computer-readable storage medium. Figure 6 , Figure 6 It is a schematic diagram of the structure of an embodiment of a computer-readable storage medium of the present application. In this embodiment, a program file 21 capable of implementing the above-mentioned method is stored in the computer-readable storage medium 20.

[0095] The computer-readable storage medium 20 may be a medium that can store program files, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, or a server that stores the program files. The server may send the stored program files to other devices for execution, or it may also execute the stored program files by itself. From a physical entity point of view, the computer-readable storage medium 20 may be a combination of multiple entities, such as multiple servers, a server plus a memory, or a memory plus a mobile hard disk, and other combinations.

[0096] The above are only implementation methods of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A target segmentation method, characterized in that: The method comprises: Obtain feature maps of different levels of the target image; Fusing at least some of the feature maps at different levels to obtain a fused feature map; The fused feature map is processed using a spatial attention mechanism and a channel attention mechanism to obtain an attention feature map; Processing the attention feature map to obtain a segmentation result of the target image; The feature maps at different levels include n layers of feature maps; and fusing at least some of the feature maps at different levels includes: Fuse the feature map of the nth layer and the feature map of the n-1th layer to obtain a fused feature map; Fuse the fused feature map with the y-th layer feature map to obtain a new fused feature map; When y>1, the feature map of the y-1th layer is used as the feature map of the yth layer, and the step of fusing the fused feature map with the feature map of the yth layer to obtain a new fused feature map is returned; Among them, y is initially n-2; The fusing the fused feature map and the y-th layer feature map to obtain a new fused feature map includes: using a spatial attention mechanism and a channel attention mechanism to process the fused feature map to obtain a first attention feature map; processing the first attention feature map and / or the y-th layer feature map to make the width and height of the first attention feature map equal to the width and height of the y-th layer feature map respectively; fusing the first attention feature map and the y-th layer feature map to obtain a new fused feature map.

2. The target segmentation method according to claim 1, characterized in that: The step of fusing the n-th layer feature map and the n-1-th layer feature map to obtain a fused feature map comprises: processing the n-th layer feature map and / or the n-1-th layer feature map so that the width and height of the n-th layer feature map are respectively equal to the width and height of the n-1-th layer feature map; and fusing the n-th layer feature map and the n-1-th layer feature map to obtain a fused feature map.

3. The target segmentation method according to claim 1, characterized in that: The method of processing the fused feature map by using the spatial attention mechanism and the channel attention mechanism to obtain the attention feature map includes: Determine a spatial attention weight of the fused feature map, and multiply the spatial attention weight by the fused feature map to obtain a first feature map; Determine a channel attention weight of the fused feature map, and multiply the channel attention weight by the fused feature map to obtain a second feature map; The first feature map and the second feature map are fused to obtain an attention feature map.

4. The target segmentation method according to claim 3, characterized in that: Determining the spatial attention weight of the fused feature map includes: performing convolution and first activation function processing on the fused feature map to obtain a spatial attention weight of 1 for a channel; and / or, The determining of the channel attention weight of the fused feature map includes: performing global average pooling processing on the fused feature map to obtain a first feature vector with a width of 1 and a height of 1, and the number of channels of the first feature vector is equal to the number of channels of the fused feature map; performing 1*1 convolution and a second activation function processing on the first feature vector to obtain a second feature vector with a channel number half of the number of channels of the fused feature map; performing 1*1 convolution and a third activation function processing on the second feature vector to obtain a channel attention weight with a channel number equal to the number of channels of the fused feature map.

5. The target segmentation method according to claim 1, characterized in that: The method realizes target segmentation based on a target segmentation network, wherein the target segmentation network includes a feature extraction layer, a fusion attention layer and a target segmentation layer; The obtaining of feature maps of different levels of the target image comprises: obtaining feature maps of different levels of the target image through the feature extraction layer; The fusing at least some of the feature maps in the feature maps at different levels to obtain a fused feature map comprises: fusing at least some of the feature maps in the feature maps at different levels through the fused attention layer to obtain a fused feature map; The processing of the attention feature map includes: processing the attention feature map through the target segmentation layer; The obtaining of the segmentation result of the target image then includes: using a cross entropy loss function and a focal loss loss function to calculate a loss based on the segmentation result of the target image and the annotation mask; The object segmentation network is trained based on the loss.

6. The target segmentation method according to claim 5, characterized in that: The training of the target segmentation network based on the loss includes: optimizing the loss using an Adam optimizer until the target segmentation network converges to obtain a trained target segmentation network.

7. The target segmentation method according to claim 1, characterized in that: The processing of the attention feature map to obtain a segmentation result of the target image includes: Performing convolution and upsampling processing on the attention feature map to obtain a third feature map with a channel number of 2, wherein the width and height of the third feature map are respectively equal to the width and height of the target image; Based on the pixel values ​​of the two channels at each position in the third feature map, confirm whether each position of the target image is the area where the target is located; The segmentation result of the target image is obtained based on the judgment result of whether each position of the target image is the area where the target is located.

8. A target segmentation device, characterized in that: The target segmentation device includes a memory and a processor; the memory stores a computer program, and the processor is used to execute the computer program to implement the steps of the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The computer storage medium stores a program file capable of implementing any one of the methods of claims 1-7.

Citation Information

Patent Citations

  • Image segmentation method, device and equipment and storage medium

    CN111091576A

  • Yellow River ice semantic segmentation method based on multi-attention mechanism double-flow fusion network

    CN111160311A