Target segmentation method, system and device based on improved attention and loss function

By improving the target segmentation method of attention and loss functions, the problems of low detection accuracy and inaccurate mask in complex spatial layout images are solved, and higher detection accuracy and segmentation accuracy are achieved, especially in small object detection, which is significant Improved performance.

CN113988179BActive Publication Date: 2024-12-20BEIJING UNIV OF CHEM TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111259594.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-12-20
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The existing instance segmentation technology has low detection accuracy in images with complex spatial layout, easy to miss detection of small targets, and the segmented mask is inaccurate.

Method used

Using the target segmentation method based on improved attention and loss functions, the model training is carried out through feature extraction and global information enhancement, combining multi-scale features and regional focus loss functions, and using NMS filtering and matrix multiplication to obtain the target bounding box and mask, and perform Binarization is used to improve segmentation results.

Benefits of technology

It improves the detection accuracy and segmentation performance of small targets, improves the accuracy and robustness of segmentation results, and overcomes the problem of inaccurate mask representation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988179B_ABST
    Figure CN113988179B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of computer vision and image processing, and specifically relates to a target segmentation method, system and device based on improved attention and loss function, aiming to solve the problems of low detection accuracy and inaccurate mask representation after segmentation in existing instance segmentation technology due to the complex spatial layout of the picture. The present invention includes: extracting features of the image to be segmented, and extracting global information and enhancing the attention mechanism of the extracted two-dimensional image features; inputting the enhanced features into a feature processing network to obtain multi-scale features; constructing a target segmentation model based on the instance segmentation network, and training the model through a target segmentation loss function constructed based on regional focus loss; performing target segmentation through the trained model to obtain the target segmentation result of the image to be segmented. The present invention has good segmentation effect, high small target detection accuracy, is not easy to miss, and has accurate mask after segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] The goal of object detection is to detect each object in an image and identify their category. The goal of semantic segmentation is to segment the input image at the pixel level while assigning semantic categories to each object in the image. Instance segmentation is a combination of the two, and its goal is to predict class labels and pixel-level instance masks to locate the different number of instances present in the image. This task has a wide range of benefits for self-driving cars, robots, video surveillance, etc.

[0003] In the past few years, instance segmentation has made great progress in the field of vision with the help of deep convolutional neural networks. At present, instance segmentation methods are generally divided into two categories. One is a two-stage method with region proposal, such as Mask R-CNN. In the first stage, a set of regions of interest (RoIs) are proposed, and in the second stage, instance masks are predicted from the features extracted using RoIAlign. Since the input image is processed in two stages, the two-stage model is more accurate than the single-stage model. The other is a single-stage instance segmentation method without region proposal, such as YOLACT. The author designed two branch networks to perform the following operations in parallel: (1) The prediction head branch generates the category confidence of each candidate box, the location of the anchor box, and the coefficients of the prototype mask; (2) The prototype branch network generates k prototype masks for each image, and the number of prototype masks is equal to the number of coefficients. Since there is no region proposal step and instance location and shape are predicted at the same time, the speed is faster. YOLACT became the first algorithm to achieve real-time segmentation speed on the COCO dataset. To achieve higher performance and accuracy, feature processing is introduced to extract multi-scale features within the network, where a top-down lateral connection path is added to propagate semantically strong features.

[0004] Some of the currently released datasets provide a large space for the improvement of the algorithm. For example, the COCO dataset consists of 200,000 images, each of which has many instances of complex spatial layouts. The MVD and Cityscapes datasets also provide a large number of street scenes of traffic participants in each image.

[0005] Although the YOLACT method has achieved great success, it still has the following problems. First, the spatial layout of each image in the dataset is complex, the spatial positioning accuracy is low, and it is easy to miss small targets in the image. Second, the detection accuracy of small targets is low. Third, the mask after segmentation is not accurate. Summary of the invention

[0006] In order to alleviate the above-mentioned problems in the prior art, namely, the low detection accuracy and inaccurate mask representation after segmentation caused by the complex spatial layout of the image in the prior art instance segmentation technology, the present invention provides a target segmentation method based on improved attention and loss function, the target segmentation method includes:

[0007] Step S10, extracting features of the image to be segmented, and performing global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented;

[0008] Step S20, inputting the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented;

