A method for training a cell boundary recognition model and a method for cell boundary recognition.

By combining staining image data and gene expression data, a cell boundary recognition model was trained, which solved the problem of loss of morphological and positional information in cell boundary recognition and improved the recognition accuracy.

CN119049047BActive Publication Date: 2026-07-17HAINAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HAINAN UNIV
Filing Date
2024-08-29
Publication Date
2026-07-17

Smart Images

  • Figure CN119049047B_ABST
    Figure CN119049047B_ABST
Patent Text Reader

Abstract

This invention discloses a cell boundary recognition model training method and a cell boundary recognition method, applied in the field of biomedical engineering. It involves acquiring cell nuclear staining images and corresponding gene expression matrices of target tissues, extracting positional, distance, and gene expression information of each image point as features from these data, and training a cell boundary recognition model by selecting positive and negative samples from the image points. The trained model then identifies non-sample points, distinguishing between points outside and inside the cell boundary, thereby recognizing the cell boundary. By extracting features from the staining image data and gene expression data, a neural network is trained to adaptively learn the position of sample points in the image relative to the cell center, thus determining whether a point in the image is at the cell boundary. Compared to cell boundary recognition based solely on staining image data, this method improves the accuracy of cell boundary recognition.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese Patent Application No. 2024106674393, filed on May 28, 2024, entitled "A Method for Training a Cell Boundary Recognition Model and a Method for Recognizing Cell Boundaries," the entire contents of which are incorporated herein by reference. This application also claims priority to Chinese Patent Application No. 2024108358206, filed on June 26, 2024, entitled "A Method for Training a Cell Boundary Recognition Model and a Method for Recognizing Cell Boundaries," the entire contents of which are incorporated herein by reference. Technical Field

[0002] This invention relates to the field of biomedical engineering, and in particular to a cell boundary recognition model training method, a cell boundary recognition method, a cell boundary recognition model training device, an electronic device, and a computer-readable storage medium. Background Technology

[0003] Cell type identification plays a crucial role in biology and medicine, serving as a key component in biological phenomenon analysis, disease pathogenesis analysis, cell lineage analysis, cell differentiation trajectory analysis, and intercellular communication analysis. Cell boundary identification is a core step in cell type identification. Current technologies generally utilize staining image data from spatial transcriptomics for cell boundary identification. However, during the acquisition of staining image data, morphological and positional information of cells is lost, and the data itself contains a mixture of nuclear, cytoplasmic, and / or cell membrane signals, resulting in low accuracy in cell boundary identification. Gene expression data from spatial transcriptomics characterizes the gene expression status of image points. Generally, there is no gene expression or extremely low gene expression intensity outside the boundaries. Therefore, gene expression data from spatial transcriptomics can be used for boundary identification. Summary of the Invention

[0004] The purpose of this invention is to provide a cell boundary recognition model training method, cell boundary recognition method, cell boundary recognition model training device, electronic device, and computer-readable storage medium, which are applied in the field of biomedical engineering. This method combines staining image data and gene expression data from spatial transcriptome data to extract features from the staining image data and gene expression data to train a neural network to adaptively learn the position of sample points in the image relative to the cell center, thereby determining whether the points in the image are at the cell boundary. Compared with cell boundary recognition based solely on staining image data, this method improves the accuracy of cell boundary recognition.

[0005] To address the aforementioned technical problems, this invention provides a method for training a cell boundary recognition model, comprising:

[0006] Obtain the cell nuclear staining image and the corresponding gene expression matrix of the target tissue, and input the cell nuclear staining image into the cell nuclear segmentation model to obtain the cell nuclear segmentation image;

[0007] Gene expression information for each image point in the cell nuclear staining image is determined based on the gene expression matrix; the gene expression information characterizes whether a gene is expressed at the image point.

[0008] Determine the distance and position information of the image point; the distance information is the distance from the image point to the center of the nearest neighbor cell nucleus, and the position information is the coordinates of the image point and the direction from the image point to the center of the nearest neighbor cell nucleus;

[0009] The image points in the cell nucleus stained image are grouped to obtain multiple point sets. Positive sample point sets and negative sample point sets are selected from the point sets of the cell nucleus segmentation image. Among them, the image points in the positive sample point set are all located inside the cell nucleus, the distance of each image point in the negative sample point set from the nearest cell nucleus center is greater than a preset distance, and the sum of gene expression intensity at each image point is less than a preset threshold.

[0010] The gene expression information, location information, and distance information of each image point in the positive sample point set and the negative sample point set are obtained as sample features, and a cell boundary recognition model is trained based on the sample features.

[0011] Optionally, determining the gene expression information of each image point in the nuclear staining image based on the gene expression matrix includes:

[0012] The mean and variance of expression intensity of each gene are calculated based on the gene expression matrix.

[0013] The regression model is determined based on the regression algorithm to identify the mean and variance of the expression intensity, and the abnormal gene expression matrix is ​​removed based on the regression model.

