Image segmentation method, electronic device and computer readable storage medium
Through multi-directional feature map processing and adaptive receptive field technology, combined with multi-gate control channel fusion and new loss function Dloss, the problems of low object shape and size segmentation accuracy and data imbalance in the existing technology are solved, achieving a more efficient and Accurate semantic segmentation.
Patent Information
- Application Number
- CN201811361168.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-08-28
- Filing Date
- 2018-11-15
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2038-11-15
AI Technical Summary
Existing semantic segmentation technology has low segmentation accuracy when dealing with objects of specific shapes and objects of different sizes, and has difficulties with uneven training data distribution, resulting in unsatisfactory segmentation results and high resource consumption.
Using a multi-directional feature map processing method, by performing multi-directional convolution and pooling operations on the feature map, and using adaptive receptive field and multi-gate control channel fusion technology, the convolution parameters and receptive field size are adjusted to adapt to the shape and size of the object. , and a new loss function Dloss is proposed to enhance the weight of difficult-to-predict categories.
It improves the segmentation accuracy and stability of objects of specific shapes, enhances the accuracy of feature extraction for objects of different sizes, reduces resource consumption, and improves the overall semantic segmentation accuracy.
Smart Images

Figure CN110866526B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of computer vision technology and artificial intelligence technology. Specifically, the present application relates to an image segmentation method, an electronic device, and a computer-readable storage medium. Background Art
[0002] The wave of artificial intelligence is sweeping the world, and computer vision technology is an indispensable part of artificial intelligence. The ultimate goal of computer vision is to enable computers to observe and perceive the world like humans, and the core task is to understand images. Among them, semantic segmentation is a more advanced task in scene understanding.
[0003] To perform semantic segmentation on an image, each pixel in the image needs to be classified. The category, shape, and size of the object in the image can be obtained through the semantic segmentation results. For example, in an object segmentation task, the pixel points of the object in the image need to be given a pixel-level category ID; in another example, in a scene segmentation task, all the pixels in the image need to be given a pixel-level category ID.
[0004] There are many types of semantic segmentation scenes and the objects of semantic segmentation are ever-changing. At this time, how to obtain ideal segmentation effects for images with different features becomes a key issue. Summary of the invention
[0005] The present application provides an image segmentation method, an electronic device and a computer-readable storage medium for enhancing the segmentation effect of semantic segmentation.
[0006] In a first aspect, the present application provides an image segmentation method, comprising:
[0007] Through the feature extraction network, the image is feature extracted to obtain a feature map;
[0008] The feature map is processed to complete the semantic segmentation of the image.
[0009] In an optional implementation, performing feature map processing on the feature map includes:
[0010] Feature map processing is performed on at least two directions of the feature map.
[0011] In an optional implementation, feature map processing is performed on at least two directions of the feature map, including:
[0012] Performing convolution operations and / or pooling operations on at least two directions of the feature map respectively;
[0013] The operation results in at least two directions are fused.
[0014] In an optional implementation, convolution operations are performed on at least two directions of the feature map, including:
[0015] According to the convolution mode and / or convolution parameter corresponding to each direction, convolution operation is performed on at least two directions of the feature map respectively; and / or
[0016] Pooling operations are performed on at least two directions of the feature map, including:
[0017] According to the pooling mode and / or pooling parameter corresponding to each direction, the pooling operation is performed on at least two directions of the feature map respectively.
[0018] In an optional implementation, before performing convolution operations on at least two directions of the feature map respectively according to the convolution modes and / or convolution parameters corresponding to the directions, the method further includes:
[0019] Determine the convolution mode and / or convolution parameters corresponding to each direction according to the device status and / or task requirements.
[0020] In an optional implementation, at least two directions include a set main direction of the feature map;
[0021] Before performing convolution operations on at least two directions of the feature map respectively according to the convolution modes and / or convolution parameters corresponding to the directions, the method further includes:
[0022] Determine the convolution mode and / or convolution parameters corresponding to other directions according to the convolution mode and / or convolution parameters corresponding to the main direction of the feature map; and / or
[0023] Before performing the pooling operation on at least two directions of the feature map respectively according to the pooling mode and / or pooling parameter corresponding to each direction, the method further includes:
[0024] According to the pooling mode and / or pooling parameters corresponding to the main direction of the feature map, the pooling modes and / or pooling parameters corresponding to other directions are determined.
[0025] In an optional implementation, the convolution parameters include: at least one of a convolution kernel size, a dilation rate, a convolution step size, and a parameter amount; and / or
[0026] The pooling parameters include: at least one of the pooling kernel size and the pooling step size.
[0027] In an optional implementation, the operation results in at least two directions are fused, including any of the following situations:
[0028] When convolution operations are performed on at least two directions of the feature map respectively, the convolution operation results in each direction are fused;
[0029] When the pooling operation is performed on at least two directions of the feature map respectively, the pooling operation results of each direction are fused;
[0030] When the convolution operation and the pooling operation are performed simultaneously on at least two directions of the feature map, the convolution operation results and the pooling operation results in each direction are fused;
[0031] When convolution operations and pooling operations are performed in sequence on at least two directions of the feature map, the pooling operation results in each direction are fused.
[0032] In an optional implementation, the operation results in at least two directions are fused, including:
[0033] For each operation result in the at least two directions of operation results, respectively determine a fusion weight and / or feature bias information corresponding to each operation result;
[0034] According to the fusion weight and / or feature bias information, each operation result is processed in a predetermined manner;
[0035] The operation results after the predetermined processing are fused.
[0036] In an optional implementation, before fusing the predetermined processed operation results, the method further includes:
[0037] For each of the operation results in at least two directions, respectively perform skip connection processing on the operation result and the output result after the operation result is processed in a predetermined manner;
[0038] The operation results after the predetermined processing are integrated, including:
[0039] The results of each operation after skip link processing are fused.
[0040] In an optional implementation, predetermined processing is performed on each operation result according to the fusion weight and / or feature bias information, including at least one of the following:
[0041] According to the fusion weight, each operation result is weighted.
[0042] According to the fusion weight, weighted processing is performed on each weighted output result respectively;
[0043] According to the fusion weight, each bias-processed output result is weighted;
[0044] According to the fusion weight, the output results after each jump connection processing are weighted respectively;
[0045] According to the feature bias information, bias processing is performed on each operation result respectively;
[0046] According to the feature bias information, bias processing is performed on each output result after weighted processing;
[0047] According to the feature bias information, bias processing is performed on each bias-processed output result respectively;
[0048] According to the feature bias information, bias processing is performed on the output results after each jump connection processing.
[0049] In an optional implementation, the method further includes:
[0050] Determine a corresponding channel correlation feature according to a feature map obtained by merging operation results in at least two directions;
[0051] Determine the fusion weights corresponding to each operation result, including:
[0052] Determine, according to the channel correlation characteristics, a fusion weight corresponding to each of the operation results in at least two directions;
[0053] Determine the feature bias information corresponding to each operation result, including:
[0054] According to the channel correlation characteristics, feature bias information corresponding to each operation result in at least two directions is determined.
[0055] In an optional implementation, feature extraction is performed on an image to obtain a feature map, including:
[0056] Step 1: for a set convolution layer in a feature extraction network, perform convolution processing on an image or an input feature map according to a convolution parameter corresponding to the set convolution layer;
[0057] Step 2: Perform feature map processing on the feature map obtained by convolution processing to obtain a category probability feature map, and determine the category confidence based on the category probability feature map;
[0058] Step 3. If it is necessary to adjust the convolution parameters corresponding to the set convolution layer based on the category confidence, then adjust the convolution parameters corresponding to the set convolution layer and then execute step 1. If it is confirmed based on the category confidence that it is not necessary to adjust the convolution parameters corresponding to the set convolution layer, then output the feature map obtained by the convolution processing.
[0059] In an optional implementation, the convolution layer is set to be at least one convolution layer whose depth is greater than a second depth threshold in at least one feature extraction module whose depth is greater than a first depth threshold.
[0060] In an optional implementation, whether the convolution parameters corresponding to the convolution layer need to be adjusted is determined by:
[0061] When the category confidence is greater than the first predetermined threshold, it is confirmed that there is no need to adjust the convolution parameters corresponding to the set convolution layer; otherwise, it is confirmed that there is a need to adjust the convolution parameters corresponding to the set convolution layer.
[0062] In an optional implementation, the method further includes:
[0063] When the total number of iterations is not less than a preset first iteration number threshold, and / or the number of iterations of the set convolution layer is not less than a preset second iteration number threshold, it is confirmed that there is no need to adjust the convolution parameters corresponding to the set convolution layer, and the feature map obtained by the convolution processing is output.
[0064] In an optional implementation, adjusting and setting the convolution parameters corresponding to the convolution layer includes:
[0065] Determine the parameter change corresponding to the set convolution layer;
[0066] Adjust the convolution parameters corresponding to the convolution layer based on the parameter change.
[0067] In an optional implementation, determining a parameter change amount corresponding to setting a convolution layer includes:
[0068] According to the category confidence, the parameter change corresponding to the setting of the convolution layer is determined.
[0069] In an optional implementation, feature extraction is performed on an image to obtain a feature map, including:
[0070] The feature map extracted by the set feature extraction module is subjected to receptive field processing by at least one receptive field processing module to obtain a feature map after receptive field processing.
[0071] In an optional implementation, the receptive field processing module includes at least one receptive field processing branch;
[0072] Any receptive field processing module performs receptive field processing, including:
[0073] The feature map output by the set feature extraction module or the previous receptive field processing module is convolved through each receptive field processing branch of the current receptive field processing module to obtain each feature map after convolution processing;
[0074] Based on the weights corresponding to each receptive field processing branch of the current receptive field processing module, the feature maps after convolution processing are fused.
[0075] In an optional implementation, the convolution parameters used by the receptive field processing branches in any receptive field processing module for convolution processing are the same.
[0076] In an optional implementation, the feature extraction module is set to include any of the following:
[0077] Any feature extraction module in the feature extraction network;
[0078] Any feature extraction module in the feature extraction network whose depth is greater than the third depth threshold.
[0079] In an optional implementation, feature extraction is performed on an image to obtain a feature map, including:
[0080] Performing feature map processing on the feature map extracted by the current feature extraction module to obtain a category probability feature map, and determining the category confidence according to the category probability feature map;
[0081] If it is confirmed based on the category confidence that it is necessary to enter the next feature extraction module for feature extraction processing, the feature map extracted by the current feature extraction module is output to the next feature extraction module. If it is confirmed based on the category confidence that it is not necessary to enter the next feature extraction module for feature extraction processing, the feature map extracted by the current feature extraction module is output as the feature map output by the feature extraction network or the output category probability feature map.
[0082] In an optional implementation, whether it is necessary to enter the next feature extraction module for feature extraction processing is confirmed by the following method:
[0083] When the category confidence is greater than the second predetermined threshold, it is confirmed that there is no need to enter the next feature extraction module for feature extraction processing; otherwise, it is confirmed that there is a need to enter the next feature extraction module for feature extraction processing.
[0084] In an optional implementation, determining the category confidence according to the category probability feature map includes:
[0085] Determine the highest probability of each pixel in the category probability feature map;
[0086] The category confidence is determined based on the average of the highest probabilities of each pixel.
[0087] In an optional implementation, feature extraction is performed on an image to obtain a feature map, including:
[0088] The feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module are input into the next feature extraction module for feature extraction.
[0089] In an optional implementation, the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module are input into the next feature extraction module for feature extraction, including:
[0090] The feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module are fused and input into the next feature extraction module for feature extraction.
[0091] In an optional implementation, the method further includes the step of: when performing offline training on each model used in the semantic segmentation process, the D loss function (Dloss) used is:
[0092]
[0093] Where N is the total number of pixels in the image, i is the predicted category, j is the actual category, and c i is the probability that the pixel belongs to category i, p is the category that is consistent with the prediction, and x p ij ={1,0}, marking whether the predicted category is consistent with the actual one.
[0094] Then, during offline training, the total target loss function is:
[0095] Loss = Segloss + α*Dloss
[0096] Segloss is the standard cross entropy loss function, and α is the balance weight between Dloss and Segloss.
[0097] In a second aspect, the present application provides an electronic device, including:
[0098] A feature extraction module is used to extract features from an image through a feature extraction network to obtain a feature map;
[0099] The feature map processing module is used to perform feature map processing on the feature map to complete the semantic segmentation of the image.
[0100] In a third aspect, the present application provides an electronic device, including:
[0101] A processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the image segmentation method as shown in the first aspect of the present application.
[0102] In a fourth aspect, the present application provides a computer-readable storage medium, which is used to store computer instructions, programs, code sets or instruction sets, which, when run on a computer, enable the computer to execute the image segmentation method shown in the first aspect of the present application.
[0103] The beneficial effects of the technical solution provided by this application are:
[0104] This application uses feature extraction on the input image to obtain a feature map; then feature map processing is performed on the feature map to complete semantic segmentation, so that the performance of semantic segmentation is effectively improved.
[0105] The present application processes feature maps in at least two directions of the feature map. For the feature map extracted by the feature extraction network, when processing the feature map, instead of performing a unidirectional convolution operation, the feature map is processed separately in multiple directions of the feature map. The convolution operation and / or pooling operation can not increase the size of the convolution kernel, and can also make the results of the convolution operation on different areas of the object consistent. For an object, convolution can be performed not only from the forward direction of the feature map, but also from other directions. The convolution in other directions can assist in covering the entire object from the forward direction, so as to obtain higher-level feature information. In other words, when performing convolution operations from the up and down directions or the left and right directions, from the front perspective, each convolution operation can cover a larger area, which can improve the accuracy and stability when segmenting objects of specific shapes.
[0106] The present application also performs a fusion process on the operation results in at least two directions during the feature map processing. Compared with the existing fusion method, the feature bias information and fusion weights corresponding to each operation result can be used to enhance the effective information in the operation result and suppress unnecessary information in the feature map. The detailed information of the output category ID map can also be maintained through jump connection processing, thereby effectively improving the feature fusion effect and improving the accuracy of the semantic segmentation results.
[0107] The present application also sets the category confidence obtained after the convolution operation of the convolution layer, and adaptively adjusts the convolution parameters of the convolution layer online, adjusts the convolution parameters of the convolution layer to the most appropriate size, and makes the adjusted convolution parameters cover the objects in the image as well as possible, so as to accurately extract the features of the objects. This can avoid the problem of introducing too much noise information and reducing the accuracy of feature extraction when the receptive field in the convolution parameters is too large, and can also avoid the problem of incomplete feature extraction due to the inability to fully cover the entire object when the receptive field is too small. This effectively improves the accuracy of the features extracted from objects of different sizes, thereby improving the segmentation accuracy of semantic segmentation and improving the stability of segmentation.
[0108] The present application also proposes that the feature extraction modules involved in online prediction can be adaptively determined, and the network structure can be adaptively adjusted online, that is, according to the category confidence of the current feature extraction result, it is decided whether to skip the subsequent feature extraction modules and directly perform the feature map processing steps or directly output the prediction results. Therefore, the final result can be output after only several layers of the network. When segmenting simple images, fewer feature extraction modules can be adaptively used for feature extraction, which can save computing power and speed up network computing.
[0109] This application also uses the prediction results inferred by the shallow module as another input of the deep network. The preliminary results of the shallow network contain semantic information between objects, which can guide the deep network to extract more spatial and semantic information and reduce the prediction area. By using the prediction results of the shallow extraction module to guide the deep extraction module, the accuracy of the features extracted by the feature extraction network is improved, thereby improving the accuracy of semantic segmentation.
[0110] The present application also proposes that, without losing segmentation accuracy, the number of channels of the convolution layer of the deep network in the feature extraction network can be reduced accordingly, that is, the number of channels of the convolution layer of the deep feature extraction module can be reduced accordingly, such as setting the number of channels of the convolution layer in the feature extraction module in the feature extraction network to be less than a preset channel number threshold, wherein the feature extraction module can be set to at least one feature extraction module with a depth greater than a third depth threshold. This network design can save the computational complexity of semantic segmentation and speed up the network operation speed.
[0111] This application also uses the information between objects to enhance the segmentation effect of objects in certain smaller categories, and proposes a new loss function Dloss, which can increase the weight of difficult-to-predict categories, so that the training process pays more attention to samples containing smaller categories or categories that are more difficult to segment, thereby effectively improving the overall semantic segmentation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0113] Figure 1a An example diagram of an object with a relatively large longitudinal dimension provided in an embodiment of the present application;
[0114] Figure 1b An example diagram of an object with a relatively large lateral size provided in an embodiment of the present application;
[0115] Figure 2a The bicycle provided for the embodiment of the present application is shown in a smaller exemplary diagram in the figure;
[0116] Figure 2bThe bicycle provided for the embodiment of the present application is shown in a larger exemplary diagram in the figure;
[0117] Figure 3a An example diagram of a simple image provided in an embodiment of the present application;
[0118] Figure 3b An example diagram of a complex image provided by an embodiment of the present application;
[0119] Figure 4 A flowchart of an image segmentation method provided in an embodiment of the present application;
[0120] Figure 5 A schematic diagram of the overall process of completing semantic segmentation provided in an embodiment of the present application;
[0121] Figure 6 A schematic diagram of a flow chart of another image segmentation method provided in an embodiment of the present application;
[0122] Figure 7 A flowchart of another image segmentation method provided in an embodiment of the present application;
[0123] Figure 8 Schematic diagram 1 of a multi-directional feature map processing method provided in an embodiment of the present application;
[0124] Fig. 9 Schematic diagram 2 of the multi-directional feature map processing method provided in an embodiment of the present application;
[0125] Fig.10 A logical schematic diagram of the fusion of multiple gate control channels provided in an embodiment of the present application;
[0126] Fig.11 A schematic diagram of multi-directional convolution using ASPP as an example provided in an embodiment of the present application;
[0127] Fig.12 A schematic diagram of feature extraction based on adaptive receptive field provided in an embodiment of the present application;
[0128] Fig.13 A schematic diagram of a process of adaptive receptive field provided in an embodiment of the present application;
[0129] Fig.14 A schematic diagram of an application-adaptive receptive field module provided in an embodiment of the present application;
[0130] Fig.15 Schematic diagram 1 of the experimental effect of Example 2 provided in the embodiment of the present application;
[0131] Fig.16 Schematic diagram 2 of the experimental effect of Example 2 provided in the embodiment of the present application;
[0132] Fig.17a A schematic diagram of an existing feature extraction network provided in an embodiment of the present application;
[0133] Fig.17b A schematic diagram of a feature extraction network provided in an embodiment of the present application;
[0134] Fig.18 A schematic diagram of multi-channel adaptive cascade prediction provided by an embodiment of the present application;
[0135] Fig.19 A schematic diagram of feature extraction based on a cascade prediction method provided in an embodiment of the present application;
[0136] Fig. 20 An example diagram of feature extraction based on the cascade prediction method provided in an embodiment of the present application;
[0137] Fig.21 A schematic diagram of feature extraction based on a multi-channel prediction method provided in an embodiment of the present application;
[0138] Fig. 22 A schematic diagram of a deep module fusion operation provided in an embodiment of the present application;
[0139] Fig.23a A schematic diagram of a multi-channel adaptive cascade prediction structure provided in an embodiment of the present application;
[0140] Figure 23b A schematic diagram of an existing semantic segmentation network structure provided in an embodiment of the present application;
[0141] Fig.24 A schematic diagram of an online prediction solution 1 provided in an embodiment of the present application;
[0142] Fig.25 A schematic diagram of the second online prediction scheme provided in the embodiment of the present application;
[0143] Fig.26 A schematic diagram of online prediction scheme 3 provided in an embodiment of the present application;
[0144] Fig. 27 A schematic diagram of an offline training solution provided in an embodiment of the present application;
[0145] Fig.28 A schematic diagram of the environmental perception of the vehicle-mounted sensor provided in the embodiment of the present application;
[0146] Fig.29 A schematic diagram of image editing provided by an embodiment of the present application;
[0147] Fig.30 A schematic diagram of producing a special effect shot image provided by an embodiment of the present application;
[0148] Fig.31 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0149] Fig.32 An example diagram of a multi-branch multi-receptive field processing method provided in an embodiment of the present application;
[0150] Fig.33 An example diagram of another multi-branch multi-receptive field processing method provided in an embodiment of the present application;
[0151] Fig.34 An example diagram of another multi-branch multi-receptive field processing method provided in an embodiment of the present application;
[0152] Fig.35 An example diagram of a semantic segmentation network structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0153] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described above with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.
[0154] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0155] The inventors of this application have found that existing semantic segmentation has the following four difficulties:
[0156] Difficulty 1: The segmentation effect for objects of specific shapes is not ideal and the segmentation accuracy is low.
[0157] This is because the convolution method used in the current semantic segmentation method cannot cover the entire object in the image, but instead divides the entire object into small blocks and performs convolution processing separately. This causes the problem of poor consistency in object prediction, that is, the object categories predicted for pixels belonging to the same object are inconsistent, for example, increasing the possibility of correctly predicting the two ends of an object but incorrectly predicting the middle part.
[0158] As an example, there may be some objects of specific shapes in the image undergoing semantic segmentation. These objects of specific shapes may be larger in a certain direction of the image, such as objects with larger dimensions in the vertical direction of the image, such as taller objects, or objects with larger dimensions in the horizontal direction of the image, such as wider objects.
[0159] For example Figure 1a As shown, the street lamp has a larger size in the vertical direction of the image. Figure 1b The train in the image has a relatively large horizontal size. The results of segmenting these objects of specific shapes using existing semantic segmentation methods are often unsatisfactory, and the segmentation accuracy of these objects is low.
[0160] Difficulty 2: For objects of the same category appearing in different images, the segmentation effect is unstable and the performance is not robust because the objects have different sizes or shapes in the images.
[0161] This is because, when defining the structure of the semantic segmentation network, the size and parameters of the convolution kernel are fixed, which means that the receptive field of the convolution processing is also fixed. However, if the same receptive field size is used for objects of different sizes, the structure of the semantic segmentation network will be difficult to cover objects of various sizes.
[0162] For example Figure 2a and Figure 2b As shown, the sizes of the bicycle in the two images are different. When using the existing technology to perform semantic segmentation on such objects with significant size differences in different images, the segmentation effect is not ideal and the segmentation accuracy is low.
[0163] Difficulty 3: It is difficult to efficiently segment simple images in a fixed network structure.
[0164] The existing technology uses a fixed network structure to perform semantic segmentation on all input images. For example, the input image can be Figure 3a As shown, the image is a simple image containing an animal. The prior art performs semantic segmentation processing on the simple image through a semantic segmentation network with a fixed structure to obtain the object ID corresponding to each pixel in the image. For another example, the input image can also be as follows Figure 3bAs shown, the image is a complex image containing information such as people, stripes, and pits. The prior art performs semantic segmentation on the complex image through a semantic segmentation network with a fixed structure to obtain the object ID corresponding to each pixel in the image.
[0165] As can be seen above, some images have simpler scenes, or fewer objects or a single type of objects, such as Figure 3a The simple images shown in the figure, some images have more complex scenes, or have more objects or more complex object types, such as Figure 3b The existing technology uses the same fixed-structure network model for semantic segmentation of different images. That is, when processing simple images, the same large complete network is still used for processing complex images, which consumes a lot of computing time and computing resources.
[0166] Difficulty 4: Objects of different categories are extremely unevenly distributed in the training data. The performance of the segmentation network model obtained by offline training with such training data is not ideal.
[0167] Uneven distribution of training data means that in the training data set, the number of data samples of each category varies greatly. Semantic segmentation is a pixel-level category prediction, so the number of samples is counted according to the number of pixels, not the number of images. For example, in the training data distribution of a typical data set, the object categories include background and 20 categories of objects, among which the background class occupies the vast majority of the total pixel sum of the entire training set, while the object category with the least pixel sum accounts for less than 1% of the total pixel sum. In data sets with more categories, although there are more object categories, such as 150 categories of objects, the phenomenon of uneven data distribution is more serious.
[0168] For training sets with severely unbalanced data distribution, existing technologies usually use pixel-level difficult sample mining technology, which causes pixels to ignore the information elements that they are part of the object, which causes the prediction results to appear mottled. As a result, when the semantic segmentation network obtained through training performs semantic segmentation on the image, the segmentation effect is not ideal and the accuracy of the segmentation results is low.
[0169] Based on this, the present application provides an image segmentation method, an electronic device and a computer-readable storage medium, aiming to solve the above technical problems.
[0170] In order to make the objectives, technical solutions and advantages of the present application more clear, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0171] The present application embodiment provides an image segmentation method, such as Figure 4 As shown, the method includes:
[0172] Step S410: extracting features from the image through a feature extraction network to obtain a feature map;
[0173] Step S420: performing feature map processing on the feature map to complete semantic segmentation of the image.
[0174] In practical applications, the overall process of completing semantic segmentation is as follows: Figure 5 As shown: step S410 is executed through the feature extraction network to extract features of the input image and obtain a feature map; step S420 is executed according to the obtained feature map to process the feature map and output a category probability feature map; each eigenvalue in the category probability feature map represents the probability value of the corresponding pixel point belonging to a certain object category or a certain scene category; ID calculation is performed on the category probability feature map to obtain a category ID map, that is, the category ID with the maximum probability corresponding to each pixel point is determined.
[0175] In an optional implementation, step S420 specifically includes: using one or more convolution kernels to perform a convolution operation on the feature map, and then fusing the feature map obtained after the convolution to obtain a category probability feature map. When performing a convolution operation on the feature map, a pooling process can also be performed on the feature map at the same time. During the fusion process, the feature map obtained after the convolution and the feature map obtained after the pooling are fused to obtain a category probability feature map. In the feature map processing process, the pooling operation is an optional operation.
[0176] In a preferred implementation, Figure 6 As shown, step S420 includes step S620. Among them, Figure 6 Step S410 in Figure 4 The same as step S410 in Figure 7 The specific implementation method thereof can refer to the introduction of step S410 or step S710, which will not be described in detail here. Specifically,
[0177] Step S620: Perform feature map processing on at least two directions of the feature map to complete semantic segmentation of the image.
[0178] The directions of the feature map include front-back direction, up-down direction, and left-right direction.
[0179] In this implementation, step S620 specifically includes step S6201 (not labeled in the figure) and step S6202 (not labeled in the figure).
[0180] Step S6201: performing convolution operation and / or pooling operation on at least two directions of the feature map respectively; Step S6202: fusing the operation results of at least two directions.
[0181] Specifically, the step S6201 of performing convolution operations on at least two directions of the feature map includes: performing convolution operations on at least two directions of the feature map according to convolution modes and / or convolution parameters corresponding to each direction;
[0182] And / or, step S6201 performs pooling operations on at least two directions of the feature map respectively, including: performing pooling operations on at least two directions of the feature map respectively according to the pooling methods and / or pooling parameters corresponding to each direction.
[0183] Among them, according to the convolution mode and / or convolution parameters corresponding to each direction, before performing convolution operations on at least two directions of the feature map respectively, it also includes: determining the convolution mode and / or convolution parameters corresponding to each direction according to the device status and / or task requirements.
[0184] In practical applications, it is also possible to obtain the convolution mode and convolution parameters corresponding to each preset direction, as well as the pooling mode and pooling parameters corresponding to each preset direction.
[0185] Specifically, at least two directions include a set main direction of the feature map;
[0186] Then, before performing convolution operations on at least two directions of the feature map respectively according to the convolution modes and / or convolution parameters corresponding to each direction, the method further includes: determining convolution modes and / or convolution parameters corresponding to other directions according to the convolution modes and / or convolution parameters corresponding to the main direction of the feature map;
[0187] And / or, before performing pooling operations on at least two directions of the feature map respectively according to the pooling methods and / or pooling parameters corresponding to each direction, it also includes: determining the pooling methods and / or pooling parameters corresponding to other directions according to the pooling methods and / or pooling parameters corresponding to the main direction of the feature map.
[0188] Specifically, the convolution parameters include: at least one of the convolution kernel size, the dilation rate, the convolution step size, and the parameter amount;
[0189] The pooling parameters include: at least one of the pooling kernel size and the pooling step size.
[0190] Furthermore, in step S6202, the operation results in at least two directions are fused, including any of the following situations:
[0191] When convolution operations are performed on at least two directions of the feature map respectively, the convolution operation results in each direction are fused;
[0192] When the pooling operation is performed on at least two directions of the feature map respectively, the pooling operation results of each direction are fused;
[0193] When the convolution operation and the pooling operation are performed simultaneously on at least two directions of the feature map, the convolution operation results and the pooling operation results in each direction are fused;
[0194] When a convolution operation is performed on at least two directions of a feature map, and then a pooling operation is performed based on the convolution result (ie, the convolution operation and the pooling operation are performed sequentially), the pooling operation results of each direction are fused.
[0195] In order to achieve a better fusion effect, step S6202 can be implemented in the following ways: for each operation result in at least two directions, the fusion weight and / or feature bias information corresponding to each operation result is determined respectively; according to the fusion weight and / or feature bias information, each operation result is subjected to predetermined processing respectively; and each operation result after the predetermined processing is subjected to fusion processing.
[0196] Optionally, before fusing the predetermined processed operation results, the method further includes: for each operation result in at least two directions, performing skip connection processing on the operation result and the output result after the predetermined processing of the operation result;
[0197] Then, the operation results after the predetermined processing are fused, including: the operation results after the jump link processing are fused.
[0198] Specifically, according to the fusion weight and / or feature bias information, predetermined processing is performed on each operation result, including at least one of the following:
[0199] According to the fusion weight, each operation result is weighted.
[0200] According to the fusion weight, weighted processing is performed on each weighted output result respectively;
[0201] According to the fusion weight, each bias-processed output result is weighted;
[0202] According to the fusion weight, the output results after each jump connection processing are weighted respectively;
[0203] According to the feature bias information, bias processing is performed on each operation result respectively;
[0204] According to the feature bias information, bias processing is performed on each output result after weighted processing;
[0205] According to the feature bias information, bias processing is performed on each bias-processed output result respectively;
[0206] According to the feature bias information, bias processing is performed on the output results after each jump connection processing.
[0207] In practical applications, the method further includes: determining corresponding channel correlation features according to a feature map obtained by merging the operation results in at least two directions;
[0208] Then, determining the fusion weight corresponding to each operation result includes: determining the fusion weight corresponding to each operation result in at least two directions according to the channel correlation characteristics;
[0209] And, determining feature bias information corresponding to each operation result includes: determining feature bias information corresponding to each operation result in at least two directions according to channel correlation characteristics.
[0210] Compared with the single-directional convolution operation used in feature map processing, this preferred implementation can overcome the following problems:
[0211] When processing feature maps, existing methods use convolution operations in a single direction (wherein this application may refer to this direction as the front-to-back direction, or as the forward direction), that is, one or more convolution kernels are used to perform convolution operations on the forward direction of the three-dimensional feature map extracted by the feature extraction network. In this convolution method, when performing convolution operations on a feature layer in the feature map, only the feature values of the local area of the current layer (the size of the local area is related to the size of the convolution kernel) are used for convolution operations, and the output result of the convolution operation is for the local area. When the same convolution kernel is used to perform convolution operations on different areas of the same object, the output results may be different.
[0212] The inventors of the present application have found that for objects of certain specific shapes (for example, objects that are relatively large in one direction of the image), even if the size of the convolution kernel is increased, a single convolution operation cannot effectively cover the entire area of the object. For objects of such specific shapes, it is often necessary to perform multiple convolution operations on each local area of the object, and the results of the convolution operations on each local area may be different. The object categories corresponding to the pixels in different areas finally determined may be different, which may lead to inaccurate segmentation results for some pixels of the object. As an example, in an image, if area 1 and area 2 both belong to object A, but the results obtained by performing a convolution operation on area 1 using the same convolution kernel may be different from the results obtained by performing a convolution operation on area 2, then the final segmentation results of the pixels in each area may be different.
[0213] For example, for Figure 1aFor the street lamp in the image, when performing convolution operation on each layer of the feature map, it is not possible to perform a convolution operation on the entire area of the street lamp through one convolution kernel. Multiple convolution operations are required, which will inevitably divide the street lamp into multiple areas. The object categories of the pixels in different areas obtained later may be different, which may cause inaccurate segmentation results of some pixels of the street lamp.
[0214] To increase the effective coverage area of each convolution operation, the size of the convolution kernel can also be increased. However, for objects of these specific shapes, even if the size of the convolution kernel is increased, it is difficult to cover the entire area of the object through a single convolution operation. In addition, if the area covered by a convolution operation is too large, each convolution operation may introduce some background information (for example, for tall and thin objects), making it difficult to obtain accurate segmentation results.
[0215] Since there may be objects of specific shapes in the image, such as objects with relatively large size in a certain direction of the image, it is difficult for the existing feature map processing method to obtain accurate semantic segmentation results, that is, the semantic segmentation effect is not ideal and the segmentation accuracy is low. In this regard, the present application proposes a multi-directional feature map processing method. For the feature map extracted by the feature extraction network, when performing feature map processing, instead of performing a single-direction convolution operation, a convolution operation is performed on multiple directions (at least two directions) of the feature map. The present application also proposes a method for fusion processing of the operation results in the feature map processing process, and first performs bias processing and / or weighted processing on the operation results in the feature map processing process, and then fuses the processed results.
[0216] Through the multi-directional feature map processing method proposed in this application, the operation results of different areas of the object can be consistent without increasing the convolution kernel size. For an object, feature map processing can be performed from at least two directions. For example, convolution can be performed not only from the forward direction of the feature map, but also from other directions. Convolution in other directions can assist in covering the entire object from the forward direction, thereby obtaining higher-level feature information. In other words, when performing convolution operations from the up and down directions or the left and right directions, from a frontal perspective, each convolution operation can cover a larger area, which can improve the accuracy and stability when segmenting objects of specific shapes.
[0217] In addition, compared with the existing fusion methods, the method of multi-gate control feature channel fusion proposed in this application can enhance the effective information in the operation results through the feature bias information and fusion weights corresponding to each operation result, suppress unnecessary information in the feature map, and maintain the detailed information of the output category ID map through jump connection processing, thereby effectively improving the feature fusion effect and improving the accuracy of the semantic segmentation results.
[0218] In an optional implementation, step S410 may include step 1, step 2, and step 3, wherein:
[0219] Step 1 (not marked in the figure), for the set convolution layer in the feature extraction network, perform convolution processing on the image or input feature map according to the convolution parameters corresponding to the set convolution layer;
[0220] Step 2 (not marked in the figure), performing feature map processing on the feature map obtained by the convolution process to obtain a class probability feature map, and determining the class confidence according to the class probability feature map;
[0221] Step 3 (not marked in the figure): If it is necessary to adjust the convolution parameters corresponding to the set convolution layer based on the category confidence, adjust the convolution parameters corresponding to the set convolution layer and then execute step 1. If it is confirmed based on the category confidence that the convolution parameters corresponding to the set convolution layer do not need to be adjusted, the feature map obtained by the convolution processing is output.
[0222] In practical applications, in step 1, if the set convolution layer is the first convolution layer of the first feature extraction module, convolution processing is performed on the original image to be semantically segmented. If the set convolution layer is not the first convolution layer of the first feature extraction module, convolution processing is performed on the output of the convolution layer, pooling layer, or batch normalization layer of the previous layer, and the feature map input to the set convolution layer is input.
[0223] The set convolution layer may be at least one convolution layer having a depth greater than a second depth threshold in at least one feature extraction module having a depth greater than a first depth threshold.
[0224] The set convolution layer may be determined in the following manner: selecting at least one key convolution layer from at least one feature extraction module as the set convolution layer, the set convolution layer being a key convolution layer in the feature extraction module having a depth greater than a first depth threshold;
[0225] The method of determining the key convolution layer includes: selecting at least one convolution layer from the feature extraction module as the key convolution layer, and the key convolution layer is a convolution layer in the feature extraction module whose depth is greater than a second depth threshold.
[0226] The embodiment of the present application proposes that the setting of the convolution layer can be predetermined. For example, when constructing a semantic segmentation network, it is determined which convolution layers in which feature extraction modules are used as the setting convolution layers.
[0227] In step 2, the category confidence is determined according to the category probability feature map, including: determining the highest probability of each pixel in the category probability feature map; and determining the category confidence according to the average value of the highest probability of each pixel.
[0228] Optionally, step 3 can confirm whether it is necessary to adjust the convolution parameters corresponding to the set convolution layer in the following manner: when the category confidence is greater than a first predetermined threshold, it is confirmed that it is not necessary to adjust the convolution parameters corresponding to the set convolution layer; otherwise, it is confirmed that it is necessary to adjust the convolution parameters corresponding to the set convolution layer.
[0229] Optionally, the above step 3 may also include: when the total number of iterations is not less than a preset first iteration number threshold, and / or the number of iterations of the set convolution layer is not less than a preset second iteration number threshold, confirming that there is no need to adjust the convolution parameters corresponding to the set convolution layer, and outputting the feature map obtained by the convolution processing.
[0230] In practical applications, if computing resources are sufficient, the number of iterations may not be set.
[0231] In step 3, adjusting the convolution parameters corresponding to the set convolution layer includes: determining the parameter change amount corresponding to the set convolution layer; and adjusting the convolution parameters corresponding to the set convolution layer based on the parameter change amount.
[0232] Furthermore, determining the amount of parameter change corresponding to setting the convolution layer may include: determining the amount of parameter change corresponding to setting the convolution layer according to the category confidence.
[0233] Optionally, the parameter change amount corresponding to the convolution layer may also be a preset fixed value.
[0234] For the convenience of description below, this feature extraction scheme can be referred to as the adaptive receptive field method.
[0235] Compared with the method of extracting features using a fixed receptive field, this method of extracting features using an adaptive receptive field can overcome the following problems:
[0236] In the process of semantic segmentation, the size of objects in the input image is very rich. In the feature extraction network, the receptive field of a convolutional layer refers to the size of the range affected by the convolution operation in the convolutional layer corresponding to the input image. The receptive field is mainly determined by the convolution parameters (such as the convolution kernel size (i.e., the convolution kernel size) or the expansion rate (rate), etc.). A large receptive field can better cover larger objects and accurately extract the features of such objects, but for smaller objects, it will introduce too much noise information and reduce the accuracy of feature extraction; conversely, a small receptive field can better cover smaller objects and accurately extract the features of such objects, but for larger objects, it cannot completely cover the entire object, resulting in incomplete feature extraction and performance degradation.
[0237] Theoretically, different receptive fields are required to segment objects of different sizes and shapes, and the receptive fields are required to cover the objects to be segmented. For larger objects, if the receptive field is too small, the object area will be predicted incorrectly, and for smaller objects, if the receptive field is too large, non-object areas will be predicted as objects. However, in existing methods, the receptive fields are pre-set and fixed. Therefore, in order to better segment objects of different sizes, existing methods need to use a large number of training sample images of different sizes to train the feature extraction network, so that the network can learn the information of objects of different sizes as much as possible, thereby compensating for the problems caused by the fixed receptive field. However, this existing method is very resource-intensive, and the size and shape of objects of the same category in different images may vary greatly. For example, Figure 2a and Figure 2b As shown, the existing methods are difficult to cover all situations and the accuracy improvement is limited.
[0238] For objects that belong to the same category but have different sizes or shapes in different images, the present application proposes an adaptive receptive field adjustment method, which uses the category confidence obtained after the convolution operation of the convolution layer to adaptively adjust the receptive field size of the convolution layer online, and adjust the receptive field size of the convolution layer to the most appropriate size, so that the adjusted receptive field can better cover the object in the image as much as possible, thereby accurately extracting the features of the object, while also avoiding the introduction of too much noise information. Through the above-mentioned adaptive receptive field adjustment method, it is possible to avoid the problem of introducing too much noise information when the receptive field is too large, reducing the accuracy of feature extraction, and it is also possible to avoid the problem of incomplete feature extraction due to the inability to fully cover the entire object when the receptive field is too small. The above-mentioned adaptive receptive field adjustment method extracts features from the image by performing a convolution operation after real-time adjustment of the receptive field, which can improve the accuracy of the features extracted from objects of different sizes, thereby improving the segmentation accuracy of semantic segmentation and the stability of segmentation.
[0239] In another optional implementation, step S410 may include: step 4 and step 5, wherein:
[0240] The feature extraction network will contain several feature extraction modules, each of which is composed of several network layers (such as convolutional layers, pooling layers, batch normalization layers, etc.).
[0241] Step 4 (not marked in the figure), performing feature map processing on the feature map extracted by the current feature extraction module to obtain a category probability feature map, and determining the category confidence according to the category probability feature map;
[0242] Step 5 (not marked in the figure): if it is confirmed based on the category confidence that it is necessary to enter the next feature extraction module for feature extraction processing, then the feature map extracted by the current feature extraction module is output to the next feature extraction module. If it is confirmed based on the category confidence that it is not necessary to enter the next feature extraction module for feature extraction processing, then the feature map extracted by the current feature extraction module is output as the feature map output by the feature extraction network or the category probability feature map obtained in step 4 is output.
[0243] Optionally, in step 5, whether it is necessary to enter the next feature extraction module for feature extraction processing can be confirmed in the following manner: when the category confidence is greater than a second predetermined threshold, it is confirmed that it is not necessary to enter the next feature extraction module for feature extraction processing; otherwise, it is confirmed that it is necessary to enter the next feature extraction module for feature extraction processing.
[0244] In step 4, the category confidence is determined according to the category probability feature map, including: determining the highest probability of each pixel in the category probability feature map; and determining the category confidence according to the average value of the highest probability of each pixel.
[0245] For the convenience of description below, this feature extraction scheme is referred to as the adaptive cascade prediction method.
[0246] Compared with the method of extracting features using a fixed network structure, this method of extracting features using an adaptive cascade prediction method can overcome the following problems:
[0247] The network structure of existing feature extraction networks is fixed. In order to ensure the input of complex images (complex scenes, large numbers of objects, or complex object types), the network is designed to be deeper and larger. When segmenting simple images, it is still necessary to use the large complete network used to process complex images, which is unnecessary for simple images and consumes a lot of computing time and computing resources.
[0248] In response to the problem in the prior art that all images use a fixed network structure, resulting in low network processing efficiency, the present application proposes an online adaptive cascade prediction method, which can adaptively determine the feature extraction modules involved in online prediction and adaptively adjust the network structure online, that is, based on the category confidence of the current feature extraction result, decide whether to skip the subsequent feature extraction module and directly perform the feature map processing step or directly output the prediction result. Therefore, the final result can be output after only several layers of the network. When segmenting simple images, fewer feature extraction modules can be adaptively used for feature extraction, which can save computing power and speed up network computing.
[0249] In yet another optional implementation, step S410 may include: step 6, wherein:
[0250] Step 6 (not marked in the figure), input the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module to the next feature extraction module for feature extraction. The above-mentioned category prediction result can be a category probability feature map obtained by performing feature map processing on the feature map extracted by the current feature extraction module, or the category ID of each pixel, that is, the pixel category label.
[0251] Optionally, step 6 may include fusing the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module and inputting the result into the next feature extraction module for feature extraction.
[0252] For example, when computing speed is prioritized, the fusion unit may be omitted; when performance is prioritized, in order to achieve better information interaction and fusion, the information may first pass through the fusion unit and then the fused result may be sent to the subsequent deep feature extraction module.
[0253] For the convenience of description below, this feature extraction scheme is referred to as a multi-channel prediction method.
[0254] Compared with extracting features using a fixed network structure, this feature extraction method using multi-channel prediction can overcome the following problems:
[0255] In the feature extraction network of the prior art, the features output from the shallow feature extraction module and the prediction results of the shallow module obtained through feature map processing, such as the category probability feature map, are not used as the input of the subsequent feature extraction module. This has caused the fragmentation and loss of the relationship information between objects to a certain extent, and the semantic information has not been fully utilized.
[0256] In the multi-channel prediction method proposed in this application, the prediction results inferred by the shallow module are used as another input of the deep network. The preliminary results of the shallow network contain semantic information between objects, such as people riding bicycles. This type of information can guide the deep network to extract more spatial and semantic information, reducing the prediction area. In the embodiment of the present application, based on the multi-channel prediction method, the prediction results of the shallow extraction module can be used to guide the deep extraction module, thereby improving the accuracy of the features extracted by the feature extraction network, thereby improving the accuracy of semantic segmentation.
[0257] In addition, as the input information of the feature extraction module increases and the prediction area needs to be reduced, the embodiment of the present application proposes that, without losing the segmentation accuracy, the number of channels of the convolution layer of the deep network in the feature extraction network can be reduced accordingly, that is, the number of channels of the convolution layer of the deep feature extraction module can be reduced accordingly, such as setting the number of channels of the convolution layer in the feature extraction module in the feature extraction network to be less than the preset channel number threshold, wherein the feature extraction module is set to be at least one feature extraction module with a depth greater than the third depth threshold. This network design can save the computational complexity of semantic segmentation and speed up the network operation speed.
[0258] Combining the above-mentioned feature extraction schemes, such as Figure 7 As shown, step S410 includes step S710. Among them, Figure 7 Step S420 in Figure 4 The same as step S420 in Figure 6 The specific implementation method thereof can be referred to the introduction of step S420 or step S620, which will not be described in detail here. Specifically,
[0259] Step S710: extracting features from the image based on at least one of an adaptive receptive field method, an adaptive cascade prediction method, and a multi-channel prediction method to obtain a feature map.
[0260] Furthermore, the image segmentation method provided in the embodiment of the present application further includes the step of: when performing offline training on each model used in the semantic segmentation process, the loss function Dloss used is:
[0261]
[0262] Where N is the total number of pixels in the image, i is the predicted category, j is the actual category, and c i is the probability that the pixel belongs to category i, p is the category that is consistent with the prediction, and x p ij ={1,0}, marking whether the predicted category is consistent with the actual one.
[0263] Then, during offline training, the total target loss function is:
[0264] Loss = Segloss + α*Dloss
[0265] Segloss is the standard cross entropy loss function, and α is the balance weight between Dloss and Segloss.
[0266] The above loss function is used to solve the problem of uneven distribution of training samples. Compared with the existing method of using pixel-level difficult sample mining method, it can overcome the following problems:
[0267] Using pixel-level difficult sample mining to solve the problem of uneven training samples requires some special processing of pixels in the training sample images that are small in number or contain samples of difficult-to-segment categories during network training, such as increasing the error weight of these pixels in the loss function or increasing the number of such images in the data set. Such processing simply targets pixels that need to be processed for category judgment, while ignoring the positional relationship between object pixels and the characteristics of the object, resulting in limited performance improvement.
[0268] In response to the problem of uneven distribution of training samples mentioned above, this application proposes an object-level difficult sample mining method, which uses the information between objects to enhance the segmentation effect of objects in certain smaller categories. Specifically, the traditional cross entropy loss function is improved, and a new loss function Dloss is proposed. This loss function can increase the weight of difficult-to-predict categories, so that the training process pays more attention to samples containing smaller categories or categories that are more difficult to segment, thereby effectively improving the overall semantic segmentation accuracy.
[0269] It can be seen that the image segmentation method provided by the embodiment of the present invention can effectively improve the performance of semantic segmentation.
[0270] The following will describe in detail the technical solution of the present application and how the technical solution of the present application solves the above difficulties with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0271] Embodiment 1
[0272] The solution provided by the embodiment of the present invention is Figure 6 The technical solution shown is described in detail, which can solve the above-mentioned difficulty 1. Specifically:
[0273] In most network structures, in order to obtain more representative feature information, the feature map needs to be further processed, and feature map processing often involves convolution of the feature map.
[0274] The standard convolution method only uses the information of a fixed area of the current layer, so the convolution cannot effectively cover a larger area. For objects of a certain shape such as taller or wider, if the convolution kernel cannot cover the entire object, the segmented object will be discontinuous.
[0275] The inventors of this application have concluded that a feature map can be viewed as a three-dimensional matrix, such as Figure 8As shown. Based on this, an embodiment of the present application proposes a multi-directional feature map processing method, which can perform convolution operations on different directions of the feature map, so as to obtain higher-level feature information from different directions. The multi-directional convolution method can obtain information of multiple rows or columns in the feature map, that is, when the convolution operation is performed from the top and bottom directions or the left and right directions, from the front perspective, each convolution operation can cover a larger area.
[0276] For example, in the difficult point 1, a tall and thin street lamp, the common convolution operation is to divide the object into blocks for convolution operation, which makes the blocks independent and it is easy to have the problem that the upper and lower halves of the street lamp are predicted correctly while the middle part is predicted incorrectly. However, for multi-directional convolution, the convolution in the upper and lower directions can help cover the entire object from the forward direction, so this convolution method can improve the accuracy and stability when segmenting objects of specific shapes (such as objects with relatively large size in a certain direction of the image).
[0277] like Fig. 9 As shown, the virtual frame part can be used as a feature map processing process. In a feasible implementation method, the virtual frame part can be executed by a preset multi-directional feature map processor.
[0278] Among them, the multi-directional feature map processor can include a multi-directional feature extractor and a multi-gate control channel fusion, combined with Figure 6 and Figure 8 , step S6201 is executed through a multi-directional feature extractor, and step S6202 is executed through a multi-gate control channel fusion method.
[0279] In practical applications, such as Fig. 9 As shown, the feature map processing process may also include, after executing step S6202 through the multi-gate control channel fusion method, performing a convolution operation on the feature map obtained by the fusion process to obtain a category probability feature map.
[0280] As an example, a complete semantic segmentation process may include: performing feature extraction on an input processing image through a feature extraction network to obtain a feature map; inputting the obtained feature map into a multi-directional feature extractor, the multi-directional feature extractor performing convolution operations on at least two directions of the feature map (such as at least two directions of the front-back direction, the left-right direction, and the up-down direction), respectively, and then performing fusion processing on the results obtained after the convolution. When performing the fusion processing, the multi-gate control channel fusion method proposed in the embodiment of the present application may be adopted to obtain a fused feature map, and then a category probability feature map is obtained through convolution operation and softmax. According to the object category probability feature map, the category ID can be determined, that is, the category ID with the maximum probability corresponding to each pixel point is determined.
[0281] In the above semantic segmentation process, the pooling operation is an optional operation. That is, when the convolution operation is performed on at least two directions of the feature map, the feature map can also be pooled at the same time. If the pooling process is performed, the result obtained after the convolution and the result obtained after the pooling are fused to obtain a fusion result, and the object category probability feature map is obtained according to the fusion result to determine the category ID.
[0282] In fact, for the embodiment of the present application, the feature map processing for each direction of the feature map refers to the above step S6201. Specifically, only the convolution operation can be used; only the pooling operation can be used; or the convolution operation and the pooling operation can be used at the same time; and for each direction, the convolution operation can be performed first, and then the pooling operation can be performed according to the convolution result. For different operation modes, the specific fusion processing process can refer to the above introduction to step S6202, which will not be repeated here.
[0283] Specifically, in step S6201, the convolution methods and convolution parameters corresponding to different directions may be the same. For example, the same convolution method and the same convolution parameters are used to perform convolution operations on at least two directions of the feature map to obtain a convolution result. Alternatively, the convolution methods and convolution parameters corresponding to different directions may also be different. For each direction, the convolution method and convolution parameters corresponding to the direction are used to perform a convolution operation on the corresponding direction of the feature map to obtain a convolution result.
[0284] Among them, the convolution methods include standard convolution, atrous convolution, depthwise convolution or separable convolution, etc. Convolution parameters include kernel size, dilation rate, convolution step, parameter amount (determined by kernel size, dilation rate, etc.). When the convolution method is atrous convolution, the convolution kernel has the corresponding dilation rate. When the convolution method is non-atrous convolution, there are only kernel size, convolution step and parameter amount, and the parameter amount is determined by kernel size, etc.
[0285] Similarly, in step S6201, the pooling methods and pooling parameters corresponding to different directions may be the same, for example, the same pooling method and the same pooling parameters are used to perform pooling operations on at least two directions of the feature map to obtain a pooling result. Alternatively, the pooling methods and pooling parameters corresponding to different directions may also be different, and for each direction, the pooling method and pooling parameters corresponding to the direction are used to perform a pooling operation on the corresponding direction of the feature map to obtain a pooling result.
[0286] Among them, the pooling methods include maximum pooling, average pooling, etc. Pooling parameters include pooling kernel size, pooling step size, etc.
[0287] In the embodiment of the present application, the at least two directions of the feature map proposed in step S620 include at least two directions of the front-back direction, the left-right direction, and the up-down direction.
[0288] In practical applications, the forward direction of the feature map, that is, the front-to-back direction, can still be used as the main direction for feature map processing, and other directions can be used as auxiliary processing. This is because the performance of the convolution operation is higher in the front-to-back direction than in other directions. Therefore, the front-to-back direction can be selected, and at least one direction can be selected from the left-right direction and the up-down direction for convolution.
[0289] Among them, for each direction of the feature map, a convolution kernel can be set, or multiple convolution kernels with the same convolution mode and different convolution parameters can be set. That is to say, for each direction of the feature map, the convolution kernel of the convolution operation can be one or more. When there are multiple convolution kernels, the convolution modes of the convolution kernels are the same and / or the convolution parameters are different.
[0290] In an embodiment of the present application, the convolution method and convolution parameters corresponding to each direction can be pre-set. If the convolution methods or convolution parameters corresponding to different directions are different, the convolution method and the corresponding convolution parameters for each direction can be set separately.
[0291] Combined with the method of determining the convolution mode and convolution parameters corresponding to each direction in the above step S6201, as an example, the convolution mode in the front-to-back direction can be set to Atrous convolution, and the number of convolution kernels and the parameters corresponding to each convolution kernel can be set through experience or experimental results, and then the convolution mode and convolution parameters in the up-down or left-right direction can be set according to the convolution mode and convolution parameters in the front-to-back direction. For example, the convolution mode in the up-down or left-right direction can be set to depthwise convolution, or the convolution mode in the up-down or left-right direction can also be set to Atrous convolution, and the number of convolution kernels is set to be consistent with the number of convolution kernels in the front-to-back direction. If the kernel size of the convolution kernel in the front-to-back direction is larger, the kernel size of the convolution kernel in the up-down or left-right direction can also be set larger.
[0292] Alternatively, in combination with the method of determining the convolution mode and convolution parameters corresponding to each direction in the above step S6201, the convolution mode and convolution parameters corresponding to each direction can be set in real time. For example, the corresponding convolution mode and convolution parameters can be selected for each direction according to the device status and task requirements.
[0293] If the task requires high real-time performance, or the device battery is low or the device is busy, you can set the up / down / left / right convolution method and / or convolution parameters to be different from the front-to-back direction. Atrous convolution is used in the front-to-back direction, and depthwise convolution can be used for the up / down / left / right. Smaller and fewer convolution kernels can be used for the up / down / left / right.
[0294] If the task requires higher performance, or the device has more battery power or is idle, you can set the up / down / left / right convolution mode and convolution parameters to be consistent with the front / back direction.
[0295] Similarly, for each direction of the feature map, a pooling kernel can be set respectively, or multiple pooling kernels with the same pooling mode and different pooling parameters can be set respectively.
[0296] This solution can pre-set the pooling method and pooling parameters corresponding to each direction. If the pooling methods or pooling parameters corresponding to different directions are different, the pooling method and the corresponding pooling parameters for each direction can be set separately.
[0297] In combination with the method of determining the pooling method and pooling parameters corresponding to each direction in the above step S6201, as an example, through experience or experimental results, the pooling method for the front-to-back direction is set to the average pooling method, and the pooling kernel size is set equal to the length and width of the feature map, and then according to the pooling method and pooling parameters in the front-to-back direction, the pooling method and pooling parameters in the up-down or left-to-right direction are set. For example, the pooling method in the up-down or left-to-right direction can be set to maximum pooling or average pooling, and the width of the pooling kernel in the left-to-right direction is 1, and the height in the up-to-down direction is 1.
[0298] From the above introduction, it can be seen that after further convolution processing and / or pooling processing are performed on the feature map, the obtained feature map needs to be fused.
[0299] When existing technologies perform feature fusion, most of them directly perform merging or addition processing, which results in poor fusion effect. Different features contribute differently to the final output result, and direct fusion methods may cause important features to be masked, affecting system performance.
[0300] The embodiment of the present application proposes a multi-gate control channel fusion processing method to fuse the feature graphs after multi-directional feature extraction. Combined with the step S6202 proposed above, in short, it can be realized in the following way: fusing the operation results of at least two directions through at least one control gate. The definition of each control gate is as follows:
[0301] Gate No. 1, which performs an operation on the acquired feature bias information, and the bias can enhance the effective information of the current channel while suppressing the invalid information of the current channel. Prior to this, a channel correlation feature is obtained by applying a preset convolution operation to the feature map output by the multi-directional feature extractor (the operation result in the above text) to describe the connection between different channels. Gate No. 1 uses a preset activation function on the channel correlation feature to obtain the corresponding bias information, wherein the activation function can be relu, leaky relu, relu6, selu, tanh, sigmoid, etc. Specifically, the control method of gate No. 1 includes: adding the acquired bias information to the operation result (i.e., biasing the operation result); or, adding the acquired bias information to the output results of other control gates (i.e., biasing the output results of other control gates).
[0302] Gate No. 2, which performs operations on the acquired fusion weight information. Prior to this, a channel correlation feature is obtained by applying a preset convolution operation to the feature map output by the multi-directional feature extractor (the operation result in the above text) to describe the connection between different channels. Gate No. 2 uses a preset activation function on the channel correlation feature to obtain the weights of each feature in the feature map output by the multi-directional feature extractor, where the activation function can be relu, leaky relu, relu6, selu, tanh, sigmoid, etc. Specifically, the control method of gate No. 2 includes: multiplying the acquired weight information with the operation result (i.e., weighting the operation result); or, multiplying the acquired weight information with the output results of other control gates (i.e., weighting the output results of other control gates).
[0303] Gate No. 3 is a straight-through gate that only performs skip connection processing (which can be called skip operation). The input and output are the same, both of which are feature maps output by the multi-directional feature extractor. The function of this gate is to maintain the detailed information of the category ID map output by the semantic segmentation. Specifically, the control method of gate No. 3 includes: adding the output results of other control gates to the operation results through skip operation.
[0304] In actual use, different door controls can be selected according to specific needs. For example, to keep the edge of the category ID map clearer, door No. 2 and door No. 3 can be used. If the error area in the category ID map is to be suppressed, door No. 1 and door No. 2 can be used, or door No. 1 and door No. 3 can also be used. Combined with step S6202, it can be seen that door No. 1 and door No. 2 can also be used alone. In addition, the order of the three doors is not limited in the embodiment of the present application. For example, door No. 3 can also be set after door No. 1 and door No. 2, or between door No. 1 and door No. 2. The embodiment of the present application does not limit the number of the three doors. For example, two door No. 1s can be used at the same time. In actual applications, the required control gate can be selected by opening and closing the corresponding control gate.
[0305] like Fig.10 As shown, the embodiment of the present application proposes a feasible logical flow of a multi-gate control channel fusion processing method. For simplicity of expression, take one output result (the result of a convolution operation or the result of a pooling operation) among all the outputs of the multi-directional feature extractor as an example: the feature map of the result is first added to the bias of gate No. 1, multiplied by the weight of gate No. 2, and then added to the feature map of the result in gate No. 3 to obtain the result of the first step of fusion processing of the feature map of the result. Repeat the above process, apply the above first step fusion processing flow to each output result of the multi-directional feature extractor, and finally sum the feature maps corresponding to all the results after the first step of fusion processing to obtain the final fusion result.
[0306] It should be noted that the feature map processing method of the embodiment of the present application can be combined with any other feature extraction method (such as the existing feature extraction method, the feature extraction method provided in subsequent embodiments, etc.).
[0307] Taking ASPP (Atrous Spatial Pyramid Pooling, spatial pyramid combination) as an example, the implementation process of the multi-directional feature map processing method based on the embodiment of the present application is introduced below:
[0308] The standard ASPP uses four parallel convolution kernels with different dilation rates to perform dilated convolution operations on the front of the feature map. The meaning of parallel is that four different convolution kernels are used to perform convolution operations on the same feature map. When performing dilated convolution, the dilation rates are different, so the convolution kernels can be considered to be different.
[0309] In the embodiment of the present application, the execution process of the multi-directional feature extractor is to perform convolution operations on different directions of the feature map respectively. Fig.11 As shown,
[0310] The similar part to ASPP is that one or more dilated convolution operations with different dilation rates can be used on the front side (front and back direction) of the feature map. In the embodiment of the present application, 4 dilated convolution operations are used as an example. In addition to convolution operations, the feature map can also be pooled. The pooling method can be average pooling, and the pooling kernel size is the same as the feature map size.
[0311] The difference from ASPP is that in addition to the front convolution and pooling operations, we can also perform up-down and / or left-right convolution and / or pooling operations. When performing up-down and / or left-right convolution and / or pooling operations, in order to ensure that channels do not affect each other and avoid spatial position confusion, we can limit one dimension of the convolution kernel (and pooling kernel) to 1, that is, each convolution or pooling operation targets a certain layer in the feature map.
[0312] As an example, multiple (for example, four) parallel convolution operations are used in the left and right directions. The width of the convolution kernel size is 1, and the height can be different S, for example, S=3, and the sizes of the convolution kernels can be set to be consistent, that is, [3,1], or inconsistent. The expansion rate corresponding to each convolution kernel (for simplicity of description, represented by rate below) can be consistent or inconsistent, for example, the rates of each convolution are {1,8,16,32}.
[0313] Optionally, pooling operations are also used in both the left and right directions, taking average pooling as an example. The step size of average pooling is 1, and the kernel size is [H, 1] (H is the height of the feature map). After the average pooling operation, the feature map can be scaled back to its original size.
[0314] The same strategy can be used for the up and down directions as for the left and right directions. The difference is that the size of the convolution kernel is [1,3] and the size of the average pooling kernel is [1,W] (W is the width of the feature map).
[0315] In addition, in the standard ASPP, multi-branch features are directly connected in parallel (also called concat operation, which is used to connect two or more arrays). The concat operation cannot effectively highlight the effective information, but will drown out the effective information, so the concat method may affect the performance after fusion.
[0316] In the embodiment of the present application, the multi-gate control channel fusion method can fuse the results of different convolutions or pooling by learning:
[0317] If convolution and pooling are processed in parallel, all convolution results and pooling results in all directions are first connected to obtain the merged feature map; if convolution and pooling are processed in series, all pooling results in all directions are first connected to obtain the merged feature map.
[0318] The multi-gate control channel fusion in the embodiment of the present application can be considered as obtaining the fusion weight corresponding to each layer in the merged feature map, and performing weighted processing on each layer according to the fusion weight of each layer, such as weighted summation processing.
[0319] Specifically, a “union” operation is first applied to all feature maps output by the multi-directional feature extractor.
[0320] After completion and operation, it is necessary to learn the contribution of each feature map to the final output result. Here, a multi-gate control channel fusion method is used to learn the contribution of different feature maps to the final output result.
[0321] When learning the contribution of a feature map to the final output result, firstly, all the feature maps output by the multi-directional feature extractor are combined and operated through a 1×1 convolution operation to obtain the channel correlation feature, and then controlled by the following three gates.
[0322] First, it passes through gate 1, which is a tanh operation. This gate is used to enhance information and suppress useless information. The input of this gate is the channel correlation feature, and the output is the bias. The reason why tanh is used to enhance information here is that the data range of tanh is [-1,1]. This method can suppress some unnecessary data on the feature map and enhance the range of some data.
[0323] Then it passes through gate No. 2, which is a sigmoid operation. The input of this gate is the channel correlation feature, and the output is the learned weight. Sigmoid is used here because the data range of sigmoid is [0,1], and a weight can be directly obtained.
[0324] Then it passes through gate No. 3, which directly performs a skip operation to ensure that detailed information is not lost.
[0325] In summary, the output of the multi-directional feature extractor is a result plus the bias, multiplied by the weight, and then added to the result, which is the output of gate 3. Each operation in each direction samples the output in the same way. Finally, all the outputs are added together to get the final output result.
[0326] From this, it can be concluded that one of the advantages of the multi-directional feature map processing method provided in the embodiment of the present application is that: compared with the concat operation, the multi-gate control feature fusion is learnable; compared with the single-gate control, the multi-gate control can enhance the effective information and maintain the detailed information of the output category ID map.
[0327] The inventor of this application has found through experiments that:
[0328] 1. The multi-directional feature extractor based on the embodiment of the present application has a 0.8% performance improvement on the validation set compared with the standard ASPP;
[0329] 2. Compared with the concat operation, the multi-gate control channel fusion method based on the embodiment of the present application has a 0.2% performance improvement on the verification set;
[0330] The results show that the multi-directional feature processor of the embodiment of the present application can improve the segmentation effect of objects of specific shapes.
[0331] Embodiment 2
[0332] The solution provided by the embodiment of the present invention introduces in detail the technical solution of extracting features from input images using the adaptive receptive field method, which can solve the above-mentioned difficulty 2. Specifically:
[0333] In semantic segmentation, the size of objects in the input image is very diverse. In the network, the receptive field of a layer refers to the size of the range affected by the convolution operation in the layer corresponding to the input image. The receptive field is mainly determined by the convolution parameters (such as the convolution kernel size or the dilation rate, etc.). A large receptive field can better cover larger objects and accurately extract the features of such objects, but for smaller objects, it will introduce too much noise information and reduce the accuracy of feature extraction; conversely, a small receptive field can better cover smaller objects and accurately extract the features of such objects, but for larger objects, it cannot completely cover the entire object, resulting in incomplete feature extraction and a decrease in extraction performance.
[0334] Therefore, the inventors of the present application believe that in order to handle the semantic segmentation of objects of different sizes and shapes, it is necessary to flexibly adjust the receptive field so that it can just cover the corresponding object size.
[0335] However, in the prior art, after the network training is completed, the convolution parameters of all layers in the network are fixed, that is, the receptive field of the network structure is fixed and cannot be adjusted during the application stage. In order to adapt to various object sizes, most existing methods use large-scale training sets containing objects of various sizes. It is not difficult to understand that this method consumes a lot of computing resources, and the acquisition of training sets is also very expensive, and it is difficult to cover all situations.
[0336] In order to solve the above problems, the embodiment of the present application proposes an adaptive receptive field, which can adjust the network receptive field online and adaptively according to the size of the object in the input image, thereby bringing better feature extraction capabilities, such as Fig.12As shown in the figure, the input image is subjected to several feature extractions. After a feature extraction, the adaptive receptive field is adjusted, and then feature extraction is continued. The feature map is processed according to the feature map finally extracted to obtain the segmentation result, and the segmentation performance is finally improved. Intuitively, it is possible to extract the features of large-sized objects with a large receptive field and the features of small-sized objects with a small receptive field.
[0337] Specifically, the adaptive receptive field method is used to extract features from the input image to obtain a feature map. For example, steps 1, 2, and 3 above are used. If the adaptive receptive field is performed in the set convolution layer for the feature map extracted by the feature extraction module, in simple terms, Fig.13 As shown,
[0338] In step SA, a feature map of the previous layer is input, and the feature map of the previous layer may be a feature map output by a convolutional layer, a pooling layer, or a batch normalization layer of the previous layer.
[0339] Step SB, performing a convolution operation (i.e., the convolution operation in the figure) on the feature map of the previous layer according to the current convolution mode and convolution parameters to obtain a convolved feature map. The convolution operation can be a standard convolution, a depthwise convolution, or a separable covolution.
[0340] Step SC, using the result processed by the feature map processing module (which can be unidirectional or multidirectional in the first embodiment) to obtain the category probability feature map. The result processed by the feature map processing module can be processed by convolution and softmax to obtain the category probability feature map.
[0341] Each eigenvalue in the category probability feature map represents the probability value that the corresponding pixel belongs to a certain object category. The probability of each category is judged according to the category probability feature map (corresponding to the category confidence mentioned above). The higher the probability, the greater the accuracy of the predicted category ID map, which means that the receptive field is more appropriate. Conversely, the lower the probability, the lower the accuracy of the predicted category ID map, which means that the current receptive field size is not appropriate and needs further adjustment. Specifically, the highest probability is taken for all pixels in the object category probability feature map, and the average of the highest probabilities is calculated (that is, the method of determining the category confidence in step 2 above). If the average value is greater than the threshold, it means that the predicted category ID map is more accurate, which means that the receptive field is more appropriate.
[0342] When judging the accuracy here, we can use the pre-set threshold. If the probability of the object category is greater than the threshold, it is considered that the best receptive field has been found, and the feature map obtained by convolution under the receptive field is output and entered into the next layer for processing; if the probability of the object category is less than or equal to the threshold, it enters the SD judgment (that is, the method of confirming whether the convolution parameters corresponding to the convolution layer need to be adjusted in step 3 above).
[0343] Step SD, determine whether the number of iterations meets the maximum number of iterations requirement. Because the iterative convolution operation consumes a certain amount of computing resources, it needs to be controlled, so the number of iterations must be limited. If the computing resources are sufficient, the number of iterations can be set.
[0344] Assume that there are n adaptive receptive field modules in the entire network, the maximum possible number of iterations for each module is m (corresponding to the preset second iteration threshold in the above text, which can be set by technicians in this field according to actual conditions), and the maximum total number of iterations for all adaptive receptive field modules in the network is N (corresponding to the preset first iteration threshold in the above text, which can be set by technicians in this field according to actual conditions). Then the possible number of iterations for each module needs to meet the following conditions:
[0345]
[0346] If the iteration condition is still met in this iteration, continue to search for the best receptive field.
[0347] Otherwise, it means that although the best receptive field has not been found, the computing resources consumed are too large, so the current receptive field can only be considered as a better receptive field that has been found, and the feature map obtained by convolution under the receptive field is output.
[0348] In the above process, it is necessary to calculate the parameter change amount for adjusting the receptive field (i.e., the parameter change amount corresponding to the convolution layer). The parameter change step can be a fixed value, or it can be determined by the average probability (i.e., the above category confidence) and the threshold (threshold), where the average probability is the average probability of all categories, and the threshold can be determined by experience. The calculation formula is as follows:
[0349]
[0350] Height is the height of the feature map, and width is the width of the feature map. The maximum step here is limited to not exceed the image itself, because if it exceeds the size of the image itself, a lot of useless convolution calculations will be performed during the convolution operation.
[0351] If the convolution of this layer is a standard convolution, the parameter change can be the size of the convolution kernel. If the convolution of this layer is a dilated convolution, the parameter change can be the dilation rate of the dilated convolution.
[0352] Furthermore, the convolution parameters are updated using the parameter change, for example, new convolution parameters = old convolution parameters + step, that is, Rate = Rate + step in the figure.
[0353] Because the above process needs to add additional computing time to obtain a better category ID map, it can be customized here according to the different needs of users. Refer to the method of determining the setting of the convolution layer in step 1 above. As an example, if the user defines efficiency first, this process can only appear in the last key convolution layer in the feature extraction stage. In the feature extraction process, as the network deepens, the resolution of the feature map continues to decrease. The key convolution layer refers to the last convolution layer in the feature map of the same resolution in the feature extraction stage. The key convolution layers are sorted from large to small according to the resolution of the feature map. The last key convolution layer is the key convolution layer with the lowest resolution. The reason why the last convolution layer at the same feature map resolution is defined as the key convolution layer is that the convolution operation of the convolution layer obtains the best semantic information of the feature map at this resolution. If the user defines performance first, this process can be applied to at least two key convolution layers. Because the adaptive receptive field module has a limited adjustment range for the receptive field, multiple applications can bring better performance.
[0354] If the algorithm is deployed in the cloud or in an environment with sufficient computing power and the performance requirements are extremely high, such as Fig.14 As shown in , an adaptive receptive field operation can be used in each convolutional layer. This can find the best receptive field solution to obtain the best category ID map. Fig.14 In , convolutional layers at the same resolution form a feature extraction module.
[0355] The adaptive receptive field provided by the embodiment of the present application has at least the following advantages:
[0356] 1. Adaptive receptive field can improve the stability of segmentation of objects of different sizes
[0357] 2. Adaptive receptive field can be applied to key parts without being very time-consuming
[0358] Therefore, the inventor of the present application has found through experiments that:
[0359] Manually setting the convolution rate to 2 will result in a 0.2% performance improvement.
[0360] Manually setting the convolution rate to 6 will result in a 0.3% performance improvement.
[0361] Adaptive receptive field brings 0.4% performance improvement on the validation set.
[0362] like Figures 15-16 As shown, the adaptive receptive field is more robust to objects of different sizes.
[0363] In addition to the above-mentioned adaptive receptive field method, the present invention also proposes a technical solution for setting the receptive field that is different from the prior art, which is described in detail below.
[0364] At present, most networks set up a multi-receptive field processing module after the feature extraction network. The multi-receptive field processing module performs convolution operations on the feature maps output by the feature extraction network according to multiple pre-set convolution parameters (for example, the convolution kernel size of each convolution operation is 3*3, but the corresponding rate is different), and obtains multiple feature maps after convolution. Then, the multiple feature maps after convolution are fused (for example, a union operation is performed), and subsequent operations are performed based on the fused feature maps, such as feature map processing and determining category probability feature maps.
[0365] Among them, fusion can be achieved in the following ways:
[0366] y=f(f(x))*w1+g(g(x))*w2
[0367] y represents the feature map output by the receptive field processing module, x represents the feature map input to the receptive field processing module, f(f(x)) represents the feature map obtained after one branch is convolved, w1 is the weight corresponding to the branch, g(g(x)) represents the feature map obtained after another branch is convolved, and w2 is the weight corresponding to the other branch. Each branch performs convolution twice, for example, f(x) and g(x) are feature maps obtained after one convolution, and f(f(x)) and g(g(x)) are feature maps obtained after two convolutions. g(x) can be a dilated convolution, and f(x) can be a standard convolution.
[0368] The inventors of the present application have discovered that when feature extraction is performed according to the existing receptive field setting method, the accuracy of feature extraction is not high.
[0369] In this regard, the embodiments of the present application propose the following method for processing multiple receptive fields of multiple branches.
[0370] Specifically, the feature map extracted by the feature extraction module is set to undergo receptive field processing through at least one receptive field processing module to obtain a feature map after receptive field processing.
[0371] A general feature extraction network includes several feature extraction modules, each of which is composed of several network layers (such as convolutional layers, pooling layers, batch normalization layers, etc.) The embodiment of the present application proposes that a receptive field processing module is pre-set for each feature extraction module of the feature extraction network.
[0372] The feature extraction module is set to include any of the following:
[0373] Any feature extraction module in the feature extraction network;
[0374] Any feature extraction module in the feature extraction network whose depth is greater than the third depth threshold.
[0375] That is, in the embodiment of the present application, a receptive field processing module can be set for each feature extraction module of the feature extraction network, or a feature extraction module whose depth is greater than a set threshold can be selected in the feature extraction network to set the receptive field processing module. In other words, a feature extraction module close to the output end of the network is selected to set the receptive field processing module. For example, the last feature extraction module in the feature extraction network is selected as the set feature extraction module.
[0376] Among them, at least one receptive field processing module can be set for setting the feature extraction module. For example, one or more receptive field processing modules can be set. When multiple receptive field processing modules are set, the multiple receptive field processing modules can be operated in series, and the feature map output by the previous receptive field processing module is used as the input of the next receptive field processing module.
[0377] The above-mentioned receptive field processing module includes at least one receptive field processing branch.
[0378] If a receptive field processing branch is included, any receptive field processing module performs receptive field processing, including:
[0379] The feature map output by the set feature extraction module or the previous receptive field processing module is convolved through the current receptive field processing module to obtain a feature map after convolution processing.
[0380] In a feasible implementation method, the method is to obtain the receptive field in multiple branches while extracting features. Specifically, the receptive field processing module includes multiple receptive field processing branches, which may include at least two branches, and each branch may have a different receptive field, that is, corresponding to different convolution parameters. After the receptive fields of the above-mentioned multiple branches, multiple feature maps after convolution can be obtained. Each branch is pre-learned through the network to obtain the corresponding fusion weight. After obtaining the multiple feature maps after convolution, the feature maps obtained by each branch can be fused based on the fusion weights corresponding to each branch. That is, in the embodiment of the present application, any receptive field processing module performs receptive field processing, including: setting the feature map output by the feature extraction module or the previous receptive field processing module, respectively performing convolution processing through each receptive field processing branch of the current receptive field processing module, to obtain each feature map after convolution processing; and then based on the weights corresponding to each receptive field processing branch of the current receptive field processing module, each feature map after convolution processing is fused. If the current receptive field processing module is not the last receptive field processing module of the last feature extraction module, the feature map obtained after the fusion processing can be output to the next feature extraction module for feature extraction. If the current receptive field processing module is not the last receptive field processing module in the series of multiple receptive field processing modules of the set feature extraction module, the feature map obtained after the fusion processing can also be output to the next receptive field processing module. If the current receptive field processing module is the last receptive field processing module of the last feature extraction module, the feature map obtained after the fusion processing can also be directly used according to the fused feature map. The subsequent operations such as feature map processing and determining the category probability feature map are performed.
[0381] Based on the above scheme, the embodiment of the present application proposes two specific implementation methods, which are described in detail below.
[0382] The first implementation method: the parameter quantities in the convolution parameters corresponding to each branch in the receptive field processing module are different, wherein the convolution kernel sizes can be the same (such as convolution kernels of 3*3 size), and the rates can be different.
[0383] like Fig.32 As shown in the figure, taking two branches as an example, the feature maps output by the set feature extraction module are processed by the receptive fields of the two branches respectively, where the receptive field processing of one branch can be performed by dilated convolution, and the receptive field processing of the other branch can be performed by standard convolution. The two branches correspond to different parameter quantities, the convolution kernel size can be the same, and the rate can be different. The feature maps obtained after multiple convolution operations on each branch are fused according to the corresponding weights to obtain the feature map output by the receptive field processing module. For example, Fig.32The weight corresponding to the hole convolution in is weight 1, and the weight corresponding to the standard convolution is weight 2. The feature maps of the two branches are fused according to weight 1 and weight 2.
[0384] In the first implementation method described above, the process of network training is consistent with the process of online processing.
[0385] In addition, when feature extraction is performed according to the first implementation method, since multi-branch multi-receptive field processing is performed in the feature extraction process, the accuracy of feature extraction is greatly improved and the processing speed is also improved.
[0386] The second implementation method: the convolution parameters (parameters in the convolution parameters) used by each receptive field processing branch in any receptive field processing module for convolution processing are the same, where the convolution kernel size can be the same (such as a convolution kernel of 3*3 size), and the rate can be different. It can also be considered that the convolution operations of each branch share the same parameter amount.
[0387] like Fig.33 As shown, taking two branches as an example, the feature maps output by the set feature extraction module are processed by the receptive fields of the two branches respectively, wherein the receptive field processing of one branch can be performed by dilated convolution, and the receptive field processing of the other branch can be performed by standard convolution. The two branches correspond to the same parameter amount, that is, the convolution operations of each branch share the same parameter amount, and the convolution kernel size of each branch can be the same, and the rate can be different. The feature maps obtained by multiple convolution operations on each branch are fused according to the corresponding weights to obtain the feature map output by the receptive field processing module. For example, the weights of the two branches are equal, both 1 / 2, and the feature maps of the two branches are fused according to the above weights, that is, the output results of the two branches are averaged.
[0388] When feature extraction is performed according to the second implementation method mentioned above, since multi-branch multi-receptive field processing is performed in the feature extraction process, and the multi-branch multi-receptive field processing uses shared parameters without adding new parameters, it is easier to converge when training the feature extraction network, the training is more stable, the accuracy of feature extraction is greatly improved, and its processing speed is also improved.
[0389] In the second implementation mode described above, the network training process (also referred to as the offline mode) and the online processing process (also referred to as the online mode) may be consistent, for example, both are Fig.33 shown.
[0390] In addition, the following can be used during the network training phase: Fig.33 The online processing flow can be as follows Fig.34 As shown, only one branch of the training phase is retained, which can be retained Fig.33 The hollow convolution branch in can also be retained Fig.33 In other words, a receptive field processing module is pre-set for each feature extraction module of the feature extraction network, and the receptive field processing module includes a branch. After the above receptive field processing module, combined with the above, it can be known that the feature map after convolution can be output to the next feature extraction module for feature extraction, or it can be output to the next receptive field processing module, or it can be directly processed according to the fused feature map and subsequent operations such as determining the category probability feature map can be performed. This method can greatly reduce the network calculation time during online processing and improve the processing speed of feature extraction.
[0391] According to the above method, the embodiment of the present application proposes the following Fig.35 The semantic segmentation network structure shown in the figure integrates the original image into the network, extracts features from the input image, and uses the network coding method of Xception. The feature map output by the feature extraction is input into the receptive field processing module, where multiple receptive field extraction modules can be connected in series. Each receptive field extraction module can be divided into two branches, each with a different receptive field. Each branch performs convolution processing according to different receptive fields (i.e., corresponding to different convolution parameters) (this process can also be considered as a feature extraction process). The feature maps obtained by the two branches are fused and input into the next receptive field processing module. The fusion result output by the last receptive field processing module is subjected to a 1*1 convolution operation, and then processed by the feature map to obtain a category probability feature map, and finally a category ID map is obtained, and the final segmentation result is output.
[0392] Embodiment 3
[0393] The solution provided by the embodiment of the present invention introduces in detail the technical solution of extracting features from input images by using the adaptive cascade prediction method and the multi-channel prediction method, which can solve the above-mentioned difficulty 3. Specifically:
[0394] In the embodiment of the present application, in the technical solution for extracting features from an input image based on a cascade prediction method, it is considered that a general feature extraction network includes several feature extraction modules, each of which is composed of several network layers (such as convolutional layers, pooling layers, batch normalization layers, etc.). Fig.17a As shown in the figure, the deep modules can extract abstract semantic features, while the shallow modules can extract relatively specific low-level shape features. In most cases, images tend to be simple and can be recognized by shallow modules, requiring only shallow feature extraction modules. On the other hand, images in complex scenes require deeper feature extraction modules and more parameters to extract relatively abstract high-level semantic features.
[0395] In the present application embodiment, Fig.18 As shown, the number of feature extraction modules involved in online prediction is determined by the input image adaptation. Whether the subsequent feature extraction module is needed is determined by the confidence calculated by the current module (corresponding to the category confidence in the above text). The confidence can be based on the probability map of the prediction result, but is not limited to this. If the confidence is greater than the set threshold, it is considered that the image has been well inferred by the current module and no deep module is needed. At this time, the network directly uses the feature extraction result as the output of the feature extraction network, performs subsequent operations to obtain the prediction result, and no longer uses the deep module. In addition, the obtained category probability feature map can also be directly output to obtain the prediction result without performing the feature map processing step.
[0396] See also Fig.17a and Fig.17b , showing a comparative schematic diagram of the cascade prediction method of the prior art and the embodiment of the present application, Fig.17a In the existing technology operation process, the input image goes through the complete feature extraction module (up to module n+4), then goes through feature map processing, ID calculation, etc., and finally outputs the category probability feature map to obtain the semantic segmentation result, that is, the prediction result. This method makes the network run slower and consumes more computing power. Fig.17b This is the operation flow of the cascade prediction method of the embodiment of the present application. The feature extraction process ends at module n+2, enters the feature map processing stage, and finally outputs the category probability feature map to obtain the segmentation result. It can be seen that the present invention greatly reduces the amount of calculation (module n+3 and module n+4 are not running) and speeds up the network operation speed.
[0397] Specifically, an adaptive cascade prediction method is used to extract features from the input image to obtain a feature map. See steps 4 and 5 above. In short, Fig.19 As shown:
[0398] Step SE, since the shallower extraction module can only provide the features of the lower layer (such as the outline of the object), the semantic information of the object is less, and it is difficult to predict the category of the object. Therefore, we generally apply the present invention from the middle layer module of the network. For example, the depth of the entire network is 2n, and the embodiment of the present application adopts the cascade prediction method starting from the nth or n+1th module.
[0399] In step SF, the features extracted by the current module (depth>n) are sent to the feature map processing module (it can be unidirectional or multi-directional in embodiment 1. The feature map processing scheme can be selected according to the actual scenario and device requirements. For example, on the mobile terminal or when the real-time requirements are relatively high, a unidirectional feature map processing technology can be used to improve the processing speed), and the category probability feature map is output.
[0400] Step SG, calculate the confidence based on the object category probability feature map. The higher the confidence, the greater the confidence of the network in judging the object category, indicating that the object or scene is relatively simple and belongs to a simple image. On the contrary, the lower the confidence, the lower the confidence of the network in judging the object category of the image, indicating that the object or scene is complex and belongs to a more difficult image. Here, the confidence can be calculated in a variety of ways. For example, a simple way refers to the method of determining the category confidence in step 4 above, and the average of the highest probability values of all pixels in the probability map is calculated as the confidence. In addition, weighted averaging can be used, or a corresponding function can be set for calculation.
[0401] In step SH, refer to the method in the above step 5 to confirm whether it is necessary to enter the next feature extraction module for feature extraction processing, and compare the confidence level with the pre-set threshold. When it is greater than the threshold, it is considered that the current feature extraction network can already extract features well for the input image, and there is no need for a subsequent deeper feature extraction module. It directly enters the feature map processing stage to obtain the prediction result, or in step SF, if the multi-directional feature map processing method in Example 1 is used to perform feature map processing, then the category probability feature map can be directly output at this time to obtain the prediction result, and there is no need to execute the feature map processing stage. When it is less than or equal to the threshold, it is considered that the features extracted by the current feature extraction module for the input image are not enough, and further deeper feature extraction is required. The above threshold can be obtained based on experience and experiments, and a typical value is 0.8.
[0402] by Fig. 20 For example, at feature extraction module n+1, adaptive cascade prediction begins. At n+1, the confidence is low, and the subsequent feature extraction module continues; at n+2, the confidence is greater than the threshold, the feature extraction process ends, and the feature map processing module is directly entered. The value of n is determined by the feature extraction module and the actual application scenario.
[0403] In the embodiment of the present application, in the technical solution for extracting features from an input image based on a multi-channel prediction method, considering the prior art, such as Fig.21 As shown in the figure, the features output from the shallow feature extraction module and the category probability feature map obtained after feature map processing (the prediction result of the shallow module) are not used as the input of the next feature extraction module. This causes the fragmentation and loss of the relationship information between objects to a certain extent, and the semantic information is not fully utilized.
[0404] Specifically, a multi-channel prediction method is used to extract features from the input image to obtain a feature map. Please refer to step 6 above. In short, continue as follows Fig.21 As shown in the lower part of
[0405] The pixel category labels (i.e., prediction results) inferred by the shallow module are used as another input to the deep module. The preliminary results of the shallow module contain semantic information between objects, such as people riding bicycles, which can guide the deep module to extract more spatial and semantic information. Due to the increase in input information and the reduction in the prediction area, the number of channels of the convolutional layer of the deep module can be reduced accordingly without losing accuracy.
[0406] Specifically, it is necessary to fuse the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module and then input them into the next feature extraction module for feature extraction. Fig. 22 As shown:
[0407] The shallow module passes the output feature map and the category probability feature map (i.e., category prediction result) obtained by the output feature map through the feature map processing module to the deep feature extraction module. Referring to step 6 above, if the size of the output feature map is different from that of the category probability feature map, a fusion operation can be performed through a fusion unit first, and the fusion result enters the subsequent feature extraction module. In this scheme, the typical structure of the fusion unit is that the output feature map and the category probability feature map each undergo a convolution with a kernel size of 3*3, and then the size of the feature map is adjusted to the same size, and then the addition operation is performed. It should be noted that the fusion unit is not limited to this structure. For example, concatenation and convolution can be used instead of add operations. If the size of the output feature map is the same as that of the category probability feature map, it can be selected whether to pass through the fusion unit according to the situation. For example, when the calculation speed is given priority, the two inputs can be directly sent to the subsequent deep feature extraction module without passing through the fusion unit. When performance is given priority, in order to better interact and fusion of information, the fusion unit can be passed first, and then the fused result can be sent to the subsequent deep feature extraction module.
[0408] By fusing the shallow feature maps and prediction results, the inference results obtained by the shallow module will be used as another input of the deep module, which can transmit more spatial and semantic information, improve the effective feature extraction performance of the deep module, and better perform semantic segmentation prediction. In this way, compared with the existing technology, the number of channels of the convolutional layer of the deep module can be greatly reduced. The specific degree of reduction depends on the feature extractor, experience and experiments. Taking the residual network ResNet as an example, the number of channels of the last two modules can be reduced by up to 1 / 3, which can greatly save computing resources and time.
[0409] In the present application embodiment, Fig.23aAs shown in the figure, a multi-channel adaptive cascade prediction structure is also proposed, which includes both cascade prediction function and multi-channel prediction function. This is mainly because most of the current methods use a fixed network structure for prediction, that is, the input image must go through all the operations from the first layer to the last layer of the network to get the output result. The prediction results of the shallow module will not be input into the subsequent network, that is, the segmentation results of the shallow module are not used to guide the inference of the deep module. For example, the existing semantic segmentation network structure with multiple modules in series, such as Figure 23b As shown in the figure. The input image passes through three modules in sequence. The first module first infers the simpler areas in the image and passes the rest to the second module for processing. The second module predicts the relatively simple areas in the areas passed by the first module, that is, the areas with medium difficulty from the overall perspective, and sends the remaining areas with the greatest difficulty to the third module for processing. The third module finally outputs the prediction results for the areas with the greatest difficulty. After forming the category ID maps of three different areas, simple, general, and difficult, they are fused to obtain the final semantic segmentation prediction results.
[0410] There are two major problems with the semantic segmentation network structure described above: First, regardless of the simplicity of the scene or object in the input image, each image must go through the three complete modules. In the case of a simple scene, it is very likely that the first module has already output a good result, but it still has to go through the two subsequent cascade modules, which greatly wastes computing time and computing resources. Second, the simple area determined by the previous module will no longer enter the subsequent module. This causes the fragmentation and loss of relationship information between objects. For example, if a picture of a person riding a bicycle is input, if the person has been segmented out in the front and only the rest is passed to the back module, the semantic information of the person riding the bicycle is not fully utilized due to the complex shape of the bicycle and the lack of human images, which will cause some pixels of the bicycle to be unable to be accurately classified.
[0411] In order to solve the above problems, the multi-channel adaptive cascade prediction structure provided in the embodiment of the present application is as follows: Fig.18 As shown in the figure, the module that actually participates in online prediction is determined by the input image adaptation, and the inference result obtained by the shallow module will be used as another input of the deep module, which can pass more spatial and semantic information and better perform semantic segmentation prediction. The specific cascade prediction method and multi-channel prediction method can be found in the above introduction and will not be repeated here.
[0412] The multi-channel adaptive cascade prediction structure provided by the embodiment of the present application includes at least the following advantages: the number of feature extraction modules involved in online prediction is adaptively determined by the input image, so the final result can be output after only a few layers of network. In addition, the number of convolutional layer channels of the deep feature extraction module can also be reduced accordingly. This design saves the amount of calculation and speeds up the network operation speed. And the segmentation results of the shallow module can be used to guide the inference of the deep module, improving the accuracy of semantic segmentation.
[0413] Embodiment 4
[0414] The solution provided by the embodiment of the present invention can solve the above-mentioned difficulty 4. Specifically:
[0415] The loss function is applied in the offline training process of the model. The network performs backpropagation based on the calculated value of the loss function, and then updates the model parameters of each layer. In the field of semantic segmentation, the most common loss function is the cross entropy loss function.
[0416] Cross entropy is used to evaluate the difference between the probability distribution obtained from the current training and the true distribution, that is, the distance between the probability of the actual output and the probability of the expected output. The smaller the value of the cross entropy, the closer the two probability distributions are. Reducing the cross entropy loss is to improve the prediction accuracy of the model. Its discrete function form is:
[0417]
[0418] Among them, p(x) is the true distribution, q(x) is the estimated probability calculated by the data, and x is the pixel of the image. The average value of the cross entropy loss function of all pixels in the image can be used as the loss function for the network training.
[0419] The inventor of the present application found that the cross entropy loss function is calculated according to a unified formula for each pixel of the image, without differences in position and object category, and ignores the relationship between pixels. For example, the cross entropy of pixels belonging to the background at the edge of the image and the cross entropy of pixels belonging to the object in the center of the image have the same weight when calculating the average value, which objectively causes the loss weight of the object category occupying a larger area in the image to be greater than the loss weight of the object category with fewer pixels, so that the network is trained to tend to have a good segmentation effect on the category with a large pixel ratio in the training sample, and a poor segmentation effect on the category with a small pixel ratio.
[0420] However, the imbalanced distribution of objects of different categories in training data is common in semantic segmentation training datasets. For some object categories, due to the small amount of corresponding training data, the cross entropy loss function tends to ignore such objects, which makes network training difficult and performance degraded. We define such training samples as difficult samples.
[0421] In summary, the cross entropy loss function does not have the ability to handle difficult samples. In order to alleviate the problem of difficult samples caused by uneven data distribution, the cross entropy loss function needs to be improved.
[0422] In the prior art, for mining pixel-level difficult samples, for example, a loss function called focus loss is used:
[0423] FL(p t )=-α t (1-p t ) γ log(p t )
[0424] where p t is the probability of predicting the correct category, α t is the scaling factor, and γ is the exponential factor. In this loss function, objects are divided into pixel-level difficult samples for mining. Obviously, the easier the samples are to divide, the harder it is to mine. t The larger it is, the smaller its contribution to the loss is; correspondingly, the p of the difficult sample t It will be smaller and contribute more to the loss. During the training process, the loss function will be more inclined to optimize difficult samples to alleviate the problem of data imbalance.
[0425] This loss function treats the entire image as a pixel-level difficult sample and processes each pixel in isolation. However, in the semantic segmentation task, pixels do not exist in isolation, but have a strong correlation with the pixels around them (for example, they belong to the same object), so this loss function is prone to cause discontinuity in the segmentation results, such as holes inside the object.
[0426] The embodiment of the present application proposes a new loss function Dloss. This loss function can increase the weight of the difficult-to-predict categories, thereby effectively improving the overall semantic segmentation accuracy. The specific formula is as follows:
[0427]
[0428] Where N is the total number of pixels in the image, i is the predicted category, j is the actual category, and c i is the probability that the pixel belongs to category i, p is the category that is consistent with the prediction, and x p ij ={1,0}, marking whether the predicted category is consistent with the actual one.
[0429] If the probability of predicting a class If it is greater than 0.8, the image content to which i belongs belongs to a positive sample. If the probability of the predicted category is less than 0.8, the image content to which i belongs belongs to a negative sample.
[0430] During offline training, the total objective loss function is:
[0431] Loss = Segloss + α*Dloss
[0432] The Segloss is the cross entropy loss function of the above standard, and α is the balance weight between Dloss and Segloss.
[0433] The new loss function Dloss provided in the embodiment of the present application can be applied to offline training of various models used in the semantic segmentation process.
[0434] The new loss function takes data imbalance into account, making the training process pay more attention to samples containing fewer categories or categories that are more difficult to segment, thereby improving the accuracy of categories that were previously difficult to segment.
[0435] The reason why Segloss is retained here is that Segloss plays a more important role in the final training process, while Dloss only enhances the training of difficult samples to improve the overall semantic segmentation accuracy.
[0436] Embodiment 5
[0437] According to the requirements of the application scenario and the hardware environment, the above embodiments can be combined in different ways to form different semantic segmentation solutions. The following are examples of three online prediction solutions and one offline training solution. Those skilled in the art should understand that the following solutions are only examples, and appropriate changes based on these examples can also be applied to the present invention, so they should also be included in the protection scope of the present invention.
[0438] Online prediction solution 1: High-performance solution for online prediction on mobile terminals
[0439] This integrated solution takes into account both running speed and actual performance. It is suitable for scenarios on mobile terminals with high performance requirements and can complete high-precision mobile online semantic segmentation prediction.
[0440] like Fig.24As shown in the figure, the camera of the mobile device collects images, and the images enter the feature extraction subnetwork of the feature extraction network for feature extraction. The feature extraction network subnetwork consists of several feature extraction modules and adaptive receptive field modules in cascade, and uses multi-channel cascade adaptive prediction to determine the number of modules actually involved in feature extraction during online prediction, that is, when the confidence is high, it is directly output to the multi-directional feature map processor, otherwise it will enter the next feature extraction module. The feature map extracted by the feature extraction subnetwork of the feature extraction network is processed by the multi-directional feature map processor, and finally the category probability feature map is output, thereby obtaining the semantic segmentation prediction result. In this integrated solution, four general feature extraction modules and four adaptive receptive field modules are used to form the feature extraction subnetwork of the feature extraction network. Multi-channel cascade adaptive prediction is applied starting from the third feature extraction module. It should be noted that the number of modules of the feature extraction subnetwork of the feature extraction network and the starting position of the multi-channel cascade adaptive prediction can be adjusted according to the specific hardware environment and application scenario. The higher the performance requirement, the more modules of the feature extraction network subnetwork are, and the later the starting position of the multi-channel cascade adaptive prediction is.
[0441] Online prediction solution 2: Mobile online prediction quick response solution
[0442] This integrated solution prioritizes running speed and is suitable for scenarios on mobile terminals that have running speed and running resource requirements, and completes fast-response mobile terminal online semantic segmentation prediction.
[0443] Since the adaptive receptive field module takes a relatively long time to run, it is removed in this integrated solution, as shown in Figure 25. In addition, the other running processes are the same as the high-performance solution for online prediction on the mobile side (online prediction solution 1). This integrated solution still takes the feature extraction network composed of four general feature extraction modules as an example. This solution can quickly calculate the semantic segmentation of images collected by mobile devices, and is suitable for scenarios with high real-time performance and tight computing resources.
[0444] Online prediction solution 3: high-performance server-side online prediction solution
[0445] This integrated solution prioritizes operating performance and is suitable for the server side to complete high-performance online semantic segmentation prediction.
[0446] The server has abundant computing resources, so the multi-channel adaptive cascade prediction module can be removed to speed up the operation, and all feature extraction networks can be used for unified prediction, such as Fig.26 As shown, the accuracy and stability of the calculation results are guaranteed.
[0447] Offline training scheme:
[0448] The structures in the above three online prediction schemes (corresponding to the network type structures 1 to 3 in the figure) can all be trained offline using the same framework. Fig. 27 As shown in the figure, we use the D loss function (Dloss) to mine difficult samples at the object level to solve the problem of uneven data distribution. The Dloss function is obtained based on the labeled value and the prediction result.
[0449] Embodiment 6
[0450] Semantic segmentation is widely used in intelligent driving, robot interaction, image processing (such as artificial intelligence (AI) editing and processing of images, medical image processing, remote sensing image processing, etc.), virtual reality (VR) / augmented reality (AR) (such as virtual fitting) and other fields.
[0451] a. Robot interaction: The robot performs semantic segmentation on the images collected by the robot to obtain an object ID map. Based on the ID map, the robot can perceive the object category and location of each object in the indoor scene. Subsequently, the robot can execute corresponding commands for a certain object, for example, executing commands issued by the user such as "go to the table and get an apple";
[0452] b. AR / VR: Perform semantic segmentation on images containing human faces to obtain the shapes and category IDs of various parts of the face. Subsequently, AR / VR interactive processing can be performed based on the shapes and category IDs of the obtained parts, for example, adding beauty makeup to the face, adding dynamic expressions, etc.
[0453] c. Road segmentation: semantic segmentation of the collected road images to segment the road parts, and then determine the drivable area, give corresponding auxiliary reminders according to the drivable area (in the assisted driving scenario, the drivable area can be marked in the image to remind the user), or perform corresponding driving processing;
[0454] d. Virtual fitting: semantic segmentation of the collected clothing images to obtain the various parts of the person and the clothing area, and subsequent replacement of clothes can be performed;
[0455] e. AI editing: Perform semantic segmentation on the collected images to separate the background area, human body area or user facial area. Based on the segmented areas, the image can be processed intelligently, such as background replacement, regional style conversion, etc.
[0456] The following is an exemplary introduction to the application scenarios of the image segmentation method proposed in this application.
[0457] (1) Autonomous driving
[0458] Autonomous driving requires accurate perception of driving scenes in real time and the establishment of appropriate scene models, in which semantic segmentation is indispensable. Using images collected by on-board cameras for semantic segmentation, pixel-level positioning accuracy can obtain the precise outline of the vehicle, and in collaboration with other sensors, accurate side distance calculations can be completed; at the same time, detected elements such as guardrails, lane lines, and road surfaces can assist in determining the precise position of the vehicle. Finally, with the perception of the entire scene, multiple sensors and modules can be unified under a framework, making it easy to complete data integration and cross-validation.
[0459] See also Fig.28 , which is a schematic diagram of the environmental perception of vehicle-mounted sensors. The high-definition images obtained by the vehicle-mounted camera are sent to the semantic segmentation network after image preprocessing to obtain the semantic segmentation prediction results; on the other hand, the data obtained from other vehicle-mounted sensors (such as lidar, etc.) are processed by sensor data to obtain sensor information, which is fused with the semantic segmentation prediction results, and finally a 3D scene model of the road can be generated in real time, that is, scene modeling. According to the conditions of the road, vehicles, pedestrians, etc., the driving path is planned and decided. It can be noted that semantic segmentation plays an irreplaceable and huge role in the above process. Accuracy and running speed are necessary requirements. According to the actual situation, in sections with good communication conditions and slow driving speed, a server-side online prediction high-performance solution can be used to communicate with the cloud server. The collected images are transmitted to the cloud at a certain frame rate, and the semantic segmentation results of the cloud server are received to reduce the consumption of vehicle-mounted computing resources. In the case of poor communication conditions or high requirements for real-time frame rate, a mobile-side online prediction high-performance solution is used to obtain segmentation results using vehicle-mounted computing devices.
[0460] In the above semantic segmentation algorithm, if the current autonomous driving scenario has high requirements for real-time segmentation, when performing multi-directional feature processing, the up-down direction and / or left-right direction can be set to be different from the convolution method and / or convolution parameters in the front-to-back direction. Atrous convolution is used in the front-to-back direction, depthwise convolution can be used in the up-down direction and left-to-right direction, and smaller and fewer convolution kernels can be used in the up-down direction and left-to-right direction. In addition, the adaptive receptive field module mentioned above can be applied only to the last key convolution layer in the feature extraction stage.
[0461] If the current autonomous driving scenario has high requirements for segmentation performance, the convolution mode and convolution parameters in the up-down direction and / or left-right direction can be set to be consistent with those in the front-back direction. In addition, the adaptive receptive field module mentioned above can be applied to at least two key convolution layers, or each convolution operation can be replaced by an adaptive receptive field operation.
[0462] (2) Portrait segmentation in mobile phone photography
[0463] Taking photos of people is an important function and application of mobile phones. As the basic technology of image editing, the importance of portrait and object segmentation is self-evident. Fig.29 For example, we can shoot people and generate some special effects.
[0464] By using the image segmentation method proposed in this application, accurate segmentation of people and objects can be obtained. Fig.30 As shown in the figure, the captured image is sent to the semantic segmentation network to obtain the predicted result map, that is, the semantic segmentation prediction result, and then the background is replaced or the local style conversion is performed as needed, that is, image editing is performed, and finally a captured image with special effects is generated. The semantic segmentation part can use the proposed mobile terminal online prediction high-performance solution to obtain more accurate segmentation results. Since most special effects shooting requires interactive operations and has a certain time tolerance, the solution can meet the requirements of running time and accuracy by balancing speed and accuracy.
[0465] In the above semantic segmentation algorithm, if the current image editing scenario has high requirements for the real-time performance of segmentation (for example, when used in an AR camera, the preview image needs to be edited in real time), when performing multi-directional feature processing, the up-down direction and / or left-right direction can be set. Different from the convolution method and / or convolution parameters in the front-to-back direction, the front-to-back direction uses Atrous convolution, the up-down direction and the left-to-right direction can use depthwise convolution, and the up-down direction and the left-to-right direction can use smaller and fewer convolution kernels. In addition, the adaptive receptive field module mentioned above can be applied only to the last key convolution layer in the feature extraction stage.
[0466] If the current image editing scenario has high requirements for segmentation performance (for example, post-processing the image), the convolution mode and convolution parameters in the up-down direction and / or left-right direction can be set to be consistent with those in the front-back direction. In addition, the adaptive receptive field module mentioned above can be applied to at least two key convolution layers, or each convolution operation can be replaced by an adaptive receptive field operation.
[0467] Embodiment 7
[0468] An embodiment of the present invention provides an electronic device, such as Fig.31 As shown, the electronic device 310 includes: a feature extraction module 3101 and a feature graph processing module 3102, wherein:
[0469] The feature extraction module 3101 is used to extract features from the image through a feature extraction network to obtain a feature map;
[0470] The feature map processing module 3102 is used to perform feature map processing on the feature map to complete the semantic segmentation of the image.
[0471] Optionally, the feature map processing module 3102 is specifically used to perform feature map processing on at least two directions of the feature map.
[0472] Optionally, the feature map processing module 3102 is specifically used to perform convolution operations and / or pooling operations on at least two directions of the feature map respectively; and to fuse the operation results in at least two directions.
[0473] Optionally, the feature map processing module 3102 is specifically configured to perform convolution operations on at least two directions of the feature map according to the convolution mode and / or convolution parameters corresponding to each direction;
[0474] And / or, the feature map processing module 3102 is specifically used to perform pooling operations on at least two directions of the feature map according to the pooling methods and / or pooling parameters corresponding to each direction.
[0475] Optionally, the feature map processing module 3102 is also used to determine the convolution mode and / or convolution parameters corresponding to each direction according to the device status and / or task requirements.
[0476] Optionally, at least two directions include a set main direction of the feature map; the feature map processing module 3102 is further used to determine the convolution mode and / or convolution parameters corresponding to other directions according to the convolution mode and / or convolution parameters corresponding to the main direction of the feature map;
[0477] And / or, the feature map processing module 3102 is also used to determine the pooling method and / or pooling parameters corresponding to other directions based on the pooling method and / or pooling parameters corresponding to the main direction of the feature map.
[0478] Specifically, the convolution parameters include: at least one of the convolution kernel size, dilation rate, step size, and parameter amount; and / or the pooling parameters include: at least one of the pooling kernel size and pooling step size.
[0479] Optionally, the feature graph processing module 3102 is specifically used in any of the following situations:
[0480] When convolution operations are performed on at least two directions of the feature map respectively, the convolution operation results in each direction are fused;
[0481] When the pooling operation is performed on at least two directions of the feature map respectively, the pooling operation results of each direction are fused;
[0482] When the convolution operation and the pooling operation are performed simultaneously on at least two directions of the feature map, the convolution operation results and the pooling operation results in each direction are fused;
[0483] When convolution operations and pooling operations are performed in sequence on at least two directions of the feature map, the pooling operation results in each direction are fused.
[0484] Optionally, the feature map processing module 3102 is specifically used to determine, for each operation result in at least two directions, a fusion weight and / or feature bias information corresponding to each operation result; and, based on the fusion weight and / or feature bias information, perform predetermined processing on each operation result; and, perform fusion processing on each operation result after the predetermined processing.
[0485] Optionally, the feature graph processing module 3102 is further configured to perform skip connection processing on each of the operation results in at least two directions and the output result after the operation result is processed in a predetermined manner;
[0486] The feature graph processing module 3102 is specifically used to fuse the operation results after the jump link processing.
[0487] Optionally, the feature graph processing module 3102 is specifically used for at least one of the following:
[0488] According to the fusion weight, each operation result is weighted.
[0489] According to the fusion weight, weighted processing is performed on each weighted output result respectively;
[0490] According to the fusion weight, each bias-processed output result is weighted;
[0491] According to the fusion weight, the output results after each jump connection processing are weighted respectively;
[0492] According to the feature bias information, bias processing is performed on each operation result respectively;
[0493] According to the feature bias information, bias processing is performed on each output result after weighted processing;
[0494] According to the feature bias information, bias processing is performed on each bias-processed output result respectively;
[0495] According to the feature bias information, bias processing is performed on the output results after each jump connection processing.
[0496] Optionally, the feature map processing module 3102 is further used to determine the corresponding channel correlation feature according to the feature map obtained by merging the operation results in at least two directions;
[0497] The feature map processing module 3102 is specifically used to determine the fusion weight corresponding to each operation result in at least two directions according to the channel correlation characteristics;
[0498] The feature map processing module 3102 is specifically used to determine the feature bias information corresponding to each operation result in at least two directions according to the channel correlation characteristics.
[0499] Optionally, the feature extraction module 3101 is specifically used to perform:
[0500] Step 1: for a set convolution layer in a feature extraction network, perform convolution processing on an image or an input feature map according to a convolution parameter corresponding to the set convolution layer;
[0501] Step 2: Perform feature map processing on the feature map obtained by convolution processing to obtain a category probability feature map, and determine the category confidence based on the category probability feature map;
[0502] Step 3. If it is necessary to adjust the convolution parameters corresponding to the set convolution layer based on the category confidence, then adjust the convolution parameters corresponding to the set convolution layer and then execute step 1. If it is confirmed based on the category confidence that it is not necessary to adjust the convolution parameters corresponding to the set convolution layer, then output the feature map obtained by the convolution processing.
[0503] Optionally, the above-mentioned set convolution layer is at least one convolution layer whose depth is greater than a second depth threshold in at least one feature extraction module whose depth is greater than a first depth threshold.
[0504] Optionally, the electronic device 310 further includes a module for setting a convolutional layer, wherein:
[0505] The convolution layer determination module is specifically configured to select at least one key convolution layer from at least one feature extraction module as the set convolution layer, and the set convolution layer is a key convolution layer in the feature extraction module having a depth greater than a first depth threshold;
[0506] The convolution layer determination module is set to be specifically used to select at least one convolution layer from the feature extraction module as a key convolution layer, and the key convolution layer is a convolution layer in the feature extraction module whose depth is greater than a second depth threshold.
[0507] Optionally, the feature extraction module 3101 is specifically used to confirm whether it is necessary to adjust the convolution parameters corresponding to the set convolution layer in the following manner: when the category confidence is greater than a first predetermined threshold, it is confirmed that it is not necessary to adjust the convolution parameters corresponding to the set convolution layer; otherwise, it is confirmed that it is necessary to adjust the convolution parameters corresponding to the set convolution layer.
[0508] Optionally, the feature extraction module 3101 is also used to confirm that there is no need to adjust the convolution parameters corresponding to the set convolution layer when the total number of iterations is not less than a preset first iteration number threshold, and / or the number of iterations of the set convolution layer is not less than a preset second iteration number threshold, and output a feature map obtained by convolution processing.
[0509] Optionally, the feature extraction module 3101 is specifically used to determine a parameter change amount corresponding to a set convolution layer; and adjust a convolution parameter corresponding to the set convolution layer based on the parameter change amount.
[0510] Optionally, the feature extraction module 3101 is specifically used to determine the parameter change corresponding to the set convolution layer according to the category confidence.
[0511] Optionally, the feature extraction module 3101 is specifically configured to perform receptive field processing on the feature map extracted by the set feature extraction module through at least one receptive field processing module to obtain a feature map after receptive field processing.
[0512] Optionally, the receptive field processing module includes at least one receptive field processing branch;
[0513] The feature extraction module 3101 is specifically used to convolve the feature map output by the set feature extraction module or the previous receptive field processing module through each receptive field processing branch of the current receptive field processing module to obtain each feature map after the convolution processing; based on the weights corresponding to each receptive field processing branch of the current receptive field processing module, each feature map after the convolution processing is fused.
[0514] Optionally, the convolution parameters used by the receptive field processing branches in any receptive field processing module for performing convolution processing are the same.
[0515] Optionally, the feature extraction module is set to include any of the following:
[0516] Any feature extraction module in the feature extraction network;
[0517] Any feature extraction module in the feature extraction network whose depth is greater than the third depth threshold.
[0518] Optionally, the feature extraction module 3101 is specifically used to perform feature map processing on the feature map extracted by the current feature extraction module to obtain a category probability feature map, and determine the category confidence based on the category probability feature map; and, if it is confirmed based on the category confidence that it is necessary to enter the next feature extraction module for feature extraction processing, then the feature map extracted by the current feature extraction module is output to the next feature extraction module; if it is confirmed based on the category confidence that it is not necessary to enter the next feature extraction module for feature extraction processing, then the feature map extracted by the current feature extraction module is output as the feature map output by the feature extraction network or the above-mentioned category probability feature map is output.
[0519] Optionally, the feature extraction module 3101 is specifically used to confirm whether it is necessary to enter the next feature extraction module for feature extraction processing in the following manner: when the category confidence is greater than a second predetermined threshold, it is confirmed that it is not necessary to enter the next feature extraction module for feature extraction processing; otherwise, it is confirmed that it is necessary to enter the next feature extraction module for feature extraction processing.
[0520] Optionally, the feature extraction module 3101 is specifically used to determine the highest probability of each pixel in the category probability feature map; and determine the category confidence based on the average value of the highest probability of each pixel.
[0521] Optionally, the feature extraction module 3101 is specifically used to input the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module to the next feature extraction module for feature extraction.
[0522] Optionally, the feature extraction module 3101 is specifically used to perform fusion processing on the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module, and then input them into the next feature extraction module for feature extraction.
[0523] The electronic device provided in the embodiment of the present application has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the device embodiment can refer to the corresponding contents in the aforementioned method embodiment, which will not be repeated here. The electronic device provided in the embodiment of the present application can effectively improve the performance of semantic segmentation.
[0524] Embodiment 8
[0525] The embodiment of the present application also provides an electronic device, including: a processor and a memory, the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the corresponding content in the aforementioned method embodiment. Optionally, the electronic device may also include a transceiver. The processor and the transceiver are connected, such as through a bus. It should be noted that in actual applications, the transceiver is not limited to one, and the structure of the electronic device does not constitute a limitation on the embodiment of the present application.
[0526] The processor may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0527] The bus may include a path to transmit information between the above components. The bus may be a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0528] The memory 802 can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an EEPROM, a CD-ROM or other optical disk storage, an optical disk storage (including a compressed optical disk, a laser disk, an optical disk, a digital versatile disk, a Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0529] The embodiment of the present application also provides a computer-readable storage medium, which is used to store computer instructions. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0530] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0531] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. An image segmentation method performed by an electronic device, It is characterized in that include: Extracting features from the image through a feature extraction network to obtain a feature map represented as a three-dimensional matrix, wherein the direction of the feature map includes a first direction, a second direction, and a third direction; Using convolution operations and / or pooling operations in at least two directions of the feature map, the feature map is processed to complete semantic segmentation of the image; In which, the convolution operation is performed according to the convolution mode and / or convolution parameters corresponding to each direction, and / or the pooling operation is performed according to the pooling mode and / or pooling parameters corresponding to each direction, and the first direction, the second direction and the third direction are perpendicular to each other.
2. The image segmentation method according to claim 1, It is characterized in that The first direction is a front-to-back direction, the second direction is an up-down direction, and the third direction is a left-to-right direction.
3. The image segmentation method according to claim 1, It is characterized in that The performing feature map processing on the feature map includes: The operation results of at least two directions of the feature map are fused.
4. The image segmentation method according to claim 1, It is characterized in that Before the convolution operation, it also includes: The convolution mode and / or convolution parameters corresponding to each direction are determined according to the device status and / or task requirements.
5. The image segmentation method according to claim 1, It is characterized in that The at least two directions include a set main direction of the characteristic graph; Before the convolution operation, it also includes: Determine the convolution mode and / or convolution parameters corresponding to other directions according to the convolution mode and / or convolution parameters corresponding to the main direction of the feature map; and / or Before performing the pooling operation on the at least two directions of the feature map respectively according to the pooling mode and / or pooling parameter corresponding to each direction, the method further includes: According to the pooling mode and / or pooling parameters corresponding to the main direction of the feature map, determine the pooling mode and / or pooling parameters corresponding to other directions.
6. The image segmentation method according to claim 1, It is characterized in that The convolution parameters include: at least one of a convolution kernel size, a dilation rate, a convolution step length, and a parameter amount; and / or The pooling parameters include: at least one of a pooling kernel size and a pooling step size.
7. The image segmentation method according to claim 3, It is characterized in that The fusing the operation results of at least two directions of the feature map includes any of the following situations: When the convolution operation is performed on the at least two directions of the feature map respectively, the convolution operation results in each direction are fused; When the pooling operation is performed on the at least two directions of the feature map respectively, the pooling operation results of each direction are fused; When the convolution operation and the pooling operation are performed simultaneously on the at least two directions of the feature map, the convolution operation results and the pooling operation results in each direction are fused; When the convolution operation and the pooling operation are performed in sequence on the at least two directions of the feature map, the pooling operation results of each direction are fused.
8. The image segmentation method according to claim 3, It is characterized in that The fusing the operation results of at least two directions of the feature graph includes: For each of the operation results in the at least two directions, respectively determine a fusion weight and / or feature bias information corresponding to each operation result; According to the fusion weight and / or the feature bias information, performing predetermined processing on each of the operation results respectively; The operation results after the predetermined processing are fused.
9. The image segmentation method according to claim 8, It is characterized in that Before fusing the predetermined processed operation results, the following steps are also included: For each of the operation results in the at least two directions, respectively performing skip connection processing on the operation result and an output result of the operation result after a predetermined processing; The fusing of the operation results after the predetermined processing includes: The results of each operation after skip link processing are fused.
10. The image segmentation method according to claim 8, It is characterized in that The performing predetermined processing on each of the operation results according to the fusion weight and / or the feature bias information respectively includes at least one of the following: According to the fusion weight, weighted processing is performed on each of the operation results respectively; According to the fusion weights, weighted processing is performed on each output result after weighted processing; According to the fusion weights, weighted processing is performed on each output result after the bias processing; According to the fusion weights, weighted processing is performed on the output results after each jump connection processing; According to the feature bias information, bias processing is performed on each of the operation results respectively; According to the feature bias information, bias processing is performed on each output result after weighted processing; According to the feature bias information, bias processing is performed on each output result after bias processing; According to the feature bias information, bias processing is performed on each output result after the jump connection processing.
11. The image segmentation method according to claim 8, It is characterized in that Also includes: Determine a corresponding channel correlation feature according to a feature map obtained by merging the operation results in the at least two directions; Determine the fusion weights corresponding to each operation result, including: Determine, according to the channel correlation feature, a fusion weight corresponding to each of the operation results in the at least two directions; Determine the feature bias information corresponding to each operation result, including: According to the channel correlation feature, feature bias information corresponding to each operation result in the at least two directions is determined.
12. The image segmentation method according to any one of claims 1 to 11, It is characterized in that Perform feature extraction on the image, including: Step 1: for a set convolution layer in the feature extraction network, perform convolution processing on the image or input feature map according to the convolution parameters corresponding to the set convolution layer; Step 2: performing feature map processing on the feature map obtained by the convolution process to obtain a category probability feature map, and determining the category confidence according to the category probability feature map; Step 3. If it is necessary to adjust the convolution parameters corresponding to the set convolution layer based on the category confidence, then adjust the convolution parameters corresponding to the set convolution layer and then execute step 1. If it is confirmed based on the category confidence that the convolution parameters corresponding to the set convolution layer do not need to be adjusted, then output the feature map obtained by the convolution processing.
13. The image segmentation method according to claim 12, It is characterized in that The set convolution layer is at least one convolution layer whose depth is greater than a second depth threshold in at least one feature extraction module whose depth is greater than a first depth threshold.
14. The image segmentation method according to claim 12, It is characterized in that Confirm whether the convolution parameters corresponding to the set convolution layer need to be adjusted by the following method: When the category confidence is greater than a first predetermined threshold, confirming that there is no need to adjust the convolution parameter corresponding to the set convolution layer; Otherwise, it is confirmed that the convolution parameters corresponding to the set convolution layer need to be adjusted.
15. The image segmentation method according to claim 12, It is characterized in that Also includes: When the total number of iterations is not less than a preset first iteration number threshold, and / or the number of iterations of the set convolutional layer is not less than a preset second iteration number threshold, it is confirmed that there is no need to adjust the convolution parameters corresponding to the set convolutional layer, and the feature map obtained by the convolution processing is output.
16. The image segmentation method according to claim 12, It is characterized in that Adjusting the convolution parameters corresponding to the set convolution layer includes: Determining a parameter change corresponding to the set convolution layer; The convolution parameter corresponding to the set convolution layer is adjusted based on the parameter change amount.
17. The image segmentation method according to claim 16, It is characterized in that The determining and setting the parameter change amount corresponding to the convolution layer includes: According to the category confidence, a parameter change amount corresponding to setting the convolution layer is determined.
18. The image segmentation method according to any one of claims 1 to 11, It is characterized in that The step of extracting features from an image to obtain a feature map includes: The feature map extracted by the set feature extraction module is subjected to receptive field processing by at least one receptive field processing module to obtain a feature map after receptive field processing.
19. The image segmentation method according to claim 18, It is characterized in that The receptive field processing module comprises at least one receptive field processing branch; Any receptive field processing module performs receptive field processing, including: The feature map output by the set feature extraction module or the previous receptive field processing module is convolved through each receptive field processing branch of the current receptive field processing module to obtain each feature map after convolution processing; Based on the weights corresponding to the respective receptive field processing branches of the current receptive field processing module, the feature maps after the convolution processing are fused.
20. The image segmentation method according to claim 19, It is characterized in that The convolution parameters used by each receptive field processing branch in any receptive field processing module for convolution processing are the same.
21. The image segmentation method according to claim 18, It is characterized in that The setting feature extraction module includes any one of the following: Any feature extraction module in the feature extraction network; Any feature extraction module in the feature extraction network whose depth is greater than the third depth threshold.
22. The image segmentation method according to any one of claims 1 to 11, It is characterized in that The feature extraction of the image comprises: Performing feature map processing on the feature map extracted by the current feature extraction module to obtain a category probability feature map, and determining the category confidence according to the category probability feature map; If it is confirmed based on the category confidence that it is necessary to enter the next feature extraction module for feature extraction processing, the feature map extracted by the current feature extraction module is output to the next feature extraction module. If it is confirmed based on the category confidence that it is not necessary to enter the next feature extraction module for feature extraction processing, the feature map extracted by the current feature extraction module is output as the feature map output by the feature extraction network or the category probability feature map is output.
23. The image segmentation method according to claim 22, It is characterized in that Confirm whether you need to enter the next feature extraction module for feature extraction processing by the following methods: When the category confidence is greater than a second predetermined threshold, confirming that there is no need to enter the next feature extraction module for feature extraction processing; Otherwise, it is confirmed that it is necessary to enter the next feature extraction module for feature extraction processing.
24. The image segmentation method according to claim 22, It is characterized in that Determining the category confidence according to the category probability feature map includes: Determine the highest probability of each pixel in the category probability feature map; The category confidence is determined based on the average of the highest probabilities of each pixel.
25. The image segmentation method according to any one of claims 1 to 11, It is characterized in that The feature extraction of the image comprises: The feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module are input into the next feature extraction module for feature extraction.
26. The image segmentation method according to claim 25, It is characterized in that The step of inputting the feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module into the next feature extraction module for feature extraction includes: The feature map obtained based on the current feature extraction module and the category prediction result obtained based on the current feature extraction module are fused and input into the next feature extraction module for feature extraction.
27. An electronic device, It is characterized in that include: A processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the image segmentation method as described in any one of claims 1 to 26.
28. A computer readable storage medium, It is characterized in that The computer storage medium is used to store computer instructions, programs, code sets or instruction sets, which, when run on a computer, enable the computer to execute the image segmentation method according to any one of claims 1 to 26.