[0009] Step S30, constructing a target segmentation model based on the instance segmentation network, and training the model using a target segmentation loss function constructed based on the regional focus loss;

[0010] Step S40, based on the multi-scale features of the image to be segmented, obtaining the category confidence, position, and k set image masks and k prototype masks of each candidate box through the trained target segmentation model;

[0011] Step S50, screening the candidate boxes by using the NMS screening algorithm, and performing matrix multiplication of k image masks and k prototype masks respectively to obtain the target bounding box and target object mask of the image to be segmented;

[0012] Step S60 , performing binarization processing on the target object mask with a set threshold, and clearing the mask outside the target boundary box of the image to be segmented to obtain the target segmentation result of the image to be segmented.

[0013] In some preferred embodiments, step S10 includes:

[0014] Step S11, extracting features of the image to be segmented through a feature extraction network to obtain two-dimensional image features of the image to be segmented;

[0015] Step S12, extracting global information of the two-dimensional image features of the image to be segmented by global average pooling to obtain a one-dimensional feature code of the image to be segmented;

[0016] Step S13, performing an iterative attention mechanism enhancement on the one-dimensional feature encoding of the image to be segmented for a set number of times to obtain enhanced features of the image to be segmented.

[0017] In some preferred embodiments, the one-dimensional feature encoding of the image to be segmented is expressed as:

[0018]

[0019] Among them, V(h) represents the one-dimensional feature encoding of the image to be segmented, W represents the width of V(h), h represents the two-dimensional image features of the image to be segmented, and f() represents the global average pooling operation.

[0020] In some preferred embodiments, step S13 includes:

[0021] Step S131, performing feature grouping of the one-dimensional feature coding of the image to be segmented by a group convolution operation to obtain m feature groups, each feature group including n subgroups;

[0022] Step S132, the subgroups of different groups are uniformly mixed, and the mixed first features are subjected to group convolution operation and attention mechanism enhancement to obtain the second features;

[0023] Step S133: fusing the first feature and the second feature through a Sigmoid function to obtain an enhanced feature of the image to be segmented.

[0024] In some preferred embodiments, the enhanced features of the image to be segmented are expressed as:

[0025] F′(h)=δ(M s (GC(V(h))))

[0026] Among them, F′(h) represents the enhanced features of the image to be segmented, GC() represents the group convolution operation, and M s () represents the iterative attention mechanism enhancement operation, and δ() represents the Sigmoid function.

[0027] In some preferred embodiments, the target segmentation loss function is expressed as:

[0028] L total =λ1L cls +λ2L box +λ3L mask +λ4L af

[0029] Among them, L total represents the target segmentation loss function, L cls represents the classification loss, L box represents the bounding box loss, L mask represents the mask loss, L af represents the regional focal loss, λ1, λ2, λ3, and λ4 represent the balance parameters of the proportion of classification loss, bounding box loss, mask loss, and area focal-loss loss in the target segmentation loss function, respectively.

[0030] In some preferred embodiments, the regional focus loss L af, which is expressed as:

[0031] L af =-(1.125-p t ) γ log(p t )

[0032] Among them, p t Represents the ratio of the bounding box to the prototype area, and γ represents the parameter for adjusting the rate of weight reduction during model training.

[0033] In another aspect of the present invention, an object segmentation module based on improved attention and loss function is proposed, and the object segmentation module includes:

[0034] A feature extraction and enhancement module is configured to extract features of the image to be segmented, and perform global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented;

[0035] A feature processing module, configured to input the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented;

[0036] The model building and training module is configured to build an object segmentation model using an instance segmentation network, and train the model using an object segmentation loss function based on the regional focus loss;

[0037] The target segmentation module is configured to obtain the category confidence, position, and k set image masks and k prototype masks of each candidate box through a trained target segmentation model based on the multi-scale features of the image to be segmented;

[0038] A target screening module is configured to screen the candidate boxes through the NMS screening algorithm, and perform matrix multiplication of k image masks and k prototype masks respectively to obtain the target bounding box and target object mask of the image to be segmented;

[0039] A threshold segmentation module is configured to perform a binarization process on the target object mask with a set threshold value, and clear the mask outside the target boundary box of the image to be segmented to obtain a target segmentation result of the image to be segmented;

[0040] The segmentation result output module is configured to output the target segmentation result of the image to be segmented.