[0014] The variance of the expression intensity of each gene was normalized and sorted in ascending order;

[0015] Select the first preset number of genes corresponding to the expression intensity variance as target genes;

[0016] Determine the target gene expression matrix of the target gene, and determine whether the target gene is expressed at image points based on the target gene expression matrix;

[0017] If so, the gene expression information of the target gene at the image point is recorded as 1;

[0018] If not, the gene expression information of the target gene at the image point is recorded as 0.

[0019] Optionally, determining the distance and location information of the image points includes:

[0020] The distance information of the image point is determined based on the coordinates of the image point and the coordinates of the nearest neighbor cell nucleus center;

[0021] Identify image points within the cell nucleus, and input the coordinates of the image points within the cell nucleus and the coordinates of the nearest neighboring cell nucleus center into the direction model to determine the direction from the image points within the cell nucleus to the nearest neighboring cell nucleus center;

[0022] Set the direction from the image point outside the cell nucleus to the nearest cell nucleus center to 0;

[0023] The location information of the image points is determined based on the direction from the image point inside the cell nucleus to the nearest neighbor cell nucleus center, the direction from the image point outside the cell nucleus to the nearest neighbor cell nucleus center, and the coordinates of the image points.

[0024] The expression for the direction model is:

[0025] ;

[0026] In the formula, d The direction from an image point within the cell nucleus to the center of the nearest neighboring cell nucleus. These are the coordinates of the image points within the cell nucleus. represents the coordinates of the nearest neighbor nucleus center of the image point within the cell nucleus, arctan is the arctangent function, and floor is the floor function.

[0027] Optionally, the cell boundary recognition model includes an input layer, a feature extraction layer, and a fully connected layer;

[0028] The input layer includes a linear projection layer, a position encoding layer, and a distance encoding layer arranged in parallel. The linear projection layer is used to linearly project the gene expression information, the position encoding layer is used to encode the position information, and the distance encoding layer is used to encode the distance information.

[0029] The feature extraction layer comprises a second preset number of sequentially connected feature extraction sub-layers; each feature extraction sub-layer comprises a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multilayer perceptron layer, and a second residual module, which are sequentially connected; wherein, the input of the first residual module is the output of the first normalization layer and the self-attention mechanism layer, and the input of the second residual module is the output of the second normalization layer and the multilayer perceptron layer.

[0030] Optionally, the step of grouping the image points in the cell nuclear staining image to obtain multiple point sets includes:

[0031] Determine the Euclidean distance from the image point in the stained cell nucleus image to the nearest neighbor cell nucleus center;

[0032] Based on the Euclidean distance, the image points in the nearest neighbor third preset number of the cell nuclear staining images are selected as the point set.

[0033] Optionally, the method further includes:

[0034] The gene expression matrix is ​​aligned with the cell nuclear staining image based on affine transformation to eliminate alignment errors between the gene expression matrix and the cell nuclear staining image.

[0035] To solve the above-mentioned technical problems, the present invention provides a cell boundary recognition method, characterized in that it includes:

[0036] Obtain gene expression information, location information, and distance information from non-sample point sets;

[0037] The gene expression information, location information, and distance information are input into the cell boundary recognition model to obtain the classification result of the non-sample point set; the classification result of the non-sample point set indicates whether the non-sample point set is a point set inside the cell boundary;

[0038] Cell boundary identification is performed based on the classification results;

[0039] The cell boundary recognition model is a model trained according to the cell boundary recognition model training method.

[0040] To solve the above-mentioned technical problems, the present invention provides a cell boundary recognition model training device, characterized in that it comprises:

[0041] The first module is used to acquire the cell nuclear staining image of the target tissue and the corresponding gene expression matrix, and input the cell nuclear staining image into the cell nuclear segmentation model to obtain the cell nuclear segmentation image;

[0042] The second module is used to determine the gene expression information of each image point in the cell nuclear staining image based on the gene expression matrix; the gene expression information characterizes whether a gene is expressed at the image point.

[0043] The third module is used to determine the distance information and position information of the image point; the distance information is the distance from the image point to the center of the nearest neighbor cell nucleus, and the position information is the coordinates of the image point and the direction from the image point to the center of the nearest neighbor cell nucleus;

[0044] The fourth module is used to group the image points in the cell nucleus staining image to obtain multiple point sets, and select positive sample point sets and negative sample point sets from the point sets of the cell nucleus segmentation image; wherein, the image points in the positive sample point set are all located inside the cell nucleus, the distance of each image point in the negative sample point set from the nearest neighbor cell nucleus center is greater than a preset distance, and the sum of gene expression intensities at each image point is less than a preset threshold.

[0045] The fifth module is used to acquire the gene expression information, location information and distance information of each image point in the positive sample point set and the negative sample point set as sample features, and to train a cell boundary recognition model based on the sample features.

[0046] To solve the above-mentioned technical problems, the present invention provides an electronic device, comprising:

