Image semantic segmentation method, device, computer-readable storage medium and chip
Through convolution processing and multi-scale feature extraction combined with inertial measurement unit information, the problem of insufficient prediction accuracy in traditional semantic segmentation methods is solved, and efficient semantic segmentation and real-time recognition effects are achieved.
Patent Information
- Application Number
- CN201910883701.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-18
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2039-09-18
AI Technical Summary
The prediction accuracy of semantic segmentation methods in traditional computer vision is not high under high-resolution conditions, especially because image features are processed in the same path after feature extraction, resulting in insufficient prediction accuracy for details.
By performing convolution processing and multi-scale feature extraction on the image to be processed, multi-scale semantic information is obtained, and feature fusion is performed after dimensionality reduction processing to expand the receptive field to improve the prediction accuracy of semantic segmentation. At the same time, inertial measurement unit information is added to enhance the image. Topological information.
It improves the prediction accuracy and computing speed of semantic segmentation maps, enhances the ability to recognize image details, and realizes real-time semantic segmentation on mobile devices.
Smart Images

Figure CN112529904B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of computer vision, and in particular, to an image semantic segmentation method, device, computer-readable storage medium, and chip. Background Art
[0002] Computer vision is an integral part of various intelligent / autonomous systems in various application fields, such as manufacturing, inspection, document analysis, medical diagnosis, and military. It is a discipline about how to use cameras / camcorders and computers to obtain the data and information we need about the objects being photographed. Figuratively speaking, it is to equip computers with eyes (cameras / camcorders) and brains (algorithms) to replace human eyes in identifying, tracking, and measuring targets, so that computers can perceive the environment. Because perception can be seen as extracting information from sensory signals, computer vision can also be seen as a science that studies how to make artificial systems "perceive" from images or multidimensional data. In general, computer vision uses various imaging systems to replace visual organs to obtain input information, and then computers replace the brain to complete the processing and interpretation of these input information. The ultimate research goal of computer vision is to enable computers to observe and understand the world through vision like humans, and have the ability to adapt to the environment autonomously.
[0003] In the field of computer vision, semantic segmentation is a very important research direction. Semantic segmentation provides high-level information for scene understanding. Semantic segmentation is to classify each pixel in the image, and has important applications in many fields and scenarios. For example, autonomous driving systems, human-computer interaction systems, photography on mobile devices, image search engines, and augmented reality applications.
[0004] Traditional solutions have the problem of low prediction accuracy when performing semantic segmentation. For example, traditional solutions can first obtain a small-sized feature vector, and then continue to extract features after upsampling. This method can further extract features under high-resolution conditions. When the depth of the entire model increases, higher-level semantic information can be obtained and the receptive field can be expanded. However, in this method, since the image features obtained after each feature extraction continue to be processed in the same path, the prediction accuracy of details is not high enough. Summary of the invention
[0005] The present application provides an image semantic segmentation method, device, computer-readable storage medium and chip to improve the accuracy of semantic segmentation maps.
[0006] In a first aspect, a method for image semantic segmentation is provided, comprising: acquiring an image to be processed; performing convolution processing on the image to be processed to obtain an initial feature map of the image to be processed; performing multi-scale feature extraction on the initial feature map to obtain a first feature map, wherein the first feature map includes multi-scale semantic information of the initial feature map; performing convolution processing on the first feature map to obtain a target feature map of the image to be processed; and determining a semantic segmentation map of the image to be processed according to the target feature map.
[0007] According to the solution of the embodiment of the present application, by extracting multi-scale semantic information, adjusting the size of the feature map containing the multi-scale semantic information and then performing feature extraction, the receptive field can be expanded and the feature expression ability of the image features can be improved, thereby improving the prediction accuracy of the semantic segmentation map.
[0008] Optionally, the above-mentioned acquiring the image includes: capturing the image by shooting with a camera.
[0009] For example, for a mobile phone, an image can be obtained by shooting.
[0010] Optionally, the above-mentioned acquiring the image includes: acquiring the image from a memory.
[0011] For example, for a mobile phone, an image can be selected from the photo album.
[0012] When obtaining the initial feature map of the image, the initial feature map can be obtained by performing a convolution operation (convolution processing) on the image, or by further processing the result of the convolution operation of the image (for example, performing summation, weighted processing, connection, etc.).
[0013] The initial feature map is subjected to multi-scale feature extraction to determine the first feature map. Specifically, feature maps of different scales can be extracted from the initial feature map to obtain multi-scale semantic information of the initial feature map. The multi-scale semantic information refers to the statistical information that the pixel value of each pixel of the first feature map represents the pixel values of pixels in sub-regions of multiple different scales on the initial feature map.
[0014] For example, the initial feature map may be convolved with different convolution kernels to obtain feature maps of different scales. For another example, the initial feature map may be pooled with different sampling rates to obtain feature maps of different scales.
[0015] In combination with the first aspect, in certain implementations of the first aspect, before performing multi-scale feature extraction on the above-mentioned initial feature map, the method also includes: performing dimensionality reduction processing on the above-mentioned initial feature map to obtain a feature map after dimensionality reduction processing; performing multi-scale feature extraction on the above-mentioned initial feature map to obtain a first feature map includes: performing multi-scale feature extraction on the feature map after dimensionality reduction processing to obtain the above-mentioned first feature map.
[0016] According to the solution of the embodiment of the present application, by performing dimensionality reduction processing on the initial feature map, the number of channels of the initial feature map can be reduced and the computing speed of semantic segmentation of the image can be improved. Therefore, the present application can improve the computing speed of semantic segmentation of the image while improving the accuracy of semantic segmentation.
[0017] In combination with the first aspect, in certain implementations of the first aspect, the performing multi-scale feature extraction on the feature map after the dimensionality reduction processing to obtain the above-mentioned first feature map includes: performing pooling processing at different sampling rates for multiple times on the feature map after the dimensionality reduction processing to obtain feature maps of multiple scales; performing upsampling processing on the feature maps of the multiple scales to obtain multiple feature maps after upsampling processing; and performing feature fusion on the multiple feature maps after the upsampling processing and the initial feature map to obtain the above-mentioned first feature map.
[0018] The feature maps of the multiple scales are multiple feature maps, and the multiple feature maps have different scales respectively.
[0019] Optionally, the feature fusion of the multiple feature maps obtained by upsampling and the initial feature map may be channel (dimensional) splicing of the multiple feature maps obtained by upsampling and the initial feature map.
[0020] According to the solution of the embodiment of the present application, the number of channels is reduced through dimensionality reduction processing, thereby reducing the amount of calculation and improving the operation speed; the characteristics of spatial pyramid pooling are retained, and multi-scale semantic information of sub-regions of different sizes can be extracted, eliminating the fixed size constraint of the convolutional neural network and improving the prediction accuracy.
[0021] In combination with the first aspect, in some implementations of the first aspect, convolution processing is performed on the above-mentioned first feature map, including: resizing the above-mentioned first feature map to obtain a second feature map, the size of the second feature map is larger than the size of the first feature map; convolution processing is performed on the above-mentioned second feature map to obtain a target feature map of the image to be processed.
[0022] In combination with the first aspect, in some implementations of the first aspect, the above-mentioned initial feature map includes at least two feature maps with different sizes. The convolution processing of the above-mentioned second feature map to obtain the target feature map of the image to be processed includes: fusing the feature map with the same size as the second feature map in the initial feature map and the second feature map to obtain a third feature map; performing convolution processing on the third feature map to obtain the target feature map of the image to be processed.
[0023] For example, the feature map with the same size as the second feature map in the initial feature map is feature map A. Fusing the feature map with the same size as the second feature map in the initial feature map and the second feature map can be fusing feature map A and the second feature map.
[0024] In combination with the first aspect, in some implementations of the first aspect, the convolution processing of the third feature map to obtain the target feature map of the image to be processed includes: performing convolution processing on the third feature map through m convolutional layers to obtain the feature map output from the m-th convolutional layer, where the input of the i-th convolutional layer in the m convolutional layers is the feature map output from the (i - 1)-th convolutional layer and the feature map with the same size as the feature map output from the (i - 1)-th convolutional layer in the initial feature map, m is an integer greater than 1, 1 < i ≤ m, and i is an integer; determining the target feature map of the image to be processed according to the feature map output from the m-th convolutional layer.
[0025] Optionally, determining the target feature map of the image to be processed according to the feature map output from the m-th convolutional layer can be determining the feature map output from the m-th convolutional layer as the target feature map of the image to be processed.
[0026] In combination with the first aspect, in some implementations of the first aspect, determining the target feature map of the image to be processed according to the feature map output from the m-th convolutional layer includes: performing multi-scale feature extraction on the feature map output from the m-th convolutional layer to obtain a fourth feature map, and the fourth feature map includes the multi-scale semantic information of the feature map output from the m-th convolutional layer; determining the target feature map according to the fourth feature map.
[0027] Optionally, determining the target feature map according to the fourth feature map can be determining the fourth feature map as the target feature map.
[0028] In combination with the first aspect, in certain implementations of the first aspect, determining the semantic segmentation map of the image to be processed according to the target feature map includes: upsampling the fourth feature map and the feature map output by at least one of the m convolutional layers to obtain at least two feature maps of the same size; performing feature fusion processing on the at least two feature maps of the same size to obtain the target feature map; and determining the semantic segmentation map of the image to be processed according to the target feature map.
[0029] The semantic segmentation map of the image to be processed is determined according to the target feature map. Specifically, the target feature map can be processed by a classifier to obtain the semantic segmentation map of the image to be processed.
[0030] In combination with the first aspect, in some implementations of the first aspect, the image to be processed includes brightness value information and inertial measurement unit (IMU) information of the image to be processed.
[0031] In combination with the first aspect, in certain implementations of the first aspect, the IMU information is resized, and the size of the resized IMU information is the same as the size of the image to be processed; the resized IMU information and the brightness value information of the image to be processed are feature channel spliced.
[0032] For example, the size of the image to be processed is H0*W0, the height is H0, the width is W0, and the image to be processed includes brightness value information of P channels. The size of the IMU information is expanded to H0*W0 as the P+1th channel. Therefore, the number of channels of the image to be processed is P+1, and the resolution of the image to be processed is H0*W0*(P+1).
[0033] According to the solution of the embodiment of the present application, when the image topology information is less, one-dimensional image information can be increased by adding IMU information, which can effectively improve the accuracy of prediction.
[0034] In a second aspect, a training method for an image semantic segmentation network is provided, the method comprising: obtaining training data, the training data comprising a training image and a label map corresponding to the training image, the training image and the label map being in one-to-one correspondence; performing the following processing on the training image according to the image semantic segmentation network: performing convolution processing on the above-mentioned training image to obtain an initial feature map of the above-mentioned training image; performing multi-scale feature extraction on the initial feature map to determine a first feature map, wherein the first feature map comprises multi-scale semantic information of the above-mentioned initial feature map; performing convolution processing on the first feature map to obtain a target feature map of the above-mentioned training image; determining a semantic segmentation map of the above-mentioned training image according to the above-mentioned target feature map, determining a loss value of the image semantic segmentation network, and then adjusting the image semantic segmentation network through back propagation according to the loss value.
[0035] The label map corresponding to the training image may be annotated in advance (specifically, it may be annotated manually). The label map corresponding to the training image includes the category label corresponding to each pixel in the training image.
[0036] In addition, in the above training process, a plurality of training images are generally used. The training image includes brightness value information and IMU information of the training image.
[0037] In the process of training the above-mentioned image semantic segmentation network, a set of initial model parameters can be set for the image semantic segmentation network, and then the model parameters of the image semantic segmentation network can be gradually adjusted according to the difference between the label map and the semantic segmentation results of the training image, until the difference between the label map and the semantic segmentation results of the training image is within a certain preset range, or, when the number of training reaches the preset number, the model parameters of the image semantic segmentation network at this time are determined as the final parameters of the image semantic segmentation network model, thereby completing the training of the image semantic segmentation network.
[0038] It should be understood that the image semantic segmentation network trained by the method of the second aspect can be used to execute the method of the first aspect of the present application.
[0039] It should be understood that in the present application, the feature maps that appear when describing or illustrating the image semantic segmentation method of the embodiment of the present application are all referring to the image to be processed, while in the image semantic segmentation network training method of the embodiment of the present application, the feature maps are all referring to the training image.
[0040] In a third aspect, an image semantic segmentation apparatus is provided, the apparatus comprising modules for executing the method in the first aspect.
[0041] In a fourth aspect, a training device for an image semantic segmentation network is provided, the device comprising modules for executing the method in the second aspect.
[0042] A fifth method provides an image semantic segmentation device, which includes: a memory for storing programs; a processor for executing the programs stored in the memory, and when the program stored in the memory is executed, the processor is used to execute the method in the first aspect.
[0043] In a sixth aspect, a training device for an image semantic segmentation network is provided, the device comprising: a memory for storing programs; a processor for executing the programs stored in the memory, and when the programs stored in the memory are executed, the processor is used to execute the method in the above-mentioned second aspect.
[0044] In a seventh aspect, an electronic device is provided, which includes the image semantic segmentation device in the third aspect or the fifth aspect.
[0045] In the seventh aspect mentioned above, the electronic device may specifically be a mobile terminal (eg, a smart phone), a tablet computer, a laptop computer, an augmented reality / virtual reality device, a vehicle-mounted terminal device, and the like.
[0046] In an eighth aspect, a computer device is provided, which includes a training device for an image semantic segmentation network according to the fourth aspect or the sixth aspect.
[0047] In the eighth aspect mentioned above, the computer device may specifically be a server or a cloud device, etc.
[0048] In a ninth aspect, a computer-readable medium is provided, which stores a program code for execution by a device, wherein the program code includes instructions for executing the steps of the method in the first aspect or the second aspect.
[0049] In a tenth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the method in the first or second aspect.
[0050] In an eleventh aspect, a chip is provided, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method in the first aspect or the second aspect.
[0051] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the first aspect or the second aspect.
[0052] The above chip can specifically be a field programmable gate array FPGA or an application specific integrated circuit ASIC.
[0053] It should be understood that in the present application, the method of the first aspect may specifically refer to the method of the first aspect and any one of the various implementations of the first aspect. The method of the second aspect may specifically refer to the method of the second aspect and any one of the various implementations of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a structural diagram of the system architecture provided by the embodiment of the present application;
[0055] Figure 2 It is a schematic diagram of semantic segmentation based on the FCN model provided in an embodiment of the present application;
[0056] Figure 3 It is a schematic diagram of a chip hardware structure provided in an embodiment of the present application;
[0057] Figure 4 is a schematic flow chart of an image semantic segmentation network training provided in an embodiment of the present application;
[0058] Figure 5 It is a schematic block diagram of a training method for an image semantic segmentation network provided in an embodiment of the present application;
[0059] Figure 6 It is a schematic block diagram of a system architecture of an image semantic segmentation network provided in an embodiment of the present application;
[0060] Figure 7 is a schematic block diagram of an image semantic segmentation device provided in an embodiment of the present application;
[0061] Figure 8 This is a schematic flow chart of an image semantic segmentation method provided in an embodiment of the present application;
[0062] Fig. 9 is a schematic block diagram of a bottleneck structure of an embodiment of the present application;
[0063] Fig.10 is a schematic block diagram of an image semantic segmentation network provided in an embodiment of the present application;
[0064] Fig.11 is a schematic block diagram of a TPP provided in an embodiment of the present application;
[0065] Fig.12 is a schematic block diagram of an image semantic segmentation network training device according to an embodiment of the present application;
[0066] Fig.13 It is a schematic diagram of the hardware structure of the image semantic segmentation network training device according to an embodiment of the present application;
[0067] Fig.14 It is a schematic diagram of the hardware structure of the image semantic segmentation device according to an embodiment of the present application. DETAILED DESCRIPTION
[0068] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0069] The image semantic segmentation method provided in the embodiment of the present application can be applied to fields that require semantic segmentation, such as autonomous driving systems, human-computer interaction systems, photography of mobile devices, image search engines, and augmented reality applications. The following is a brief introduction to two common application scenarios.
[0070] Application scenario 1: Optimizing the photo taking effect on mobile devices
[0071] Mobile device photography has developed rapidly, from simply recording scenes to being comparable to professional cameras, and computer vision technology has also been applied in this process. In the process of taking photos with mobile devices, in order to obtain better shooting effects and highlight the objects being photographed, it is necessary to perform semantic segmentation on the image.
[0072] Specifically, semantic segmentation is performed on the image to identify different objects by acquiring semantic information in the image, and different objects can then be processed differently.
[0073] Among them, semantic segmentation of the image can be performed by the image semantic segmentation method of the embodiment of the present application. Different objects can be identified according to the semantic segmentation, which is convenient for identifying the shooting subject, and then the shooting subject can be highlighted and the shooting results can be optimized.
[0074] Application scenario 2: Autonomous driving system
[0075] The autonomous driving system (ADS) requires the use of various networks, including object detection, image recognition, semantic segmentation, and 3D pose estimation, etc. These complex networks can provide rich scene information, replace the driver to drive the car, and achieve safe driving.
[0076] Specifically, semantic segmentation is required in the autonomous driving system, that is, to divide the entire scene at a semantic level with pixel accuracy and high speed, for example, this pixel belongs to the vehicle, another pixel belongs to the guardrail, etc. Next, by converting pixels to physical distances, the system can complete the complete modeling of the entire scene. Pixel-level positioning accuracy can obtain a more accurate outline of the vehicle, so that accurate side distance calculations can be completed; at the same time, the detected elements such as guardrails, lane lines and road surfaces can assist in the more accurate determination of the vehicle's position.
[0077] The semantic segmentation can be performed by the image semantic segmentation method of the embodiment of the present application. According to the semantic segmentation, different objects in the image can be determined, thereby realizing the calculation of the distance to the side of the vehicle and the judgment of the vehicle position.
[0078] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0079] (1) Semantic Segmentation
[0080] Different from traditional image segmentation problems based on features such as grayscale, color, texture, and shape, semantic segmentation is usually at the pixel level, that is, each pixel in the image is labeled with a specific category. Semantic segmentation means that after segmenting objects of different categories in the image, these objects can also be classified. Semantic segmentation usually takes an image as input and a semantic segmentation map (prediction map) as output. Each pixel in the segmentation map contains the label of the category corresponding to the pixel.
[0081] (2) Neural Network
[0082] A neural network can be composed of neural units. A neural unit can be a s The output of the operation unit can be shown as formula (1):
[0083]
[0084] Where, s = 1, 2, ... n, n is a natural number greater than 1, W s For x s The weight of the neural unit, b is the bias of the neural unit. f is the activation function of the neural unit, which is used to perform nonlinear transformation on the features in the neural network and convert the input signal in the neural unit into an output signal. The output signal of the activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. A neural network is a network formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0085] (3) Deep Neural Networks
[0086] A deep neural network (DNN), also known as a multi-layer neural network, can be understood as a neural network with multiple hidden layers. According to the position of different layers, the neural network inside the DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.
[0087] Although DNN looks complicated, the work of each layer is not complicated. In simple terms, it can be expressed as the following linear relationship: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since DNN has many layers, the coefficient W and the offset vector The number of these parameters is also relatively large. The definitions of these parameters in DNN are as follows: Taking the coefficient W as an example, assuming that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input.
[0088] In summary, the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as
[0089] It should be noted that the input layer does not have a W parameter. In a deep neural network, more hidden layers allow the network to better describe complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks. Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (the weight matrix formed by many layers of vector W).
[0090] (4) Convolutional Neural Network
[0091] Convolutional neural network (CNN) is a deep neural network with a convolutional structure. Convolutional neural network contains a feature extractor consisting of a convolution layer and a subsampling layer, which can be regarded as a filter. Convolutional layer refers to the neuron layer in the convolutional neural network that performs convolution processing on the input signal. In the convolutional layer of the convolutional neural network, a neuron can only be connected to some neurons in the adjacent layers. A convolutional layer usually contains several feature planes, each of which can be composed of some rectangularly arranged neural units. The neural units in the same feature plane share weights, and the shared weights here are convolution kernels. Shared weights can be understood as the way to extract image information is independent of position. The convolution kernel can be initialized in the form of a matrix of random size, and the convolution kernel can obtain reasonable weights through learning during the training process of the convolutional neural network. In addition, the direct benefit of shared weights is to reduce the connection between the layers of the convolutional neural network, while reducing the risk of overfitting.
[0092] (5) Residual Network
[0093] The residual network is a deep convolutional network proposed in 2015. Compared with traditional convolutional neural networks, the residual network is easier to optimize and can improve accuracy by increasing the depth. The core of the residual network is to solve the side effects (degradation problem) brought by increasing the depth, so that the network performance can be improved by simply increasing the network depth. The residual network generally contains many sub-modules with the same structure. Usually, a residual network (ResNet) is used to connect a number to indicate the number of times the sub-module is repeated. For example, ResNet50 means that there are 50 sub-modules in the residual network.
[0094] (6) Loss Function
[0095] In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it predict a lower value, and keep adjusting until the deep neural network can predict the target value we really want or a value very close to the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.
[0096] (7) Back propagation algorithm
[0097] Neural networks can use the error back propagation (BP) algorithm to correct the values of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the parameters in the initial neural network model are updated by back propagating the error loss information, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, which aims to obtain the optimal parameters of the neural network model, such as the weight matrix.
[0098] Combine the following Figure 1 The system architecture of the embodiment of the present application is introduced in detail.
[0099] Figure 1 Schematic diagram of the system architecture of the embodiment of the present application. Figure 1 As shown, the system architecture 100 includes an execution device 110 , a training device 120 , a database 130 , a client device 140 , a data storage system 150 , and a data collection system 160 .
[0100] In addition, the execution device 110 includes a calculation module 111, an I / O interface 112, a preprocessing module 113 and a preprocessing module 114. The calculation module 111 may include the target model / rule 101, and the preprocessing module 113 and the preprocessing module 114 are optional.
[0101] The data acquisition device 160 is used to collect training data. For the image semantic segmentation method of the embodiment of the present application, the training data may include a training image and a label map corresponding to the training image, wherein the label map gives the category label corresponding to each pixel in the training image. Furthermore, the training data may also include inertial measurement unit (IMU) information corresponding to the training image. Inertial measurement unit (IMU) information may include posture information, such as shooting angle information of the training image. The training data is stored in the database 130, and the training device 120 obtains the target model / rule 101 based on the training data maintained in the database 130.
[0102] The following describes how the training device 120 obtains the target model / rule 101 based on the training data. The training device 120 performs semantic segmentation on the input training image, and compares the output semantic segmentation result (the predicted value of the category corresponding to each pixel in the image) with the label map until the difference between the semantic segmentation result output by the training device 120 and the label map is less than a certain threshold, thereby completing the training of the target model / rule 101.
[0103] The above-mentioned target model / rule 101 can be used to implement the image semantic segmentation method of the embodiment of the present application, that is, the image to be processed is input into the target model / rule 101 (it can be pre-processed first and then input into the target model / rule 101), and the semantic segmentation result of the image to be processed can be obtained. The target model / rule 101 in the embodiment of the present application can be specifically a neural network. It should be noted that in actual applications, the training data maintained in the database 130 does not necessarily all come from the collection of the data acquisition device 160, and may also be received from other devices. It should also be noted that the training device 120 does not necessarily train the target model / rule 101 completely based on the training data maintained by the database 130, and it is also possible to obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
[0104] The target model / rule 101 trained by the training device 120 can be applied to different systems or devices, such as Figure 1 The execution device 110 shown in the figure may be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR), a vehicle terminal, etc., or a server or a cloud. Figure 1In the embodiment, the execution device 110 is configured with an input / output (I / O) interface 112 for data interaction with an external device. The user can input data to the I / O interface 112 through the client device 140. The input data in this embodiment of the application may include: the image to be processed input by the client device. Further, the input data may also include IMU information corresponding to the image to be processed. The client device 140 here may specifically be a terminal device.
[0105] The preprocessing module 113 and the preprocessing module 114 are used to perform preprocessing according to the input data (such as the image to be processed) received by the I / O interface 112. In the embodiment of the present application, there may be no preprocessing module 113 and the preprocessing module 114 or only one preprocessing module. When there is no preprocessing module 113 and the preprocessing module 114, the computing module 111 may be directly used to process the input data.
[0106] When the execution device 110 preprocesses the input data, or when the computing module 111 of the execution device 110 performs calculations and other related processing, the execution device 110 can call the data, code, etc. in the data storage system 150 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 150.
[0107] Finally, the I / O interface 112 presents the processing results, such as the semantic segmentation results calculated by the target model / rule 101, to the client device 140, thereby providing them to the user.
[0108] Specifically, the semantic segmentation result obtained by processing the target model / rule 101 in the computing module 111 can be processed by the preprocessing module 113 (and can also be processed by the preprocessing module 114) and the processed result can be sent to the I / O interface, and then the I / O interface can send the processed result to the client device 140 for display.
[0109] It should be understood that when the preprocessing module 113 and the preprocessing module 114 do not exist in the above-mentioned system architecture 100, the computing module 111 can also transmit the processed semantic segmentation results to the I / O interface, and then the I / O interface sends the processed results to the client device 140 for display.
[0110] It is worth noting that the training device 120 can generate corresponding target models / rules 101 based on different training data for different goals or different tasks. The corresponding target models / rules 101 can be used to achieve the above goals or complete the above tasks, thereby providing users with the desired results.
[0111] exist Figure 1In the case shown in the figure, the user can manually give input data, and the manual giving can be operated through the interface provided by the I / O interface 112. In another case, the client device 140 can automatically send input data to the I / O interface 112. If the client device 140 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 140. The user can view the results output by the execution device 110 on the client device 140, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 140 can also be used as a data acquisition terminal to collect the input data of the input I / O interface 112 and the output results of the output I / O interface 112 as shown in the figure as new sample data, and store them in the database 130. Of course, it is also possible not to collect through the client device 140, but the I / O interface 112 directly stores the input data of the input I / O interface 112 and the output results of the output I / O interface 112 as new sample data in the database 130.
[0112] It is worth noting that Figure 1 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 1 In the embodiment, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 may also be placed in the execution device 110.
[0113] like Figure 1 As shown, the target model / rule 101 obtained by training with the training device 120 may be a neural network in the embodiment of the present application. Specifically, the neural network provided in the embodiment of the present application may be a fully convolutional network (FCN), etc. In the neural network provided in the embodiment of the present application, both the backbone network and the sub-network may be a fully convolutional network.
[0114] As mentioned in the previous basic concept introduction, convolutional neural network is a deep neural network with convolution structure, which is a deep learning architecture. Deep learning architecture refers to multiple levels of learning at different abstract levels through machine learning algorithms. As a deep learning architecture, CNN is a feed-forward artificial neural network, in which each neuron can respond to the image input into it.
[0115] A convolutional neural network (CNN) may include an input layer, a convolutional layer / pooling layer (where the pooling layer is optional), and a fully connected layer. Replacing the fully connected layer with a convolutional layer will result in a fully convolutional network. Figure 2 As shown, the full convolution network may include an input layer 210, a convolution layer / pooling layer 220 (wherein the pooling layer is optional), and a convolution layer 230. The relevant contents of these layers are described in detail below.
[0116] Convolutional layer / pooling layer 220:
[0117] like Figure 2 The convolution layer / pooling layer 220 shown may include layers 221-226, for example: in one implementation, layer 221 is a convolution layer, layer 222 is a pooling layer, layer 223 is a convolution layer, layer 224 is a pooling layer, layer 225 is a convolution layer, and layer 226 is a pooling layer; in another implementation, layers 221 and 222 are convolution layers, layer 223 is a pooling layer, layer 224 and 225 are convolution layers, and layer 226 is a pooling layer. That is, the output of a convolution layer can be used as the input of a subsequent pooling layer, or as the input of another convolution layer to continue the convolution operation.
[0118] The following will take the convolution layer 221 as an example to introduce the internal working principle of a convolution layer.
[0119] The convolution layer 221 may include a plurality of convolution operators, which are also called kernels. The convolution operator is equivalent to a filter that extracts specific information from the input image matrix in image processing. The convolution operator can be essentially a weight matrix, which is usually predefined. In the process of performing convolution (Conv) operation on the image, the weight matrix is usually processed one pixel after another (or two pixels after two pixels... depending on the value of the step length stride) on the input image in the horizontal direction, so as to complete the work of extracting specific features from the image. The size of the weight matrix should be related to the size of the image. It should be noted that the depth dimension of the weight matrix is the same as the depth dimension of the input image. In the process of performing convolution operation, the weight matrix will extend to the entire depth of the input image. Therefore, convolution with a single weight matrix will produce a convolution output with a single depth dimension, but in most cases, a single weight matrix is not used, but multiple weight matrices of the same size (row × column), that is, multiple isotype matrices, are applied. The output of each weight matrix is stacked up to form the depth dimension of the convolution image, where the dimension can be understood as being determined by the "multiple" mentioned above. Different weight matrices can be used to extract different features in the image, for example, one weight matrix is used to extract image edge information, another weight matrix is used to extract specific colors of the image, and another weight matrix is used to blur unnecessary noise in the image, etc. The multiple weight matrices have the same size (rows × columns), and the size of the feature maps extracted by the multiple weight matrices of the same size is also the same. The extracted multiple feature maps of the same size are then merged to form the output of the convolution operation.
[0120] The weight values in these weight matrices need to be obtained through a lot of training in practical applications. The weight matrices formed by the weight values obtained through training can be used to extract information from the input image, so that the full convolutional network 200 can make correct predictions.
[0121] When the full convolutional network 200 has multiple convolutional layers, the initial convolutional layer (for example, 221) often extracts more general features, which can also be called low-level features. As the depth of the full convolutional network 200 increases, the features extracted by the later convolutional layers (for example, 226) become more and more complex, such as high-level semantic features. Features with higher semantics are more suitable for the problem to be solved.
[0122] Pooling layer:
[0123] Since it is often necessary to reduce the number of training parameters, it is often necessary to periodically introduce a pooling layer after the convolution layer. Figure 2Each layer 221-226 illustrated in 220 may be a convolution layer followed by a pooling layer, or may be multiple convolution layers followed by one or more pooling layers. In the image processing process, the only purpose of the pooling layer is to reduce the spatial size of the image. The pooling layer may include an average pooling operator and / or a maximum pooling operator for sampling the input image to obtain an image of smaller size. The average pooling operator may calculate the pixel values in the image within a specific range to generate an average value as the result of average pooling. The maximum pooling operator may take the pixel with the largest value in the range within a specific range as the result of maximum pooling. In addition, just as the size of the weight matrix used in the convolution layer should be related to the image size, the operator in the pooling layer should also be related to the image size. The size of the image output after processing by the pooling layer may be smaller than the size of the image input to the pooling layer, and each pixel in the image output by the pooling layer represents the average value or maximum value of the corresponding sub-region of the image input to the pooling layer.
[0124] Convolutional layer 230:
[0125] After being processed by the convolution layer / pooling layer 220, the full convolution network 200 is not sufficient to output the required output information. As mentioned above, the convolution layer / pooling layer 220 only extracts features and reduces the parameters brought by the input image. However, in order to generate the final output information (the required class information or other related information), the full convolution network 200 needs to use the convolution layer 230 to generate one or a group of output heatmaps of the required number of classes. Therefore, the convolution layer 230 may include multiple convolution layers (such as Figure 2 231, 232 to 23n) and output layer 240 shown, the parameters contained in the multi-layer convolutional layer can be pre-trained according to relevant training data of a specific task type, for example, the task type can include semantic segmentation, etc. ...
[0126] The last layer of the entire full convolutional network 200 is the output layer 240, which has a loss function similar to the classification cross entropy, specifically used to calculate the prediction error. Once the forward propagation of the entire full convolutional network 200 (such as Figure 2 The propagation from 210 to 240 is forward propagation), and the reverse propagation (such as Figure 2 The propagation from 240 to 210 is called back propagation) and then starts to update the weight values and biases of the aforementioned layers to reduce the loss of the full convolutional network 200 and the error between the result output by the output layer of the full convolutional network 200 and the ideal result.
[0127] It should be noted that if Figure 2The fully convolutional network 200 shown is only an example of a convolutional neural network. In specific applications, the convolutional neural network may also exist in the form of other network models.
[0128] The following introduces a chip hardware structure provided by an embodiment of the present application.
[0129] Figure 3 A chip hardware structure provided in an embodiment of the present application includes a neural network processor 30. The chip can be arranged as follows: Figure 1 The execution device 110 shown in FIG. 1 is used to complete the calculation work of the calculation module 111. The chip can also be set in Figure 1 The training device 120 shown in FIG. 1 is used to complete the training work of the training device 120 and output the target model / rule 101. The algorithms of each layer in the convolutional neural network can be as follows: Figure 3 is implemented in the chip shown.
[0130] The neural-network processing unit (NPU) is mounted on the host CPU as a coprocessor, and the host CPU assigns tasks to it. The core part of the NPU is the operation circuit 303, which is controlled by the controller 304 to extract data from the memory (weight memory or input memory) and perform multiplication and addition operations.
[0131] In some implementations, the operation circuit 303 includes multiple processing units (process engines, PEs) inside. In some implementations, the operation circuit 303 is a two-dimensional systolic array. The operation circuit 303 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 303 is a general-purpose matrix processor.
[0132] For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit 303 takes the weight data of the matrix B from the weight memory 302 and caches it on each PE in the operation circuit 303. The operation circuit 303 takes the input data of the matrix A from the input memory 301, performs matrix operations based on the input data of the matrix A and the weight data of the matrix B, and stores the partial results or the final results of the matrix in the accumulator 308.
[0133] The vector calculation unit 307 includes multiple operation processing units, which further process the output of the operation circuit 303 when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector calculation unit 307 can be used for calculations of non-convolutional layers or fully connected layers (FC) in a neural network, such as pooling, batch normalization, local response normalization, etc.
[0134] In some implementations, the vector calculation unit 307 stores the processed vector to the unified memory 306. For example, the vector calculation unit 307 can apply a nonlinear function to the output of the operation circuit 303, such as a vector of accumulated values, to generate an activation value. In some implementations, the vector calculation unit 307 generates a normalized value, a merged value, or both. In some implementations, the vector processed by the vector calculation unit 307 can be used as an activation input of the operation circuit 303, for example, for use in a subsequent layer in a neural network.
[0135] The unified memory 306 is used to store input data and output data.
[0136] The weight data is directly transferred from the external memory to the input memory 301 and / or the unified memory 306 through the direct memory access controller 305 (DMAC), the weight data in the external memory is stored in the weight memory 302, and the data in the unified memory 306 is stored in the external memory.
[0137] The bus interface unit (BIU) 310 is used to implement the interaction between the main CPU, DMAC and instruction fetch memory 309 through the bus.
[0138] An instruction fetch buffer 309 connected to the controller 304 for storing instructions used by the controller 304;
[0139] The controller 304 is used to call the instructions cached in the memory 309 to control the working process of the computing accelerator.
[0140] Generally, unified memory 306, input memory 301, weight memory 302 and instruction memory 309 are all on-chip memories. External memory is independent of the NPU hardware architecture. The external memory can be double data rate synchronous dynamic random access memory (DDR SDRAM), high bandwidth memory (HBM) or other readable and writable memory.
[0141] In addition, the operations of each layer in the neural network can be performed by the operation circuit 303 or the vector calculation unit 307.
[0142] Figure 4 A schematic flow chart of an image semantic segmentation network training provided by an embodiment of the present application is shown. Training data is input into the image semantic segmentation network for training, and the trained image semantic segmentation network is output.
[0143] Exemplarily, the training data includes training images I = {I1, I2, ..., I r} and the label map L corresponding to the training image = {L1,L2,...,L r}. Where r represents the number of training images. The training images and label maps are in one-to-one correspondence, and the number of label maps corresponding to the training images is also r. For the convenience of description, the training images and the corresponding label maps can be called image-label map pairs. The label map corresponding to the training image includes the category label corresponding to each pixel in the training image. The label map corresponding to the training image can be pre-annotated (specifically, it can be manually annotated).
[0144] For example, the training image may be an RGB (red (red, R), green (green, G), blue (blue, B)) image. For another example, the training image may also be a grayscale image.
[0145] Furthermore, in addition to the brightness value information, the training image may also include inertial measurement unit (IMU) information corresponding to the training image. For example, the IMU information may be shooting angle information of the training image. The IMU information may be obtained through an IMU module.
[0146] Specifically, the IMU information of the training image and the brightness value information of the training image can be integrated for image semantic segmentation network training. For example, if the training image is an RGB image, the IMU information is expanded to the size of the RGB image and integrated with the brightness value of the RGB image. The input of the image semantic segmentation network is a training image of four channels. The above training image includes brightness value information of three channels (R, G, B) and IMU information of one channel.
[0147] Using IMU information as a one-dimensional input of the training image can assist in the training of the image semantic segmentation network.
[0148] In addition, in the above training process, multiple training images are generally used.
[0149] In the process of training the above-mentioned image semantic segmentation network, a set of initial model parameters can be set for the image semantic segmentation network, and then the model parameters of the image semantic segmentation network can be gradually adjusted according to the difference between the label map and the semantic segmentation results of the training image, until the difference between the label map and the semantic segmentation results of the training image is within a certain preset range, or, when the number of training reaches the preset number, the model parameters of the image semantic segmentation network at this time are determined as the final parameters of the image semantic segmentation network model, thereby completing the training of the image semantic segmentation network.
[0150] Figure 5 A training method 500 for an image semantic segmentation network is provided in an embodiment of the present application. Figure 5 The method shown can be performed by the image semantic segmentation device in the embodiment of the present application. Specifically, Figure 5 The method shown can be Fig.12 The image semantic segmentation device 1200 shown is executed.
[0151] Figure 5 The method shown includes steps S510 to S550, which are described in detail below.
[0152] S510, obtaining training data.
[0153] S520, expanding training data.
[0154] By expanding the training data and performing data enhancement, more training data can be used for training, thereby making the trained image semantic segmentation network have higher prediction accuracy when performing semantic segmentation.
[0155] Expanding the training data can also be said to increase the number of training images. Specifically, the methods of expanding the training data can include the following.
[0156] A-1: Mirror the training image horizontally.
[0157] A-2: Randomly scale the training image. For example, the training image may be randomly scaled by 0.5 to 2 times.
[0158] A-3: Randomly crop the training images. Since scaling will change the size of the training images, the images need to be cropped to a fixed size before being input into the image semantic segmentation network.
[0159] S530, initializing image semantic segmentation network parameters.
[0160] Exemplarily, the image semantic segmentation network can adopt the Mobilenetv2 (mobilenetworkV2) network, and can be initialized using the parameters of the Mobilenetv2 network officially provided by tensorflow. The parameters of the Mobilenetv2 network are pre-trained parameters under the data set (ImageNet), which has better image understanding capabilities, equivalent to pre-training the image semantic segmentation network, which is beneficial to the subsequent training of the image semantic segmentation network.
[0161] S540, setting the number of training iterations to perform network training. The following steps are performed in each iteration.
[0162] S541, from I={I1,I2,...,I n} and L={L1,L2,...,L n} to obtain a subset for training.
[0163] S542, perform forward prediction and calculate the loss.
[0164] Specifically, the image in the above subset is taken as input, and the prediction result of semantic segmentation is output, where the prediction result is a predicted label map, and the predicted label map includes the predicted category label corresponding to each pixel in the image.
[0165] The predicted label map is compared with the label map. Specifically, formula (2) can be used for calculation.
[0166] L=L adapt +γL weight (2)
[0167] Where L represents the loss function, and γ is a hyperparameter used to control the importance of the loss. For example, the value can be set to 1. The loss function consists of two parts. The first part is the cross entropy loss L adapt , the second part is the regularization loss L weight . Calculate the cross entropy loss Ladapt Specifically, it can be calculated using formula (3).
[0168]
[0169] Where N is the number of pixels in the training image, and p i Indicates that the predicted category label of pixel i and the category label of the corresponding pixel in the label map are the predicted values of the same category, i∈[0,N-1], i is an integer, p j Indicates that the predicted category of the pixel is the predicted value of category j, j∈[0,K-1], j is an integer, K represents the number of pixel categories, and K is a positive integer.
[0170] Calculate the regularization loss L weight Specifically, it can be calculated using formula (4).
[0171]
[0172] Among them, α represents the weight of regularization loss, for example, α can be set to 0.0001, and w represents the parameters of all variables. Regularization loss can alleviate overfitting by reducing features and penalizing the weights of unimportant features.
[0173] S543, determine whether the current number of iterations reaches the specified number. If the current number of iterations reaches the specified number, the training is completed and enters S550; if the current number of iterations does not reach the specified number, enter S544.
[0174] S544, back propagation, update parameters, enter S441.
[0175] Specifically, the Adam optimizer can be used to update the parameters, wherein the initial learning rate can be set to 0.0001, and the learning rate can be calculated. Specifically, it can be calculated using formula (5).
[0176]
[0177] Among them lr t-1 Indicates the learning rate used in the previous iteration, lr t It represents the learning rate used in this iteration, step represents the current number of iterations, Iters represents the total number of iterations, which is the specified number in S442, and power represents momentum. Power is a hyperparameter. For example, power can be set to 0.9.
[0178] S550, outputting the training result, that is, outputting the trained image semantic segmentation network.
[0179] The method 500 may be specifically performed as follows: Figure 1The training device 120 shown in FIG. 5 is executed, and the training image in the method 500 may be as follows: Figure 1 The training data maintained in the database 130 is shown.
[0180] Optionally, the method 500 may be processed by a CPU, or by a CPU and a GPU together, or may use other processors suitable for neural network calculations without using a GPU, and this application does not impose any limitation thereto.
[0181] The training device 120 can be specifically used to train the image semantic segmentation network provided in the embodiment of the present application. Figure 6 It is a schematic diagram of the system architecture of the image semantic segmentation network of an embodiment of the present application.
[0182] like Figure 6 As shown in the figure, the input image is processed by the image semantic segmentation network to obtain the category label corresponding to each pixel in the input image, which is the semantic segmentation result, also known as the segmentation map or label map.
[0183] Figure 6 The image semantic segmentation network shown includes a backbone network module, a spatial pyramid pooling module (SPP), an upsampling module, a subnetwork module, and an output module. Figure 6 The image semantic segmentation network in can execute the image semantic segmentation method of the embodiment of the present application. The following is a general introduction to the process of the image semantic segmentation network processing the input image.
[0184] After acquiring the input image, the backbone network module performs convolution processing on the input image to obtain the initial feature map of the input image. SPP can perform multi-scale feature extraction on the initial feature map to obtain a first feature map, which includes multi-scale semantic information of the initial feature map. The first feature map includes multi-scale semantic information of the initial feature map, that is, extracts multi-scale semantic information of the initial feature map. The upsampling module adjusts the size of the first feature map to obtain a second feature map, and the size of the second feature map is larger than that of the first feature map. The sub-network module extracts features from the second feature map to obtain a target feature map of the input image. The output module classifies the pixels in the target feature map to obtain a segmentation map (label map).
[0185] The image semantic segmentation network of the embodiment of the present application can be applied to autonomous driving, terminal equipment, monitoring equipment, etc. The embodiment of the present application is deployed on the computing nodes of related equipment, and the speed and accuracy of semantic segmentation can be improved through software modification.
[0186] The image semantic segmentation device of the embodiment of the present application can be as follows Figure 7 As shown, the image semantic segmentation device mainly includes a backbone network module 710, an SPP 720, an upsampling module 730, a sub-network module 740 and an output module 750.
[0187] In order to better understand the execution process of the image semantic segmentation method in the embodiment of the present application, Figure 7 The functions of each module in the following are briefly described.
[0188] The backbone network module 710 is used to extract features from an input image (also referred to as a picture) to obtain an initial feature map of the input image. Furthermore, the feature extraction may be a series of convolution processes, which may be said to be convolution processes of the input image through multiple convolution layers to obtain an initial feature map. In this case, the initial feature map may include multiple feature maps, and the sizes of the multiple feature maps in the initial feature map may be different.
[0189] The backbone network in the backbone network module 710 can be implemented in a variety of ways, for example, a MobileNetV2 network, a VGG network (a network proposed by the Visual Geometry Group of the University of Oxford), and a deep residual network (ResNet).
[0190] SPP 720 is used to perform multi-scale feature extraction on the initial feature map generated by the backbone network to obtain a first feature map, where the first feature map includes multi-scale semantic information of the initial feature map.
[0191] The upsampling module 730 is used to resize the first feature map output by the SPP 720. Specifically, the size of the first feature map is adjusted, that is, the size of the first feature map is enlarged by upsampling to obtain the second feature map. For example, the upsampling method may include deconvolution or bilinear difference. The upsampling module can restore the resolution of the image.
[0192] The subnetwork module 740 is used to perform feature extraction on the feature map of the upsampled output to obtain a target feature map of the input image. Further, the feature extraction can be a series of convolution processes, and the series of convolution processes can also be said to be convolution processes of the second feature map through multiple convolution layers to obtain the target feature map. In this case, the target feature map may include multiple feature maps, and the sizes of the multiple feature maps in the target feature map may be different.
[0193] In this way, through the resolution restoration of the upsampling module, the sub-network module can further extract features at high resolution, thereby improving the expressiveness of image features.
[0194] Furthermore, the structure of the sub-network module may be the same as that of the backbone network.
[0195] The output module 750 is used to process the target feature map to obtain a category label corresponding to each pixel in the input image.
[0196] Combine the following Figure 8 The image semantic segmentation method 800 of an embodiment of the present application is described in detail. Figure 8 It is a schematic flowchart of the image semantic segmentation method of an embodiment of the present application. Figure 8 The method shown can be performed by the image semantic segmentation device in the present application. The method 800 includes S810 to S880.
[0197] S810, obtaining an image to be processed.
[0198] The above-mentioned images can be various images, for example, images taken by mobile phones or other smart terminals, and road scene images obtained by auxiliary / automatic driving systems.
[0199] Furthermore, the image to be processed includes not only the brightness value information of the image to be processed, but also IMU information corresponding to the image to be processed, such as the shooting angle information of the image to be processed. The above IMU information can be obtained through the IMU module.
[0200] Specifically, the IMU information of the image to be processed and the brightness value information of the image to be processed can be integrated. For example, if the image to be processed is an RGB image, the size of the IMU information is expanded to the size of the RGB image, and after being integrated with the brightness value information of the RGB image, the input of the image semantic segmentation network is a four-channel image to be processed. Among them, the image to be processed may include brightness value information of three channels (R, G, B) and IMU information of one channel.
[0201] In the above S810, the image may be acquired by photographing with a camera or from a memory.
[0202] Alternatively, the IMU information of the image to be processed is not limited to the image semantic segmentation network in the embodiment of the present application, but can also be applied to other image semantic segmentation networks. For example, the IMU information of the image to be processed and the brightness value information of the image to be processed can be integrated. The image to be processed includes the brightness value information of the image to be processed and the IMU information corresponding to the image to be processed. The image to be processed is input into other image semantic segmentation networks to obtain a semantic segmentation result.
[0203] When there is less image topology information, adding IMU information can effectively improve the accuracy of prediction. For example, if there is only a large area of ground and wall in the image, the semantic segmentation result obtained without adding angle information is poor, and incorrect segmentation of the ceiling may occur. The ground, ceiling, and wall have obvious spatial position information. In indoor situations, shooting downwards usually captures the ground, shooting upwards usually captures the ceiling, and shooting horizontally is likely to capture the wall. Therefore, adding IMU information can increase the accuracy of image segmentation.
[0204] It should be understood that Figure 8 The method shown may also start directly from S820 .
[0205] S820: Perform feature extraction on the image to be processed to obtain an initial feature map of the image to be processed.
[0206] When the initial feature map is obtained in S820, the initial feature map can be obtained by performing a series of convolution operations (convolution processing) on the image to be processed, or by further processing the convolution operation result of the image (for example, summing, weighting, connecting, etc.).
[0207] In S820, the image may be convolved using the backbone network (module) in the image semantic segmentation network to obtain an initial feature map.
[0208] The backbone network can extract the semantic information and contextual information of the image to be processed, and expand the receptive field of image features while gradually reducing the image resolution.
[0209] The backbone network can adopt a variety of convolutional network architectures, such as MobileNetV2 network, VGG network and ResNet network.
[0210] The above initial feature map may contain multiple channels. Assuming that the resolution of the input image is H0*W0*3 (height H0, width W0, number of channels is 3, that is, three RBG channels), then after convolution processing, the initial feature map U∈H*W*K can be obtained, where H and W represent the height and width of the initial feature map, respectively, and K represents the number of channels of the initial feature map. The size in the embodiment of the present application refers to the height and width of the feature map.
[0211] In the above S820, when extracting features from an image, the image may be subjected to convolution processing in sequence through multiple convolution layers. Taking the backbone network as the MobileNetV2 network as an example, the image may be subjected to convolution processing through a bottleneck structure to obtain an initial feature map. The bottleneck structure may be as follows: Fig. 9 shown.
[0212] Specifically, a bottleneck structure is used to perform a convolution operation on the image to be processed. The convolution operation of a convolution layer may include the following processes: performing point convolution (Conv1×1) on the image to be processed to expand the number of channels; performing batch normalization (BN) to normalize the input; performing depthwise convolution (Depthwise Conv) to extract features; performing BN to normalize the input; performing point convolution to compress the number of channels to obtain a feature map after the convolution operation of a convolution layer.
[0213] Table 1 shows the parameter settings of the MobileNetV2 network used in the backbone network of one embodiment of the present application. The first column is the input size of different convolutional layers, the second column is the operator processing process, conv2d represents convolution, t represents the expansion factor, c represents the number of channels, n represents the number of repetitions, and s represents the stride.
[0214] Table 1
[0215]
[0216] Fig.10 A schematic diagram of the structure of an image semantic segmentation network in another embodiment of the present application is shown. Fig.10 Step S820 is described.
[0217] The size of the image to be processed is 640×480. After the convolution processing of the backbone network with the parameter configuration shown in Table 1, five feature maps of different sizes can be obtained. The initial feature map in S820 can include five feature maps of different sizes. The five feature maps of different sizes are feature map f1 (size is 320×240), feature map f2 (size is 160×120), feature map f3 (size is 80×60), feature map f4 (size is 40×30) and feature map f5 (size is 20×15). Fig.10 Only feature map f3 (size is 80×60), feature map f4 (size is 40×30) and feature map f5 (size is 20×15) are shown. It should be understood that the size of an image does not necessarily change after being processed by a convolutional layer. Fig.10 The backbone network in Figure 2 shows only four convolutional layers, but Fig.10 The backbone network in can include more than four convolutional layers.
[0218] If there is at least one convolutional layer in the backbone network, and the size of the feature map output by the convolutional layer is the same as the size of the feature map input to the convolutional layer, then there is more than one initial feature map with the same size.
[0219] Exemplarily, in the embodiments of the present application, "feature fusion is performed on a feature map of the same size (size A) as the initial feature map", if there is more than one feature map of size A in the initial feature map, one or more feature maps of size A can be arbitrarily selected from the feature maps of size A in the initial feature map for fusion, or all feature maps of size A in the initial feature map can be feature fused, or the last output feature map can be selected from the feature maps of size A. For example, fusion is performed with a feature map of size 40×30 in the initial feature map, that is, feature fusion is performed with feature map f4, and feature map f4 can be a feature map with a resolution of 40×30×64 in Table 1, or a feature map with a resolution of 40×30×96, or a feature map with a resolution of 40×30×(64+96).
[0220] When the initial feature map is composed of multiple feature maps, in the subsequent processing of the initial feature map, any feature map can be selected to be input into the subsequent TPP for further processing. Preferably, the feature map f5 output by the last convolutional layer of the backbone network can be selected to be input into the subsequent TPP for further processing. The feature map f5 (32×) output by the last convolutional layer has a size of 20×15, which is 1 / 32 of the image to be processed, has a larger receptive field, and has a stronger ability to express image features.
[0221] Using the MobileNetV2 network as the backbone network can greatly reduce the number of model parameters and floating-point operations. The network takes up less space, reduces the amount of calculation, and increases the running speed. In addition, the backbone network needs to be transplanted to the mobile terminal using the open source software library tensorflow, which provides a pre-trained model of the MobileNetV2 network. The backbone network pre-trained with the dataset (ImageNet) has a more powerful semantic understanding ability.
[0222] It should be understood that the above convolution process and Fig.10 The backbone network in the figure is only an example. In the embodiments of the present application, there is no limitation on the network used in the convolution processing, the number of convolution processing, etc.
[0223] S830, performing multi-scale feature extraction on the initial feature map to obtain a first feature map, wherein the first feature map includes multi-scale semantic information of the initial feature map.
[0224] Multi-scale feature extraction is performed on the initial feature map to determine a first feature map. Specifically, feature maps of different scales can be extracted from the initial feature map to obtain multi-scale semantic information of the initial feature map.
[0225] For example, the initial feature map may be convolved with different convolution kernels to obtain feature maps of different scales. For another example, the initial feature map may be pooled with different sampling rates to obtain feature maps of different scales.
[0226] Furthermore, the initial feature map may be first subjected to dimensionality reduction processing, and then multi-scale feature extraction may be performed on the feature map obtained by the dimensionality reduction processing to determine the first feature map.
[0227] Specifically, the initial feature map can be processed by a tiny pyramid polling module (TPP) to obtain the first feature map.
[0228] Fig.11 FIG. 2 shows a schematic diagram of the structure of TPP in an embodiment of the present application. Fig.10 , the TPP processing process is explained by taking the feature map f5 in the initial feature map in S820 as an example of the input TPP feature map.
[0229] S831, performing dimensionality reduction processing on the feature map f5 to obtain a feature map f5', that is, reducing the number of channels of the feature map f5.
[0230] Specifically, the dimensionality reduction process may be a point convolution (Conv1×1) process. For example, the number of channels of the feature map after the point convolution may be reduced to 1 / 4 of the number of channels of the feature map f5.
[0231] S832, collecting semantic information of different scales from the feature map f5' obtained by the dimensionality reduction process.
[0232] Exemplarily, semantic information of different scales can be collected from the feature map f5' by SPP. Specifically, the feature map f5' can be subjected to multiple pooling processes of different sampling rates, or multiple pooling processes of different sizes, to obtain feature maps of multiple scales, that is, to obtain multi-scale semantic information.
[0233] like Fig.11 As shown, assuming that the size of the feature map f5 is H*W, the size of the feature map f5' obtained by the dimensionality reduction process is also H*W, and the number of pooling processes is 4 times as an example for explanation.
[0234] For the first pooling process, the feature map f5' is taken as an entire picture block (also called a sub-region), and the size of the picture block is H*W; for the second pooling process, the feature map f5' is divided into 4 picture blocks, and the size of each picture block is H*W / 4; for the third pooling process, the feature map f5' is divided into 9 picture blocks, and the size of each picture block is H*W / 9; for the fourth pooling process, the feature map f5' is divided into 36 picture blocks, and the size of each picture block is H*W / 36. Extract a feature value from each of the above picture blocks to obtain 4 feature maps corresponding to the 4 pooling processes. The pixel values in the 4 feature maps represent the statistical information of the pixel values of multiple pixels in the sub-regions of different scales in the feature map f5'. For example, each pixel value of the feature map obtained by the second pooling process represents the statistical information of all pixels in each of the 4 picture blocks of the feature map f5'.
[0235] S833, upsampling the feature maps of multiple scales respectively, and performing feature fusion on the multiple feature maps after the upsampling process and the initial feature map to obtain a first feature map.
[0236] Taking the four feature maps obtained in S832 as an example, the four feature maps obtained after the above pooling are upsampled respectively to obtain four feature maps with the same size (H*W) as the feature map f5, and the four feature maps with a size of H*W obtained by upsampling are feature fused with the feature map f5.
[0237] Specifically, the feature fusion method may include point-by-point addition (add) of feature maps or channel / dimension concatenation (concat).
[0238] Preferably, the feature fusion method is feature map channel splicing.
[0239] It should be understood that the above TPP process and Fig.11 The structural diagram is only an example. In the embodiments of the present application, there is no limitation on the network used in the dimensionality reduction process, the network used in the extraction of multi-scale semantic information, or the sampling rate of the pooling process.
[0240] Compared with the complete spatial pyramid pooling structure, the TPP structure in the embodiment of the present application reduces the number of channels through dimensionality reduction processing, thereby reducing the amount of calculation and improving the operation speed; retains the characteristics of spatial pyramid pooling, can extract multi-scale semantic information of sub-regions of different sizes, eliminates the fixed size constraint of the convolutional neural network, and improves the prediction accuracy.
[0241] Optionally, method 800 also includes S840.
[0242] S840: resize the first feature map to obtain a second feature map, where the size of the second feature map is larger than the size of the first feature map.
[0243] Exemplarily, upsampling is performed on the first feature map to obtain the second feature map.
[0244] For example, Fig.10 The size of the first feature map (32X) in S810 is 1 / 32 of the image to be processed in S810. The first feature map (32X) is upsampled to achieve 4 times size restoration (X4), and the size of the obtained second feature map (8X) is 1 / 8 of the image to be processed in S810.
[0245] Optionally, method 800 also includes S850.
[0246] S850, performing feature fusion on the second feature map and the shallow features in the initial feature map in S810 to obtain a third feature map.
[0247] Specifically, the second feature map may be feature fused with a feature map in the initial feature map in S810 that has the same size as the second feature map to obtain a third feature map.
[0248] For example, Fig.10 The size of the second feature map (8X) in S810 is 1 / 8 of the image to be processed in S810, and the size of the feature map f3 (8X) in the above initial feature map is 1 / 8 of the image to be processed in S810. The second feature map (8X) and the above feature map f3 (8X) can be feature fused to obtain the third feature map (8X).
[0249] For another example, the size of the second feature map (16X) is 1 / 16 of the image to be processed in S810, and the size of the feature map f4 (16X) in the initial feature map is 1 / 16 of the image to be processed in S810, and the second feature map (16X) is feature fused with the feature map f4. The feature map obtained by feature fusion can also continue to be processed as described above, that is, the feature map obtained by feature fusion is further upsampled, and the feature map obtained by upsampling is further feature fused with the feature map of the same size as the initial feature map, and so on, to obtain a third feature map.
[0250] According to the solution of the embodiment of the present application, by performing feature fusion with the features of the backbone network and realizing feature reuse, more accurate spatial information can be obtained, and the spatial information is fused with the semantic information, so that the information of the backbone network can be further utilized in subsequent feature extraction, thereby expanding the receptive field of the feature and refining the prediction result.
[0251] S860: Perform feature extraction on the first feature map, the second feature map, or the third feature map.
[0252] It should be noted that if the method 800 includes S850, then S860 is to extract features from the third feature map. If the method 800 does not include S850, then S860 is to extract features from the second feature map.
[0253] If the method 800 does not include S840, then S860 is to extract features from the first feature map.
[0254] The method 800 includes S850, combining Fig.10 , taking the feature extraction of the third feature map (8X) as an example, S860 is explained.
[0255] When performing feature extraction in S860, a series of convolution operations (convolution processing) can be performed on the third feature map (8X), or the convolution operation result of the third feature map (8X) can be further processed (for example, summing, weighting, connecting, etc.).
[0256] In S860, the third feature map (8X) may be convolved by the subnetwork (module) in the above-mentioned image semantic segmentation network.
[0257] The sub-network can adopt a variety of convolutional network architectures, for example, MobileNetV2 network, VGG network and ResNet network, etc. The structure of the sub-network can be the same as the backbone network, for example, both adopt MobileNetV2 network.
[0258] In the above S860, when extracting features from the third feature map (8X), the third feature map (8X) may be subjected to convolution processing in sequence through multiple convolution layers. Taking the MobileNetV2 network as an example, the convolution operation (convolution processing) on the third feature map (8X) may be performed through a bottleneck structure. The bottleneck structure may be as follows: Fig. 9 shown.
[0259] Furthermore, the feature map output by each convolutional layer in the sub-network can be fused with the shallow features obtained by the backbone network, and the feature map obtained by feature fusion can be used as the input of the next convolutional layer in the sub-network.
[0260] Exemplarily, the feature maps output by each convolutional layer of the sub-network can be fused with the feature maps of the same size output by each convolutional layer of the backbone network as the input of the next convolutional layer of the sub-network.
[0261] For example, the third feature map is subjected to feature extraction through m convolutional layers to obtain a feature map output from the m-th convolutional layer, where the input of the i-th convolutional layer in the m convolutional layers can be the feature map output from the (i - 1)-th convolutional layer. Further, the size of the feature map output from the (i - 1)-th convolutional layer is H i-1 *W i-1 , and the input of the i-th convolutional layer in the m convolutional layers can be a feature map obtained by performing feature fusion on the feature map output from the (i - 1)-th convolutional layer and the feature map with a size of H i-1 *W i-1 in the initial feature map. m is an integer greater than 1, 1 < i ≤ m, and i is an integer.
[0262] Fig.10 In ,
[0262] , and Fig.10 , m is 2 layers.
[0263] Table 2 shows the parameter settings of a sub-network having the same structure as the backbone network in Table 1 described above. Among them, the first column represents the size of the input image (or feature map), bottleneck represents the bottleneck structure, t represents the expansion factor, c represents the number of channels, n represents the number of repetitions, and s represents the stride.
[0264] Table 2
[0265]
[0266] It should be understood that the above convolution process is only an example, and in the embodiments of the present application, the network used for convolution processing, the number of convolution processes, the number of times of feature fusion between the feature map of the sub-network and the shallow feature map of the backbone network, etc. are not limited.
[0267] Table 2 is described in combination with Table 1. The input of the first convolutional layer of the sub-network in Table 2 is the third feature map (8X). This third feature map (8X) is a feature map obtained by performing feature fusion on the second feature map and the feature map f3(8X) in the above initial feature map. The input of the second convolutional layer of the sub-network is a feature map (16X) obtained by performing feature fusion on the output feature map (16X) of the first convolutional layer of the sub-network and the feature map f4(16X) in the initial feature map of the backbone network. The input of the third convolutional layer of the sub-network is the output feature map (32X) of the second convolutional layer of the sub-network. The size of the third feature map (8X) is 80×60. After being processed by the 3 convolutional layers of the sub-network shown in Table 2, two feature maps with different sizes are obtained. The three feature maps with different sizes are feature map f6 (with a size of 40×30) and feature map f7 (20×15). That is to say, the size of the feature map after being processed by the convolutional layer may be the same as that of the feature map before the convolutional layer processing. Fig.10Only the feature map f6 (size is 40×30) and feature map f7 (size is 20×15) obtained through two convolutional layers are shown.
[0268] It should be noted that if method 800 does not include S850, S860 is a process of extracting features from the second feature map or the first feature map, which is similar to the above feature extraction process, and only the feature map of the input sub-network is replaced with the second feature map or the first feature map.
[0269] According to the embodiments of the present application, the deep feature map of the backbone network is upsampled and merged with the shallow feature map of the same size as the input of the sub-network, and the feature map obtained after processing the sub-network is further fused with the feature map obtained after processing the backbone network to achieve feature reuse of the backbone network in the sub-network, which can make full use of the information of the backbone network. The feature vector for feature reuse will further expand the receptive field in the sub-network, improve the expressive ability of the feature, and thus improve the prediction accuracy.
[0270] At the same time, it can fully integrate spatial information and semantic information without additional overhead to refine the prediction results.
[0271] In addition, feature reuse can also be seen as a semantic segmentation process from coarse to fine. First, the rough prediction information (information in the initial feature map) is obtained through the backbone network, and then the rough prediction information is upsampled and continuously integrated into the shallow feature map to restore the image details. The process of continuously integrating the shallow feature map of the backbone network is still in the encoder, and a larger receptive field can be obtained in the decoder, and the feature expression ability is stronger. The image semantic segmentation network proposed in this application can improve the prediction accuracy of semantic segmentation as much as possible while ensuring the running speed.
[0272] Optionally, method 800 may include S870.
[0273] S870, performing multi-scale feature extraction on the feature map output by the sub-network of S860 to obtain a fourth feature map, wherein the fourth feature map includes multi-scale semantic information of the feature map output by the above sub-network.
[0274] Multi-scale feature extraction is performed on the feature map output by the sub-network to obtain a fourth feature map. Specifically, feature maps of different scales can be extracted from the feature map output by the sub-network to obtain multi-scale semantic information of the feature map output by the sub-network.
[0275] For example, the feature map output by the sub-network can be convolved with different convolution kernels to obtain feature maps of different scales. For another example, the feature map output by the sub-network can be pooled with different sampling rates to obtain feature maps of different scales.
[0276] Furthermore, the feature map output by the sub-network may be first subjected to dimensionality reduction processing to obtain a feature map after dimensionality reduction processing; and multi-scale feature extraction may be performed on the feature map after dimensionality reduction processing to obtain the fourth feature map mentioned above.
[0277] Exemplarily, the subnetwork is an m-layer convolutional network, and the feature map output by the subnetwork may include feature maps output by m convolutional layers. In this case, the feature map output by any one of the m convolutional layers may be subjected to dimensionality reduction processing. Preferably, the feature map output by the last convolutional layer (the mth convolutional layer) of the m convolutional layers may be subjected to dimensionality reduction processing. For example, the feature map f7 in the above subnetwork is subjected to dimensionality reduction processing.
[0278] Specifically, the feature map output by the sub-network can be processed by a small pyramid pooling structure to obtain a fourth feature map.
[0279] Fig.11 The schematic diagram of the structure of TPP in one embodiment of the present application is shown in FIG. Fig.10 and Fig.11 , S870 is explained by taking the feature graph of the input TPP as the feature graph f7 in the above sub-network as an example.
[0280] S871, perform dimensionality reduction processing on the feature map f7 to obtain a feature map f7', that is, reduce the number of channels of the feature map f7.
[0281] Specifically, the dimensionality reduction process may be a point convolution (Conv1×1) process. For example, the number of channels of the feature map after the point convolution may be reduced to 1 / 4 of the number of channels of the feature map f7.
[0282] S872, collecting semantic information of different scales from the feature map f7' obtained by the dimensionality reduction process.
[0283] Exemplarily, semantic information of different scales can be collected from the feature map f7' by SPP. Specifically, the feature map f7' can be subjected to multiple pooling processes of different sampling rates, or multiple pooling processes of different sizes, to obtain feature maps of multiple scales, that is, to obtain multi-scale semantic information.
[0284] like Fig.11 As shown, it is assumed that the feature map of the input TPP is feature map f7, with a size of H7*W7, and the feature map after dimensionality reduction processing is feature map f7', with a size of H7*W7. The number of pooling processing times is 4 times as an example for explanation.
[0285] For the first pooling process, the feature map f7' is taken as a whole picture block (also called a sub-region), and the size of the picture block is H7*W7; for the second pooling process, the feature map f7' is divided into 4 picture blocks, and the size of each picture block is H7*W7 / 4; for the third pooling process, the feature map f7' is divided into 9 picture blocks, and the size of each picture block is H7*W7 / 9; for the fourth pooling process, the feature map f7' is divided into 36 picture blocks, and the size of each picture block is H7*W7 / 36. Extract a feature from each of the above picture blocks to obtain 4 feature maps corresponding to the 4 pooling processes.
[0286] S873, upsampling the feature maps of multiple scales respectively, and performing feature fusion on the multiple feature maps obtained by the upsampling process and the feature map f7 to obtain a fourth feature map.
[0287] Taking the four feature maps obtained in S872 as an example, the four feature maps obtained after the above pooling are upsampled respectively to obtain four feature maps with the same size (H7*W7) as the feature map f7, and the four feature maps with a size of H7*W7 obtained by upsampling are feature fused with the feature map f7.
[0288] Specifically, the feature fusion method may include point-by-point addition (add) of feature maps or channel / dimension concatenation (concat).
[0289] Preferably, the feature fusion method is feature map channel splicing.
[0290] It should be understood that the above TPP process and Fig.11 The structural diagram is only an example. In the embodiments of the present application, there is no limitation on the network used in the dimensionality reduction process, the network used in the extraction of multi-scale semantic information, or the sampling rate of the pooling process.
[0291] Compared with the complete spatial pyramid pooling structure, the TPP structure in the embodiment of the present application reduces the number of channels through dimensionality reduction processing, thereby reducing the amount of calculation and improving the operation speed; retains the characteristics of spatial pyramid pooling, can extract multi-scale semantic information of sub-regions of different sizes, eliminates the fixed size constraint of the convolutional neural network, and improves the prediction accuracy.
[0292] S880, determining a target feature map, and determining a semantic segmentation map of the image to be processed according to the target feature map.
[0293] S881, determine the target feature map.
[0294] Exemplarily, method 800 does not include S870, and the target feature map can be determined based on the feature map obtained by performing feature extraction on the second feature map or the third feature map in S860.
[0295] Further, determining the target feature map according to the feature map obtained by extracting features from the second feature map or the third feature map in S860 may be upsampling the feature map obtained by extracting features from the second feature map or the third feature map to obtain the target feature map.
[0296] Alternatively, determining the target feature map according to the feature map obtained by extracting features from the second feature map or the third feature map in S860 may be to use the feature map obtained by extracting features from the second feature map or the third feature map as an intermediate feature map, and to process the intermediate feature map to obtain the target feature map.
[0297] Exemplarily, method 800 includes S870, and a target feature map may be determined according to the fourth feature map obtained in S870.
[0298] Further, determining the target feature map according to the fourth feature map obtained in S870 may be upsampling the fourth feature map to obtain the target feature map.
[0299] Alternatively, determining the target feature map according to the fourth feature map obtained in S870 may be taking the fourth feature map as an intermediate feature map, processing the intermediate feature map, and obtaining the target feature map.
[0300] The processing of the intermediate feature map to obtain the target feature map may be performed in the following manner.
[0301] The intermediate feature map is upsampled, and the feature map obtained by upsampling is fused with at least one feature map output by the sub-network and / or the backbone network to obtain a target feature map.
[0302] Specifically, at least one feature map output by the sub-network and / or the backbone network can be upsampled first so that its size is the same as the size of the feature map obtained by upsampling the intermediate feature map, and then feature fusion is performed with the feature map obtained by upsampling the intermediate feature map to obtain the target feature map.
[0303] For example, the size of the intermediate feature map (32X) can be 1 / 32 of the image to be processed. The intermediate feature map (32X) is upsampled and restored 4 times to obtain the feature map f8 (8X). The feature map f6 (16X) output by the sub-network in S860 is upsampled and restored 2 times to obtain the feature map f9 (8X). The feature maps f8 (8X) and f9 (8X) are fused to obtain the target feature map. Further, as Fig.10As shown, the feature map f8(8X), the feature map f9(8X) and the initial feature map f3(8X) can also be fused to obtain the target feature map.
[0304] S882, determining a semantic segmentation map of the image to be processed according to the target feature map.
[0305] Specifically, the output module can classify the pixels in the target feature map to obtain a segmentation map (label map).
[0306] It should be noted that the number of pixels of the segmentation map is the same as the number of pixels of the image to be acquired.
[0307] Classifying pixels in a target feature map is a prior art and will not be described in detail here.
[0308] In order to specifically illustrate the effectiveness of the image semantic segmentation method in the embodiment of the present application, a comparative experiment was conducted on the indoor dataset SUN-RGBD (13 categories) between the method 500 in the embodiment of the present application and the SceneNet network, the light-weight RefineNet network (light-weight RefineNet, LWRefineNet), and the bilateral segmentation network (bilateral segmentation network, BiseNet). Table 3 shows the experimental results on SUN-RGBD. The method in the embodiment of the present application can reach a running speed of more than 125 frames on a 1080Ti graphics card, and the prediction accuracy is higher than the prediction accuracy of other real-time image semantic segmentation networks shown in the table. Among them, the mean intersection over union (mIoU) value is an important indicator for measuring image segmentation accuracy.
[0309] Table 3
[0310]
[0311] In addition, the method 500 in the embodiment of the present application was also executed using a mobile terminal (mobile phone), that is, the image semantic segmentation network in the embodiment of the present application was transplanted to the mobile terminal for testing. Table 4 shows the test results. The size of the mobile terminal model is only 16M. For a picture of size 640x480, the prediction speed on the mobile terminal can reach 10 frames, and the accuracy is more than 82%. Among them, FPS represents the number of frames transmitted per second.
[0312] Table 4
[0313]
[0314] According to the embodiments of the present application, the deep features of the backbone network are upsampled and merged with the shallow feature maps of the same size as the input of the sub-network, and the features obtained after processing the sub-network are further fused with the feature maps obtained after processing the backbone network to achieve feature reuse of the backbone network in the sub-network, which can fully utilize the information of the backbone network. The feature vectors for feature reuse will further expand the receptive field in the sub-network, improve the expressive ability of the features, and thereby improve the prediction accuracy.
[0315] At the same time, it can fully integrate spatial information and semantic information without additional overhead to refine the prediction results.
[0316] In addition, feature reuse can also be seen as a semantic segmentation process from coarse to fine. First, the rough prediction information (information in the initial feature map) is obtained through the backbone network, and then the rough prediction information is upsampled and continuously integrated into the shallow feature map to restore the image details. The process of continuously integrating the shallow feature map of the backbone network is still in the encoder, and a larger receptive field can be obtained in the decoder, and the feature expression ability is stronger. The image semantic segmentation network proposed in this application can improve the prediction accuracy of semantic segmentation as much as possible while ensuring the running speed.
[0317] The method 800 may be specifically performed as follows: Figure 1 The execution device 110 is shown to execute.
[0318] Optionally, the method 800 may be processed by a CPU, or may be processed by a CPU and a GPU together, or may use other processors suitable for neural network calculations without using a GPU, and this application does not impose any limitation thereto.
[0319] It can be understood that method 500 is the training phase of the image semantic segmentation network (eg Figure 1 The specific training is performed by the image semantic segmentation network provided in the implementation of method 500; and method 800 can be understood as the application stage of the image semantic segmentation network (such as Figure 1 The execution device 110 shown in the figure may be executed in the following manner: the image semantic segmentation network trained by the method 500 is used, and a semantic segmentation result is obtained according to the image input by the user, that is, the segmentation map in the method 800. It should be noted that the method 800 may not use the image semantic segmentation network trained by the method 500.
[0320] The above text describes in detail the image semantic segmentation method of the embodiment of the present application in combination with the accompanying drawings. The following text describes in detail the image semantic segmentation device of the embodiment of the present application in combination with the accompanying drawings. It should be understood that the image semantic segmentation device described below is capable of performing each step of the image semantic segmentation method of the embodiment of the present application. In order to avoid unnecessary repetition, the repeated description is appropriately omitted when introducing the image semantic segmentation device of the embodiment of the present application.
[0321] Fig.12 It is a schematic block diagram of an image semantic segmentation device according to an embodiment of the present application. Fig.12 The image semantic segmentation device 1200 shown includes an acquisition unit 1201 and a processing unit 1202 .
[0322] The acquisition unit 1201 and the processing unit 1202 can be used to execute the image semantic segmentation method of the embodiment of the present application. Specifically, the acquisition unit 1201 can execute the above S810, and the processing unit 1202 can execute the above S820 to S880.
[0323] The processing unit 1202 can be divided into multiple modules according to different processing functions. Specifically, the processing unit 1202 can be equivalent to Figure 7 The image semantic segmentation apparatus shown in the figure has a backbone network module 710, a TPP 720, an upsampling module 730, a sub-network module 740, and an output module 750. The processing unit 3002 can implement Figure 7 The functions of each module in the image semantic segmentation device are shown.
[0324] It should be understood that the acquisition unit 1201 and the processing unit 1202 in the above-mentioned device 1200 may be equivalent to the processor 1302 in the device 1300 described below.
[0325] Fig.13 It is a schematic diagram of the hardware structure of a training device for an image semantic segmentation network provided in an embodiment of the present application. Fig.13 The training device 1300 of the image semantic segmentation network shown (the device 1300 may be a computer device) includes a memory 1301, a processor 1302, a communication interface 1303 and a bus 1304. The memory 1301, the processor 1302 and the communication interface 1303 are connected to each other through the bus 1304.
[0326] The memory 1301 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 1301 may store a program. When the program stored in the memory 1301 is executed by the processor 1302, the processor 1302 and the communication interface 1303 are used to execute the various steps of the training method of the image semantic segmentation network of the embodiment of the present application.
[0327] Processor 1302 can adopt a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU) or one or more integrated circuits to execute relevant programs to implement the functions required to be performed by the units in the training device of the image semantic segmentation network of the embodiment of the present application, or to execute the training method of the image semantic segmentation network of the method embodiment of the present application.
[0328] The processor 1302 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the training method of the image semantic segmentation network of the present application may be completed by an integrated logic circuit of hardware or software instructions in the processor 1302. The above-mentioned processor 1302 may also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1301, and the processor 1302 reads the information in the memory 1301, and combines its hardware to complete the functions required to be performed by the units included in the training device of the image semantic segmentation network of the embodiment of the present application, or executes the training method of the image semantic segmentation network of the method embodiment of the present application.
[0329] The communication interface 1303 uses a transceiver such as but not limited to a transceiver to implement communication between the device 1300 and other devices or communication networks. For example, the communication interface 1303 can be used to obtain training data (such as the training images and label images described in the first embodiment of the present application).
[0330] The bus 1304 may include a path for transmitting information between various components of the device 1300 (eg, the memory 1301 , the processor 1302 , and the communication interface 1303 ).
[0331] Fig.14 It is a schematic diagram of the hardware structure of the image semantic segmentation device provided in an embodiment of the present application. Fig.14 The image semantic segmentation apparatus 1400 shown (the apparatus 1400 may be a computer device) includes a memory 1401, a processor 1402, a communication interface 1403 and a bus 1404. The memory 1401, the processor 1402 and the communication interface 1403 are connected to each other through the bus 1404.
[0332] The memory 1401 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 1401 may store a program. When the program stored in the memory 1401 is executed by the processor 1402, the processor 1402 and the communication interface 1403 are used to execute the various steps of the image semantic segmentation method of the embodiment of the present application.
[0333] Processor 1402 can adopt a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU) or one or more integrated circuits to execute relevant programs to implement the functions required to be performed by the units in the image semantic segmentation device of the embodiment of the present application, or to execute the image semantic segmentation method of the method embodiment of the present application.
[0334] The processor 1402 may also be an integrated circuit chip having signal processing capabilities. In the implementation process, each step of the image semantic segmentation method of the present application may be completed by an integrated logic circuit of hardware or software instructions in the processor 1402. The above-mentioned processor 1402 may also be a general-purpose processor, a digital signal processor (digitalsignal processing, DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (field programmablegate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1401, and the processor 1402 reads the information in the memory 1401, and combines its hardware to complete the functions required to be performed by the units included in the image semantic segmentation device of the embodiment of the present application, or executes the image semantic segmentation method of the method embodiment of the present application.
[0335] The communication interface 1403 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the device 1400 and other devices or a communication network. For example, the image to be processed can be acquired through the communication interface 1403 .
[0336] The bus 1404 may include a path for transmitting information between various components of the device 1400 (eg, the memory 1401 , the processor 1402 , and the communication interface 1403 ).
[0337] It should be noted that although Fig.13 and Fig.14 The devices 1300 and 1400 shown in the figure only show the memory, processor, and communication interface, but in the specific implementation process, those skilled in the art should understand that the devices 1300 and 1400 also include other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the devices 1300 and 1400 may also include hardware devices for implementing other additional functions. In addition, those skilled in the art should understand that the devices 1300 and 1400 may also only include the devices necessary for implementing the embodiments of the present application, and do not necessarily include Fig.13 or Fig.14 All devices shown in .
[0338] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0339] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0340] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0341] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0342] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0343] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a universal serial bus flash disk (USB flash disk, UFD), UFD can also be referred to as a USB flash drive or a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.
[0344] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for image semantic segmentation, characterized in that: Including: Obtain an image to be processed; Perform convolution processing on the image to be processed to obtain an initial feature map of the image to be processed; Perform multi-scale feature extraction on the initial feature map to obtain a first feature map, where the first feature map includes multi-scale semantic information of the initial feature map; Perform convolution processing on the first feature map to obtain a target feature map of the image to be processed; Determine a semantic segmentation map of the image to be processed according to the target feature map; The performing convolution processing on the first feature map to obtain a target feature map of the image to be processed includes: Adjust the size of the first feature map to obtain a second feature map, and the size of the second feature map is larger than that of the first feature map; Fuse the feature map in the initial feature map with the same size as the second feature map and the second feature map to obtain a third feature map, and the initial feature map includes at least two feature maps with different sizes; Perform convolution processing on the third feature map to obtain a target feature map of the image to be processed.
2. The method according to claim 1, characterized in that Before performing multi-scale feature extraction on the initial feature map, the method further includes: Perform dimensionality reduction processing on the initial feature map to obtain a feature map after dimensionality reduction processing; The performing multi-scale feature extraction on the initial feature map to obtain a first feature map includes: Perform multi-scale feature extraction on the feature map after dimensionality reduction processing to obtain the first feature map.
3. The method according to claim 2, characterized in that The performing multi-scale feature extraction on the feature map after dimensionality reduction processing to obtain the first feature map includes: Perform pooling processing with multiple different sampling rates on the feature map after dimensionality reduction processing respectively to obtain feature maps with multiple scales; Perform upsampling processing on the feature maps with multiple scales respectively to obtain multiple feature maps after upsampling processing; Fuse the multiple feature maps after upsampling processing with the initial feature map to obtain the first feature map.
4. The method according to any one of claims 1 to 3, characterized in that The performing convolution processing on the third feature map to obtain a target feature map of the image to be processed includes: Perform convolution processing on the third feature map through m convolutional layers to obtain a feature map output from the m-th convolutional layer, where the input of the i-th convolutional layer in the m convolutional layers is the feature map output from the (i - 1)-th convolutional layer and the feature map in the initial feature map with the same size as the feature map output from the (i - 1)-th convolutional layer, m is an integer greater than 1, 1 < i ≤ m, and i is an integer; Determine a target feature map of the image to be processed according to the feature map output from the m-th convolutional layer.
5. The method according to claim 4, characterized in that The determining a target feature map of the image to be processed according to the feature map output from the m-th convolutional layer includes: Perform multi-scale feature extraction on the feature map output from the m-th convolutional layer to obtain a fourth feature map, and the fourth feature map includes multi-scale semantic information of the feature map output from the m-th convolutional layer; Determine the target feature map according to the fourth feature map.
6. The method according to claim 5, characterized in that The determining a semantic segmentation map of the image to be processed according to the target feature map includes: Upsample the fourth feature map and the feature maps output by at least one convolutional layer among the m convolutional layers respectively to obtain at least two feature maps with the same size; Perform feature fusion processing on the at least two feature maps with the same size to obtain the target feature map; Determine the semantic segmentation map of the image to be processed according to the target feature map.
7. The method according to any one of claims 1 to 3, characterized in that The image to be processed includes the luminance value information to be processed and inertial measurement unit (IMU) information.
8. The method according to claim 7, characterized in that The obtaining of the image to be processed includes: Adjust the size of the IMU information so that the size of the adjusted IMU information is the same as the size of the image to be processed; Perform feature channel splicing on the adjusted IMU information and the luminance value information of the image to be processed.
9. An image semantic segmentation device, characterized in that: Includes: An obtaining unit for obtaining an image to be processed; A processing unit, and the processing unit is used for: Perform convolutional processing on the image to be processed to obtain the initial feature map of the image to be processed; Perform multi-scale feature extraction on the initial feature map to obtain a first feature map, where the first feature map includes multi-scale semantic information of the initial feature map; Perform convolutional processing on the first feature map to obtain the target feature map of the image to be processed; Determine the semantic segmentation map of the image to be processed according to the target feature map; The processing unit is used for: Adjust the size of the first feature map to obtain a second feature map, and the size of the second feature map is larger than the size of the first feature map; Perform feature fusion on the feature map in the initial feature map that has the same size as the second feature map and the second feature map to obtain a third feature map, and the initial feature map includes at least two feature maps with different sizes; Perform convolutional processing on the third feature map to obtain the target feature map of the image to be processed.
10. The device according to claim 9, characterized in that The processing unit is further used for: Perform dimensionality reduction processing on the initial feature map to obtain a feature map after dimensionality reduction processing; The processing unit is used for: Performing multi-scale feature extraction on the initial feature map to determine the first feature map includes: Perform multi-scale feature extraction on the feature map after dimensionality reduction processing to obtain the first feature map.
11. The device according to claim 10, characterized in that The processing unit is used for: Perform pooling processing on the feature map after dimensionality reduction processing at multiple different sampling rates respectively to obtain feature maps at multiple scales; Perform upsampling processing on the feature maps at multiple scales respectively to obtain multiple feature maps after upsampling processing; Perform feature fusion on the multiple feature maps after upsampling processing and the initial feature map to obtain the first feature map.
12. The device according to any one of claims 9 to 11, characterized in that The processing unit is used for: Perform convolutional processing on the third feature map through m convolutional layers to obtain the feature map output from the m-th convolutional layer, where the input of the i-th convolutional layer among the m convolutional layers is the feature map output from the (i - 1)-th convolutional layer and the feature map in the initial feature map that has the same size as the feature map output from the (i - 1)-th convolutional layer, m is an integer greater than 1, 1 < i ≤ m, and i is an integer; Determine the target feature map of the image to be processed according to the feature map output from the m-th convolutional layer.
13. The device according to claim 12, characterized in that The processing unit is used for: Performing multi-scale feature extraction on the feature map output from the m-th convolutional layer to obtain a fourth feature map, wherein the fourth feature map includes multi-scale semantic information of the feature map output from the m-th convolutional layer; The target feature map is determined according to the fourth feature map.
14. The device according to claim 13, characterized in that The processing unit is used for: Upsampling the fourth feature map and the feature map output by at least one of the m convolutional layers to obtain at least two feature maps of the same size; Performing feature fusion processing on the at least two feature maps of the same size to obtain the target feature map; Determine a semantic segmentation map of the image to be processed according to the target feature map.
15. The device according to any one of claims 9 to 11, characterized in that The image to be processed includes brightness value information and inertial measurement unit IMU information.
16. The device according to claim 15, characterized in that The processing unit is used for: Resizing the IMU information, wherein the size of the resized IMU information is the same as the size of the image to be processed; The resized IMU information is concatenated with the brightness value information of the image to be processed.
17. A computer-readable storage medium, characterized in that: The computer-readable medium stores a program code for execution by a device, wherein the program code includes a program for executing the method according to any one of claims 1 to 8.
18. A chip, characterized in that: The chip includes a processor and a data interface, and the processor reads instructions stored in a memory through the data interface to execute the method according to any one of claims 1-8.
Citation Information
Patent Citations
Full convolutional network semantic segmentation method based on multi-scale low-level feature fusion
CN108830855A
A semantic image segmentation method in a convolutional neural network
CN109727249A
Retinal vessel segmentation method based on dense convolution and depthwise separable convolution
CN110097554A
Real-time high-performance street-view image semantic segmentation method based on deep learning
CN110188817A
Apparatus for upscaling an image, method for training the same, and method for upscaling an image
US20180315165A1