[0041] According to a third aspect of the present invention, an electronic device is provided, comprising:

[0042] at least one processor; and

[0043] a memory communicatively connected to at least one of the processors; wherein,

[0044] The memory stores instructions that can be executed by the processor, and the instructions are used to be executed by the processor to implement the above-mentioned target segmentation method based on improved attention and loss function.

[0045] In a fourth aspect of the present invention, a computer-readable storage medium is proposed, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the above-mentioned target segmentation method based on improved attention and loss function.

[0046] Beneficial effects of the present invention:

[0047] (1) The present invention is based on a target segmentation method with improved attention and loss functions, extracts global information from image features, converts two-dimensional image features into one-dimensional feature codes, obtains partial position information and long-range dependencies of the target in the longitudinal direction of the image, and enhances the one-dimensional feature codes with an iterative attention mechanism, so that the acquired features can represent richer information, improve the accuracy and precision of the target segmentation results, and effectively improve the segmentation performance of small targets.

[0048] (2) The present invention is based on a target segmentation method based on improved attention and loss functions, constructs a target segmentation model based on the YOLACT network, trains the model through a target segmentation loss function constructed based on the area focal-loss loss, and uses the area focal-loss loss function to increase the proportion of small targets in the loss, thereby improving the segmentation performance of small targets. This solves the problems of low detection accuracy of small targets, easy missed detection, and inaccurate masks after segmentation in the prior art target segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0050] Figure 1 It is a flow chart of the target segmentation method based on improved attention and loss function of the present invention;

[0051] Figure 2 An image to be segmented according to an embodiment of a target segmentation method based on improved attention and loss function of the present invention;

[0052] Figure 3 1. is a schematic diagram of the attention mechanism structure of an embodiment of the target segmentation method based on improved attention and loss function of the present invention;

[0053] Figure 4 It is a schematic diagram of a prototype result of an embodiment of the target segmentation method based on improved attention and loss function of the present invention;

[0054] Figure 5 2. It is a schematic diagram of target instance segmentation results of an embodiment of a target segmentation method based on improved attention and loss function of the present invention;

[0055] Figure 6 This is a schematic diagram of other instance segmentation results of an embodiment of the target segmentation method based on improved attention and loss function of the present invention. DETAILED DESCRIPTION

[0056] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0057] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0058] The present invention provides a target segmentation method based on improved attention and loss function, the target segmentation method comprising:

[0059] Step S10, extracting features of the image to be segmented, and performing global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented;

[0060] Step S20, inputting the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented;

[0061] Step S30, constructing a target segmentation model based on the instance segmentation network (ie, the YOLACT network), and training the model using a target segmentation loss function constructed based on an area focal loss (ie, an area focal-loss loss);

[0062] Step S40, based on the multi-scale features of the image to be segmented, obtaining the category confidence, position, and k set image masks and k prototype masks of each candidate box through the trained target segmentation model;

[0063] Step S50, screening the candidate boxes by using the NMS screening algorithm, and performing matrix multiplication of k image masks and k prototype masks respectively to obtain the target bounding box and target object mask of the image to be segmented;

[0064] Step S60 , performing binarization processing on the target object mask with a set threshold, and clearing the mask outside the target boundary box of the image to be segmented to obtain the target segmentation result of the image to be segmented.

[0065] In order to more clearly illustrate the target segmentation method based on the improved attention and loss function of the present invention, the following is combined with Figure 1 Each step in the embodiment of the present invention is described in detail.

[0066] The object segmentation method based on improved attention and loss function of the first embodiment of the present invention includes steps S10 to S60, and each step is described in detail as follows:

[0067] Step S10, extracting features of the image to be segmented, and performing global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented.

[0068] like Figure 2 As shown, it is an image to be segmented according to an embodiment of the target segmentation method based on improved attention and loss function of the present invention, Figure 2 In the left picture, the racket and tennis ball are small targets, while the person playing is the big target. Figure 2 In the right picture, the skateboard is a small target, the person on the skateboard is a large target, and the person on the left is an incomplete large target due to the complex background light.

[0069] Step S11, extracting features of the image to be segmented through a feature extraction network to obtain two-dimensional image features of the image to be segmented.