[0047] Memory, used to store computer programs;

[0048] A processor is used to implement the cell boundary recognition model training method and the cell boundary recognition method described above when executing the computer program.

[0049] To address the aforementioned technical problems, the present invention provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are executed by a processor, they implement the aforementioned cell boundary recognition model training method and the cell boundary recognition method.

[0050] As can be seen, the method of the present invention acquires the cell nucleus staining image of the target tissue and the corresponding gene expression matrix; determines the gene expression information of each image point in the cell nucleus staining image based on the gene expression matrix; the gene expression information characterizes whether the gene is expressed at the image point; determines the distance information and position information of the image point; the distance information is the distance from the image point to the nearest neighbor cell nucleus center, and the position information is the coordinates of the image point and the direction from the image point to the nearest neighbor cell nucleus center; inputs the cell nucleus staining image into the cell nucleus segmentation model to obtain the cell nucleus segmentation image, and groups the image points in the cell nucleus segmentation image to obtain multiple point sets; selects positive sample point sets and negative sample point sets from the point sets; wherein, the image points in the positive sample point sets are all located inside the cell nucleus, and the distance from each image point in the negative sample point set to the nearest neighbor cell nucleus center is greater than a preset distance, and the sum of the gene expression intensity at each image point is less than a preset threshold; obtains the gene expression information, position information and distance information of each image point in the positive sample point set and the negative sample point set as sample features, and trains a cell boundary recognition model based on the sample features. By combining staining image data and gene expression data from spatial transcriptome data, features of the staining image data and gene expression data are extracted to train a neural network to adaptively learn the position of sample points in the image relative to the cell center, thereby determining whether the points in the image are at the cell boundary. Compared with cell boundary recognition based solely on staining image data, this improves the accuracy of cell boundary recognition. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0052] Figure 1 A flowchart illustrating a cell boundary recognition model training method provided in an embodiment of the present invention;

[0053] Figure 2 This is a schematic diagram of the structure of a cell boundary recognition model provided in an embodiment of the present invention;

[0054] Figure 3 This is a structural block diagram of a cell boundary recognition model training device provided in an embodiment of the present invention. Detailed Implementation

[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0056] Spatial transcriptomics is an innovative technology that combines molecular biology and spatial mapping to detect gene expression patterns in different cell types within tissues, advancing research into cell-cell signaling and cell type tissue analysis. Recent breakthroughs in analytical techniques have fundamentally changed our understanding of multicellular biological systems and hold promise for solving previously intractable biological problems. Based on transcript detection strategies, spatial transcriptomics technologies can be broadly categorized into two main types: imaging-based and sequencing-based.

[0057] Existing technologies typically utilize nuclear / membrane staining image data obtained through imaging techniques to identify cell boundaries. However, during the acquisition of staining images, information about cell morphology and location is lost, and the staining image data itself contains a mixture of nuclear, cytoplasmic, and / or cell membrane signals, affecting the accuracy of cell boundary identification.

[0058] The method of this invention introduces gene expression data corresponding to tissue staining images, extracts features from cell nuclear staining image data and gene expression data for training a cell boundary recognition model, and improves the accuracy of cell boundary recognition by adaptively learning the position of each point in the staining image relative to the nearest neighbor cell center through a neural network.

[0059] The following combination Figure 1 , Figure 1 A flowchart of a cell boundary recognition model training method provided in an embodiment of the present invention, the method may include:

[0060] S101: Obtain the nuclear staining image of the target tissue and the corresponding gene expression matrix, and input the nuclear staining image into the nuclear segmentation model to obtain the nuclear segmentation image.

[0061] This embodiment can obtain the gene expression matrix corresponding to the set of cell nuclear staining images of the target tissue. The target tissue in this embodiment is the tissue that needs to be identified by cell boundary. This embodiment does not limit the specific type of the target tissue, which can be animal tissue or plant tissue. This embodiment also does not limit the specific method of obtaining cell nuclear staining images.

[0062] The gene expression matrix in this embodiment records the gene expression data of the target tissue. The gene expression matrix can be a multi-dimensional matrix, with each dimension containing the gene expression data of one gene, such as whether the gene is expressed and its expression intensity at each image point in a cell nuclear staining image. This embodiment does not limit the method of obtaining the gene expression matrix; generally, the gene expression matrix can be obtained through spatial transcriptomics technology.

[0063] In this embodiment, noise reduction processing can be performed on the nuclear staining image to eliminate noise. To eliminate alignment errors between the nuclear staining image and the gene expression matrix, this embodiment can align the nuclear staining image and the gene expression matrix using affine transformation.

[0064] In this embodiment, a cell nucleus staining image can be input into a cell nucleus segmentation model to obtain a segmented cell nucleus image. This embodiment does not limit the type of cell nucleus segmentation model; generally, it can be the Cellpose segmentation model, which is a general-purpose, deep learning-based cell segmentation method. The cell nucleus segmentation image allows for precise localization of the coordinates of each cell nucleus center, which is beneficial for determining the distance and direction of each image point from its nearest neighbor cell nucleus center.

