Image segmentation method and device based on weighted particle ball clustering and electronic equipment
By using a weighted particle-sphere clustering method in image segmentation, combined with a graph autoencoder, the problem of recognizing complex shapes and high-dimensional feature distributions is solved, and more accurate image segmentation results are achieved.
Patent Information
- Application Number
- CN202411676938.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-11-22
AI Technical Summary
Existing technologies struggle to accurately identify complex shapes and high-dimensional feature distributions with significant differences in density levels during image segmentation, resulting in poor image segmentation performance.
The pixels of the target segmented image are mapped to the grain space. By utilizing the feature representation capability of weighted grains, the connections between grains are constructed, and graph autoencoders are used for iterative updates and reconstruction to capture the local details and global structure of the image.
It improves the accuracy and completeness of image segmentation, exhibits insensitivity to parameter initialization, and enhances flexibility and convenience for practical applications.
Smart Images

Figure CN119625306B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of computer vision, and particularly relates to an image segmentation method and device based on weighted granular ball clustering and an electronic device. BACKGROUND
[0002] Image segmentation is a key step in image processing, which refers to dividing an image into several non-overlapping regions, so that the pixels in the same region have similar characteristics (such as color, texture, shape, etc.), while the pixel characteristics between different regions have obvious differences. Such segmentation process helps to extract the target of interest from the complex background, and provides basic data for subsequent target recognition, tracking, understanding and analysis. Image segmentation plays an important role in many fields, including medical image analysis (by segmenting the lesion area, doctors can more accurately judge the disease), satellite remote sensing image processing (segmenting different landforms and vegetation types helps to analyze the surface environment more deeply), face recognition (by segmenting the face area, the accuracy and efficiency of face recognition are improved), traffic monitoring (segmenting vehicles and pedestrians and other targets helps to monitor and manage traffic flow).
[0003] In the image segmentation task, clustering algorithms can divide the image into different regions or clusters by measuring the similarity and grouping the image pixels or features. Clustering algorithms belong to the category of unsupervised learning, which can discover the potential structure in the image and cluster similar parts together without relying on explicit labels or prior information. For example, Chinese patent CN118172374A discloses an image segmentation method, device and electronic equipment and storage medium, which includes: obtaining a target image, taking each pixel of the target image as a data object; performing natural neighbor search to obtain the natural neighbors of each data object; forming natural granular balls from the natural neighbors to obtain an initial natural granular ball group of the target image; calculating a splitting threshold; selecting natural granular balls with a radius greater than the splitting threshold for splitting, and after iteration, obtaining a final stable natural granular ball group; merging and clustering any two natural granular balls from the final stable natural granular ball group, and after iteration, obtaining a clustering result, and obtaining an image segmentation result of the target image according to the clustering result. The patent application combines granular ball calculation and natural neighbors to form natural granular balls, uses natural granular balls to cover the image, performs natural granular ball splitting and clustering, and obtains an image segmentation result according to the clustering result, which is more accurate and more suitable for complex image segmentation. However, the patent application has the problem of being difficult to accurately identify high-dimensional feature distribution with complex shape and large density level difference, resulting in poor image segmentation performance. SUMMARY
[0004] In order to solve the problems in the prior art, the present application provides an image segmentation method and device based on weighted granular ball clustering and an electronic device; pixel points of a target segmentation image are mapped to a granular ball space, the excellent feature representation capability of the weighted granular ball is utilized, and a fine method is used to construct the connection between the granular balls, so that the local details and global structure of each pixel point of the target segmentation image are more comprehensively captured; the weighted information of previous pixel points can be used to reconstruct an image weighted graph with accuracy and integrity. Through iterative updating and reconstruction of the image weighted graph, the internal structure and properties of the graph data can be more accurately captured, and better image segmentation results are obtained.
[0005] In a first aspect of the present application, the present application provides an image segmentation method based on weighted granular ball clustering, comprising:
[0006] obtaining a target segmentation image;
[0007] initializing pixel points in the target segmentation image as image initial granular balls; the center of the image initial granular ball is determined by the mean value of the pixel values of all pixel points of the target segmentation image, the radius of the image initial granular ball is determined by the pixel point farthest from the mean value of the pixel values in the target segmentation image, and the initial weight of the image initial granular ball is determined by the feature weight of each pixel point;
[0008] splitting the image initial granular ball of the target segmentation image into image weighted granular balls based on a split threshold; the split threshold is determined by the data distribution of the image initial granular ball in the target segmentation image;
[0009] constructing the image weighted granular ball of the target segmentation image into an image weighted graph; the image weighted graph includes the connection relationship of the pixel points in the ball and the association relationship of the pixel point centers between the balls;
[0010] inputting the image weighted graph of the target segmentation image into a graph autoencoder to obtain a graph embedding representation;
[0011] clustering the graph embedding representation of the target segmentation image to obtain a segmentation result of the target segmentation image.
[0012] In a second aspect of the present application, the present application further provides an image segmentation device based on weighted granular ball clustering, comprising:
[0013] an image data acquisition module for acquiring a target segmentation image;
[0014] an image data conversion module, configured to initialize each pixel point in the target segmentation image as an image initial grain ball; a center of the image initial grain ball is determined by a mean value of pixel values of all pixel points in the target segmentation image, a radius of the image initial grain ball is determined by a pixel point farthest from the mean value of pixel values in the target segmentation image, and an initial weight of the image initial grain ball is determined by a feature weight of each pixel point;
[0015] and configured to split the image initial grain ball of the target segmentation image into an image weighted grain ball based on a split threshold; the split threshold is determined by data distribution of the image initial grain ball in the target segmentation image;
[0016] and configured to construct the image weighted grain ball of the target segmentation image into an image weighted graph; the image weighted graph comprises a connection relationship of pixel points in a ball and a correlation relationship of centers of pixel points between balls;
[0017] an image feature extraction module, configured to input the image weighted graph of the target segmentation image into a graph auto-encoder to obtain a graph embedding representation;
[0018] an image data segmentation module, configured to cluster the graph embedding representation of the target segmentation image to obtain a segmentation result of the target segmentation image.
[0019] In a third aspect of the present application, the present application further provides an electronic device comprising:
[0020] a processor;
[0021] a memory for storing instructions executable by the processor;
[0022] wherein the processor is configured to execute the instructions to implement the image segmentation method according to the first aspect of the present application.
[0023] Technical effects of the present application:
[0024] The present application takes each pixel point of a target segmentation image as a data object, initializes the pixel points in the target segmentation image as image initial granules; the center of the image initial granule is determined by the mean value of the pixel values of all pixel points of the target segmentation image, the radius of the image initial granule is determined by the pixel point farthest from the mean value of the pixel values in the target segmentation image, and the initial weight of the image initial granule is determined by the feature weight of each pixel point; the image initial granules of the target segmentation image are split into image weighted granules based on a split threshold; the split threshold is determined by the data distribution of the image initial granules in the target segmentation image; the image weighted granules of the target segmentation image are constructed into an image weighted graph; the image weighted graph includes the connection relationship of the pixel points in the ball and the association relationship of the pixel point centers between the balls; the image weighted graph of the target segmentation image is input into a graph autoencoder to obtain a graph embedding representation; the graph embedding representation of the target segmentation image is clustered to obtain a segmentation result of the target segmentation image. The present application performs multi-granularity representation on the target segmentation image through the weighted granule structure and combines the feature weight, which is beneficial to comprehensively capturing the local details and global data structure of the target segmentation image, and thus improves the image segmentation accuracy. In addition, the present application is not sensitive to parameter initialization and does not need to be pre-trained, thereby improving its actual flexibility and convenience. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 is the flow chart of the image segmentation method based on weighted granule clustering of the embodiment of the present application;
[0026] Figure 2 is the schematic diagram of image weighted granule splitting of the embodiment of the present application;
[0027] Figure 3 is the schematic diagram of image weighted graph construction of the embodiment of the present application;
[0028] Figure 4 is the schematic diagram of graph embedding representation extraction of the embodiment of the present application;
[0029] Figure 5 is the schematic diagram of graph embedding representation extraction structure of the embodiment of the present application;
[0030] Figure 6 is the schematic diagram of graph autoencoder structure of the embodiment of the present application;
[0031] Figure 7 is the schematic diagram of the image segmentation device structure based on weighted granule clustering of the embodiment of the present application;
[0032] Figure 8 is the schematic diagram of the electronic device structure of the embodiment of the present application. DETAILED DESCRIPTION
[0033] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts are within the scope of the present application.
[0034] In the field of image processing, granular ball segmentation refers to an image segmentation method based on granular ball algorithm or model. This method may involve dividing pixels or feature points in an image into different granular balls (or clusters), and then performing image segmentation based on these granular balls. For example, Chinese patent CN117765263A discloses an image segmentation method based on superpixels and improved granular balls, which obtains superpixel segmentation results by SLIC algorithm, then performs dimensionality reduction processing on the feature set using the improved ISOMAP algorithm based on granular balls, and finally clusters important features using the optimized DPC clustering algorithm to obtain the final segmentation result. The granular ball segmentation here can be understood as a feature dimensionality reduction and clustering method for improving the accuracy and efficiency of image segmentation.
[0035] The present application first proposes an image segmentation method based on weighted granular ball clustering, which uses an image segmentation method to segment an image.
[0036] The image segmentation method based on weighted granular ball clustering provided by the present application will be described in detail below in combination with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The execution subject of the image segmentation method based on weighted granular ball clustering may be, for example, any electronic device with processing capability such as a terminal or a server.
[0037] In some embodiments, the image segmentation method based on weighted granular ball clustering of the present application can be applied in a server or a terminal.
[0038] In an optional embodiment, a server can be used for image segmentation based on weighted granular ball clustering. Specifically, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc. basic cloud computing services.
[0039] In an optional embodiment, the terminal can be an image acquisition device for the target segmentation image, for example, after an image of the real world is acquired by using a mobile phone camera or a video camera, the image is taken as the target segmentation image, and then the image segmentation method based on the weighted particle ball clustering provided in the embodiments of the present disclosure is performed on the target segmentation image. Specifically, the terminal can include but is not limited to electronic devices such as smart phones, desktop computers, tablet computers, notebook computers, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, and the like. Optionally, the operating system running on the electronic device can include but is not limited to an Android system, an IOS system, Linux, Windows, and the like.
[0040] Figure 1 A flowchart of an image segmentation method based on weighted particle ball clustering provided in the present application is shown in FIG. 1. As shown in FIG. 1, the method includes the following steps: Figure 1
[0041] 101. Obtain a target segmentation image;
[0042] In the embodiments of the present application, the target segmentation image can include at least one sample image and a label corresponding to each sample image if any. The label is used to represent an object to be segmented in the sample image. For example, if the method is used to segment a city scene in a target segmentation image, and a sample image is obtained, the label corresponding to the sample image can be used to represent lane lines, traffic signs, pedestrians, vehicles, etc. (that is, lane lines, traffic signs, pedestrians, vehicles, etc. are objects to be segmented in the sample image).
[0043] In some embodiments, the present embodiment can use an open-source city scene segmentation dataset CityScapes as the target segmentation image, which contains high-resolution images from various urban streets, each image with a pixel-level label to identify different objects and scene categories.
[0044] It can be understood that, in order to obtain better image segmentation results, the graph autoencoder in the subsequent process can be pre-trained, that is, the model parameters of the graph autoencoder can be optimized using at least one sample image and a label corresponding to each sample image. Of course, the present application can also directly segment sample images with unknown labels, that is, at least one sample image with unknown labels can be used for segmentation to obtain the corresponding image segmentation result.
[0045] 102. Initialize each pixel point in the target segmentation image as an image initial particle ball;
[0046] In the embodiment of the present application, each pixel point in the target segmentation image is mapped to a granule ball space, and each data point or data object in the granule ball space corresponds to each pixel point in the target segmentation image; for an image initial granule, the center of the image initial granule is determined by the average pixel value of all pixel points of the target segmentation image, the radius of the image initial granule is determined by the pixel point farthest from the average pixel value in the target segmentation image, and the initial weight of the image initial granule is determined by the feature weight of each pixel point; the embodiment is expressed by the following formula:
[0047] WGB0={(x i ,w0)|i=1,2,...,n}
[0048]
[0049] Wherein, WGB0 represents the image initial granule, x i represents the i-th pixel point of the target segmentation image, w0 represents the initial weight of the image initial granule, and can be generated by some existing clustering algorithm, so that greater initial weight can be given to important pixel points or features, and smaller initial weight can be given to unimportant pixel points or features; different pixel points can have different weights, so the weighted distance between different pixel points can be described; n represents the number of pixel points of the image segmentation image; c0 represents the center of the image initial granule, and r0 represents the radius of the image initial granule.
[0050] 103、Split the image initial granule of the target segmentation image into image weighted granules based on a split threshold; the split threshold is determined by the data distribution of the image initial granule in the target segmentation image;
[0051] In the embodiment of the present application, since the image initial granule can only represent one classification cluster, the image initial granule needs to be split to obtain more image weighted granules. The embodiment of the present application determines the split threshold by combining the standard deviation of the target segmentation image with the weight of the image initial granule; the standard deviation of the image initial granule is calculated according to the Euclidean distance from the center of the image initial granule to each pixel point and the number of pixel points; and the split threshold is calculated according to the product of the standard deviation of the image initial granule and the square root value of the image initial weight. The calculation formula of the split threshold is represented as:
[0052]
[0053] Wherein, DM weight represents the split threshold.
[0054] In the continuous splitting process, the splitting threshold is determined by the standard deviation of the target segmentation image combined with the weight of the image weighted granule ball; the standard deviation of the image weighted granule ball is calculated according to the Euclidean distance from the center of the image weighted granule ball to each pixel point and the number of pixel points; the updated splitting threshold is calculated according to the product of the standard deviation of the image weighted granule ball and the square root value of the image initial weight, which is similar to the splitting threshold of the image initial granule ball, and the calculation formula is not provided in this embodiment.
[0055] In some embodiments, splitting the image initial granule ball of the target segmentation image into image weighted granule balls based on the splitting threshold needs to judge the splitting feasibility and the splitting effectiveness, which can ensure that the image weighted granule balls after splitting can tend to be stable, the image weighted granule balls after splitting contain pixel points with the most similar features, and the pixel point clustering is changed to image weighted granule ball clustering in a coarse-grained manner, which can reduce part of the operation complexity.
[0056] For the splitting feasibility, if the number of pixel points of the image initial granule ball is greater than or equal to twice the preset neighbor node number, two midpoints between the center and the two pixel points with the farthest weighted distance in the image initial granule ball are selected as the two centers of the image weighted granule ball, and the pixel points in the image initial granule ball are divided into the image weighted granule ball closer to the corresponding center;
[0057] For example, if the number of pixel points of the image initial granule ball is greater than twice the preset neighbor node number, it indicates that the image initial granule ball can be split, and similarly, the image initial granule ball after splitting can continue to be split into image weighted granule balls; in the splitting process, for the convenience of description, it is assumed that the granule ball before splitting is the image parent granule ball WGB parent , the granule ball after splitting is the image child granule ball WGB child , one point p with the farthest weighted distance from the center of the image parent granule ball WGB parent is selected, another point q with the farthest weighted distance from the point p is selected, the midpoint p c, q c of the connecting line of p and q is selected as the two reference points of the image child granule ball WGB child ; the distances between the data point x parent in WGB i and p c and q c are calculated, if the distance between x i and p c is less than the distance to q c , the data point x i and q c belong to the same image child granule ball, and the cycle is repeated until all pixel points in WGB parent are traversed, and thus the image parent granule ball WGBparent It split into two image subspheres, WGB, with fewer data points. child .
[0058] Regarding splitting validity, if the splitting threshold of the initial image sphere is greater than the splitting threshold of all image weighted spheres, then the image weighted sphere is added to the image sphere set.
[0059] For example, based on the splitting threshold DM of the image parent particle sphere parent The sum of the splitting thresholds of each image sub-sphere ∑DM child The relationship between DM and the criteria for passing the ball determines whether the ball can be passed successfully. parent ≥∑DM child Then the image subsphere WGB child Add the image weighted sphere set WGBS.
[0060] like Figure 2 As shown, this demonstrates in detail how to start from the initial image parent sphere WGB. parent In the process, it is split into two image sub-spheres WGB through a series of steps. child It also details the changes in weights during this process. In the initial state, Figure 2 In (a), the weight of each point in WGB is w. i Subsequently, this process was iteratively repeated, involving recalculation of weights and evaluation of the feasibility and effectiveness of splitting. Ultimately, two image subspheres, WGB, were obtained. child The weights within each image subsphere have been adjusted to w. i These weighted WGBs child It was then added to the new weighted sphere set WGBS', such as Figure 2 As shown in (b), through a continuous splitting and iterative process, a final result was obtained. Figure 2 (c) is a stable set of weighted spheres WGBS.
[0061] Understandably, in this embodiment of the invention, after the initial image grains undergo a first round of splitting, based on the feasibility and effectiveness of the splitting, the number of image weighted grains in the image weighted grain set WGBS changes from 1 to 2. Through this further division and judgment, the number of image weighted grains continuously increases and tends to stabilize, while the number of data points in each image weighted grain decreases significantly, resulting in more similar feature data being contained within the same grain. The splitting ends when the number of image weighted grains in the image weighted grain set no longer changes. This ensures that similar feature points or pixels are within the same grain, facilitating subsequent clustering and segmentation.
[0062] 104. Construct an image weighted graph from the image weighted spheres of the target segmented image; the image weighted graph includes the connection relationship of pixels within the spheres and the correlation relationship of pixel centers between spheres;
[0063] In this embodiment of the invention, in order to more effectively integrate local and global information, the obtained image weighted sphere set is used to generate a weighted graph by constructing connections between data points within the spheres and associations between data centers between spheres, as shown below. Figure 3 As shown, constructing an image weighted map from the image weighted spheres of the target segmented image includes:
[0064] 401. Establish intra-sphere connectivity between each pixel in the image weighted sphere and its neighboring pixels;
[0065] For example, for each pixel in the image weighted sphere, the pixel is connected to its neighboring pixels to obtain a weighted graph P1 with local information. In the weighted graph P1, if a certain pixel x i With another pixel x j Given the relationship between neighboring pixels, the corresponding weighted graph representation is P1(x). i |x j )=d(x i ,x j ), where d(x) i ,x j ) represents pixel x i With pixel x j The weighted distance; if a certain pixel x i With another pixel x j If the relationship is not that of neighboring pixels, the corresponding weighted graph representation is P1(x). i |x j =0; This method of constructing a weighted graph can fully extract the local information of pixels, which is convenient for subsequent clustering and segmentation.
[0066] 402. Take the pixel closest to the center in the weighted sphere of the image as the new approximate center, and connect the various approximate centers to obtain the inter-sphere connectivity relationship;
[0067] For example, for each approximate center in the image weighted sphere, connecting each approximate center yields the inter-sphere connectivity relationship, resulting in a weighted graph P2 with global information. In the weighted graph P2, if a certain approximate center c i 'With another approximate center c j If they are connected, the corresponding weighted graph representation is P2(c i '|c j ')=d(c i ',c j '), where d(c i ',cj represents the approximate center c i and the weighted distance of the approximate center c j .
[0068] 403、superimpose the intra-sphere connection relationship and the inter-sphere connection relationship to obtain an image weighted graph.
[0069] Illustratively, the weighted graph obtained in step 401 is superimposed with the weighted graph obtained in step 402, and the directed graph is changed into an undirected graph, which is the image weighted graph, which can effectively integrate local and global information.
[0070] 105、input the image weighted graph of the target segmentation image into a graph autoencoder to obtain a graph embedding representation;
[0071] In the embodiment of the present application, the image weighted graph of the target segmentation image is input into the graph autoencoder, the related information is fully mined, and the powerful data processing capability of the graph autoencoder is utilized. Through forward propagation and back propagation and continuous correction on the basis of the loss function, the graph embedding representation information of the target segmentation image can be fully extracted.
[0072] In the embodiment of the present application, as shown in Figure 4 the image weighted graph of the target segmentation image is input into the graph autoencoder to obtain a graph embedding representation, which includes:
[0073] 501、calculate an iteration step length according to the cluster number of the target segmentation image and the pixel point number of the target segmentation image;
[0074] In the embodiment of the present application, the calculation formula of the iteration step length is:
[0075]
[0076] wherein, k inc represents the iteration step length, N represents the pixel point number of the target segmentation image, and k represents the cluster number of the target segmentation image.
[0077] 502、calculate an initialized preset neighbor node number according to the cluster number of the target segmentation image and the pixel point number of the target segmentation image;
[0078] In the embodiment of the present application, the calculation formula of the initialized preset neighbor node number is:
[0079]
[0080] wherein, k nei represents the initialized preset neighbor node number, N represents the pixel point number of the target segmentation image, and k represents the cluster number of the target segmentation image. This indicates rounding down to the nearest integer.
[0081] 503. Decrease the preset number of neighbor nodes according to the iteration step size until the preset number of neighbor nodes reaches the minimum number.
[0082] 504. Input the image weighted graph of the target segmented image into the graph autoencoder according to the preset number of neighbor nodes to obtain the optimal graph embedding representation.
[0083] For example, such as Figure 5 As shown, in a scenario with 46 data points, assuming the initial preset number of neighbor nodes k nei =6, step size k inc =2 and minimum quantity k min =2. In the initial iteration phase Figure 5 In (a), the image weighted graph of the target segmentation image is input into the graph autoencoder according to the 6 nearest neighbor clustering method to generate the corresponding graph embedding representation; such as Figure 5 (b) shows that in the second iteration, the preset number of neighbor nodes k nei =4, the weighted image graph of the target segmentation image is input into the graph autoencoder according to the 4 nearest neighbor clustering method; after continuous iteration, in the final iteration stage Figure 5 In (c), the preset number of neighboring nodes is reduced to the set minimum value k. nei =2, at this point the image weighted graph is input according to the 2 nearest neighbor clustering method to obtain the final graph embedding representation. In this process, the present invention uses a method of gradually reducing the preset number of neighbor nodes, prompting the graph autoencoder model to focus more on neighbor nodes that have a significant impact and representational ability on the target node. The advantage of the weighted graph is that it can filter the most influential neighbors according to the weight of the connections between nodes, thereby generating a more accurate and meaningful graph embedding representation, thus improving the accuracy of image segmentation.
[0084] In some embodiments, such as Figure 6As shown, the graph autoencoder consists of two parts: an encoder and a decoder. In the encoder part, the input layer receives the weighted image graph as input and passes it to the hidden layer. The hidden layer consists of two graph convolutional network (GCN) layers, which process the input data and extract features. Specifically, the first GCN layer contains 256 neurons and uses ReLU as the activation function. It receives weighted image data with a dimension of 1024 and maps it to a higher-level feature space. The second GCN layer contains 64 neurons and uses a linear activation function. It further processes the output of the first GCN layer and generates a low-dimensional embedding representation. This embedding representation is a compressed form of the weighted image data, capturing the key information and relationships between nodes in the graph. After the embedding layer, the decoder part receives this low-dimensional embedding as input and attempts to reconstruct the original weighted image. The decoder generates a reconstructed adjacency matrix through a series of operations. This reconstructed adjacency matrix is an approximate representation of the original input image weighted graph.
[0085] In some embodiments, the pre-training or training process of the graph autoencoder can be implemented using the following loss function:
[0086]
[0087] in, Z represents the graph embedding representation, λ is the consistency parameter for the cross-entropy loss and the regularization term, and
[0088]
[0089] The goal of the optimized model in this embodiment is to minimize the reconstruction loss, which is the difference between the reconstructed adjacency matrix and the input adjacency matrix of the original graph. Through continuous iterative training, the model gradually learns how to extract useful features from the weighted graph and generate accurate low-dimensional embedding representations, thereby reconstructing an image weighted graph similar to the original input.
[0090] 106. Cluster the graph embedding representation of the target segmented image to obtain the segmentation result of the target segmented image.
[0091] In this embodiment of the invention, some existing clustering algorithms, such as the K-means algorithm, can be used to cluster the graph embedding representation of the target segmentation image to obtain the final clustering result, thereby obtaining the segmentation result of the target segmentation image.
[0092] Figure 7 This is a block diagram of an image segmentation apparatus based on weighted particle-sphere clustering, according to an exemplary embodiment. (Refer to...) Figure 7 The device includes:
[0093] The image data acquisition module 111 is configured to acquire a target segmentation image.
[0094] The image data conversion module 112 is configured to initialize a pixel point in the target segmentation image as an image initial particle ball, wherein a center of the image initial particle ball is determined by a mean value of pixel values of all pixel points in the target segmentation image, a radius of the image initial particle ball is determined by a pixel point farthest from the mean value of the pixel values in the target segmentation image, and an initial weight of the image initial particle ball is determined by a feature weight of each pixel point.
[0095] The image data conversion module 112 is further configured to split the image initial particle ball of the target segmentation image into an image weighted particle ball based on a split threshold, wherein the split threshold is determined by a data distribution of the image initial particle ball in the target segmentation image.
[0096] The image data conversion module 112 is further configured to construct the image weighted particle ball of the target segmentation image into an image weighted graph, wherein the image weighted graph comprises a connection relationship of pixel points in a ball and a correlation relationship of centers of pixel points between balls.
[0097] The image feature extraction module 113 is configured to input the image weighted graph of the target segmentation image into a graph auto-encoder to obtain a graph embedding representation.
[0098] The image data segmentation module 114 is configured to cluster the graph embedding representation of the target segmentation image to obtain a segmentation result of the target segmentation image.
[0099] Figure 8 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. The electronic device can be a terminal. The electronic device includes a processor, a memory, a network interface, a display, and an input device connected through a system bus. The processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement a method for image segmentation based on weighted particle ball clustering. The display of the electronic device can be a liquid crystal display or an electronic ink display. The input device of the electronic device can be a touch layer overlaid on the display, or a key, trackball, or touchpad provided on the shell of the electronic device. The input device can also be an external keyboard, touchpad, or mouse, etc.
[0100] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiments can be completed by programs instructing relevant hardware, and the programs can be stored in a computer readable storage medium, which can include ROM, RAM, magnetic disk or optical disk, etc.
[0101] Although the embodiments of the present application have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the application, and the scope of the present application is defined by the appended claims and their equivalents.
Claims
1. A method for image segmentation based on weighted particle swarm clustering, characterized in that, The method comprises the following steps: obtaining a target segmentation image; initializing a pixel point in the target segmentation image as an image initial particle ball; the center of the image initial particle ball is determined by the average pixel value of all pixel points of the target segmentation image, the radius of the image initial particle ball is determined by the pixel point farthest from the average pixel value in the target segmentation image, and the initial weight of the image initial particle ball is determined by the feature weight of each pixel point; splitting the image initial particle ball of the target segmentation image into an image weighted particle ball based on a split threshold; the split threshold is determined by the data distribution of the image initial particle ball in the target segmentation image; constructing the image weighted particle ball of the target segmentation image into an image weighted graph; the image weighted graph comprises the connection relationship of the pixel points in the ball and the correlation relationship of the pixel point centers between the balls; constructing the image weighted particle ball of the target segmentation image into an image weighted graph comprises: establishing the intra-ball connection relationship of each pixel point in the image weighted particle ball and the neighbor pixel points; taking the center nearest pixel point in the image weighted particle ball as a new approximate center, and connecting the approximate centers to obtain the inter-ball connection relationship; superimposing the intra-ball connection relationship and the inter-ball connection relationship to obtain the image weighted graph; inputting the image weighted graph of the target segmentation image into a graph autoencoder to obtain a graph embedding representation; clustering the graph embedding representation of the target segmentation image to obtain a segmentation result of the target segmentation image.
2. The image segmentation method based on weighted particle swarm clustering according to claim 1, characterized in that, The split threshold is determined by the standard deviation of the image initial particle ball combined with the weight of the image initial particle ball.
3. The image segmentation method based on weighted particle swarm clustering according to claim 2, characterized in that, The calculation method of the split threshold comprises: calculating the standard deviation of the image initial particle ball according to the Euclidean distance from the center of the image initial particle ball to each pixel point and the number of pixel points; and calculating the split threshold according to the product of the standard deviation of the image initial particle ball and the square root value of the image initial weight.
4. The image segmentation method based on weighted particle swarm clustering according to claim 1, characterized in that, Splitting the image initial particle ball of the target segmentation image into an image weighted particle ball based on a split threshold specifically comprises: if the number of pixel points of the image initial particle ball is greater than or equal to twice the preset neighbor node number, selecting two midpoints between the center and the two pixel points farthest away from each other in the image initial particle ball as the centers of the image weighted particle ball, and dividing the pixel points in the image initial particle ball into the image weighted particle ball closer to the corresponding center; if the split threshold of the image initial particle ball is greater than the split threshold of all image weighted particle balls, the image weighted particle ball is added to the image particle ball set.
5. The image segmentation method based on weighted particle swarm clustering according to claim 1, characterized in that, Inputting the image weighted graph of the target segmentation image into a graph autoencoder to obtain a graph embedding representation comprises: calculating an iteration step according to the number of clustering clusters of the target segmentation image and the number of pixel points of the target segmentation image; calculating an initial preset neighbor node number according to the number of clustering clusters of the target segmentation image and the number of pixel points of the target segmentation image; decreasing the preset neighbor node number by the iteration step until the preset neighbor node number reaches the minimum number; inputting the image weighted graph of the target segmentation image into the graph autoencoder according to the preset neighbor node number to obtain an optimal graph embedding representation.
6. The image segmentation method based on weighted particle swarm clustering according to claim 5, characterized in that, The calculation formula of the initial preset neighbor node number is: ; wherein, represents the initialized preset number of neighbor nodes, represents the number of pixel points of the target segmentation image, represents the number of clustering clusters of the target segmentation image, represents the floor function.
7. The image segmentation method based on weighted particle swarm clustering according to claim 5, characterized in that, The calculation formula of the iteration step length is expressed as: ; wherein, denotes an iteration step size, denotes a number of pixel points of the target segmentation image, denotes a number of clustering clusters of the target segmentation image, denotes a floor function.
8. An image segmentation apparatus based on weighted particle swarm clustering, characterized by, The device comprises: An image data acquisition module configured to acquire a target segmentation image; An image data conversion module configured to initialize each pixel point in the target segmentation image as an image initial particle ball; a center of the image initial particle ball is determined by a mean value of pixel values of all pixel points of the target segmentation image, a radius of the image initial particle ball is determined by a pixel point farthest from the mean value of the pixel values in the target segmentation image, and an initial weight of the image initial particle ball is determined by a feature weight of each pixel point; and configured to split the image initial particle ball of the target segmentation image into an image weighted particle ball based on a split threshold; the split threshold is determined by data distribution of the image initial particle ball in the target segmentation image; and configured to construct the image weighted particle ball of the target segmentation image into an image weighted graph; the image weighted graph comprises a connection relationship of in-ball pixel points and a correlation relationship of centers of inter-ball pixel points; Constructing the image weighted particle ball of the target segmentation image into the image weighted graph comprises: establishing an in-ball connection relationship between each pixel point in the image weighted particle ball and a neighbor pixel point; taking a center nearest pixel point in the image weighted particle ball as a new approximate center, and connecting each approximate center to obtain an inter-ball connection relationship; superimposing the in-ball connection relationship and the inter-ball connection relationship to obtain the image weighted graph; An image feature extraction module configured to input the image weighted graph of the target segmentation image into a graph auto-encoder to obtain a graph embedding representation; An image data segmentation module configured to cluster the graph embedding representation of the target segmentation image to obtain a segmentation result of the target segmentation image.
9. An electronic device, comprising: comprises: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the image segmentation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image segmentation method based on super-pixel and particle ball improvement
CN117765263A
Image segmentation method and device, electronic equipment and storage medium
CN118172374A
Intelligent rating method for nonmetallic inclusions in steel based on deep learning
CN118747891A