[0070] Step S12, extracting global information of the two-dimensional image features of the image to be segmented by global average pooling, and obtaining a one-dimensional feature encoding of the image to be segmented, as shown in formula (1):

[0071]

[0072] Among them, V(h) represents the one-dimensional feature encoding of the image to be segmented, W represents the width of V(h), h represents the two-dimensional image features of the image to be segmented, and f() represents the global average pooling operation.

[0073] Global information extraction is performed on two-dimensional image features, that is, the two-dimensional image features are converted into one-dimensional features through global average pooling based on SENet, and partial position information and long-range dependencies of the target in the image are obtained in the vertical direction.

[0074] Step S13, performing an iterative attention mechanism enhancement on the one-dimensional feature encoding of the image to be segmented for a set number of times to obtain enhanced features of the image to be segmented.

[0075] Step S131, performing feature grouping of the one-dimensional feature coding of the image to be segmented by a group convolution operation to obtain m feature groups, each of which includes n subgroups.

[0076] In step S132, subgroups of different groups are uniformly mixed, and a group convolution operation and attention mechanism enhancement are performed on the mixed first features to obtain the second features.

[0077] Step S133, the first feature and the second feature are fused by a Sigmoid function to obtain an enhanced feature of the image to be segmented, as shown in formula (2):

[0078] F′(h)=δ(M s (GC(V(h)))) (2)

[0079] Among them, F′(h) represents the enhanced features of the image to be segmented, GC() represents the group convolution operation, and M s () represents the iterative attention mechanism enhancement operation, and δ() represents the Sigmoid function.

[0080] The enhanced features of the image to be segmented obtained by the above method can represent richer information.

[0081] Step S20: inputting the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented.

[0082] like Figure 3 As shown, it is a schematic diagram of the attention mechanism structure of an embodiment of the target segmentation method based on improved attention and loss function of the present invention. The input of the attention mechanism structure is divided into two lines after residual processing, one is the first output, and the other is processed by global average pooling + global maximum pooling, group convolution + Relu function in sequence as the second output. The second output is processed by channel shuffling and 1×1 convolution in sequence, and then spliced ​​with the second output as the third output. The third output is processed by Sigmoid function and spliced ​​with the first output through the re-weighting method as the final output of the attention mechanism structure.

[0083] Step S30, constructing a target segmentation model based on the instance segmentation network, and training the model using a target segmentation loss function constructed based on the regional focus loss.

[0084] The target segmentation loss function is expressed as shown in formula (3):

[0085] L total =λ1L cls +λ2L box +λ3L mask +λ4L af (3)

[0086] Among them, L total represents the target segmentation loss function, L cls represents the classification loss, Lbox represents the bounding box loss, L mask represents the mask loss, L af represents the regional focal loss, λ1, λ2, λ3, and λ4 represent the balance parameters of the proportion of classification loss, bounding box loss, mask loss, and area focal-loss loss in the target segmentation loss function, respectively.

[0087] In one embodiment of the present invention, λ1=1, λ2=1.25, λ3=6.125, and λ4=1.

[0088] Region focus loss L af , which is expressed as shown in formula (4):

[0089] L af =-(1.125-p t ) γ log(p t ) (4)

[0090] Among them, p t Represents the ratio of the bounding box to the prototype area, and γ represents the parameter for adjusting the rate of weight reduction during model training.

[0091] In one embodiment of the present invention, γ=2.

[0092] Step S40, based on the multi-scale features of the image to be segmented, the category confidence, position, and k set image masks and k prototype masks of each candidate box are obtained through the trained target segmentation model.

[0093] like Figure 4 As shown, it is a schematic diagram of the prototype result of an embodiment of the target segmentation method based on improved attention and loss function of the present invention, which focuses on showing the feature map in the network processing process after weighting by mask coefficients.

[0094] Step S50 , screening the candidate boxes by using the NMS screening algorithm, and performing matrix multiplication of k image masks and k prototype masks respectively, to obtain the target bounding box and target object mask of the image to be segmented.

[0095] Step S60 , performing binarization processing on the target object mask with a set threshold, and clearing the mask outside the target boundary box of the image to be segmented to obtain the target segmentation result of the image to be segmented.