[0065] S102: Determine the gene expression information of each image point in the cell nuclear staining image based on the gene expression matrix; the gene expression information characterizes whether a gene is expressed at the image point.

[0066] This embodiment can determine the gene expression information of each image point in a cell nucleus staining image based on a gene expression matrix. The gene expression information characterizes whether a gene is expressed at that image point. The gene expression information in this embodiment can be used as training features for a cell boundary recognition model.

[0067] Since not all genes are highly correlated with cell boundary recognition, this embodiment can screen for genes that are highly correlated with cell boundary recognition. Furthermore, due to errors in the experimental process, this embodiment can also remove abnormal gene expression matrices.

[0068] First, this embodiment can calculate the mean and variance of the expression intensity of each gene based on the gene expression matrix. In this embodiment, if a gene is expressed at an image point, the value at the corresponding image point in the gene expression matrix is ​​the gene expression intensity; if a gene is not expressed at an image point, the corresponding image point in the gene expression matrix is ​​empty.

[0069] Correspondingly, in this embodiment, the mean expression intensity can be calculated by summing the gene expression intensities at each image point and dividing by the number of image points where the gene is expressed. The variance of expression intensity can be calculated by summing the squares of the differences between the gene expression intensity at each image point and the mean expression intensity, and then dividing by the number of image points where the gene is expressed. For example, if a cell nucleus staining image has four image points, and gene A is expressed only at the first and second image points with expression intensities of 2 and 3 respectively, that is, the value at the first image point in the gene expression matrix of gene A is 2, the value at the second image point is 3, and the rest are empty, then the mean expression intensity of gene A is (2+3) / 2=2.5, and the variance of expression intensity is ((2.5-2) / 2). 2 +(3-2.5) 2 ) / 2=0.25.

[0070] Furthermore, this embodiment can determine a regression model for the mean and variance of expression intensity based on a regression algorithm, and then remove abnormal gene expression matrices based on the regression model. This embodiment does not limit the specific type of regression algorithm; generally, a locally weighted regression algorithm can be used. The regression algorithm is used to fit the mean and variance of expression intensity of each gene to obtain a regression model. This embodiment can use the regression model to remove abnormal gene expression matrices. Generally, when the mean and variance of expression intensity of a gene deviate from the regression model by more than a threshold, the gene can be identified as an abnormally expressed gene, and the abnormal gene expression matrix can be removed from the gene expression matrix.

[0071] This embodiment does not limit the specific method of screening genes that are highly related to cell boundary recognition. Generally, the expression intensity variance of each gene can be normalized and sorted in ascending order. The genes corresponding to the first preset number of expression intensity variances are selected as target genes. In this embodiment, the target genes are those that are highly related to cell boundary recognition.

[0072] Furthermore, this embodiment can determine the target gene expression matrix of the target gene and determine the gene expression information of each image point based on the target gene expression matrix. This embodiment does not limit the specific method of determining gene expression information; generally, it can be determined whether the target gene is expressed at the image point. If so, the gene expression information of the target gene at the image point is recorded as 1; if not, the gene expression information of the target gene at the image point is recorded as 0. That is, if gene A is expressed at the first image point, then the gene expression information of gene A at the first image point is 1; if gene A is not expressed at the first image point, then the gene expression information of gene A at the first image point is 0. The gene expression information of each image point contains the gene expression information of all target genes.

[0073] S103: Determine the distance and location information of the image point; the distance information is the distance from the image point to the center of the nearest neighbor cell nucleus, and the location information is the coordinates of the image point and the direction from the image point to the center of the nearest neighbor cell nucleus.

[0074] This embodiment can extract the distance and location information of each image point from the cell nucleus staining image. The distance information is the distance from the image point to the nearest neighbor cell nucleus center, and the location information is the coordinates of the image point and the direction from the image point to the nearest neighbor cell nucleus center.

[0075] This embodiment determines the distance information of image points based on their coordinates and the coordinates of the nearest neighbor cell nucleus center. In this embodiment, the nearest neighbor cell nucleus center refers to the center of the nearest neighbor cell nucleus for each image point. The coordinates of the image points in this embodiment are their coordinates within the stained cell nucleus image; this embodiment does not limit the method of constructing the coordinate system.

[0076] In this embodiment, the location information of the image point may include the coordinates of the image point and the direction from the image point to the nearest neighbor cell nucleus center. The direction from the image point inside the cell nucleus to the nearest neighbor cell nucleus center is determined differently for image points outside the cell nucleus.

[0077] For image points within the cell nucleus, this embodiment can input the coordinates of the image point within the cell nucleus and the coordinates of the nearest neighboring cell nucleus center into the direction model to determine the direction from the image point within the cell nucleus to the nearest neighboring cell nucleus center.

[0078] For image points outside the cell nucleus, this embodiment can set all directions from the image point outside the cell nucleus to the nearest cell nucleus center to 0.

