Method, device, equipment and storage medium for determining instance category of pixels in image
By combining image downsampling and connected domain sub-regional clustering methods, the problem of small and many instance targets in dense villages is solved, the accuracy of instance category determination and clustering speed are improved, and the clarity of detection results is improved. and accuracy.
Patent Information
- Application Number
- CN202011040874.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-28
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-09-28
AI Technical Summary
In the detection of small houses in dense villages and rural areas with existing technology, the instance target is too small, which makes it difficult to design and detect candidate frames, the instance recall rate is low, and the result accuracy is low. Moreover, too many building instances make clustering difficult and easy to cluster. Something went wrong.
By downsampling the image to be detected, shared features are obtained, and the connected domain sub-region clustering method is used for semantic segmentation and instance analysis, integrating semantic features and instance features to determine the instance category of each pixel.
It improves the accuracy of determining instance categories, prevents instances in different areas from being clustered into one category, speeds up clustering, and improves the clarity and accuracy of detection results.
Smart Images

Figure CN112053358B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, equipment and storage medium for determining instance categories of pixels in an image. Background Art
[0002] The industry practice for building detection based on satellite images is mostly a two-stage target detection algorithm mask-rcnn series. The first stage is a rough detection of the target instance position box: the positive sample objects to be detected in the image are roughly located and the positive and negative samples are classified to obtain a series of candidate box positions (anchor boxes). The second stage is a small position regression classification network and a semantic segmentation network: the regression classification network is responsible for multi-category fine classification of positive sample objects and regression of the offset of the external rectangular box relative to the anchor box, and the semantic segmentation network is responsible for pixel-level single-instance foreground and background segmentation.
[0003] Taking mask-rcnn as an example, the existing technology has the following problems in the detection tasks of densely populated villages and small rural houses: 1. The instance target is too small, which has a great impact on the candidate frame design and detection difficulty of the first stage, resulting in low instance recall rate. 2. The instance edges of the output results are often unclear, which will cause the detection of multiple small areas of overlapping results, resulting in low accuracy and failure to meet the application standards. In addition, there are too many building instances in many pictures (thousands), and the foreground pixel features can reach 1 million, making clustering extremely difficult. Often, buildings in the same picture have many similarities, and instances that are far apart cannot be the same instance, but the textures are almost the same, which will lead to clustering errors.
[0004] Therefore, it is necessary to provide a method, apparatus, device and storage medium for determining the instance category of pixels in an image to improve the accuracy of determining the instance category of pixels, thereby ensuring that instances in different areas are not clustered into one category and speeding up the clustering speed. Summary of the invention
[0005] The present application provides a method, apparatus, device and storage medium for determining instance categories of pixels in an image, which can improve the accuracy of determining instance categories of pixels, thereby ensuring that instances in different regions are not clustered into one category and speeding up clustering.
[0006] In one aspect, the present application provides a method for determining an instance category of a pixel in an image, the method comprising:
[0007] Acquire an image to be detected, wherein the image to be detected includes instances of the target quantity;
[0008] Downsampling the image to be detected to obtain shared features;
[0009] Using a connected domain sub-region clustering method to perform semantic segmentation processing on the shared features to obtain semantic features;
[0010] Performing instance analysis processing on the shared features to obtain instance features; the instance features include spatial position features of each pixel in the image to be detected;
[0011] The semantic feature is fused with the instance feature to determine the fusion feature of each pixel in the image to be detected;
[0012] According to the fusion features of each pixel in the image to be detected, the instance category of each pixel in the image to be detected is determined.
[0013] Another aspect provides a device for determining an instance category of a pixel in an image, the device comprising:
[0014] An image acquisition module, used for acquiring an image to be detected, wherein the image to be detected includes instances of the target quantity;
[0015] A shared feature determination module, used for performing downsampling processing on the image to be detected to obtain shared features;
[0016] A semantic feature determination module, used for performing semantic segmentation processing on the shared features by adopting a connected domain sub-region clustering method to obtain semantic features;
[0017] An instance feature determination module is used to perform instance analysis processing on the shared features to obtain instance features; the instance features include spatial position features of each pixel in the image to be detected;
[0018] A fusion feature determination module, used to fuse the semantic feature with the instance feature to determine the fusion feature of each pixel in the image to be detected;
[0019] The instance category determination module is used to determine the instance category of each pixel in the image to be detected according to the fusion features of each pixel in the image to be detected.
[0020] On the other hand, a device for determining the instance category of pixels in an image is provided, the device comprising a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the method for determining the instance category of pixels in an image as described above.
[0021] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method for determining the instance category of a pixel in an image as described above.
[0022] On the other hand, a computer storage medium is provided, wherein the computer storage medium stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by a processor to implement the method for determining the instance category of pixels in an image as described above.
[0023] The method, apparatus, device and storage medium for determining the instance category of pixels in an image provided by the present application have the following technical effects:
[0024] The present application obtains shared features by downsampling the image to be detected, and then performs semantic segmentation and instance analysis on the shared features to obtain semantic features and instance features, wherein the instance features include the spatial position features of each pixel in the image to be detected; the semantic features are then fused with the instance features to determine the fused features of each pixel in the image to be detected; and the instance category of each pixel in the image to be detected is determined based on the fused features of each pixel in the image to be detected. The present application obtains the fused features of each pixel by fusion of the semantic features obtained by the connected domain region clustering method with the instance features including the spatial position features, thereby improving the accuracy of determining the instance category of the pixel, thereby ensuring that instances in different regions will not be clustered into one category and speeding up the clustering process. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 is a schematic diagram of a system for determining instance categories of pixels in an image provided by an embodiment of the present application;
[0027] Figure 2 It is a flowchart of a method for determining an instance category of a pixel in an image provided by an embodiment of the present application;
[0028] Figure 3It is a flowchart of a method for downsampling the image to be detected to obtain shared features provided by an embodiment of the present application;
[0029] Figure 4 It is a flowchart of a method for determining a semantic branch network and an instance branch network provided in an embodiment of the present application;
[0030] Figure 5 is a flow chart of a method for determining a fusion feature of each pixel in the image to be detected provided by an embodiment of the present application;
[0031] Figure 6 It is a schematic diagram of the U-Net network framework provided in an embodiment of the present application;
[0032] Figure 7 is a schematic diagram of the structure of a device for determining an instance category of a pixel in an image provided by an embodiment of the present application;
[0033] Figure 8 is a structural diagram of a shared feature determination module provided in an embodiment of the present application;
[0034] Fig. 9 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is an interdisciplinary subject that covers a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics.
[0036] Specifically, the solution provided in the embodiment of the present application relates to the field of machine learning of artificial intelligence. Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all fields of artificial intelligence. The present application uses a machine learning model to automatically segment a large number of instances in an image with high accuracy.
[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0039] See also Figure 1 , Figure 1 is a schematic diagram of a system for determining instance categories of pixels in an image provided by an embodiment of the present application, such as Figure 1 As shown, the system for determining instance categories of pixels in the image may include at least a server 01 and a client 02 .
[0040] Specifically, in the embodiments of this specification, the server 01 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers, and may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 01 may include a network communication unit, a processor, a memory, and the like. Specifically, the server 01 can be used to determine the instance category of a pixel in an image.
[0041] Specifically, in the embodiments of this specification, the client 02 may include physical devices such as smart phones, desktop computers, tablet computers, laptops, digital assistants, smart wearable devices, etc., and may also include software running in physical devices, such as web pages provided by some service providers to users, or applications provided by these service providers to users. Specifically, the client 02 may be used to display the image corresponding to each instance in the image to be detected.
[0042] The following describes a method for determining instance categories of pixels in an image of the present application. Figure 2 It is a flowchart of a method for determining an instance category of pixels in an image provided by an embodiment of the present application. This specification provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment or the drawings. Specifically, Figure 2 As shown, the method may include:
[0043] S201: Acquire an image to be detected, wherein the image to be detected includes instances of a target quantity.
[0044] In the embodiments of the present specification, the image to be detected may include a large number of instances, the number of targets may be greater than 2, the structures of the instances in the image are similar and the attributes are the same; the instances in the same image belong to the same category, and the instances may be dense and small objects in the image to be detected, for example, the instances may be buildings or vehicles, etc., and the number of targets may be set to be greater than a preset number. The structure of each instance in the image to be detected is similar. When drawing a map based on the image to be detected, it is necessary to segment the instances in the image to be detected and obtain the size, position and other features of each instance.
[0045] S203: Down-sampling the image to be detected to obtain shared features.
[0046] In the embodiments of this specification, Figure 3 As shown, the downsampling process of the image to be detected to obtain the shared features may include:
[0047] S2031: extracting an edge texture feature set of the image to be detected;
[0048] In the embodiments of this specification, the edge texture feature set may include multiple edge texture features, the edge texture feature is the bottom layer feature of the deep learning network, that is, the feature map of the front layer network, and the visual representation of the edge texture feature is usually point, line, surface, angle. The edge texture feature set of the image to be detected can be extracted through the bottom convolution layer, that is, the edge texture feature set of the image to be detected is extracted through multiple convolution and pooling operations.
[0049] S2033: Determine an edge texture combination feature according to the edge texture feature set of the image to be detected;
[0050] In the embodiments of this specification, deep learning is a step-by-step abstraction process, in which the bottom-level edge texture feature combination is abstracted into the middle-level feature, i.e., the local feature of the instance, and then the local information of the instance is abstracted into the overall feature of the instance, i.e., the edge texture combination feature, and then instance category learning is performed.
[0051] In the embodiments of the present specification, the edge texture features of the image to be detected are combined through the middle and high-level convolutional layers to obtain the edge texture combination features; that is, the edge texture features can be fused through multiple convolution and pooling operations to obtain the edge texture combination features; for example, after obtaining the points, lines, surfaces, and angles of the instance in the image to be detected, the local features of the instance in the image to be detected are determined through the middle-level convolutional layer, and the local features of the instance are further convolved and pooled through the high-level convolutional layer to determine the overall features of the instance in the image to be detected, that is, the edge texture combination features, so as to perform instance category learning.
[0052] S2035: performing normal distribution processing on the edge texture combined features to obtain normalized features;
[0053] In the embodiments of this specification, the normalized normal distribution is processed as a functional layer in deep learning: the BN-BatchNorm layer. BN uses certain normalization methods to forcibly pull the distribution of the input value of any neuron in each layer of the neural network back to the standard normal distribution with a mean of 0 and a variance of 1. In essence, it forces the increasingly biased distribution to be pulled back to the standard distribution, so that a small change in the input value will lead to a large change in the loss function, thereby making the gradient larger and avoiding the gradient vanishing problem; and a larger gradient means a fast learning convergence speed, which can greatly speed up the training speed.
[0054] S2037: Perform nonlinear mapping processing on the normalized features to obtain the shared features.
[0055] In the embodiments of the present specification, the edge texture feature set of the image to be detected can be extracted through the bottom convolution layer; the edge texture features of the image to be detected are combined through the middle and high-level convolution layers to obtain the edge texture combination features; the edge texture combination features are normalized and normally distributed through the normalization layer to obtain the normalized features; and the normalized features are nonlinearly mapped through the activation layer to obtain the shared features.
[0056] In the embodiments of the present specification, shared features of the image to be detected can be obtained through downsampling processing, and the shared features can be used for semantic segmentation and instance analysis processing.
[0057] In the embodiments of this specification, downsampling represents the gradual deepening process of deep learning, and the bottom layer, middle layer, and high layer information are respectively realized through multiple convolution, pooling and other operations. Convolution and pooling both have the effect of reducing the scale. Figure 6 In the downsampling process shown in Figure 04, during the multiple convolution and pooling operations from the bottom layer to the middle layer and then to the high-level convolution layer, the scale of the deep features gradually decreases and the number of channels gradually increases. For example, the image changes from 256 (length) * 256 (width) * 3 (number of channels) to 128 (length) * 128 * (width) * 20 (number of channels). The length and width are both reduced, and the number of channels increases.
[0058] In a specific embodiment, the image to be detected can be a building image, in which the instance is a building. The image includes thousands of building instances. The features extracted by the bottom convolution layer, that is, the edge texture feature set of the image, are the edges, points, lines, and corners of the building; the features extracted by the middle convolution layer are the local features of the building, such as the top features and side features of a room; the features extracted by the high-level convolution layer, that is, the edge texture combined features, are the overall features of the building.
[0059] S205: Perform semantic segmentation processing on the shared features using a connected domain region clustering method to obtain semantic features.
[0060] In the embodiment of the present specification, the semantic features include background features and foreground features of the image to be detected; the semantic features obtained by using the connected domain sub-region clustering method to perform semantic segmentation processing on the shared features include:
[0061] The shared features are semantically segmented using a connected domain sub-region clustering method to obtain background features and foreground features of the image to be detected.
[0062] In the embodiment of the present specification, after the step of using the connected domain sub-region clustering method to perform semantic segmentation processing on the shared features to obtain the background features and foreground features of the image to be detected, the method further includes:
[0063] A first mask of background features of the image to be detected and a second mask of the foreground features are determined.
[0064] In an embodiment of the present specification, the background features and foreground features of the image to be detected can be determined by a connected domain region clustering method, and masks corresponding to the foreground features and background features can be generated. For example, the mask of the foreground features can be set to 1, and the mask of the background features can be set to 0, thereby distinguishing the foreground from the background.
[0065] In the embodiment of this specification, the semantic segmentation processing of the shared features by using the connected domain sub-region clustering method is performed to obtain the semantic features including:
[0066] The shared features are subjected to semantic segmentation processing through a semantic branch network to obtain semantic features.
[0067] In the embodiments of the present specification, the semantic branch network may include multiple upsampling modules, and the shared features may be subjected to deconvolution layer operations through the multiple upsampling modules, and each upsampling module performs deconvolution operations to achieve size enlargement; and provides the necessary feature information for upper-level upsampling fusion. The input of each upsampling module comes not only from the output features of the previous upsampling module, but also from the corresponding shared feature layer of the same size in the downsampling process. In order to better fuse the feature information, the two features are added inside the module, and a convolution operation is performed to achieve information fusion, and the image foreground and background are predicted to obtain semantic features.
[0068] In the embodiments of this specification, the brightness value of a binary image has only two states: black (0) and white (255). In practical applications, many image analyses are ultimately converted to binary image analyses, such as foreground detection of an image; the most important method for binary image analysis is connected region labeling, which is the basis for all binary image analyses. It labels white pixels (targets) in a binary image so that each individual connected region forms a marked block. Further, we can obtain geometric parameters such as the contour, circumscribed rectangle, centroid, and invariant moment of these blocks. In an image, the smallest unit is a pixel, and each pixel is surrounded by 8 adjacent pixels. There are two common adjacency relationships: 4-adjacency and 8-adjacency. There are a total of 4 points in 4-adjacency, namely, up, down, left, and right. There are a total of 8 points in 8-adjacency, including points in diagonal positions. Visually, connected points form an area, while disconnected points form different areas. The set of all connected points is called a connected area. The connected domain sub-region clustering method of the present application can separate the foreground and background of an image; when the instance is a building, the foreground is the building.
[0069] S207: Perform instance analysis processing on the shared features to obtain instance features; the instance features include spatial position features of each pixel in the image to be detected.
[0070] In the embodiments of the present specification, the shared features can be subjected to deconvolution layer operations through multiple upsampling modules, and each upsampling module performs a deconvolution operation to achieve size enlargement; and provide the necessary feature information for upper-level upsampling fusion. The input of each upsampling module comes not only from the output features of the previous upsampling module, but also from the corresponding shared feature layer of the same size in the downsampling process. In order to better fuse the feature information, the two features will be added inside the module, and a convolution operation will be performed to achieve information fusion, and the pixel features in the image will be learned to obtain instance features. The instance features include the spatial position features of each pixel in the image to be detected, and the spatial position features of the pixels can be represented by the two-dimensional spatial coordinates of the pixels. The spatial position features can reflect the spatial regional differences between pixels, thereby improving the feature similarity of adjacent pixels, while increasing the spatial differences between pixels that are far apart.
[0071] In the embodiment of this specification, the instance feature also includes the texture feature of each pixel in the image to be detected, and the instance feature obtained by performing instance analysis processing on the shared feature includes:
[0072] The shared features are subjected to instance analysis processing to obtain texture features and spatial position features of each pixel in the image to be detected.
[0073] In the embodiment of this specification, the texture feature of the pixel can be represented by an eight-dimensional feature vector; at this time, the instance feature is represented by a ten-dimensional feature vector, and the last two dimensions are the spatial coordinates corresponding to the pixel; thereby, the texture difference and spatial regional difference between different instances can be distinguished;
[0074] In the embodiment of this specification, the example analysis processing of the shared features to obtain the example features includes:
[0075] The shared features are subjected to instance analysis processing through an instance branch network to obtain instance features.
[0076] In the embodiments of this specification, the texture features may be represented by feature vectors of fixed dimensions (eg, 8 dimensions).
[0077] In the embodiments of this specification, Figure 4 As shown, before the step of performing semantic segmentation processing on the shared features through the semantic branch network to obtain semantic features, the method further includes:
[0078] S2041: construct a cross entropy loss function of the first network;
[0079] S2043: constructing an intra-class aggregation loss function and an inter-class discrimination loss function of the second network;
[0080] S2045: Determine the sum of the cross entropy loss function, the intra-class aggregation loss function and the inter-class discrimination loss function as a comprehensive loss function;
[0081] S2047: Adjust parameters of the first network and the second network respectively to obtain a current first network and a current second network;
[0082] S2049: Calculate the comprehensive loss values corresponding to the current first network and the current second network;
[0083] S20411: When the comprehensive loss value is less than a preset threshold, the current first network is determined as the semantic branch network, and the current second network is determined as the instance branch network.
[0084] In the embodiment of this specification, the method further includes:
[0085] S20413: When the comprehensive loss value is greater than or equal to the preset threshold, repeat the steps of: adjusting the parameters of the first network and the second network respectively to obtain the current first network and the current second network.
[0086] In the embodiments of this specification, the preset threshold can be set according to the actual situation. In the training process of the semantic branch network, it is necessary to annotate a semantic label for each pixel in the training image, and the semantic label includes a foreground label and a background label; in the training process of the instance branch network, it is necessary to annotate a feature label for each pixel in the training image, and the feature label may include a texture feature and a spatial position feature.
[0087] In the embodiment of this specification, the cross entropy loss function of the first network may be:
[0088]
[0089] Among them, pi is the predicted probability, yi is the category label (0, 1), and N is the number of features.
[0090] The intra-class aggregation loss function of the second network can be:
[0091]
[0092] Among them, CC is the number of instances of the training image, δv is the intra-class penalty factor, μc is the average value of a certain intra-class feature, and xi is a certain pixel feature;
[0093] The inter-class discrimination loss function of the second network can be:
[0094]
[0095] Where CC is the number of instances in the training image, δ d is the inter-class penalty factor, μ ca , μ cb is the average value of a feature within a class.
[0096] In this embodiment of the specification, the first network and the second network are both in the same deep learning network, and the method further includes:
[0097] Constructing a regularized loss function for the deep learning network;
[0098] Correspondingly, determining the sum of the cross entropy loss function, the intra-class aggregation loss function and the inter-class discrimination loss function as a comprehensive loss function includes:
[0099] The sum of the cross entropy loss function, the intra-class aggregation loss function, the inter-class discrimination loss function and the regularization loss function is determined as a comprehensive loss function.
[0100] In the embodiments of the present specification, the regularized loss function may be an L1 regularized function or an L2 regularized function. When calculating the comprehensive loss function, the regularized loss function is introduced to prevent the model corresponding to the network from overfitting and improve the generalization ability of the model.
[0101] In the embodiments of this specification, the deep learning network can be a U-Net network, which is a classic fully convolutional network (i.e., there is no fully connected operation in the network). The input of the network is a picture with mirrored edges; the left side of the network is a series of downsampling operations consisting of convolution and Max Pooling, which is called the contracting path. The contracting path consists of 4 blocks, each of which uses 3 effective convolutions and 1 maximum pooling (Max Pooling) downsampling. The number of feature maps is multiplied by 2 after each downsampling; the right side of the network is the expansive path. It is also composed of 4 blocks. Before each block starts, the size of the Feature Map is multiplied by 2 through deconvolution, and its number is halved (the last layer is slightly different), and then merged with the Feature Map of the symmetrical compression path on the left. Since the sizes of the Feature Maps of the compression path on the left and the expansion path on the right are different, U-Net is normalized by cropping the Feature Map of the compression path to the Feature Map of the same size as the expansion path. The convolution operation of the expansion path still uses an effective convolution operation.
[0102] S209: Fusing the semantic feature with the instance feature to determine a fusion feature of each pixel in the image to be detected.
[0103] In the embodiments of this specification, Figure 5 As shown, the fusing of the semantic feature with the instance feature to determine the fusion feature of each pixel in the image to be detected may include:
[0104] S2091: Fusing the first mask of the background features of the image to be detected with the texture features and spatial position features of the background pixels corresponding to the image to be detected to obtain a first fusion result;
[0105] S2093: Fusing the second mask of the foreground feature of the image to be detected with the texture feature and the spatial position feature of the foreground corresponding pixel in the image to be detected to obtain a second fusion result;
[0106] S2095: Determine a fusion feature of each pixel in the image to be detected according to the first fusion result and the second fusion result.
[0107] In the embodiments of this specification, a connected domain region clustering and spatial location feature fusion strategy is adopted, which can ensure that pixels in different regions are not clustered into one category on the one hand, and accelerate the clustering speed on the other hand.
[0108] S2011: Determine the instance category of each pixel in the image to be detected according to the fusion features of each pixel in the image to be detected.
[0109] In an embodiment of the present specification, after the step of determining the instance category of each pixel in the image to be detected, the method further includes:
[0110] Determine the pixel set corresponding to each instance category through density clustering algorithm;
[0111] In response to a triggering operation on the display interface, an image corresponding to each instance in the image to be detected is displayed according to a pixel set corresponding to each instance category.
[0112] In the embodiments of this specification, the density-based clustering method performs clustering based on the density of the data set in spatial distribution, without presetting the number of clusters, and is therefore particularly suitable for clustering data sets with unknown content. Representative algorithms include: DBSCAN, OPTICS. Taking the DBSCAN algorithm as an example, the purpose of DBSCAN is to find the largest set of density-connected objects. The classic density-based clustering algorithm DBSCAN (Density-Based Spatial Clustering of Application with Noise) is a density clustering algorithm based on high-density connected areas.
[0113] The basic algorithm flow of DBSCAN is as follows: Starting from any object P, all objects that are density-reachable from P are extracted through breadth-first search according to thresholds and parameters to obtain a cluster. If P is a core object, the corresponding object can be marked as the current class once and expanded on this basis. After obtaining a complete cluster, a new object is selected to repeat the above process. If P is a boundary object, it is marked as noise and discarded.
[0114] Specifically, in the embodiments of the present specification, the instances after density clustering can generate instance polygons composed of a small number of points through an appropriate vectorization algorithm; the image corresponding to the instance can be a polygonal structure; the triggering operation on the display interface can be a user sliding, clicking or dragging on the display interface or other operations, for example, you can click on the "Image Preview" in the display interface to construct and display the image corresponding to each instance in the image to be detected, and the instances in the image are separated from each other.
[0115] In the embodiment of the present specification, after the step of determining the pixel set corresponding to each instance category by using a density clustering algorithm, the method may further include:
[0116] A pixel set corresponding to each instance category is sent to the terminal; so that the terminal responds to the operation on the display interface and constructs and displays an image corresponding to each instance in the image to be detected.
[0117] Specifically, in the embodiments of the present specification, instances in the image can be marked with different colors to facilitate users to distinguish different instances in the image; the terminal may include a map application, and the map application can respond to operations on the display interface to construct and display an image corresponding to each instance in the image to be detected; thereby intuitively displaying the map information corresponding to the image to be detected to the user.
[0118] In a specific embodiment, the network framework corresponding to the method of the present application is as follows: Figure 6 As shown, it is divided into three parts: feature extraction downsampling, feature fusion upsampling and instance clustering. The corresponding model of this network framework is the instance segmentation image determination model; in the application process, the image to be detected is directly input into the instance segmentation image determination model to obtain the output instance segmentation image. Specifically, first, the downsampling processing network 04 processes the image to be detected 03 to obtain shared features; then the shared features are respectively input into the instance branch network 05 and the semantic branch network 06 to obtain the instance feature map 07 and the semantic feature map 08; then the pixel clustering map 09 in the instance is obtained according to the instance feature map 07 and the semantic feature map 08, and finally the instance segmentation image 10 is obtained.
[0119] In a specific embodiment, the method of the present application is used to segment building instances in dense areas and applied to a map application with an accuracy rate of more than 95%, which greatly improves the efficiency of map data generation.
[0120] It can be seen from the technical solutions provided by the above embodiments of this specification that the embodiments of this specification obtain shared features by downsampling the image to be detected, and then respectively perform semantic segmentation and instance analysis on the shared features to obtain semantic features and instance features, wherein the instance features include the spatial position features of each pixel in the image to be detected; then the semantic features are fused with the instance features to determine the fused features of each pixel in the image to be detected; and the instance category of each pixel in the image to be detected is determined based on the fused features of each pixel in the image to be detected. The present application obtains the fused features of each pixel by fusing the semantic features obtained by the connected domain regional clustering method with the instance features including the spatial position features, thereby improving the accuracy of determining the instance category of the pixel, thereby ensuring that instances in different regions will not be clustered into one category and speeding up the clustering speed.
[0121] The present application also provides a device for determining the instance category of pixels in an image. Figure 7 As shown, the device comprises:
[0122] An image acquisition module 710 is used to acquire an image to be detected, wherein the image to be detected includes instances of the target quantity;
[0123] A shared feature determination module 720 is used to perform downsampling processing on the image to be detected to obtain shared features;
[0124] A semantic feature determination module 730 is used to perform semantic segmentation processing on the shared features by using a connected domain sub-region clustering method to obtain semantic features;
[0125] An instance feature determination module 740 is used to perform instance analysis processing on the shared features to obtain instance features; the instance features include spatial position features of each pixel in the image to be detected;
[0126] A fusion feature determination module 750 is used to fuse the semantic feature with the instance feature to determine the fusion feature of each pixel in the image to be detected;
[0127] The instance category determination module 760 is used to determine the instance category of each pixel in the image to be detected according to the fusion features of each pixel in the image to be detected.
[0128] In some embodiments, the apparatus may further include:
[0129] A pixel set determination module, used to determine the pixel set corresponding to each instance category through a density clustering algorithm;
[0130] The image display module is used to respond to a trigger operation on the display interface and display the image corresponding to each instance in the image to be detected according to the pixel set corresponding to each instance category.
[0131] In some embodiments, the semantic features include background features and foreground features of the image to be detected; the semantic feature determination module may include:
[0132] The semantic feature determination unit is used to perform semantic segmentation processing on the shared features by adopting a connected domain sub-region clustering method to obtain background features and foreground features of the image to be detected.
[0133] In some embodiments, the apparatus may further include:
[0134] The mask determination module is used to determine a first mask of the background features of the image to be detected and a second mask of the foreground features.
[0135] In some embodiments, the instance feature further includes a texture feature of each pixel in the image to be detected, and the instance feature determination module may include:
[0136] The instance feature determination unit is used to perform instance analysis processing on the shared features to obtain texture features and spatial position features of each pixel in the image to be detected.
[0137] In some embodiments, the fusion feature determination module may include:
[0138] A first fusion result determination unit is used to fuse the first mask of the background features of the image to be detected with the texture features and spatial position features of the background corresponding pixels in the image to be detected to obtain a first fusion result;
[0139] A second fusion result determination unit is used to fuse the second mask of the foreground feature of the image to be detected with the texture feature and the spatial position feature of the foreground corresponding pixel in the image to be detected to obtain a second fusion result;
[0140] A fusion feature determination unit is used to determine the fusion feature of each pixel in the image to be detected according to the first fusion result and the second fusion result.
[0141] In some embodiments, Figure 8 As shown, the shared feature determination module 720 may include:
[0142] The edge texture feature set extraction unit 7210 is used to extract the edge texture feature set of the image to be detected;
[0143] An edge texture combined feature determination unit 7220 is used to determine an edge texture combined feature according to the edge texture feature set of the image to be detected;
[0144] A normalized feature determination unit 7230 is used to perform normalized normal distribution processing on the edge texture combined feature to obtain a normalized feature;
[0145] The shared feature determination unit 7240 is used to perform nonlinear mapping processing on the normalized features to obtain the shared features.
[0146] In some embodiments, the apparatus may further include:
[0147] A cross entropy loss function building module, used to build the cross entropy loss function of the first network;
[0148] A loss function construction module of the second network, used to construct an intra-class aggregation loss function and an inter-class discrimination loss function of the second network;
[0149] A comprehensive loss function determination module, used to determine the sum of the cross entropy loss function, the intra-class aggregation loss function and the inter-class discrimination loss function as a comprehensive loss function;
[0150] A parameter adjustment module, used to adjust the parameters of the first network and the second network respectively to obtain the current first network and the current second network;
[0151] A comprehensive loss value calculation module, used to calculate the comprehensive loss values corresponding to the current first network and the current second network;
[0152] The branch network determination module is used to determine the current first network as the semantic branch network and the current second network as the instance branch network when the comprehensive loss value is less than a preset threshold.
[0153] In some embodiments, the apparatus may further include:
[0154] A repeating module is used to repeat the steps of adjusting the parameters of the first network and the second network respectively to obtain the current first network and the current second network when the comprehensive loss value is greater than or equal to the preset threshold.
[0155] The device and method embodiments in the described device embodiments are based on the same inventive concept.
[0156] An embodiment of the present application provides a device for determining an instance category of a pixel in an image, the device comprising a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement a method for determining an instance category of a pixel in an image as provided in the above method embodiment.
[0157] An embodiment of the present application also provides a computer storage medium, which can be set in a terminal to store at least one instruction or at least one program related to a method for determining an instance category of a pixel in an image in a method embodiment. The at least one instruction or at least one program is loaded and executed by the processor to implement the method for determining the instance category of a pixel in an image provided in the above method embodiment.
[0158] Optionally, in the embodiments of this specification, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0159] The memory described in the embodiments of this specification can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0160] The method for determining the instance category of pixels in an image provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Fig. 9 1 is a hardware structure block diagram of a server of a method for determining an instance category of pixels in an image provided by an embodiment of the present application. Fig. 9As shown, the server 900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 910 (the processor 910 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 930 for storing data, and one or more storage media 920 (such as one or more mass storage devices) for storing application programs 923 or data 922. Among them, the memory 930 and the storage medium 920 can be short-term storage or permanent storage. The program stored in the storage medium 920 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 910 can be configured to communicate with the storage medium 920 and execute a series of instruction operations in the storage medium 920 on the server 900. The server 900 may also include one or more power supplies 960, one or more wired or wireless network interfaces 950, one or more input and output interfaces 940, and / or one or more operating systems 921, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, FreeBSD TM, etc.
[0161] The input / output interface 940 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 900. In one example, the input / output interface 940 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 940 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0162] It can be understood by those skilled in the art that Fig. 9 The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig. 9 More or fewer components as shown, or with Fig. 9 Different configurations are shown.
[0163] The present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in the above various optional implementations.
[0164] It can be seen from the embodiments of the method, device, server or storage medium for determining the instance category of pixels in an image provided by the present application that the present application obtains shared features by performing downsampling processing on the image to be detected, and then performs semantic segmentation processing and instance analysis processing on the shared features respectively to obtain semantic features and instance features, wherein the instance features include the spatial position features of each pixel in the image to be detected; the semantic features are then fused with the instance features to determine the fused features of each pixel in the image to be detected; and the instance category of each pixel in the image to be detected is determined based on the fused features of each pixel in the image to be detected. The present application obtains the fused features of each pixel by fusing the semantic features obtained by the connected domain regional clustering method with the instance features including the spatial position features, thereby improving the accuracy of determining the instance category of the pixel, thereby ensuring that instances in different regions will not be clustered into one category and speeding up the clustering speed.
[0165] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0166] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0167] A person skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0168] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for determining instance categories of pixels in an image, characterized in that: The method comprises: Acquire an image to be detected, wherein the image to be detected includes instances of the target quantity; Downsampling the image to be detected to obtain shared features; Using a connected domain sub-region clustering method to perform semantic segmentation processing on the shared features to obtain semantic features; the semantic features include background features and foreground features of the image to be detected; Determine a first mask of background features of the image to be detected and a second mask of the foreground features; Performing instance analysis processing on the shared features to obtain instance features; the instance features include spatial position features of each pixel in the image to be detected and texture features of each pixel; Fusing the first mask of the background features of the image to be detected with the texture features and spatial position features of the background pixels corresponding to the image to be detected to obtain a first fusion result; Fusing the second mask of the foreground feature of the image to be detected with the texture feature and the spatial position feature of the foreground corresponding pixel in the image to be detected to obtain a second fusion result; Determining a fusion feature of each pixel in the image to be detected according to the first fusion result and the second fusion result; According to the fusion features of each pixel in the image to be detected, the instance category of each pixel in the image to be detected is determined.
2. The method according to claim 1, characterized in that After the step of determining the instance category of each pixel in the image to be detected, the method further includes: Determine the pixel set corresponding to each instance category through density clustering algorithm; In response to a triggering operation on the display interface, an image corresponding to each instance in the image to be detected is displayed according to a pixel set corresponding to each instance category.
3. The method according to claim 1, characterized in that The example features obtained by performing example analysis on the shared features include: The shared features are subjected to instance analysis processing to obtain texture features and spatial position features of each pixel in the image to be detected.
4. The method according to claim 1, characterized in that: The downsampling of the image to be detected to obtain the shared features comprises: Extracting an edge texture feature set of the image to be detected; Determining edge texture combination features according to the edge texture feature set of the image to be detected; Performing normalized normal distribution processing on the edge texture combined features to obtain normalized features; Nonlinear mapping is performed on the normalized features to obtain the shared features.
5. The method according to claim 1, characterized in that The semantic features obtained by performing semantic segmentation processing on the shared features using the connected domain sub-region clustering method include: Performing semantic segmentation processing on the shared features through a semantic branch network to obtain semantic features; The example features obtained by performing example analysis on the shared features include: The shared features are subjected to instance analysis processing through an instance branch network to obtain instance features.
6. The method according to claim 5, characterized in that Before the step of performing semantic segmentation processing on the shared features through a semantic branch network to obtain semantic features, the method further includes: Construct the cross entropy loss function of the first network; Constructing the intra-class aggregation loss function and inter-class discrimination loss function of the second network; Determine the sum of the cross entropy loss function, the intra-class aggregation loss function and the inter-class discrimination loss function as a comprehensive loss function; Adjusting parameters of the first network and the second network respectively to obtain a current first network and a current second network; Calculating the comprehensive loss values corresponding to the current first network and the current second network; When the comprehensive loss value is less than a preset threshold, the current first network is determined as the semantic branch network, and the current second network is determined as the instance branch network.
7. A device for determining instance categories of pixels in an image, characterized in that: The device comprises: An image acquisition module, used for acquiring an image to be detected, wherein the image to be detected includes instances of the target quantity; A shared feature determination module, used for performing downsampling processing on the image to be detected to obtain shared features; A semantic feature determination module is used to perform semantic segmentation processing on the shared features by using a connected domain sub-region clustering method to obtain semantic features; the semantic features include background features and foreground features of the image to be detected; A mask determination module, used to determine a first mask of background features of the image to be detected and a second mask of the foreground features; An instance feature determination module is used to perform instance analysis processing on the shared features to obtain instance features; the instance features include spatial position features of each pixel in the image to be detected and texture features of each pixel; A fusion feature determination module, used to fuse the semantic feature with the instance feature to determine the fusion feature of each pixel in the image to be detected; An instance category determination module, used to determine the instance category of each pixel in the image to be detected according to the fusion features of each pixel in the image to be detected; Wherein, the fusion feature determination module includes: A first fusion result determination unit is used to fuse the first mask of the background features of the image to be detected with the texture features and spatial position features of the background corresponding pixels in the image to be detected to obtain a first fusion result; A second fusion result determination unit is used to fuse the second mask of the foreground feature of the image to be detected with the texture feature and the spatial position feature of the foreground corresponding pixel in the image to be detected to obtain a second fusion result; A fusion feature determination unit is used to determine the fusion feature of each pixel in the image to be detected according to the first fusion result and the second fusion result.
8. The device according to claim 7, characterized in that The device also includes: A pixel set determination module, used to determine the pixel set corresponding to each instance category through a density clustering algorithm; The image display module is used to respond to a trigger operation on the display interface and display the image corresponding to each instance in the image to be detected according to the pixel set corresponding to each instance category.
9. The device according to claim 7, characterized in that The instance feature determination module comprises: The instance feature determination unit is used to perform instance analysis processing on the shared features to obtain texture features and spatial position features of each pixel in the image to be detected.
10. The device according to claim 7, characterized in that The shared feature determination module comprises: An edge texture feature set extraction unit, used to extract the edge texture feature set of the image to be detected; An edge texture combination feature determination unit, used to determine an edge texture combination feature according to an edge texture feature set of the image to be detected; A normalized feature determination unit, used for performing normalized normal distribution processing on the edge texture combined feature to obtain a normalized feature; The shared feature determination unit is used to perform nonlinear mapping processing on the normalized features to obtain the shared features.
11. The device according to claim 7, characterized in that The semantic feature determination module is further used to perform semantic segmentation processing on the shared features through a semantic branch network to obtain semantic features; The instance feature determination module is further used to perform instance analysis processing on the shared features through an instance branch network to obtain instance features.
12. The device according to claim 11, characterized in that The device also includes: A cross entropy loss function building module, used to build the cross entropy loss function of the first network; A loss function construction module of the second network, used to construct an intra-class aggregation loss function and an inter-class discrimination loss function of the second network; A comprehensive loss function determination module, used to determine the sum of the cross entropy loss function, the intra-class aggregation loss function and the inter-class discrimination loss function as a comprehensive loss function; A parameter adjustment module, used to adjust the parameters of the first network and the second network respectively to obtain the current first network and the current second network; A comprehensive loss value calculation module, used to calculate the comprehensive loss values corresponding to the current first network and the current second network; The branch network determination module is used to determine the current first network as the semantic branch network and the current second network as the instance branch network when the comprehensive loss value is less than a preset threshold.
13. The device according to claim 12, characterized in that The device also includes: A repeating module is used to repeat the steps of adjusting the parameters of the first network and the second network respectively to obtain the current first network and the current second network when the comprehensive loss value is greater than or equal to the preset threshold.
14. A device for determining instance categories of pixels in an image, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for determining the instance category of pixels in an image as described in any one of claims 1-6.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for determining the instance category of a pixel in an image as described in any one of claims 1-6.