[0096] like Figure 5 and Figure 6As shown, they are schematic diagrams of target instance and other instance segmentation results of an embodiment of the target segmentation method based on improved attention and loss function of the present invention, which contain interferences such as motion shadows, lighting changes, and image noise. It can be seen from the segmentation results that the method of the present invention has strong robustness and can overcome these interferences to obtain accurate target segmentation results.

[0097] Although the various steps in the above embodiment are described in the above-mentioned order, those skilled in the art can understand that in order to achieve the effect of this embodiment, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in a reverse order. These simple changes are within the scope of protection of the present invention.

[0098] The target segmentation module based on improved attention and loss function of the second embodiment of the present invention comprises:

[0099] A feature extraction and enhancement module is configured to extract features of the image to be segmented, and perform global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented;

[0100] A feature processing module, configured to input the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented;

[0101] A model building and training module, configured to build an object segmentation model based on an instance segmentation network, and to train the model using an object segmentation loss function built based on a regional focus loss;

[0102] The target segmentation module is configured to obtain the category confidence, position, and k set image masks and k prototype masks of each candidate box through a trained target segmentation model based on the multi-scale features of the image to be segmented;

[0103] A target screening module is configured to screen the candidate boxes through the NMS screening algorithm, and perform matrix multiplication of k image masks and k prototype masks respectively to obtain the target bounding box and target object mask of the image to be segmented;

[0104] A threshold segmentation module is configured to perform a binarization process on the target object mask with a set threshold value, and clear the mask outside the target boundary box of the image to be segmented to obtain a target segmentation result of the image to be segmented;

[0105] The segmentation result output module is configured to output the target segmentation result of the image to be segmented.

[0106] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0107] It should be noted that the target segmentation system based on improved attention and loss function provided in the above embodiment is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the modules or steps in the embodiments of the present invention can be decomposed or combined. For example, the modules in the above embodiment can be combined into one module, or further divided into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of the present invention are only for distinguishing the modules or steps and are not regarded as improper limitations of the present invention.

[0108] An electronic device according to a third embodiment of the present invention includes:

[0109] at least one processor; and

[0110] a memory communicatively connected to at least one of the processors; wherein,

[0111] The memory stores instructions that can be executed by the processor, and the instructions are used to be executed by the processor to implement the above-mentioned target segmentation method based on improved attention and loss function.

[0112] A computer-readable storage medium according to a fourth embodiment of the present invention stores computer instructions, and the computer instructions are used to be executed by the computer to implement the above-mentioned target segmentation method based on improved attention and loss function.

[0113] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the storage device and processing device described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0114] Those skilled in the art should be able to appreciate that the modules and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two, and the programs corresponding to the software modules and method steps can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field. In order to clearly illustrate the interchangeability of electronic hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0115] The terms "first", "second", etc. are used to distinguish similar objects rather than to describe or indicate a particular order or sequence.

[0116] The term "comprise" or any other similar term is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus / device that includes a list of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or apparatus / device.

[0117] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A target segmentation method based on improved attention and loss function, characterized in that: The target segmentation method includes: Step S10, extracting features of the image to be segmented, and performing global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented, including: Step S11, extracting features of the image to be segmented through a feature extraction network to obtain two-dimensional image features of the image to be segmented; Step S12, extracting global information of the two-dimensional image features of the image to be segmented by global average pooling to obtain a one-dimensional feature code of the image to be segmented: Wherein, V(h) represents the one-dimensional feature encoding of the image to be segmented, W represents the width of V(h), h represents the two-dimensional image features of the image to be segmented, and f() represents the global average pooling operation; Step S13, performing an iterative attention mechanism enhancement on the one-dimensional feature encoding of the image to be segmented for a set number of times to obtain enhanced features of the image to be segmented, including: Step S131, performing feature grouping of the one-dimensional feature coding of the image to be segmented by a group convolution operation to obtain m feature groups, each feature group including n subgroups; Step S132, the subgroups of different groups are uniformly mixed, and the mixed first features are subjected to group convolution operation and attention mechanism enhancement to obtain the second features; Step S133, fusing the first feature and the second feature through a Sigmoid function to obtain an enhanced feature of the image to be segmented; Step S20, inputting the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented; Step S30, constructing a target segmentation model based on the instance segmentation network, and training the model using a target segmentation loss function constructed based on the regional focus loss; Step S40, based on the multi-scale features of the image to be segmented, obtaining the category confidence, position, and k set image masks and k prototype masks of each candidate box through the trained target segmentation model; Step S50, screening the candidate boxes by using the NMS screening algorithm, and performing matrix multiplication of k image masks and k prototype masks respectively to obtain the target bounding box and target object mask of the image to be segmented; Step S60 , performing binarization processing on the target object mask with a set threshold, and clearing the mask outside the target boundary box of the image to be segmented to obtain the target segmentation result of the image to be segmented.