[0079] This embodiment can determine the position information of image points based on the direction from the image point inside the cell nucleus to the nearest cell nucleus center, the direction from the image point outside the cell nucleus to the nearest cell nucleus center, and the coordinates of the image point.

[0080] In this embodiment, the expression for the direction model can be:

[0081] ;

[0082] In the formula, d The direction from an image point within the cell nucleus to the center of the nearest neighboring cell nucleus. These are the coordinates of the image points within the cell nucleus. represents the coordinates of the nearest neighbor nucleus center of the image point within the cell nucleus, arctan is the arctangent function, floor is the floor function, and and indicates that the conditions are met simultaneously.

[0083] In this embodiment, the direction can be represented by a numerical value. The direction is rounded down using the floor function, which can reduce the amount of calculation caused by decimals. In this embodiment, the down rounding function can also be replaced by the up rounding function, or it can be discarded. The specific setting can be determined according to the actual application.

[0084] S104: Group the image points in the cell nucleus staining image to obtain multiple point sets, and select positive sample point sets and negative sample point sets from the point sets of the cell nucleus segmentation image; wherein, the image points in the positive sample point set are all located inside the cell nucleus, the distance of each image point in the negative sample point set from the nearest cell nucleus center is greater than a preset distance, and the sum of gene expression intensity at each image point is less than a preset threshold.

[0085] The image points in the nuclear staining images are grouped to obtain multiple point sets. This embodiment does not limit the specific method of point set division. Generally, the Euclidean distance of each image point in the nuclear staining image to the nearest neighbor nucleus center can be determined. Based on the Euclidean distance, image points from the third preset number of nearest neighbor nuclear staining images are selected as a point set, typically 50 image points. Points within the same point set generally share the same nearest neighbor nucleus center.

[0086] In this embodiment, positive and negative samples can be selected from the point set of the cell nucleus segmentation image to train the cell boundary recognition model. In this embodiment, the label of the positive sample can be 1, and the label of the negative sample can be 0. The positive sample can represent the point inside the cell boundary, and the negative sample can represent the point outside the cell boundary.

[0087] Furthermore, this implementation does not limit the specific method of selecting positive and negative sample point sets. Generally, the image points in the positive sample point set are all located inside the cell nucleus, the distance of each image point in the negative sample point set from the nearest neighbor cell nucleus center is greater than a preset distance, and the sum of gene expression intensity at each image point is less than a preset threshold.

[0088] In this embodiment, the sum of gene expression intensities can be calculated from the gene expression matrix. The sum of gene expression intensities at each image point is obtained by adding the expression intensities of each gene at that image point.

[0089] When the positive and negative samples are unbalanced, the model will overfit. In this embodiment, a preset threshold can be adjusted to change the number of negative samples so as to balance the positive and negative samples.

[0090] S105: Obtain gene expression information, location information, and distance information of each image point in the positive sample point set and negative sample point set as sample features, and train a cell boundary recognition model based on the sample features.

[0091] This embodiment can obtain gene expression information, location information and distance information of each image point in the positive sample point set and negative sample point set as sample features, and train a cell boundary recognition model based on the sample features.

[0092] This embodiment does not limit the specific architecture of the cell boundary recognition model, and can generally be as follows: Figure 2 As shown, the cell boundary recognition model includes an input layer, a feature extraction layer, and a fully connected layer. The input layer can convert features into tensors. The input layer can include parallel linear projection layers, position encoding layers, and distance encoding layers. The linear projection layer is used to linearly project gene expression information, the position encoding layer is used to encode position information, and the distance encoding layer is used to encode distance information.

[0093] In this embodiment, the feature extraction layer may include a second preset number of sequentially connected feature extraction sub-layers, typically eight. Each feature extraction sub-layer includes a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multilayer perceptron layer, and a second residual module, all connected in sequence. The input to the first residual module is the output of the first normalization layer and the self-attention mechanism layer, and the input to the second residual module is the output of the second normalization layer and the multilayer perceptron layer.

[0094] The recognition results are output through a fully connected layer. During training, cross-entropy loss can be used as the optimization objective of the model. The parameters of the model are optimized through backpropagation to obtain the trained cell boundary recognition model.

[0095] Based on the above embodiments, the method of the present invention combines staining image data and gene expression data from spatial transcriptome data, extracts features from the staining image data and gene expression data, and trains a neural network to adaptively learn the position of sample points in the image relative to the cell center, thereby determining whether the points in the image are at the cell boundary. Compared with cell boundary recognition based solely on staining image data, this method improves the accuracy of cell boundary recognition.

[0096] The following is a cell boundary recognition method provided by an embodiment of the present invention, which may include:

[0097] Obtain gene expression information, location information, and distance information from non-sample point sets;

[0098] Gene expression information, location information, and distance information are input into the cell boundary recognition model to obtain the classification results of non-sample point sets; the classification results of non-sample point sets characterize whether the non-sample point sets are point sets within the cell boundary;

