An image instance segmentation method based on segmentation-everything large model
Through the combination of superpixel-based graph neural network and segmentation of all large models, the accuracy problem of instance segmentation of complex morphological and densely distributed images in biological images is solved, and higher-quality instance segmentation results are achieved.
Patent Information
- Application Number
- CN202411002059.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-25
AI Technical Summary
Existing biological image instance segmentation methods have the problems of over-segmentation, over-merging, and inaccurate segmentation boundaries when processing complex-shaped and densely distributed images. This is especially true for large visual models such as Segmented All Large Models (SAM) in biological images. Poor application.
Using a graph neural network based on superpixels, by constructing an undirected graph and extracting a variety of embedding vectors, high-quality cues are generated and combined with the powerful image processing capabilities of SAM for instance segmentation. Specific steps include superpixel segmentation, construction of undirected graph, hint aggregation of graph neural network and final instance segmentation result prediction.
It effectively improves the accuracy of biological image instance segmentation, reduces over-segmentation and over-merging errors, and improves the accuracy of segmentation boundaries.
Smart Images

Figure CN118552735B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image segmentation, and in particular to an image instance segmentation method based on a segmentation model. Background Art
[0002] Instance segmentation aims to separate multiple instances of the same class within an image. Instance segmentation plays a crucial role in biological image analysis. It not only identifies and examines the morphology, distribution, and phenotypic characteristics of biological entities, but also provides key visual information to help scientists and researchers understand the growth and development processes of various organisms.
[0003] Existing instance segmentation methods for biological images can be categorized into proposal-based and proposal-free methods. Proposal-based instance segmentation methods (e.g., K. He, et al., "Mask R-CNN," in Proceedings of the IEEE International Conference on Computer Vision, 2017; D. Liu, et al., "Nucleisegmentation via a deep panoptic model with semantic feature fusion," in International Joint Conference on Artificial Intelligence, 2018) first detect each instance using a bounding box, and then use a segmentation network to predict a mask within each bounding box. However, proposal-based instance segmentation methods rely heavily on the quality of the bounding boxes used for object detection. Specifically, due to the irregular shapes and dense distribution of instances in biological images, the instance bounding boxes generated by rectangular box-based detection methods often overlap. Furthermore, due to the large variation in instance size—for example, the soma and dendrite regions of neurons in electron microscopy images can differ by tens of times—proposal-based instance segmentation methods cannot fully detect instances whose size exceeds the model's receptive field when using neural networks with a fixed receptive field. Therefore, in order to solve the above problems, researchers have proposed proposal-free methods that do not rely on bounding boxes (such as X. Liu, et al., “Cross-dimension affinity distillation for3d em neuron segmentation”, in Proceedings of the IEEE / CVF Conference onComputer Vision and Pattern Recognition, 2024; Y. Liu, et al., “Affinityderivation and graph merge for instance segmentation”, in Proceedings of theEuropean Conference on Computer Vision, 2018).Proposal-free methods first predict image embeddings or morphological features and then apply post-processing algorithms to generate the final instance segmentation results. For example, they use the mean drift algorithm (K. Fukunaga, et al., “The estimation of the gradient of a density function, with applications in pattern recognition”, in IEEE Transactions on Information Theory, 1975) and the graph cut algorithm (X. Liu, et al., “Multicut brings automated neuritesegmentation closer to human performance”, in Nature Methods, 2017) for neuron segmentation. However, proposal-free methods rely heavily on hand-crafted post-processing algorithms, which have poor robustness and make it difficult to obtain accurate instance boundaries.
[0004] In the past two years, large-scale visual models, such as the Segment Anything Model (SAM), have revolutionized the field of image segmentation due to their powerful representation and recognition capabilities. For example, SAM performs fully automatic instance segmentation by first automatically dividing the image into a regular grid and then performing segmentation at each grid point. When faced with instance objects of varying sizes, SAM uses non-maximum suppression to merge overlapping instances based on the segmentation results of uniform grid points. However, because SAM is trained on large-scale natural image datasets, directly applying it to biological images with instances that have similar appearance and texture, complex morphology, and dense distribution has been difficult to achieve satisfactory results. Specifically, SAM has limited ability to handle the complex spatial relationships between instances in biological images, frequently resulting in over-segmentation and over-merging errors. Furthermore, SAM's ability to capture the complex morphology and fine structure of instances in biological images is poor, resulting in poor instance boundary segmentation accuracy and incomplete segmentation errors. Summary of the Invention
[0005] In order to solve the above technical problems, the present invention provides an image instance segmentation method based on segmenting all large models.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] An image instance segmentation method based on a segmentation model, wherein the instance segmentation model used can segment instances in an input image to obtain instance segmentation results; the method specifically comprises the following steps:
[0008] Step 1: Construction of graph neural network based on superpixels: Perform superpixel segmentation to obtain multiple superpixels; construct an undirected graph G based on superpixels: use superpixels as nodes of the undirected graph G, and establish edges between the nodes corresponding to two adjacent superpixels; extract the image by segmenting the image encoder of all large models The SAM embedding vector in the image is extracted through the U-Net two-way segmentation model The instance context embedding vector and instance-aware embedding vector in the image are concatenated; the SAM embedding vector, the context embedding vector and the instance-aware embedding vector are concatenated and the concatenated embedding vector is used as the node feature; the average affinity of the pixels on the overlapping boundary of two adjacent superpixels is calculated to obtain the affinity graph edge feature. , calculate the cosine similarity between the grayscale histograms of adjacent superpixels to obtain the cosine similarity edge feature , the intersection-over-union (IoU) between two adjacent superpixel segmentation masks is used as the edge feature based on SAM ; The affinity graph edge features , cosine similarity edge feature and SAM-based edge features Perform serial merging and use the merged features as edge features; construct an initial graph neural network based on the undirected graph, node features, and edge features;
[0009] Step 2: Prompt aggregation based on graph neural networks: The graph neural network aggregates node features of adjacent nodes by updating node features to capture the structural information of the undirected graph; updates edge features based on the feature similarity between adjacent nodes; shortens the distance in feature space between node features corresponding to superpixels from the same instance, increases the distance in feature space between node features corresponding to superpixels from different instances, and sets a distance threshold to determine whether the superpixels corresponding to two nodes connected by an edge come from the same instance, thereby achieving edge classification;
[0010] Generate an initial hint for each superpixel, then merge all superpixels belonging to the same instance based on the edge classification results, and merge the initial hints of all superpixels belonging to the same instance to obtain the final hint;
[0011] Step 3: Input the final prompt into the prompt encoder of the segmentation model to get the prompt image embedding; Input the image encoder of the segmentation model to obtain image embedding; input the prompt image embedding and image embedding into the mask decoder of the segmentation model to obtain the mask containing the image Instance segmentation results of the binary segmentation masks of each instance in .
[0012] Furthermore, the pair of images Perform superpixel segmentation to obtain multiple superpixels. Construct an undirected graph G based on the superpixels. Use the superpixels as nodes of the undirected graph G, and establish edges between the nodes corresponding to two adjacent superpixels. Specifically,
[0013] The U-Net two-way segmentation model includes a U-Net encoder, a top branch decoder, and a bottom branch decoder; Input to the U-Net two-way segmentation model to obtain the affinity map, and then use the seeding watershed algorithm to convert the affinity map into superpixels; the i-th superpixel As the i-th node of the undirected graph G ; If superpixel and superpixels are adjacent in space, then at the i-th node and the jth node Create an edge between them.
[0014] Furthermore, in step 1, the image encoder extracts the image by segmenting all large models The SAM embedding vector in the image is extracted through the U-Net two-way segmentation model The instance context embedding vector and instance-aware embedding vector in , specifically including:
[0015] Extracting the SAM embedding vector by segmenting the image encoder of the large model with frozen parameters;
[0016] The U-Net two-way segmentation model includes a U-Net encoder, a top branch decoder, and a bottom branch decoder. The top branch of the U-Net two-way segmentation model includes a U-Net encoder and a top branch decoder. The bottom branch of the U-Net two-way segmentation model includes a U-Net encoder and a bottom branch decoder.
[0017] Utilize the bottom branch of a trainable U-Net two-way segmentation model to predict images The affinity graph is then extracted, and the embedding of the penultimate layer of the network of the bottom branch is used as the instance context embedding vector to enhance the boundary information of each instance;
[0018] The instance-aware embedding vector is generated using the top branch of a trainable U-Net two-way segmentation model.
[0019] Furthermore, the image encoder that segments all large models and the U-Net two-way segmentation model constitute the feature extraction module;
[0020] In the feature extraction module, the image is predicted through the bottom branch of the U-Net two-way segmentation model The process of generating the affinity graph of the trained U-Net is called affinity graph branch, and the process of generating the instance-aware embedding vector using the top branch of the trainable U-Net is called instance-aware embedding branch.
[0021] Adopt affinity graph branch loss based on binary cross entropy loss To supervise the learning of the affinity graph branch:
[0022] ;
[0023] in, represents the cross entropy loss, Indicates passing Image of function activation No. The affinity of pixels, express The corresponding target affinity, is an image The number of pixels in ;
[0024] The instance-aware embedding branch is implemented through the discriminative loss To conduct supervision:
[0025] ;
[0026] in:
[0027] ;
[0028] ;
[0029] ;
[0030] in, 、 、 represent variance loss, distance loss, and regularization loss respectively; is the number of instances in an image in the labeled data, is an instance The number of pixels in Representation instance Middle The feature vector of pixels, 、 、 is an instance , Examples , Examples The average embedding of and are the inner distance and outer distance of the set instance respectively; express distance, express function;
[0031] The total loss of the feature extraction module for: ;
[0032] 、 、 and is the weight parameter;
[0033] Based on total loss The feature extraction module is trained and the encoder of all segmentation models is frozen during training.
[0034] Furthermore, in step 2, the distance between node features corresponding to superpixels from the same instance in the feature space is shortened, the distance between node features corresponding to superpixels from different instances in the feature space is increased, and a distance threshold is set to determine whether the superpixels corresponding to two nodes connected by an edge are from the same instance, thereby achieving edge classification, which specifically includes:
[0035] Define labels for edge classifications : Representative Node and nodes From the same instance, Representative Node and nodes From different instances or not adjacent; through the repulsion-attraction loss, features from different instance nodes are kept away from each other, while features from the same instance nodes are kept close to each other;
[0036] Repulsion-attraction loss for:
[0037] ;
[0038] ;
[0039] in, Representation node and nodes The repulsion-attraction loss between Indicates the total number of nodes, Represents nodes respectively and nodes The eigenvector of express distance, express function, is the distance threshold between two node features from different instances.
[0040] Furthermore, in step 2, generating an initial hint for each superpixel specifically includes:
[0041] The initial hint for each superpixel includes point hint and mask hint;
[0042] For images The superpixel segmentation result during superpixel segmentation is used as the mask hint of the superpixel;
[0043] A rectangular area is cropped according to the bounding box of each superpixel, and the Euclidean distance transform of the superpixels in the rectangular area is calculated to obtain a distance map; then, the local peak of the distance map is detected as the point prompt of the superpixel.
[0044] Compared with the prior art, the beneficial technical effects of the present invention are:
[0045] This paper proposes a novel biological instance segmentation model based on SAM to enhance the accuracy of biological instance segmentation. To address the challenges of SAM in biological image segmentation, this paper generates SAM hints based on a superpixel-based graph neural network, which can effectively solve the problems of over-segmentation, under-segmentation, and inaccurate segmentation boundaries. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. The drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.
[0047] Figure 1 A system framework diagram of the instance segmentation model provided by an embodiment of the present invention.
[0048] Figure 2 A diagram of a method for constructing a superpixel-based graph neural network provided in an embodiment of the present invention.
[0049] Figure 3 Schematic diagram of the SAM-based edge feature calculation method provided in an embodiment of the present invention.
[0050] Figure 4 Schematic diagram of the prompt aggregation method based on graph neural network provided in an embodiment of the present invention.
[0051] Figure 5 A schematic diagram of extracting point prompts provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] A preferred embodiment of the present invention will be described in detail below with reference to the accompanying drawings.
[0053] The present invention provides a method for biological image instance segmentation based on a large segmentation model. The main idea is to perform biological image instance segmentation based on the powerful representation and segmentation capabilities of SAM. Specifically, it includes: generating superpixels based on a graph neural network to generate high-quality prompts for SAM, and then combining SAM's powerful image processing capabilities to improve the accuracy of instance segmentation in biological images. Compared with the uniform grid point prompts automatically generated by SAM, the prompts generated by the present invention capture richer instance spatial position distribution information and instance boundary morphology information. The overall technical solution of the present invention includes the following steps:
[0054] Step 1, superpixel-based hint generation, specifically includes:
[0055] Step 11: Construction of graph neural network based on superpixels:
[0056] SAM has limited processing capabilities for complex spatial relationships between instances in biological images and often produces over-merging errors. Therefore, the present invention generates a large number of superpixels as graph neural network nodes to reduce over-merging errors. Then, the present invention constructs a graph neural network based on superpixels, integrates aggregated context information based on the graph neural network, and aggregates the initial superpixels. In order to improve the feature representation capability of the graph neural network, the present invention fully utilizes the prior information of SAM in the process of extracting node features and edge features. Specifically, the present invention uses the embedding of SAM's image encoder as the node feature, and uses the intersection-over-union ratio between adjacent masks predicted by SAM as the edge feature. In addition, in order to better extract the relationship between superpixels, the present invention uses the cosine similarity between grayscale histograms as the edge feature.
[0057] Step 12: Prompt aggregation based on graph neural network:
[0058] To generate high-quality SAM hints, we propose a hint aggregation method based on graph neural networks. First, we generate point- and mask-based hints for each superpixel and use graph neural networks to predict relationships between superpixels to avoid over-segmentation errors. Second, we aggregate superpixel hints based on the edge classification results of the graph neural network to generate the final hint.
[0059] Step 2, SAM prediction based on hints:
[0060] Finally, to leverage SAM's superior ability to handle instance boundaries, the present invention uses the aggregated, high-quality final hints in SAM to predict the final instance segmentation results through SAM's hint encoder, image encoder, and mask decoder. Specifically, the present invention inputs the aggregated final hints into SAM's hint encoder and simultaneously inputs the two-dimensional image into the image encoder. The resulting hint image embedding and image embedding are then input into SAM's mask decoder to obtain the corresponding segmentation results for each hint.
[0061] Through the above method, the present invention can effectively perform instance segmentation on biological images. The present invention conducts experiments on four representative biological datasets, and the experimental results show that the method proposed by the present invention is superior to other existing methods.
[0062] Example
[0063] First, superpixels are generated for the input image. Each superpixel is then regarded as a node, and edges are added between the nodes corresponding to all adjacent superpixels. A graph neural network is then used to predict the relationship between superpixels, and this is regarded as a binary classification method for predicting edges between adjacent superpixels. Secondly, the present invention generates hints for each superpixel and aggregates the superpixel hints based on the edge classification results of the graph neural network. Finally, the obtained feature embedding is input into the mask decoder of SAM to obtain the final segmentation result.
[0064] Each part will be explained in detail next.
[0065] 1. Superpixel-based hint generation:
[0066] Considering that SAM is not good at capturing and representing spatial position information and complex morphological information when processing densely distributed and complex morphological objects in biological images, this paper proposes a superpixel-based hint generation method to obtain high-quality initial hints. Figure 1 As shown in the figure, the present invention first generates a set of superpixels, then uses a graph neural network to predict the relationship between adjacent superpixels. Finally, the present invention generates superpixel-based hints based on the results of the graph neural network.
[0067] 1.1, Graph Neural Network Generation Based on Superpixels:
[0068] 1.1.1, Construction of graph neural network based on superpixel:
[0069] First, construct an undirected graph ,in Indicates inclusion A node set of nodes, represents an edge set, where ,and yes The first-order neighbors of . Figure 2 As shown in FIG, the present invention first generates superpixels and then converts them into a region adjacency graph. The present invention then treats each superpixel as a node and adds edges between the nodes corresponding to all adjacent superpixels. Specifically, a U-Net encoder and a two-branch decoder can be used. An affinity graph is generated from a decoder of one branch and then converted into a superpixel using a seeding watershed algorithm. Each superpixel Considered as an undirected graph A node in If two superpixels and If they are spatially adjacent, an edge is established between their corresponding nodes. The node and edge features in the graph will be explained in more detail later.
[0070] 1.1.2, Node Features:
[0071] The present invention uses node features composed of three types of image embeddings, including: (1) SAM embedding vectors: The present invention extracts SAM embedding vectors through the encoder of SAM with frozen parameters; (2) instance context embedding vectors: The present invention uses the bottom branch of a trainable U-Net two-way segmentation model to predict the affinity graph, and then extracts the embedding of the second-to-last layer of the bottom branch network as the instance context embedding vector to enhance the boundary information of each instance; (3) instance-aware embedding vectors: The present invention generates instance-aware embedding vectors from the top branch of a trainable U-Net two-way segmentation model.
[0072] The present invention adopts a binary cross entropy loss function to supervise the learning of affinity graph branches:
[0073] ;
[0074] in, represents the cross entropy loss, Indicates passing Function activation The affinity of pixels, represents the target affinity, is the number of pixels in the input image.
[0075] The instance-aware embedding branch is supervised by a discriminative loss to ensure that pixels of different instances are distinguishable in the feature space. The discriminative loss consists of three terms:
[0076] ;
[0077] ;
[0078] ;
[0079] in, 、 、 represent variance loss, distance loss, and regularization loss respectively, is the number of instances of an image in the labeled data, is an instance The number of pixels in Representation instance No. The feature vector of pixels, is an instance The average embedding of . and are the inner distance and outer distance of different instances respectively. In a preferred embodiment, and . express distance, express Function. The discriminative loss is the weighted sum of the above three items: In a preferred embodiment, setting , The total loss of the feature extraction module Expressed as In a preferred embodiment, .
[0080] 1.1.3, Edge Features:
[0081] This paper comprehensively considers SAM and superpixel segmentation processes and adopts three edge features: (1) affinity graph edge feature The present invention calculates two adjacent superpixels The average affinity of pixels on the overlapping boundary is obtained (2)Cosine similarity edge feature : In order to enhance the model's ability to identify the differences in texture and pattern within an instance, the present invention calculates the cosine similarity between the grayscale histograms of adjacent superpixels as an edge feature. (3) Edge features based on SAM : In order to introduce information about the spatial and structural relationship of adjacent superpixels, the present invention uses the intersection-over-union metric between the masks predicted by SAM as the feature embedding of the edge. Figure 3 As shown, each superpixel is sent to SAM as an independent hint to predict a new segmentation map. Then, the present invention calculates a pair of adjacent superpixels The intersection-over-union ratio between segmentation masks.
[0082] 1.2, Prompt aggregation based on graph neural network:
[0083] 1.2.1, Aggregation Algorithm of Graph Neural Network:
[0084] like Figure 4 As shown in Figure 2, the present invention uses a graph neural network to predict the relationship between superpixels. The graph neural network is set to include three layers of equivariant graph neural network (EGNN), and two modules are designed in each layer of EGNN, respectively for updating node features and edge features. The node feature matrix of the graph neural network is expressed as ,in Representing a collection midpoint of dimensional feature vector. Superpixel aggregation can be viewed as a binary classification of edges between adjacent superpixels. To achieve this, the present invention uses an edge feature tensor As a variant of the adjacency matrix. The initial edge features of the first layer of EGNN Set to:
[0085] ;
[0086] in, Represents a splicing operation, express edge features. Represents the aggregate score, reflecting the two adjacent nodes The probability of merging, and Reflects two adjacent nodes The probability of maintaining separation. The update of node features is used to aggregate the features of adjacent nodes, thereby capturing the structural information of the graph. The formula for the node feature update process can be described as:
[0087] ;
[0088] in It is the first The node characteristics of the nodes, is a multi-layer perceptron.
[0089] After the node features are updated, each pair of adjacent nodes is predicted The feature similarity between To update the edge feature. Updated to:
[0090] ;
[0091] ;
[0092] in Refers to a multilayer perceptron using a sigmoid activation function; Indicates the The edge features of the layer, Representation node and nodes The feature similarity between Indicates the Aggregate score of the layer, Indicates the Layer two adjacent nodes Probability of keeping separate.
[0093] The edge features are then updated using normalization to ensure Each element in can fall within the range [0,1]. Each layer of EGNN generates an updated edge feature tensor To aggregate superpixels, the average score is calculated from all EGNN layers.
[0094] 1.2.2, Repulsion-attraction loss:
[0095] To enhance the discrimination between superpixels in the feature space, we use the repulsion-attraction (RA) loss proposed by Liu, et al. (Liu, et al., “Biological Instance Segmentation with a Superpixel-GuidedGraph”, in International Joint Conference on Artificial Intelligence, 2022). For a clearer description, we define the labels for edge classification: Represents adjacent nodes and When coming from the same instance; represent and From different instances or they are not adjacent. If superpixels come from different instances, their node features should be far away in the feature space. On the contrary, node features from the same instance should be close in the feature space. Unlike pixel-level discriminant loss, repel-attract loss is specifically designed for the discrimination between node features. Repel-attract loss ensures that node features of different instances (such as node A and node B) repel each other, while node features of the same instance (such as node A and node C) attract each other. The formula of repel-attract loss can be expressed as:
[0096] ;
[0097] ;
[0098] in express distance, express function, is the distance threshold between two node features from different instances. In this embodiment, .
[0099] 1.2.3, Maximum and minimum aggregation score loss:
[0100] The maximum and minimum edges between nodes can be used to measure the global connectivity between nodes and optimize the aggregation effect of the graph. To find this edge, the maximum spanning tree can be used to find the minimum edge in each path connecting the pair of nodes, and then the largest edge among these minimum edges is selected as the maximum and minimum edge. In order to optimize the global result, the present invention uses the maximum and minimum aggregation score loss proposed by Liu, et al. (Liu, et al., "Biological Instance Segmentation with a Superpixel-GuidedGraph", in International Joint Conference on Artificial Intelligence, 2022) To supervise the learning process of edge features:
[0101] ;
[0102] ;
[0103] ;
[0104] in, Representation node The set of all possible paths between Indicates at the connection point and The path with the largest and smallest edges among all the paths in Represents the predicted aggregate score of the maximum and minimum edges.
[0105] 1.2.4, prompt generation:
[0106] like Figure 4As shown, the present invention generates a point-based and mask-based hint for each superpixel, and then aggregates the superpixel hints to generate the final hint based on the edge classification results of the graph neural network. Specifically, the hint form of SAM can be points, boxes, and masks. Because the mask itself contains box information, the present invention no longer uses the box as a hint. Therefore, for each superpixel, a mask hint and a point hint are first generated. The segmentation result of each superpixel is used as a mask hint. In addition, for point hints, the present invention specially designs a point hint extraction method. As shown Figure 5 As shown in the figure, a rectangular area is first cropped according to the bounding box of each superpixel and its Euclidean distance transform is calculated. Then, the local peak of the distance field of the region is detected as a point prompt. Finally, the present invention aggregates the superpixel prompts based on the results of the superpixel-based graph neural network calculated previously to obtain the final prompt Collection ,in Indicates the number of final prompts.
[0107] 2. SAM prediction based on hints:
[0108] like Figure 1 As shown, for each image , the present invention utilizes each final prompt Get the final segmentation result:
[0109] ;
[0110] ;
[0111] ;
[0112] in 、 and They are the image encoder, hint encoder and mask decoder of SAM. is the image embedding obtained by the image encoder, is the hint image embedding obtained by the hint encoder. Represents three prediction confidence scores The present invention selects the binary segmentation mask with the highest confidence as the final prediction result.
[0113] 3. Overall framework:
[0114] The method proposed in this paper is mainly divided into two steps. The first step is to generate hints based on superpixels, and the second step is to predict SAM based on hints. Figure 1As shown in Figure 2. The first step consists of two stages: the construction of a graph neural network based on superpixels and the aggregation of hints based on graph neural networks. In the construction stage of a graph neural network based on superpixels, as shown in Figure 2. Figure 2 As shown in , the present invention first generates superpixels for the input image, then treats each superpixel as a node and adds edges between all adjacent superpixels. The present invention uses SAM embedding vectors, instance context embedding vectors, and instance-aware embedding vectors as node features, and uses affinity graph edge features, cosine similarity edge features, and SAM-based edge features as edge features. In the prompt aggregation stage based on graph neural networks, as shown in Figure 4 As shown in Figure 2, the present invention generates point- and mask-based hints for each superpixel and uses a graph neural network to predict the relationship between superpixels. The present invention then aggregates the superpixel hints based on the results of the graph neural network to generate the final hint.
[0115] In the second step, the aggregated final hint is input into SAM’s hint encoder, and the 2D image is input into the image encoder. The resulting hint masker embedding and image encoder embedding are then input into SAM’s mask decoder to obtain the final segmentation result.
[0116] Table 1a, Segmentation results of the neuron dataset in the superpixel generation stage
[0117]
[0118] Table 1b, Final segmentation results of the neuron dataset
[0119]
[0120] As shown in Tables 1a and 1b, this paper uses the AC3 / AC4, CREMIA, CREMIB, and CREMIC datasets (see CREMI, “MICCAI challenge on circuit reconstruction from electron microscopy images”, https: / / cremi.org / , 2016). CREMI-Total represents the combined CREMIA, CREMIB, and CREMIC datasets. The paper then tests the proposed method on the MALA model, the LMC model, the BISSG model (see X. Liu, et al., “Bological instance segmentation with a superpixel-guided graph”, in International Joint Conference on Artificial Intelligence, 2022), the SAM-grid model, the SAM-box model, and the instance segmentation model of this paper. This paper uses the ARAND metric (see WM Rand, “Objective criteria for the evaluation of clustering methods”, in Journal of the American Statistical Association, 1971) and the VOI metric (see M. Meila, “Comparing clusterings by the variation of information,”, in Learning Theory and Kernel Machine, 2003) to evaluate the final segmentation results. The ARAND metric is adapted from the RAND score (see I. Arganda-Carrer, et al., “Crowdsourcing the creation of image segmentation algorithms for connectomics”, in Frontiers in neuroanatomy, 2015):
[0121] ;
[0122] in and Represents the RAND scores of instance segmentation and merging respectively. The VOI indicator detects the segmentation result by calculating the cumulative conditional entropy between the over-segmentation error and the over-merging error. The formula is as follows:
[0123] ;
[0124] in represents the conditional entropy, Represents the prediction result, and G represents the true label. and Two indicators, representing the VOI results of over-segmentation error and over-merging error. In addition, 、 ,VOI-s, and ARAND-s are used to detect the segmentation results in the superpixel generation stage. In Table 1a and Table 1b, “↓” indicates that the smaller the indicator, the better the model effect.
[0125] Table 2, BBC039V1 dataset segmentation results
[0126]
[0127] As shown in Table 2, the present invention was tested on the Mask R-CNN model, Cell R-CNN model, UPSNetN model, JSISNet model, PanFPN model, OANet model, AUNet model, Cell R-CNNv2 model, PFFNet model, BISSG model (see X. Liu, et al., “Bological instance segmentation with a superpixel-guided graph”, in International Joint Conference on Artificial Intelligence, 2022), SAM-grid model, SAM-box model, and the instance segmentation model of the present invention. The final segmentation results were evaluated using the AJI, Dice, F1, and PQ metrics. In Table 2, "↑" indicates that the larger the metric, the better the model performance.
[0128] Table 3. HEK293T dataset results
[0129]
[0130] As shown in Table 3, the present invention has achieved significant improvements in the Mask RCNN w / ResNet-50 model (see K. He, et al., "Mask R-CNN", in Proceedings of the IEEE international conference on computer vision, 2017), the Mask RCNN w / ResNeST-50 model (see H. Zhan, et al., "ResNeSt:Split-attention networks", in Proceedings of the IEEE / CVF conference oncomputer vision and pattern recognition, 2022), the PointRend model, the Mask RCNN w / Swin-Tiny model (see Z. Liu, et al., "Swin Transformer: Hierarchical vision transformer using shifted windows", in Proceedings of the IEEE / CVFinternational conference on computer vision, 2021), the Cascade Mask R-CNN model, the Hybrid Task Cascade model, the MViTv2 model, and the SCTS model (see Y. Zhou, et al., "SCTS:Instance segmentation of single cells using a transformer-based semantic-aware model and space-filling augmentation”, in Proceedings of the IEEE / CVFWinter Conference on Applications of Computer Vision, 2023), Cascade SCTS model (see Y. Zhou, et al.The results were tested on the following models: “SCTS: Instance segmentation of single cells using a transformer-based semantic-aware model and space-filling augmentation”, inProceedings of the IEEE / CVF Winter Conference on Applications of Computer Vision, 2023), the BISSG model (see X. Liu, et al., “Bological instance segmentation with a superpixel-guided graph”, inInternational Joint Conference onArtificial Intelligence, 2022), the SAM-grid model, the SAM-box model, and the instance segmentation model of our present invention. The AP, AP50, and AP75 metrics were used to evaluate the final segmentation results. In Table 3, “↑” indicates that the larger the metric, the better the model.
[0131] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. It is intended that all variations within the meaning and range of equivalents of the claims be embraced herein, and any reference signs in the claims should not be construed as limiting the claims to which they relate.
[0132] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
Claims
1. A method for image instance segmentation based on a segmentation model, characterized in that: The instance segmentation model used can segment instances in the input image to obtain instance segmentation results; specifically, the following steps are included: Step 1: Construction of graph neural network based on superpixels: Perform superpixel segmentation to obtain multiple superpixels; construct an undirected graph G based on superpixels: use superpixels as nodes of the undirected graph G, and establish edges between the nodes corresponding to two adjacent superpixels; extract the image by segmenting the image encoder of all large models The SAM embedding vector in the image is extracted through the U-Net two-way segmentation model The instance context embedding vector and instance-aware embedding vector in the graph are concatenated; the SAM embedding vector, the context embedding vector and the instance-aware embedding vector are concatenated, and the concatenated embedding vector is used as the node feature; the average affinity of the pixels on the overlapping boundary of two adjacent superpixels is calculated to obtain the affinity graph edge feature , calculate the cosine similarity between the grayscale histograms of adjacent superpixels to obtain the cosine similarity edge feature , the intersection-over-union ratio between two adjacent superpixel segmentation masks is used as the edge feature based on SAM ; The affinity graph edge features , cosine similarity edge feature and SAM-based edge features Perform serial merging and use the merged features as edge features; construct an initial graph neural network based on the undirected graph, node features, and edge features; Step 2: Prompt aggregation based on graph neural network: The graph neural network aggregates the node features of adjacent nodes by updating the node features to capture the structural information of the undirected graph; the edge features are updated by the feature similarity between adjacent nodes; By shortening the distance between the node features corresponding to superpixels from the same instance in the feature space, increasing the distance between the node features corresponding to superpixels from different instances in the feature space, and setting a distance threshold, it is possible to determine whether the superpixels corresponding to two nodes connected by an edge are from the same instance, thereby achieving edge classification; specifically, it includes: Define labels for edge classifications : Representative Node and nodes From the same instance, Representative Node and nodes From different instances or not adjacent; through the repulsion-attraction loss, features from different instance nodes are kept away from each other, while features from the same instance nodes are kept close to each other; Repulsion-attraction loss for: ; ; in, Representation Node and nodes The repulsion-attraction loss between Represents the total number of nodes, Respectively represent nodes and nodes The characteristic vector of express distance, express function, is the distance threshold between two node features from different instances; An initial hint is generated for each superpixel, and then all superpixels belonging to the same instance are merged based on the edge classification result, and the initial hints of all superpixels belonging to the same instance are merged to obtain a final hint; generating an initial hint for each superpixel specifically includes: The initial hint for each superpixel includes point hint and mask hint; For images When performing superpixel segmentation, the superpixel segmentation result is used as a mask hint of the superpixel; A rectangular area is cut out according to the bounding box of each superpixel, and the Euclidean distance transform of the superpixels in the rectangular area is calculated to obtain a distance map; then, the local peak of the distance map is detected as the point prompt of the superpixel; Step 3: Input the final prompt into the prompt encoder of the segmentation model to get the prompt image embedding; Input the image encoder of the segmentation model to obtain the image embedding; input the prompt image embedding and the image embedding into the mask decoder of the segmentation model to obtain the image Instance segmentation results of the binary segmentation masks of each instance in .
2. The image instance segmentation method based on the segmentation model according to claim 1 is characterized in that: The pair of images Perform superpixel segmentation to obtain multiple superpixels, construct an undirected graph G based on the superpixels, use the superpixels as nodes of the undirected graph G, and establish edges between the nodes corresponding to two adjacent superpixels, specifically including: The U-Net two-way segmentation model includes a U-Net encoder, a top branch decoder, and a bottom branch decoder; Input to the U-Net two-way segmentation model to obtain the affinity map, and then use the seeding watershed algorithm to convert the affinity map into superpixels; the i-th superpixel As the i-th node of the undirected graph G ; If the superpixel and superpixels If they are adjacent in space, then at the i-th node and the jth node Create an edge between them.
3. The image instance segmentation method based on the segmentation model according to claim 1 is characterized in that: In step 1, the image encoder extracts the image by segmenting all large models The SAM embedding vector in the image is extracted through the U-Net two-way segmentation model The instance context embedding vector and instance-aware embedding vector in , specifically including: Extracting the SAM embedding vector by segmenting the image encoder of the large model with frozen parameters; The U-Net two-way segmentation model includes a U-Net encoder, a top branch decoder, and a bottom branch decoder; the top branch of the U-Net two-way segmentation model includes a U-Net encoder and a top branch decoder; the bottom branch of the U-Net two-way segmentation model includes a U-Net encoder and a bottom branch decoder; Utilize the bottom branch of a trainable U-Net two-way segmentation model to predict images The affinity graph is then extracted from the penultimate layer of the network of the bottom branch as the instance context embedding vector to enhance the boundary information of each instance; The instance-aware embedding vector is generated using the top branch of a trainable U-Net two-way segmentation model.
4. The image instance segmentation method based on the segmentation model according to claim 3 is characterized in that: The image encoder that segments all large models and the U-Net two-way segmentation model constitute the feature extraction module; In the feature extraction module, the bottom branch of the U-Net two-way segmentation model is used to predict the image The process of generating the affinity graph of the trainable U-Net is called affinity graph branch, and the process of generating the instance-aware embedding vector using the top branch of the trainable U-Net is called instance-aware embedding branch. Adopt affinity graph branch loss based on binary cross entropy loss To supervise the learning of the affinity graph branch: ; in, represents the cross entropy loss, Indicates that Image of function activation No. The affinity of pixels, express The corresponding target affinity, is an image The number of pixels in ; The instance-aware embedding branch is implemented through a discriminative loss To conduct supervision: ; in: ; ; ; in, , , Represent variance loss, distance loss and regularization loss respectively; is the number of instances in an image in the labeled data, is an instance The number of pixels in Representation instance Middle The feature vector of pixels, , , is an instance , Examples , Examples The average embedding of and They are the inner distance and outer distance of the set instance respectively; express distance, express function; The total loss of the feature extraction module for: ; , , and is the weight parameter; Based on total loss The feature extraction module is trained and the encoder of all segmentation models is frozen during training.