2. The object segmentation method based on improved attention and loss function according to claim 1, characterized in that: The enhanced features of the image to be segmented are expressed as: F′(h)=δ(M s (GC(V(h)))) Among them, F′(h) represents the enhanced features of the image to be segmented, GC( ) represents the group convolution operation, and M s ( ) represents the iterative attention mechanism enhancement operation, and δ( ) represents the Sigmoid function.

3. The object segmentation method based on improved attention and loss function according to claim 1, characterized in that: The target segmentation loss function is expressed as: L total =λ1L cls +λ2L box +λ3L mask +λ4L af Among them, L total Represents the target segmentation loss function, L cls represents the classification loss, L box represents the bounding box loss, L mask represents the mask loss, L af represents the regional focal loss, λ1, λ2, λ3, and λ4 represent the balance parameters of the proportion of classification loss, bounding box loss, mask loss, and area focal-loss loss in the target segmentation loss function, respectively.

4. The object segmentation method based on improved attention and loss function according to claim 3, characterized in that: The area focus loss L af , which is expressed as: L af =-(1.125-p t ) γ log(p t ) Among them, p t Represents the ratio of the bounding box to the prototype area, and γ represents the parameter for adjusting the rate of weight reduction during model training.

5. An object segmentation system based on improved attention and loss function, characterized in that: The object segmentation system includes the following modules: The feature extraction and enhancement module is configured to extract features of the image to be segmented, and perform global information extraction and attention mechanism enhancement on the extracted two-dimensional image features to obtain enhanced features of the image to be segmented, including: Extract features of the image to be segmented through a feature extraction network to obtain two-dimensional image features of the image to be segmented; The global information of the two-dimensional image features of the image to be segmented is extracted by global average pooling to obtain a one-dimensional feature encoding of the image to be segmented: Wherein, V(h) represents the one-dimensional feature encoding of the image to be segmented, W represents the width of V(h), h represents the two-dimensional image features of the image to be segmented, and f() represents the global average pooling operation; Performing an iterative attention mechanism enhancement for a set number of times on the one-dimensional feature encoding of the image to be segmented to obtain enhanced features of the image to be segmented, including: Performing feature grouping of the one-dimensional feature encoding of the image to be segmented by a group convolution operation to obtain m feature groups, each of which includes n subgroups; The subgroups of different groups are evenly mixed, and the mixed first features are subjected to group convolution and attention mechanism enhancement to obtain the second feature; The first feature and the second feature are fused by a Sigmoid function to obtain an enhanced feature of the image to be segmented; A feature processing module, configured to input the enhanced features of the image to be segmented into a feature processing network to obtain multi-scale features of the image to be segmented; A model building and training module, configured to build an object segmentation model based on an instance segmentation network, and to train the model using an object segmentation loss function built based on a regional focus loss; The target segmentation module is configured to obtain the category confidence, position, and k set image masks and k prototype masks of each candidate box through a trained target segmentation model based on the multi-scale features of the image to be segmented; A target screening module is configured to screen the candidate boxes through the NMS screening algorithm, and perform matrix multiplication of k image masks and k prototype masks respectively to obtain the target bounding box and target object mask of the image to be segmented; A threshold segmentation module is configured to perform a binarization process on the target object mask with a set threshold value, and clear the mask outside the target boundary box of the image to be segmented to obtain a target segmentation result of the image to be segmented; The segmentation result output module is configured to output the target segmentation result of the image to be segmented.

6. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to at least one of the processors; wherein, The memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the target segmentation method based on improved attention and loss function as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which are used to be executed by the computer to implement the target segmentation method based on improved attention and loss function as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Image pedestrian re-identification method and system based on multi-attention joint learning

    CN111539370A

  • Sublingual microcirculation image segmentation method and device, electronic equipment and storage medium

    CN112651978A