[0099] Cell boundary identification based on classification results;

[0100] Among them, the cell boundary recognition model is a model trained according to the cell boundary recognition model training method.

[0101] This embodiment can obtain gene expression information, location information, and distance information of non-sample point sets. The gene expression information, location information, and distance information of non-sample point sets are input into the trained cell boundary recognition model to identify the non-sample point sets and obtain the classification results of the non-sample point sets.

[0102] Generally, even for the same type of tissue, experimental errors may cause significant differences in cell size in the obtained nuclear staining images during the acquisition of nuclear staining images. Therefore, the cell boundary recognition model in this embodiment is generally applied to the cell staining images of the target tissue. Whether to use the cell boundary recognition model of this embodiment for cell staining images of other tissues of the same type can be determined according to the actual situation.

[0103] In this embodiment, the classification result of the non-sample point set indicates whether the non-sample point set is a point set inside the cell boundary. The positive sample point set in the sample point set generally represents points inside the cell boundary, and the negative sample point set generally represents points outside the cell boundary. In this embodiment, all point sets in the cell nucleus staining image can be divided into intracellular point sets and extracellular point sets. Furthermore, the intersection of intracellular points and extracellular points can be determined as the cell boundary to achieve cell boundary identification.

[0104] The following combination Figure 3 , Figure 3 This is a structural block diagram of a cell boundary recognition model training device provided in an embodiment of the present invention. The device may include:

[0105] The first module 100 is used to acquire the cell nuclear staining image of the target tissue and the corresponding gene expression matrix, and input the cell nuclear staining image into the cell nuclear segmentation model to obtain the cell nuclear segmentation image.

[0106] The second module 200 is used to determine the gene expression information of each image point in the cell nuclear staining image based on the gene expression matrix; the gene expression information characterizes whether a gene is expressed at the image point.

[0107] The third module 300 is used to determine the distance information and position information of the image point; the distance information is the distance from the image point to the center of the nearest neighbor cell nucleus, and the position information is the coordinates of the image point and the direction from the image point to the center of the nearest neighbor cell nucleus;

[0108] The fourth module 400 is used to group the image points in the cell nucleus staining image to obtain multiple point sets, and select positive sample point sets and negative sample point sets from the point sets of the cell nucleus segmentation image; wherein, the image points in the positive sample point set are all located inside the cell nucleus, the distance of each image point in the negative sample point set from the nearest neighbor cell nucleus center is greater than a preset distance, and the sum of gene expression intensities at each image point is less than a preset threshold;

[0109] The fifth module 500 is used to acquire the gene expression information, location information and distance information of each image point in the positive sample point set and the negative sample point set as sample features, and to train a cell boundary recognition model based on the sample features.

[0110] Based on the above embodiments, the method of the present invention combines staining image data and gene expression data from spatial transcriptome data, extracts features from the staining image data and gene expression data, and trains a neural network to adaptively learn the position of sample points in the image relative to the cell center, thereby determining whether the points in the image are at the cell boundary. Compared with cell boundary recognition based solely on staining image data, this method improves the accuracy of cell boundary recognition.

[0111] Based on the above embodiments, the second module 200 may include:

[0112] The first unit is used to calculate the mean expression intensity and variance of each gene based on the gene expression matrix.

[0113] The second unit is used to determine the regression model of the mean and variance of the expression intensity based on the regression algorithm, and to remove the abnormal gene expression matrix based on the regression model.

[0114] The third unit is used to normalize the variance of the expression intensity of each gene and sort them in ascending order;

[0115] The fourth unit is used to select the first preset number of genes corresponding to the expression intensity variance as target genes;

[0116] The fifth unit is used to determine the target gene expression matrix of the target gene, and to determine whether the target gene is expressed at the image points based on the target gene expression matrix; if yes, the sixth unit is executed; if no, the seventh unit is executed.

[0117] The sixth unit is used to record the gene expression information of the target gene of the image point as 1;

[0118] The seventh unit is used to record the gene expression information of the target gene of the image point as 0.

[0119] Based on the above embodiments, the third module 300 may include:

[0120] The eighth unit is used to determine the distance information of the image point based on the coordinates of the image point and the coordinates of the nearest neighbor cell nucleus center;

[0121] Unit 9 is used to determine image points within the cell nucleus. The coordinates of the image points within the cell nucleus and the coordinates of the nearest neighboring cell nucleus center are input into the direction model to determine the direction from the image points within the cell nucleus to the nearest neighboring cell nucleus center.

[0122] Unit 10 is used to set the direction from non-nuclear image points to the nearest neighbor nucleus center to 0;

[0123] The eleventh unit is used to determine the position information of the image point based on the direction from the image point inside the cell nucleus to the nearest cell nucleus center, the direction from the image point outside the cell nucleus to the nearest cell nucleus center, and the coordinates of the image point;

[0124] The expression for the direction model is:

[0125] ;

[0126] In the formula, d The direction from an image point within the cell nucleus to the center of the nearest neighboring cell nucleus. These are the coordinates of the image points within the cell nucleus. represents the coordinates of the nearest neighbor nucleus center of the image point within the cell nucleus, arctan is the arctangent function, and floor is the floor function.

[0127] Based on the above embodiments, the cell boundary recognition model includes an input layer, a feature extraction layer, and a fully connected layer;

[0128] The input layer includes a linear projection layer, a position encoding layer, and a distance encoding layer arranged in parallel. The linear projection layer is used to linearly project the gene expression information, the position encoding layer is used to encode the position information, and the distance encoding layer is used to encode the distance information.

[0129] The feature extraction layer comprises a second preset number of sequentially connected feature extraction sub-layers; each feature extraction sub-layer comprises a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multilayer perceptron layer, and a second residual module, which are sequentially connected; wherein, the input of the first residual module is the output of the first normalization layer and the self-attention mechanism layer, and the input of the second residual module is the output of the second normalization layer and the multilayer perceptron layer.

[0130] Based on the above embodiments, the step of grouping image points in the cell nuclear staining image to obtain multiple point sets includes:

[0131] Determine the Euclidean distance from the image point in the stained cell nucleus image to the nearest neighbor cell nucleus center;

[0132] Based on the Euclidean distance, the nearest neighbor image points from the third preset number of the cell nuclear staining images are selected as the point set.

[0133] Based on the above embodiments, the device may further include:

[0134] The sixth module is used to align the gene expression matrix with the cell nuclear staining image based on affine transformation, so as to eliminate the alignment error between the gene expression matrix and the cell nuclear staining image.

[0135] The following is a cell boundary recognition device provided by an embodiment of the present invention, which may include:

[0136] The seventh module is used to obtain gene expression information, location information, and distance information for non-sample point sets;

[0137] The eighth module is used to input the gene expression information, the location information, and the distance information into the cell boundary recognition model to obtain the classification result of the non-sample point set; the classification result of the non-sample point set indicates whether the non-sample point set is a point set inside the cell boundary;

[0138] The ninth module is used for cell boundary identification based on the classification results;

[0139] The cell boundary recognition model is a model trained using the cell boundary recognition model training device.

[0140] Based on the above embodiments, the present invention also provides an electronic device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the steps provided in the above embodiments. Of course, the device may also include various necessary network interfaces, a power supply, and other components.

[0141] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an execution terminal or processor, can implement the method provided in the embodiments of the present invention; the storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0142] In this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for training a cell boundary recognition model, characterized in that, include: Obtain the cell nuclear staining image and the corresponding gene expression matrix of the target tissue, and input the cell nuclear staining image into the cell nuclear segmentation model to obtain the cell nuclear segmentation image; Gene expression information of each image point in the cell nuclear staining image is determined based on the gene expression matrix; the gene expression information indicates whether a gene is expressed at the image point; if yes, the gene expression information of the gene at the image point is recorded as 1; if no, the gene expression information of the gene at the image point is recorded as 0. Determine the distance and position information of the image point; the distance information is the distance from the image point to the center of the nearest neighbor cell nucleus, and the position information is the coordinates of the image point and the direction from the image point to the center of the nearest neighbor cell nucleus; The image points in the cell nucleus staining image are grouped to obtain multiple point sets. Positive and negative sample point sets are selected from these point sets of the cell nucleus segmentation image. In the positive sample point set, all image points are located within the cell nucleus. In the negative sample point set, the distance from each image point to its nearest neighbor's cell nucleus center is greater than a preset distance, and the sum of gene expression intensities at each image point is less than a preset threshold. If a gene is expressed at an image point, the value at the corresponding image point in the gene expression matrix is ​​the gene expression intensity. The gene expression intensities at each image point are summed to obtain the total gene expression intensity at that image point. The gene expression information, location information, and distance information of each image point in the positive sample point set and the negative sample point set are obtained as sample features. A cell boundary recognition model is trained based on the sample features. The cell boundary recognition model includes an input layer, a feature extraction layer, and a fully connected layer. The input layer includes a linear projection layer, a location encoding layer, and a distance encoding layer in parallel. The linear projection layer is used to linearly project the gene expression information, the location encoding layer is used to encode the location information, and the distance encoding layer is used to encode the distance information.

2. The cell boundary recognition model training method according to claim 1, characterized in that, The process of determining the gene expression information of each image point in the cell nuclear staining image based on the gene expression matrix includes: The mean and variance of expression intensity of each gene are calculated based on the gene expression matrix. The regression model is determined based on the regression algorithm to identify the mean and variance of the expression intensity, and the abnormal gene expression matrix is ​​removed based on the regression model. The variance of the expression intensity of each gene was normalized and sorted in ascending order; Select the first preset number of genes corresponding to the expression intensity variance as target genes; Determine the target gene expression matrix of the target gene, and determine whether the target gene is expressed at image points based on the target gene expression matrix; If so, the gene expression information of the target gene at the image point is recorded as 1; If not, the gene expression information of the target gene at the image point is recorded as 0.

