Cell boundary recognition model training method and cell boundary recognition method
By combining the stained image data and gene expression data in the spatial transcriptome data, the neural network is trained to identify cell boundaries, solving the problem of low accuracy in cell boundaries recognition in the prior art and achieving higher recognition accuracy.
Patent Information
- Application Number
- CN202411199041.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-06-26
- Filing Date
- 2024-08-29
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-08-29
AI Technical Summary
The prior art In cell boundary recognition, the recognition accuracy is low due to the loss of cell morphology and location information and the stained image data contains a mixture of nuclear, cytoplasm and cell membrane signals.
Combining the stained image data and gene expression data in the spatial transcriptome data, extract features and train neural networks, adaptively learn the position of sample points in the image relative to the center of the cell to determine whether the points in the image are at the cell boundary.
Improves the accuracy of cell boundary recognition compared to using stained image data alone for identification.
Smart Images

Figure CN119049047A_ABST
Abstract
Description
[0001] This application claims the priority of Chinese patent application filed with the China Patent Office on May 28, 2024, with application number 2024106674393, and invention name “A cell boundary recognition model training method and cell boundary recognition method”, and all the contents are incorporated by reference into this application. This application claims the priority of Chinese patent application filed with the China Patent Office on June 26, 2024, with application number 2024108358206, and invention name “A cell boundary recognition model training method and cell boundary recognition method”, and all the contents are incorporated by reference into this application. Technical Field
[0002] The present 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 Art
[0003] Cell type identification plays an important role in the fields of biology and medicine, such as in the analysis of biological phenomena, disease pathogenesis, cell lineage, cell differentiation trajectory, and intercellular communication. Cell boundary identification is the core step of cell type identification. In the prior art, the staining image data in the spatial transcriptome data is generally used for cell boundary identification. However, the morphology and position information of the cells are lost during the collection of staining image data, and the data itself contains a mixture of nuclear, cytoplasmic, and / or cell membrane signals, resulting in a low accuracy rate for cell boundary identification. The gene expression data in the spatial transcriptome data characterizes the gene expression status of the image points. Generally, there is no gene expression outside the boundary, or there is an extremely low gene expression intensity. Therefore, the gene expression data in the spatial transcriptome technology can be used for boundary identification. Summary of the invention
[0004] The purpose of the present invention is to provide 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, which are applied to the field of biomedical engineering. The method combines the staining image data and gene expression data in the spatial transcriptome data, extracts the staining image data and gene expression data features to train a neural network to adaptively learn the position of sample points in the image relative to the cell center, so as to judge whether the points in the image are at the cell boundary. Compared with cell boundary recognition only through staining image data, the accuracy of identifying cell boundaries is improved.
[0005] In order to solve the above technical problems, the present invention provides a cell boundary recognition model training method, comprising:
[0006] Acquire a cell nucleus staining image of a target tissue and a corresponding gene expression matrix, and input the cell nucleus staining image into a cell nucleus segmentation model to obtain a cell nucleus segmentation image;
[0007] Determining gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix; the gene expression information represents whether the gene is expressed at the image point;
[0008] 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 neighboring 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 neighboring cell nucleus;
[0009] The image points in the cell nucleus staining image are grouped to obtain a plurality of point sets, and a positive sample point set and a negative sample point set are selected from the point set of the cell nucleus segmentation image; wherein the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than a preset distance, and the sum of the gene expression intensity at each image point is less than a preset threshold;
[0010] The gene expression information, the position information and the 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 obtained by training based on the sample features.
[0011] Optionally, determining the gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix includes:
[0012] Calculate the expression intensity mean and expression intensity variance of each gene based on the gene expression matrix;
[0013] Determine a regression model of the expression intensity mean and the expression intensity variance based on a regression algorithm, and eliminate abnormal gene expression matrices based on the regression model;
[0014] The expression intensity variance of each gene is normalized and sorted in ascending order;
[0015] Selecting genes corresponding to the expression intensity variances of the first preset number as target genes;
[0016] Determining a target gene expression matrix of the target gene, and judging whether the target gene is expressed at an image point 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, the determining of the distance information and the position information of the image point includes:
[0020] Determine the distance information of the image point based on the coordinates of the image point and the coordinates of the center of the nearest neighboring cell nucleus;
[0021] Determine an image point in the cell nucleus, input the coordinates of the image point in the cell nucleus and the coordinates of the center of the nearest neighboring cell nucleus into a direction model to determine the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus;
[0022] The direction from the image point outside the cell nucleus to the center of the nearest neighboring cell nucleus is set to 0;
[0023] Determine the position information of the image point based on the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, the direction from the image point in the non-cell nucleus to the center of the nearest neighboring cell nucleus, and the coordinates of the image point;
[0024] The expression of the directional model is:
[0025] ;
[0026] Where d is the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, are the coordinates of the image point in the cell nucleus, are the coordinates of the nearest neighbor nucleus center of the image point in the nucleus, arctan is the inverse tangent 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 in parallel, the linear projection layer is used to perform linear projection on 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 includes a second preset number of feature extraction sublayers connected in sequence; the feature extraction sublayer includes a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multi-layer 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 multi-layer perceptron layer.
[0030] Optionally, the grouping of image points in the cell nucleus staining image to obtain a plurality of point sets includes:
[0031] Determine the Euclidean distance from an image point in the cell nucleus staining image to the center of the nearest neighboring cell nucleus;
[0032] A third preset number of nearest neighbor image points in the cell nucleus staining image are selected as a point set based on the Euclidean distance.
[0033] Optionally, the method further includes:
[0034] The gene expression matrix is aligned with the cell nucleus staining image based on affine transformation to eliminate the alignment error between the gene expression matrix and the cell nucleus staining image.
[0035] In order to solve the above technical problems, the present invention provides a cell boundary recognition method, which is characterized by comprising:
[0036] Obtain gene expression information, location information and distance information of non-sample point sets;
[0037] Inputting the gene expression information, the position information and the distance information into a cell boundary recognition model to obtain a 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 within the cell boundary;
[0038] Performing cell boundary recognition based on the classification result;
[0039] Wherein, the cell boundary recognition model is a model trained according to the cell boundary recognition model training method.
[0040] In order to solve the above technical problems, the present invention provides a cell boundary recognition model training device, which is characterized by comprising:
[0041] The first module is used to obtain a cell nucleus staining image of a target tissue and a corresponding gene expression matrix, and input the cell nucleus staining image into a cell nucleus segmentation model to obtain a cell nucleus segmentation image;
[0042] The second module is used to determine the gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix; the gene expression information represents whether the 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 neighboring 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 neighboring 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 a positive sample point set and a negative sample point set from the point set of the cell nucleus segmentation image; wherein the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than a preset distance, and the sum of the gene expression intensity at each image point is less than a preset threshold;
[0045] The fifth module is used to obtain the gene expression information, the position information and the distance information of each image point in the positive sample point set and the negative sample point set as sample features, and obtain a cell boundary recognition model based on the sample features.
[0046] In order to solve the above technical problems, the present invention provides an electronic device, comprising:
[0047] Memory, for storing computer programs;
[0048] A processor is used to implement the above-mentioned cell boundary recognition model training method and the cell boundary recognition method when executing the computer program.
[0049] In order to solve the above technical problems, the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the above-mentioned cell boundary recognition model training method and the cell boundary recognition method are implemented.
[0050] It can be seen that the method of the present invention obtains 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 represents 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 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; 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 a positive sample point set and a negative sample point set from the point set; wherein the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighbor cell nucleus is greater than the preset distance, and the sum of the gene expression intensities at each image point is less than the 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 obtains a cell boundary recognition model based on sample feature training. By combining the staining image data and gene expression data in the spatial transcriptome data, the features of the staining image data and gene expression data are extracted to train the neural network to adaptively learn the position of the sample points in the image relative to the cell center, so as to determine whether the points in the image are at the cell boundary. Compared with cell boundary identification only through staining image data, the accuracy of identifying cell boundaries is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0052] Figure 1 A flowchart of a cell boundary recognition model training method provided by an embodiment of the present invention;
[0053] Figure 2 A schematic diagram of the structure of a cell boundary recognition model provided by an embodiment of the present invention;
[0054] Figure 3 This is a structural block diagram of a cell boundary recognition model training device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] Spatial transcriptomics is an innovative technology that combines molecular biology and spatial mapping. It can detect the spatial expression patterns of genes in different cell types in tissues, and advance the research progress of cell-cell signaling and cell type tissue analysis. The latest breakthroughs in analytical technology have completely changed our understanding of multicellular biological systems and are expected to solve biological problems that were previously unsolvable. According to the transcript detection strategy, spatial transcriptomics technology can be roughly divided into two categories: imaging-based and sequencing-based.
[0057] In the process of cell boundary recognition, the prior art generally uses the cell nucleus / membrane staining image data obtained by imaging technology to recognize the cell boundary. However, the cell morphology and position information are lost during the staining image acquisition process, and the staining image data itself contains a mixture of nuclear, cytoplasmic and / or cell membrane signals, which affects the accuracy of cell boundary recognition.
[0058] The method of the present invention introduces the gene expression data corresponding to the tissue staining image, extracts the features of the cell nucleus staining image data and the gene expression data for training the cell boundary recognition model, and adaptively learns the position of each point in the staining image relative to the center of the nearest neighbor cell through a neural network to improve the accuracy of identifying cell boundaries.
[0059] The following combination Figure 1 , Figure 1 A flowchart of a cell boundary recognition model training method provided by an embodiment of the present invention, the method may include:
[0060] S101: Obtain a cell nucleus staining image of a target tissue and a corresponding gene expression matrix, and input the cell nucleus staining image into a cell nucleus segmentation model to obtain a cell nucleus segmentation image.
[0061] This embodiment can obtain the gene expression matrix corresponding to the cell nuclear staining image set of the target tissue. The target tissue in this embodiment is the tissue that requires cell boundary identification. 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 the cell nuclear staining image.
[0062] The gene expression matrix in this embodiment records the gene expression data of the target tissue. The gene expression matrix can be a multidimensional matrix, and each dimension can contain the gene expression data of a gene, such as whether the gene is expressed and the expression intensity at each image point in the cell nucleus staining image. This embodiment does not limit the method for obtaining the gene expression matrix, and the gene expression matrix can generally be obtained through spatial transcriptomics technology.
[0063] In this embodiment, in order to eliminate noise in the cell nuclear staining image, the cell nuclear staining image may be subjected to noise reduction processing. In order to eliminate the alignment error between the cell nuclear staining image and the gene expression matrix, in this embodiment, the cell nuclear staining image may be aligned with the gene expression matrix through affine transformation.
[0064] In this embodiment, the cell nucleus staining image can be input into the cell nucleus segmentation model to obtain the cell nucleus segmentation image. This embodiment does not limit the type of the cell nucleus segmentation model, which can generally be a Cellpose segmentation model. Cellpose is a general cell segmentation method based on deep learning. The cell nucleus segmentation image can accurately locate the coordinates of the center of each cell nucleus, which is conducive to determining the distance and direction of each image point from the center of the nearest neighboring cell nucleus.
[0065] S102: determining gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix; the gene expression information represents whether the gene is expressed at the image point.
[0066] This embodiment can determine the gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix, wherein the gene expression information represents whether the gene is expressed at the image point. The gene expression information in this embodiment can be used as a training feature of the cell boundary recognition model.
[0067] Since not all genes are highly correlated with cell boundary recognition, this embodiment can screen genes that are highly correlated with cell boundary recognition, and since errors exist in the experimental process, this embodiment can also eliminate abnormal gene expression matrices.
[0068] First, this embodiment can calculate the mean value and variance of the expression intensity of each gene based on the gene expression matrix. In this embodiment, if the gene is expressed at an image point, the value at the corresponding image point in the gene expression matrix of the gene is the gene expression intensity; if the gene is not expressed at the image point, the value at the corresponding image point in the gene expression matrix of the gene does not exist and is empty.
[0069] Correspondingly, in this embodiment, the calculation method of the mean expression intensity can be the sum of the expression intensity of the gene at each image point divided by the number of image points where the gene is expressed, and the calculation method of the variance of the expression intensity can be the sum of the square of the difference between the expression intensity of the gene at each image point and the mean expression intensity and then divided by the number of image points where the gene is expressed. For example, if there are four image points in the cell nuclear staining image, and gene A is only expressed at the first image point and the second image point, 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 the expression intensity is ((2.5-2) 2 +(3-2.5) 2 ) / 2=0.25.
[0070] Further, the present embodiment can determine the regression model of the expression intensity mean and the expression intensity variance based on the regression algorithm, and remove the abnormal gene expression matrix based on the regression model. The present embodiment does not limit the specific type of the regression algorithm, which can generally be a local weighted regression algorithm. The regression algorithm is used to regress the expression intensity mean and the expression intensity variance of each gene to obtain a regression model. The present embodiment can remove the abnormal gene expression matrix through the regression model. Generally, when the expression intensity mean and the expression intensity variance of a gene deviate from the regression model and exceed the threshold, the gene can be determined as an abnormal expression gene, and the abnormal gene expression matrix of the abnormal expression gene is removed from the gene expression matrix.
[0071] This embodiment does not limit the specific method of screening genes that are highly correlated with cell boundary recognition. Generally, the expression intensity variance of each gene can be normalized and sorted in order from small to large, and the genes corresponding to the first preset number of expression intensity variances are selected as target genes. The target genes in this embodiment are genes that are highly correlated with cell boundary recognition.
[0072] Furthermore, the present 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. The present embodiment does not limit the specific method of determining the 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, the gene expression information of gene A at the first image point is 1, and if gene A is not expressed at the first image point, 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 information and position information of the image point; the distance information is the distance from the image point to the center of the nearest neighboring 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 neighboring cell nucleus.
[0074] This embodiment can extract the distance information and position information of each image point from the cell nucleus staining image, wherein the distance information is the distance from the image point to the center of the nearest neighboring 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 neighboring cell nucleus.
[0075] In this embodiment, the distance information of the image point can be determined based on the coordinates of the image point and the coordinates of the nearest neighbor cell nucleus center. The nearest neighbor cell nucleus center in this embodiment is the center of the nearest neighbor cell nucleus of each image point. The coordinates of the image point in this embodiment are the coordinates of the image point in the cell nucleus staining image, and this embodiment does not limit the construction method of the coordinate system.
[0076] In this embodiment, the position information of the image point may include the coordinates of the image point and the direction from the image point to the center of the nearest neighboring cell nucleus, wherein the directions from the image point in the cell nucleus and the image point outside the cell nucleus to the center of the nearest neighboring cell nucleus are determined differently.
[0077] For an image point in a cell nucleus, this embodiment may input the coordinates of the image point in the cell nucleus and the coordinates of the center of the nearest neighboring cell nucleus into a direction model to determine the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus.
[0078] For image points outside the cell nucleus, this embodiment may set all directions from the image points outside the cell nucleus to the center of the nearest neighboring cell nucleus to 0.
[0079] This embodiment can determine the position information of the image point based on the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, the direction from the image point outside the cell nucleus to the center of the nearest neighboring cell nucleus, and the coordinates of the image point.
[0080] The expression of the direction model in this embodiment can be:
[0081] ;
[0082] Where d is the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, are the coordinates of the image point in the cell nucleus, are the coordinates of the nearest neighbor nucleus center of the image point in the nucleus, arctan is the inverse tangent function, floor is the floor function, and means that the conditions are met at the same time.
[0083] The direction in this embodiment can be represented by a numerical value. The direction is rounded down by the floor function to reduce the amount of calculation caused by decimals. In this embodiment, the floor function can also be replaced by a ceiling function or discarded. The specific setting can be based on the actual application.
[0084] S104: The image points in the cell nucleus staining image are grouped to obtain a plurality of point sets, and a positive sample point set and a negative sample point set are selected from the point set of the cell nucleus segmentation image; wherein the image points in the positive sample point set are all within the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than a preset distance, and the sum of the gene expression intensities at each image point is less than a preset threshold.
[0085] The image points in the cell nucleus staining image are grouped to obtain multiple point sets, and the embodiment does not limit the specific method of dividing the point sets. Generally, the Euclidean distance between each image point in the cell nucleus staining image and the nearest neighbor cell nucleus center can be determined, and the image points in the nearest third preset number of cell nucleus staining images are selected as the point set based on the Euclidean distance, which can generally be 50 image points. Points in the same point set generally have the same nearest neighbor cell 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 within the cell boundary, and the negative sample can represent the point outside the cell boundary.
[0087] Furthermore, the present embodiment does not limit the specific method of selecting the positive and negative sample point sets. Generally, the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than the preset distance, and the sum of the gene expression intensities at each image point is less than the preset threshold.
[0088] The sum of gene expression intensities in this embodiment can be calculated from a gene expression matrix, and the expression intensities of each gene at an image point are added together to obtain the sum of gene expression intensities at the image point.
[0089] When the positive and negative samples are unbalanced, the model will be overfitted. In this embodiment, the preset threshold can be adjusted to change the number of negative samples to balance the positive and negative samples.
[0090] S105: Obtain 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 obtain a cell boundary recognition model based on sample feature training.
[0091] In this embodiment, gene expression information, position information and distance information of each image point in the positive sample point set and the negative sample point set can be obtained as sample features, and a cell boundary recognition model can be obtained through training based on the sample features.
[0092] This embodiment does not limit the specific architecture of the cell boundary recognition model. 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 a parallel linear projection layer, a position encoding layer and a distance encoding layer. 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 feature extraction sublayers connected in sequence, which may generally be 8, and the feature extraction sublayer includes a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multi-layer 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 multi-layer perceptron layer.
[0094] The recognition results are output through the fully connected layer. During the training process, the cross entropy loss can be used as the optimization target of the model, and the parameters of the model can be optimized through back propagation to obtain a trained cell boundary recognition model.
[0095] Based on the above embodiments, the method of the present invention combines the staining image data and gene expression data in the spatial transcriptome data, extracts the features of the staining image data and the gene expression data to train a neural network to adaptively learn the position of sample points in the image relative to the cell center, so as to determine whether the points in the image are at the cell boundary. Compared with cell boundary identification only through staining image data, the accuracy of identifying cell boundaries is improved.
[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 of 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 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 within the cell boundary;
[0099] Identify cell boundaries based on the classification results;
[0100] The cell boundary recognition model is a model trained according to a cell boundary recognition model training method.
[0101] This embodiment can obtain gene expression information, position information and distance information of the non-sample point set, input the gene expression information, position information and distance information of the non-sample point set into the trained cell boundary recognition model, identify the non-sample point set and obtain the classification result of the non-sample point set.
[0102] Generally speaking, even for the same type of tissue, in the process of obtaining cell nuclear staining images, experimental errors may cause the cell sizes in the obtained cell nuclear staining images to differ too much. 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 the cell staining images of other tissues of the same type can be judged based on actual conditions.
[0103] In this embodiment, the classification result of the non-sample point set represents whether the non-sample point set is a point set within the cell boundary. The positive sample point set in the sample point set generally represents the points within the cell boundary, and the negative sample point set generally represents the 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, and the intersection of intracellular points and extracellular points can be further determined as the cell boundary to realize the recognition of the cell boundary.
[0104] The following combination Figure 3 , Figure 3 A structural block diagram of a cell boundary recognition model training device provided by an embodiment of the present invention, the device may include:
[0105] The first module 100 is used to obtain a cell nucleus staining image of a target tissue and a corresponding gene expression matrix, and input the cell nucleus staining image into a cell nucleus segmentation model to obtain a cell nucleus segmentation image;
[0106] The second module 200 is used to determine the gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix; the gene expression information represents whether the 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 neighboring 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 neighboring 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 a positive sample point set and a negative sample point set from the point set of the cell nucleus segmentation image; wherein the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than a preset distance, and the sum of the gene expression intensity at each image point is less than a preset threshold;
[0109] The fifth module 500 is used to obtain the gene expression information, the position information and the distance information of each image point in the positive sample point set and the negative sample point set as sample features, and obtain a cell boundary recognition model based on the sample features.
[0110] Based on the above embodiments, the method of the present invention combines the staining image data and gene expression data in the spatial transcriptome data, extracts the features of the staining image data and the gene expression data to train a neural network to adaptively learn the position of sample points in the image relative to the cell center, so as to determine whether the points in the image are at the cell boundary. Compared with cell boundary identification only through staining image data, the accuracy of identifying cell boundaries is improved.
[0111] Based on the above embodiment, the second module 200 may include:
[0112] The first unit is used to calculate the expression intensity mean and expression intensity variance of each gene based on the gene expression matrix;
[0113] The second unit is used to determine the regression model of the expression intensity mean and the expression intensity variance based on a regression algorithm, and eliminate abnormal gene expression matrices based on the regression model;
[0114] The third unit is used to normalize the expression intensity variance of each gene and sort them in ascending order;
[0115] A fourth unit is used to select genes corresponding to the first preset number of expression intensity variances as target genes;
[0116] The fifth unit is used to determine the target gene expression matrix of the target gene, and judge whether the target gene is expressed at the image point based on the target gene expression matrix; if so, execute the sixth unit; if not, execute the seventh unit;
[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] An eighth unit, configured to determine the distance information of the image point based on the coordinates of the image point and the coordinates of the center of the nearest neighboring cell nucleus;
[0121] The ninth unit is used to determine the image point in the cell nucleus, and input the coordinates of the image point in the cell nucleus and the coordinates of the center of the nearest neighboring cell nucleus into the direction model to determine the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus;
[0122] The tenth unit is used to set the direction from the image point outside the cell nucleus to the center of the nearest neighboring cell nucleus to 0;
[0123] An eleventh unit is used to determine the position information of the image point based on the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, the direction from the image point in the non-cell nucleus to the center of the nearest neighboring cell nucleus and the coordinates of the image point;
[0124] The expression of the directional model is:
[0125] ;
[0126] Where d is the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, are the coordinates of the image point in the cell nucleus, are the coordinates of the nearest neighbor nucleus center of the image point in the nucleus, arctan is the inverse tangent 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 in parallel, the linear projection layer is used to perform linear projection on 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 includes a second preset number of feature extraction sublayers connected in sequence; the feature extraction sublayer includes a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multi-layer 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 multi-layer perceptron layer.
[0130] Based on the above embodiment, the step of grouping the image points in the cell nucleus staining image to obtain a plurality of point sets includes:
[0131] Determine the Euclidean distance from an image point in the cell nucleus staining image to the center of the nearest neighboring cell nucleus;
[0132] Based on the Euclidean distance, a third preset number of nearest neighbor image points in the cell nucleus staining image 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 nucleus staining image based on affine transformation to eliminate the alignment error between the gene expression matrix and the cell nucleus 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 of non-sample point sets;
[0137] An eighth module is used to input the gene expression information, the position information and the distance information into a cell boundary recognition model to obtain a 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 within the cell boundary;
[0138] A ninth module, used for identifying cell boundaries based on the classification results;
[0139] Wherein, the cell boundary recognition model is a model trained by the cell boundary recognition model training device.
[0140] Based on the above embodiments, the present invention further provides an electronic device, which may include a memory and a processor, wherein the memory stores a computer program, and when the processor calls the computer program in the memory, the steps provided in the above embodiments may be implemented. Of course, the device may also include various necessary network interfaces, power supplies, and other components.
[0141] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by an execution terminal or a processor, the method provided in the embodiment of the present invention can be implemented; the storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0142] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
Claims
1. A cell boundary recognition model training method, characterized in that: include: Acquire a cell nucleus staining image of a target tissue and a corresponding gene expression matrix, and input the cell nucleus staining image into a cell nucleus segmentation model to obtain a cell nucleus segmentation image; Determining gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix; the gene expression information represents whether the gene is expressed at the image point; 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 neighboring 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 neighboring cell nucleus; The image points in the cell nucleus staining image are grouped to obtain a plurality of point sets, and a positive sample point set and a negative sample point set are selected from the point set of the cell nucleus segmentation image; wherein the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than a preset distance, and the sum of the gene expression intensity at each image point is less than a preset threshold; The gene expression information, the position information and the 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 obtained by training based on the sample features.
2. The cell boundary recognition model training method according to claim 1, characterized in that: The determining the gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix includes: Calculate the expression intensity mean and expression intensity variance of each gene based on the gene expression matrix; Determine a regression model of the expression intensity mean and the expression intensity variance based on a regression algorithm, and eliminate abnormal gene expression matrices based on the regression model; The expression intensity variance of each gene is normalized and sorted in ascending order; Selecting genes corresponding to the expression intensity variances of the first preset number as target genes; Determining a target gene expression matrix of the target gene, and judging whether the target gene is expressed at an image point 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 determining of the distance information and position information of the image point includes: Determine the distance information of the image point based on the coordinates of the image point and the coordinates of the center of the nearest neighboring cell nucleus; Determine an image point in the cell nucleus, input the coordinates of the image point in the cell nucleus and the coordinates of the center of the nearest neighboring cell nucleus into a direction model to determine the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus; The direction from the image point outside the cell nucleus to the center of the nearest neighboring cell nucleus is set to 0; Determine the position information of the image point based on the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, the direction from the image point in the non-cell nucleus to the center of the nearest neighboring cell nucleus, and the coordinates of the image point; The expression of the directional model is: ; Where d is the direction from the image point in the cell nucleus to the center of the nearest neighboring cell nucleus, are the coordinates of the image point in the cell nucleus, are the coordinates of the nearest neighbor nucleus center of the image point in the nucleus, arctan is the inverse tangent function, and floor is the floor function.
4. The cell boundary recognition model training method according to claim 1, characterized in that: 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 perform linear projection on 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; The feature extraction layer comprises a second preset number of feature extraction sub-layers connected in sequence; The feature extraction sublayer includes a first normalization layer, a self-attention mechanism layer, a first residual module, a second normalization layer, a multi-layer 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 multi-layer perceptron layer.
5. The cell boundary recognition model training method according to claim 1, characterized in that: The step of grouping the image points in the cell nucleus staining image to obtain a plurality of point sets includes: Determine the Euclidean distance from an image point in the cell nucleus staining image to the center of the nearest neighboring cell nucleus; Based on the Euclidean distance, a third preset number of nearest neighbor image points in the cell nucleus staining image are selected as the point set.
6. The cell boundary recognition model training method according to claim 1, characterized in that: Also includes: The gene expression matrix is aligned with the cell nucleus staining image based on affine transformation to eliminate the alignment error between the gene expression matrix and the cell nucleus staining image.
7. A cell boundary recognition method, characterized in that: include: Obtain gene expression information, location information and distance information of non-sample point sets; Inputting the gene expression information, the position information and the distance information into a cell boundary recognition model to obtain a 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 within the cell boundary; Performing cell boundary recognition based on the classification result; Wherein, the cell boundary recognition model is a model trained according to 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 obtain a cell nucleus staining image of a target tissue and a corresponding gene expression matrix, and input the cell nucleus staining image into a cell nucleus segmentation model to obtain a cell nucleus segmentation image; The second module is used to determine the gene expression information of each image point of the cell nucleus staining image based on the gene expression matrix; the gene expression information represents whether the gene is expressed at the image point; 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 neighboring 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 neighboring 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 a positive sample point set and a negative sample point set from the point set of the cell nucleus segmentation image; wherein the image points in the positive sample point set are all in the cell nucleus, the distance between each image point in the negative sample point set and the center of the nearest neighboring cell nucleus is greater than a preset distance, and the sum of the gene expression intensity at each image point is less than a preset threshold; The fifth module is used to obtain the gene expression information, the position information and the distance information of each image point in the positive sample point set and the negative sample point set as sample features, and obtain a cell boundary recognition model based on the sample features.
9. An electronic device, characterized in that: include: Memory, for storing computer programs; A processor, configured to implement the cell boundary recognition model training method according to any one of claims 1 to 6 and the cell boundary recognition method according to 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, and when the computer-executable instructions are executed by the processor, the cell boundary recognition model training method according to any one of claims 1 to 6 and the cell boundary recognition method according to claim 7 are implemented.
Citation Information
Patent Citations
Cell boundary recognition model training method and cell boundary recognition method
CN118334655A
Cell boundary recognition model training method and cell boundary recognition method
CN118537856A
Method of processing a biological image
CA2528578A1
Cell data analysis method, device and equipment and storage medium
CN116958221A
Method and device for determining a contour and a center of an object
US20110123090A1