3. The cell boundary recognition model training method according to claim 1, characterized in that, The determination of the distance and position information of the image points includes: The distance information of the image point is determined based on the coordinates of the image point and the coordinates of the nearest neighbor cell nucleus center; Identify image points within the cell nucleus, and input the coordinates of the image points within the cell nucleus and the coordinates of the nearest neighboring cell nucleus center into the direction model to determine the direction from the image points within the cell nucleus to the nearest neighboring cell nucleus center; Set the direction from the image point outside the cell nucleus to the nearest cell nucleus center to 0; The location information of the image points is determined based on the direction from the image point inside the cell nucleus to the nearest neighbor cell nucleus center, the direction from the image point outside the cell nucleus to the nearest neighbor cell nucleus center, and the coordinates of the image points. The expression for the direction model is: ; In the formula, d The direction from an image point within the cell nucleus to the center of the nearest neighboring cell nucleus. These are the coordinates of the image points within the cell nucleus. represents the coordinates of the nearest neighbor nucleus center of the image point within the cell nucleus, arctan is the arctangent function, and floor is the floor function.

4. The cell boundary recognition model training method according to claim 1, characterized in that, The feature extraction layer comprises a second preset number of sequentially connected feature extraction sub-layers; The feature extraction sublayer comprises a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multilayer perceptron layer, and a second residual module connected in sequence; wherein, the input of the first residual module is the output of the first normalization layer and the self-attention mechanism layer, and the input of the second residual module is the output of the second normalization layer and the multilayer perceptron layer.

5. The cell boundary recognition model training method according to claim 1, characterized in that, The process of grouping image points in the cell nuclear staining image to obtain multiple point sets includes: Determine the Euclidean distance from the image point in the stained cell nucleus image to the nearest neighbor cell nucleus center; Based on the Euclidean distance, the nearest neighbor image points from the third preset number of the cell nuclear staining images are selected as the point set.

6. The cell boundary recognition model training method according to claim 1, characterized in that, Also includes: Aligning the gene expression matrix with the cell nuclear staining image using affine transformation eliminates alignment errors between the gene expression matrix and the cell nuclear staining image.

7. A method for cell boundary recognition, characterized in that, include: Obtain gene expression information, location information, and distance information from non-sample point sets; The gene expression information, the location information, and the distance information are input into the cell boundary recognition model to obtain the classification results of the non-sample point set; The classification result of the non-sample point set indicates whether the non-sample point set is a point set within the cell boundary; Cell boundary identification is performed based on the classification results; The cell boundary recognition model is a model trained by the cell boundary recognition model training method according to any one of claims 1 to 6.

8. A cell boundary recognition model training device, characterized in that, include: The first module is used to acquire the cell nuclear staining image of the target tissue and the corresponding gene expression matrix, and input the cell nuclear staining image into the cell nuclear segmentation model to obtain the cell nuclear segmentation image; The second module is used to determine the gene expression information of each image point in the cell nucleus staining image based on the gene expression matrix; the gene expression information indicates whether a gene is expressed at the image point; if yes, the gene expression information of the gene at the image point is recorded as 1; if no, the gene expression information of the gene at the image point is recorded as 0. The third module is used to determine the distance information and position information of the image point; the distance information is the distance from the image point to the center of the nearest neighbor cell nucleus, and the position information is the coordinates of the image point and the direction from the image point to the center of the nearest neighbor cell nucleus; The fourth module is used to group the image points in the cell nucleus staining image to obtain multiple point sets, and select positive sample point sets and negative sample point sets from the point sets of the cell nucleus segmentation image; wherein, the image points in the positive sample point set are all located within the cell nucleus, the distance of each image point in the negative sample point set from the nearest neighbor cell nucleus center is greater than a preset distance, and the sum of gene expression intensities at each image point is less than a preset threshold; if a gene is expressed at an image point, the value at the corresponding image point in the gene expression matrix is ​​the gene expression intensity; the gene expression intensities of each gene at the image point are added together to obtain the sum of gene expression intensities at the image point; The fifth module is used to acquire the gene expression information, location information, and distance information of each image point in the positive sample point set and the negative sample point set as sample features, and to train a cell boundary recognition model based on the sample features. The cell boundary recognition model includes an input layer, a feature extraction layer, and a fully connected layer. The input layer includes a linear projection layer, a position encoding layer, and a distance encoding layer in parallel. The linear projection layer is used to linearly project the gene expression information, the position encoding layer is used to encode the position information, and the distance encoding layer is used to encode the distance information.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the cell boundary recognition model training method as described in any one of claims 1 to 6 and the cell boundary recognition method as described in claim 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the cell boundary recognition model training method as described in any one of claims 1 to 6 and the cell boundary recognition method as described in claim 7.