Spatial analysis single cell state modeling method and system based on domain self-adaption and layered fine tuning

By employing domain-adaptive and hierarchical fine-tuning methods, the discretization of cell states and model generalization in multiplex immunofluorescence images were addressed, achieving high-precision cell classification and biological interpretability, thus promoting the development of precision medicine.

CN121983111APending Publication Date: 2026-05-05SHANGHAI JIAOTONG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI JIAOTONG UNIV
Filing Date
2025-12-29
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing technologies for processing multiplex immunofluorescence images suffer from problems such as discretized and static cell states, poor model generalization ability, insufficient identification of rare cell categories, and lack of biological interpretability, resulting in an inability to accurately describe the continuous and context-dependent states of cells.

Method used

We employ a domain-adaptive and hierarchical fine-tuning approach. By constructing a masked autoencoder and a two-stage classifier, combined with a ViT encoder and a linear decoder, we perform domain-adaptive training and hierarchical training to learn the multi-channel protein expression information of each single cell, thereby achieving accurate cell classification and biologically interpretable continuous state representation.

Benefits of technology

It achieves highly generalizable cell classification, improves the identification accuracy of rare cell subpopulations, provides biologically interpretable and visual methods, and promotes precision medicine and personalized treatment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121983111A_ABST
    Figure CN121983111A_ABST
Patent Text Reader

Abstract

The invention relates to a spatial analysis single cell state modeling method and system based on domain self-adaption and layered fine tuning, and the method comprises the steps: obtaining multiple immunofluorescence images and single cell segmentation masks, and constructing a no-label data set; constructing a mask auto-encoder composed of a ViT encoder and a linear decoder, adding a classification token in front of the image, carrying out field adaptive training on the mask auto-encoder based on the unlabeled data set, learning the classification token, and obtaining a field adaptive weight of the ViT encoder; obtaining a labeled data set; constructing a state embedding generation model, wherein the state embedding generation model comprises a shared ViT backbone network and a two-stage classifier; a classification token is added in front of an image feature sequence in the labeled data set, hierarchical training is carried out on the state embedding generation model, and the classification token is learned; and inputting the cell image blocks into the trained state embedding generation model, outputting a classification result and cell state embedding, and carrying out interpretability analysis. Compared with the prior art, the method has the advantages that accurate cell classification can be realized, and cell state representation with biological interpretability can be generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of biological image analysis, and in particular to a spatial analytical single-cell state modeling method and system based on domain adaptation and hierarchical fine-tuning. Background Technology

[0002] The cell is the basic unit of life, and its "state" is a complex concept defined by protein expression, subcellular localization, and the surrounding microenvironment, determining tissue function, development, and disease progression. Traditional methods simplify this complexity by assigning discrete, static labels (such as "T cell" or "tumor cell") to cells. However, this simplification ignores two core characteristics of cell state: continuity (e.g., from resting to activated T cells) and context-dependentness (a cell's state is profoundly influenced by its neighboring cells). Chinese patent CN118800318A discloses a cell state-based modeling method, device, electronic device, and storage medium. It employs a dual-path modeling method based on single-cell state, integrating high- and low-dimensional approaches. By acquiring a cell state matrix, calculating RNA rates in the first and second dimensions, and processing the matrix through a mutual learning module to obtain a transition probability matrix, a dual-path model for calculating RNA rates is constructed. This method relies entirely on single-cell omics data for mathematical calculations and model derivation, and the generated cell state is an abstract mathematical vector. This process detaches itself from the original spatial location, morphological structure, and in-situ information of protein expression of cells in tissues, resulting in the "cell state" modeled by it being unable to be directly associated with intuitive biological phenotypes, and thus lacking true biological interpretability derived from visual evidence.

[0003] In recent years, the development of spatial omics technologies such as multiplex immunofluorescence (mIF) has enabled the simultaneous measurement of multiple protein biomarkers at unprecedented resolution while preserving tissue spatial information. However, integrating these high-dimensional image data into a unified model that can accurately and quantitatively describe the continuous and context-dependent state of each cell remains a core challenge in the field.

[0004] Specifically, the existing technology has the following drawbacks: 1. Discretization and Staticization of Cell States: Most existing methods classify cells into predefined, discrete "categories," which is an oversimplification of biological reality. This "snapshot" labeling fails to capture the intermediate states and continuous transitions of cells during differentiation, activation, or malignant transformation, thus losing a large amount of dynamic information.

[0005] 2. Poor model generalization ability (domain bias problem): When a deep learning model pre-trained on natural images is directly applied to mIF data of a specific laboratory or a specific type of cancer, the model performance will drop sharply due to domain shift caused by differences in staining process, scanner model, tissue source, etc., and it will be unable to generalize effectively.

[0006] 3. Insufficient ability to identify rare cell types: In the complex tumor microenvironment, the number of different cell subpopulations varies greatly. Traditional "flat" single classification models are easily dominated by the majority cell types during training, resulting in poor recognition performance of rare but biologically significant cell subpopulations (such as regulatory T cells).

[0007] 4. Lack of interpretability and biological insights: Most deep learning models are like "black boxes," with opaque decision-making processes. Current technologies struggle to reveal which key biological features (such as the location of specific proteins on the cell membrane or in the nucleus) the model bases its decisions, limiting the model's value in assisting scientific discovery. Summary of the Invention

[0008] The purpose of this invention is to provide a spatial analytical single-cell state modeling method and system based on domain adaptation and hierarchical fine-tuning. Through a two-stage training strategy of domain adaptation training and hierarchical training, it can not only achieve accurate cell classification, but also learn a continuous state representation of each single cell that integrates multi-channel protein expression information and has biological interpretability.

[0009] The objective of this invention can be achieved through the following technical solutions: A spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning includes the following steps: Multiple immunofluorescence images and corresponding single-cell segmentation masks generated by cell segmentation algorithms are obtained, and image preprocessing is performed based on the single-cell segmentation masks to construct an unlabeled dataset; A mask autoencoder is constructed, which consists of a ViT encoder and a linear decoder. The ViT encoder serves as the backbone network of the final state embedding generative model. A classification token is added before the image feature sequence in the unlabeled dataset. The mask autoencoder is trained based on the unlabeled dataset in a domain-adaptive manner. During the training process, the classification token is learned to obtain the domain-adaptive weights of the ViT encoder. Obtain all available labeled datasets, merge them completely, and then remove duplicates to obtain a labeled dataset. A state embedding generative model is constructed, including a shared ViT backbone network and a two-stage classifier. The shared ViT backbone network is loaded with the domain-adaptive weights of the ViT encoder obtained by domain-adaptive training, and the two-stage classifier includes a coarse classifier and a fine classifier. A classification token is added before the image feature sequence in the labeled dataset, and the state embedding generation model is trained hierarchically based on the labeled dataset, learning the classification token during the training process. Any cell image patch is input into the trained state embedding generation model, the classification result is output based on the two-stage classifier, the cell state embedding is obtained based on the output vector of the classification token, and interpretability analysis is performed.

[0010] The preprocessing specifically involves: traversing all available multiplex immunofluorescence images, extracting each individual cell into a standard-sized, multi-channel image block centered on its centroid based on the cell segmentation mask, and saving each image block as an independent binary file.

[0011] The specific method for performing domain-adaptive training of the mask autoencoder based on the unlabeled dataset is as follows: In each training batch, cell image patches in the unlabeled training set are randomly masked and then input into the ViT encoder. The ViT encoder outputs the feature representation of the visible region image patch. After processing by the linear decoder, the original pixels of the masked region are reconstructed. The mask autoencoder is trained based on the mean square error between the reconstruction result and the original input image.

[0012] The hierarchical training specifically refers to: Unfreeze the parameters of the last few Transformer Blocks and the final normalization layer of the ViT backbone network, and freeze the remaining parameters; Set a preset small learning rate for the thawed ViT backbone network layer and a preset large learning rate for the newly initialized two-stage classifier; The ViT backbone network and coarse classifier are trained based on the labeled dataset, enabling the coarse classifier to distinguish between epithelial cells, immune cells and other cells. After the coarse classifier is trained, its updated ViT backbone network weights are maintained, and the ViT backbone network and fine classifier are trained based on the labeled dataset.

[0013] The interpretability analysis specifically includes: Attention map visualization: Extract the attention map of the last encoder block of the ViT backbone network and highlight the subcellular regions that the state embedding generative model focuses on when making decisions in the form of a heatmap; Feature space visualization: Extract the classification tokens generated by the state embedding generative model for all sub-regions within the cell image block, reduce the dimensionality through principal component analysis and map them to the RGB color space to generate a semantic segmentation map that intuitively reflects the model's understanding of subcellular structures.

[0014] A spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning includes: Data acquisition module: acquires multiplex immunofluorescence images and corresponding single-cell segmentation masks generated by the cell segmentation algorithm; Image preprocessing module: Image preprocessing is performed based on single-cell segmentation masks to construct an unlabeled dataset; Dataset building module: Obtain all available labeled datasets, merge them completely, and then remove duplicates to obtain a labeled dataset; Model training module: used to perform domain-adaptive training and hierarchical training, where, The domain-adaptive training specifically involves: constructing a mask autoencoder, which consists of a ViT encoder and a linear decoder. The ViT encoder serves as the backbone network of the final state embedding generative model. A classification token is added before the image feature sequence in the unlabeled dataset. The mask autoencoder is then trained in a domain-adaptive manner based on the unlabeled dataset. During the training process, the classification token is learned to obtain the domain-adaptive weights of the ViT encoder. The hierarchical training specifically involves: constructing a state embedding generation model, including a shared ViT backbone network and a two-stage classifier, wherein the shared ViT backbone network is loaded with the domain-adaptive weights of the ViT encoder obtained through domain-adaptive training, and the two-stage classifier includes a coarse classifier and a fine classifier; adding classification tokens to the image feature sequences in the labeled dataset, and performing hierarchical training on the state embedding generation model based on the labeled dataset, learning the classification tokens during the training process; Embedding generation module: Input any cell image patch into the trained state embedding generation model, output the classification result based on the two-stage classifier, and obtain the cell state embedding based on the output vector of the classification token; Interpretability Analysis Module: Used for interpretability analysis based on the output of the embedded generation module.

[0015] Compared with the prior art, the present invention has the following beneficial effects: (1) Extremely high classification accuracy and generalization ability: This invention fundamentally solves the domain bias problem when general models are applied to specific mIF data through self-supervised pre-training on full unlabeled data. This is the key to the model's high generalization ability. Subsequently, by combining a hierarchical classification architecture that simulates expert logic with an advanced fine-tuning strategy of differentiated learning rates, the invention maximizes the use of pre-trained knowledge while accurately adapting to downstream tasks, significantly improving the recognition accuracy of rare cell subpopulations. The method of this invention achieves extremely high classification performance (coarse classification accuracy > 97%) on independent gold standard datasets, and in particular, it completely solves the core pain point of low recall rate (complete detection rate) of key immune cells in existing methods.

[0016] (2) Enables the discovery of new cell states: The core innovation of this invention lies in the fact that its goal is not to directly label cells, but to learn a continuous high-dimensional state embedding for each cell. This embedding can describe the intermediate states and subtle differences of cells, providing a unified and powerful digital foundation for all downstream analyses. The continuous cell state embedding makes it possible to discover new and undefined cell subpopulations or transitional states through unsupervised methods such as clustering, greatly expanding the depth of research.

[0017] (3) Built-in interpretability: This invention utilizes the inherent characteristics of the ViT architecture to provide an intuitive visualization method that can reveal the subcellular localization patterns on which the model's decisions are based, transforming the "black box" model into a reliable scientific discovery tool.

[0018] (4) Efficient data to insight workflow: This invention adopts a data flow of "one-time preprocessing + fast loading" and combined with a powerful model to achieve efficient transformation from raw images to precise cell state analysis, and has the ability to process large-scale clinical cohorts.

[0019] (5) Promoting precision medicine and personalized treatment: By accurately and quantitatively modeling the state of each cell in the tumor microenvironment, this invention provides unprecedented digital pathological evidence for assessing tumor immune status, screening patients with advantages for immunotherapy, and discovering new therapeutic targets. Attached Figure Description

[0020] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a schematic diagram of the training process of the present invention; Figure 3 This is a system structure diagram of the present invention. Detailed Implementation

[0021] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are based on the technical solution of the present invention and provide detailed implementation methods and specific operating procedures. However, the scope of protection of the present invention is not limited to the following embodiments.

[0022] This embodiment provides a spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning, such as... Figure 1 As shown, it includes the following steps: S100, Data Acquisition and Preprocessing of Full Sample Cell Image Blocks.

[0023] Specifically, it includes the following steps: S101, Data Collection: Acquire multiplex immunofluorescence (mIF) images (.ome.tiff format) and corresponding single-cell segmentation masks (mask.tif format) generated by cell segmentation algorithms (such as Mesmer).

[0024] S102, Image Preprocessing: To address the I / O bottleneck in subsequent training, a one-time data preprocessing step is performed. All available multiplex immunofluorescence images are traversed, and each individual cell is extracted into a standard-sized (e.g., 64×64 pixels), multi-channel (e.g., 7-channel) image patch centered on its centroid, based on the cell segmentation mask.

[0025] S103, Data Storage: Save each cell patch as a separate, extremely fast-loading binary file (e.g., .npy). This step will create an unlabeled dataset containing millions to tens of millions of cell patches.

[0026] In one preferred embodiment, the script 0_extract_all_unlabeled_patches_optimized.py is executed to extract approximately 9.6 million 64×64 pixel cell patches from 1,608 samples across all 18 queues under BASE_DATA_DIR and save them as .npy files.

[0027] S200, Domain Adaptive Supervised Pre-training.

[0028] This is one of the core innovations of this invention. It aims to adapt the general pre-trained ViT model backbone network to the visual feature domain specific to the mIF dataset in this study. Specifically, a masked autoencoder (MAE) is constructed, consisting of a ViT encoder and a simple linear decoder. The ViT encoder serves as the backbone network of the final state embedding generative model. A classification token (CLS token) is added before the image feature sequence in the unlabeled dataset. The masked autoencoder is then trained with domain adaptation based on the unlabeled dataset. During training, the classification token is learned to obtain the domain-adaptive weights of the ViT encoder.

[0029] Among them, such as Figure 2 As shown, the domain-adaptive training specifically involves: in each training batch, randomly masking cell image patches in the unlabeled training set (e.g., masking 75% of the area), then inputting them into the ViT encoder. The ViT encoder outputs feature representations of the visible area image patches, which are then processed by a linear decoder to reconstruct the original pixels of the masked area. By minimizing the mean squared error (MSE Loss) between the reconstructed pixels and the original pixels, the ViT backbone network is driven to learn the intrinsic structure and patterns of the data, thereby training the mask autoencoder.

[0030] In this step, the model is trained to reconstruct randomly occluded image regions, enabling its ViT backbone network to learn visual features specific to mIF images in this domain, and outputting a ViT backbone network weight that is domain-adapted and "understands" the style of the data in this study.

[0031] In one preferred embodiment, the script `1_self_supervised_pretrain_optimized.py` is executed. A 10% subset of the data from `PREPROCESSED_PATCH_DIR` is loaded to build the MaskedAutoencoder model. It is trained for 50 epochs with a batch size of 256, using the AdamW optimizer, with the goal of reconstructing the original pixels that are randomly masked (75%). After training, the weights of the encoder (ViT backbone network) are saved as `PhenoSSP_vits16_kidney_adapted.pt`.

[0032] S300, Construction and partitioning of labeled datasets.

[0033] Specifically, all available, high-quality labeled datasets with expert annotations are obtained, fully merged, and deduplicated to ensure that each cell has only one unique and most reliable label, resulting in a labeled dataset, which is then strictly divided into a training set (80%) and a validation set (20%).

[0034] In one preferred embodiment, the 2_supervised_finetune.py script is executed. All expert annotations in ANNOTATION_DIR and ORIGINAL_ANNOTATION_PATH are loaded and merged, resulting in a final fine-tuned dataset of approximately 134,000 cells after deduplication. This dataset is then divided into training and validation sets at 80% and 20% respectively.

[0035] S400, advanced supervised fine-tuning based on a hierarchical strategy.

[0036] This is another core innovation of the present invention. It aims to achieve a high degree of separability among different cell categories in the final cell state embedding space. Specifically, a state embedding generation model is constructed, including a shared ViT backbone network and a two-stage classifier. The shared ViT backbone network is loaded with domain-adaptive weights from the ViT encoder obtained through domain-adaptive training. The two-stage classifier includes a coarse classifier and a fine classifier. A classification token (CLS token) is added before the image feature sequences in the labeled dataset. The state embedding generation model is then trained hierarchically based on the labeled dataset, and the classification token is learned during the training process.

[0037] like Figure 2 As shown, the tiered training is specifically as follows: Unfreeze the parameters of the last few Transformer Blocks and the final normalization layer of the ViT backbone network, and freeze the remaining parameters; Set a preset small learning rate (e.g., 2e-6) for the thawed ViT backbone network layer, and set a preset large learning rate (e.g., 1e-4) for the newly initialized two-stage classifier. The ViT backbone network and coarse classifier are trained based on the labeled dataset, enabling the coarse classifier to distinguish between epithelial cells, immune cells and other cells. After the coarse classifier is trained, its updated ViT backbone network weights are maintained, and the ViT backbone network and fine classifier are trained based on the labeled dataset.

[0038] In this embodiment, robust training strategies, including class-weighted loss, weighted random sampling, and early stopping, are employed in both training phases of hierarchical training to address class imbalance and prevent overfitting.

[0039] In one preferred embodiment, the CoarseClassifier model is initialized, with its backbone network loaded from PhenoSSP_vits16_kidney_adapted.pt. The last two Block and Norm layers of the backbone network are unfrozen. Differential learning rates are set: 2e-6 for the unfrozen layers of the backbone network and 1e-4 for the classification head. Training is performed using weighted random sampling and an early stopping mechanism (patience=5) to obtain the final coarse classification model and the updated backbone network. Based on this, ImmuneFineTuner is trained using the same strategy to obtain the final fine-tuned immune classification model.

[0040] S500, Cell State Embedding Generation and Interpretability Analysis.

[0041] Specifically, any cell image patch is input into the trained state embedding generation model, the classification result is output based on the two-stage classifier, the cell state embedding is obtained based on the output vector of the classification token, and interpretability analysis is performed.

[0042] In this embodiment, interpretability analysis specifically includes: Attention map visualization: Using the model's built-in get_last_self_attention method, the attention map of the last encoder block of the ViT backbone network is extracted and highlighted in the form of a heatmap to show the subcellular regions that the state embedding generative model focuses on when making decisions; Feature space visualization: Extract the classification tokens generated by the state embedding generative model for all sub-regions within the cell image block, reduce the dimensionality through principal component analysis (PCA) and map them to the RGB color space to generate a semantic segmentation map that intuitively reflects the model's understanding of subcellular structures.

[0043] In one preferred embodiment, the script `3_evaluate_final_model.py` is executed. The finally trained model is loaded, and inference is performed on independent test samples. For each cell, the CLS token output by its ViT backbone network is its state embedding. This embedding is fed into the classification head to obtain the final class. The predicted class is compared with the gold standard to evaluate the model performance.

[0044] For interpretability analysis: Execute the script 4_visualize_attention_and_features.py, specifying a cell (e.g., sample A-1, cell ID 1056).

[0045] (1) The script calls the model’s built-in get_last_self_attention method to obtain and visualize the attention map, showing the subcellular regions that the model focuses on.

[0046] (2) At the same time, the script extracts patch token features, reduces dimensionality through PCA and visualizes them to show the model’s semantic understanding of subcellular structures.

[0047] This embodiment also provides a spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning, such as Figure 3 As shown, it includes: Data acquisition module: acquires multiplex immunofluorescence images and corresponding single-cell segmentation masks generated by the cell segmentation algorithm; Image preprocessing module: Image preprocessing is performed based on single-cell segmentation masks to construct an unlabeled dataset; Dataset building module: Obtain all available labeled datasets, merge them completely, and then remove duplicates to obtain a labeled dataset; Model training module: used to perform domain-adaptive training and hierarchical training, where, The domain-adaptive training specifically involves: constructing a mask autoencoder, which consists of a ViT encoder and a linear decoder. The ViT encoder serves as the backbone network of the final state embedding generative model. A classification token is added before the image feature sequence in the unlabeled dataset. The mask autoencoder is then trained in a domain-adaptive manner based on the unlabeled dataset. During the training process, the classification token is learned to obtain the domain-adaptive weights of the ViT encoder. The hierarchical training specifically involves: constructing a state embedding generation model, including a shared ViT backbone network and a two-stage classifier, wherein the shared ViT backbone network is loaded with the domain-adaptive weights of the ViT encoder obtained through domain-adaptive training, and the two-stage classifier includes a coarse classifier and a fine classifier; adding classification tokens to the image feature sequences in the labeled dataset, and performing hierarchical training on the state embedding generation model based on the labeled dataset, learning the classification tokens during the training process; Embedding generation module: Input any cell image patch into the trained state embedding generation model, output the classification result based on the two-stage classifier, and obtain the cell state embedding based on the output vector of the classification token; Interpretability Analysis Module: Used for interpretability analysis based on the output of the embedded generation module.

[0048] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0049] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.

Claims

1. A spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning, characterized in that, Includes the following steps: Multiple immunofluorescence images and corresponding single-cell segmentation masks generated by cell segmentation algorithms are obtained, and image preprocessing is performed based on the single-cell segmentation masks to construct an unlabeled dataset; A mask autoencoder is constructed, which consists of a ViT encoder and a linear decoder. The ViT encoder serves as the backbone network of the final state embedding generative model. A classification token is added before the image feature sequence in the unlabeled dataset. The mask autoencoder is trained based on the unlabeled dataset in a domain-adaptive manner. During the training process, the classification token is learned to obtain the domain-adaptive weights of the ViT encoder. Obtain all available labeled datasets, merge them completely, and then remove duplicates to obtain a labeled dataset. A state embedding generative model is constructed, including a shared ViT backbone network and a two-stage classifier. The shared ViT backbone network is loaded with the domain-adaptive weights of the ViT encoder obtained by domain-adaptive training, and the two-stage classifier includes a coarse classifier and a fine classifier. A classification token is added before the image feature sequence in the labeled dataset, and the state embedding generation model is trained hierarchically based on the labeled dataset, learning the classification token during the training process. Any cell image patch is input into the trained state embedding generation model, the classification result is output based on the two-stage classifier, the cell state embedding is obtained based on the output vector of the classification token, and interpretability analysis is performed.

2. The spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning according to claim 1, characterized in that, The preprocessing specifically involves: traversing all available multiplex immunofluorescence images, extracting each individual cell into a standard-sized, multi-channel image block centered on its centroid based on the cell segmentation mask, and saving each image block as an independent binary file.

3. The spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning according to claim 1, characterized in that, The specific method for performing domain-adaptive training of the mask autoencoder based on the unlabeled dataset is as follows: In each training batch, cell image patches in the unlabeled training set are randomly masked and then input into the ViT encoder. The ViT encoder outputs the feature representation of the visible region image patch. After processing by the linear decoder, the original pixels of the masked region are reconstructed. The mask autoencoder is trained based on the mean square error between the reconstruction result and the original input image.

4. The spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning according to claim 1, characterized in that, The hierarchical training specifically refers to: Unfreeze the parameters of the last few Transformer Blocks and the final normalization layer of the ViT backbone network, and freeze the remaining parameters; Set a preset small learning rate for the thawed ViT backbone network layer and a preset large learning rate for the newly initialized two-stage classifier; The ViT backbone network and coarse classifier are trained based on the labeled dataset, enabling the coarse classifier to distinguish between epithelial cells, immune cells and other cells. After the coarse classifier is trained, its updated ViT backbone network weights are maintained, and the ViT backbone network and fine classifier are trained based on the labeled dataset.

5. The spatial analytical single-cell state modeling method based on domain adaptation and hierarchical fine-tuning according to claim 1, characterized in that, The interpretability analysis specifically includes: Attention map visualization: Extract the attention map of the last encoder block of the ViT backbone network and highlight the subcellular regions that the state embedding generative model focuses on when making decisions in the form of a heatmap; Feature space visualization: Extract the classification tokens generated by the state embedding generative model for all sub-regions within the cell image block, reduce the dimensionality through principal component analysis and map them to the RGB color space to generate a semantic segmentation map that intuitively reflects the model's understanding of subcellular structures.

6. A spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning, characterized in that, include: Data acquisition module: acquires multiplex immunofluorescence images and corresponding single-cell segmentation masks generated by the cell segmentation algorithm; Image preprocessing module: Image preprocessing is performed based on single-cell segmentation masks to construct an unlabeled dataset; Dataset building module: Obtain all available labeled datasets, merge them completely, and then remove duplicates to obtain a labeled dataset; Model training module: used to perform domain-adaptive training and hierarchical training, where, The domain-adaptive training specifically involves: constructing a mask autoencoder, which consists of a ViT encoder and a linear decoder. The ViT encoder serves as the backbone network of the final state embedding generative model. A classification token is added before the image feature sequence in the unlabeled dataset. The mask autoencoder is then trained in a domain-adaptive manner based on the unlabeled dataset. During the training process, the classification token is learned to obtain the domain-adaptive weights of the ViT encoder. The hierarchical training specifically involves: constructing a state embedding generation model, including a shared ViT backbone network and a two-stage classifier, wherein the shared ViT backbone network is loaded with the domain-adaptive weights of the ViT encoder obtained through domain-adaptive training, and the two-stage classifier includes a coarse classifier and a fine classifier; adding classification tokens to the image feature sequences in the labeled dataset, and performing hierarchical training on the state embedding generation model based on the labeled dataset, learning the classification tokens during the training process; Embedding generation module: Input any cell image patch into the trained state embedding generation model, output the classification result based on the two-stage classifier, and obtain the cell state embedding based on the output vector of the classification token; Interpretability Analysis Module: Used for interpretability analysis based on the output of the embedded generation module.

7. A spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning according to claim 6, characterized in that, The preprocessing specifically involves: traversing all available multiplex immunofluorescence images, extracting each individual cell into a standard-sized, multi-channel image block centered on its centroid based on the cell segmentation mask, and saving each image block as an independent binary file.

8. A spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning according to claim 6, characterized in that, The specific method for performing domain-adaptive training of the mask autoencoder based on the unlabeled dataset is as follows: In each training batch, cell image patches in the unlabeled training set are randomly masked and then input into the ViT encoder. The ViT encoder outputs the feature representation of the visible region image patch. After processing by the linear decoder, the original pixels of the masked region are reconstructed. The mask autoencoder is trained based on the mean square error between the reconstruction result and the original input image.

9. A spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning according to claim 6, characterized in that, The hierarchical training specifically refers to: Unfreeze the parameters of the last few Transformer Blocks and the final normalization layer of the ViT backbone network, and freeze the remaining parameters; Set a preset small learning rate for the thawed ViT backbone network layer and a preset large learning rate for the newly initialized two-stage classifier; The ViT backbone network and coarse classifier are trained based on the labeled dataset, enabling the coarse classifier to distinguish between epithelial cells, immune cells and other cells. After the coarse classifier is trained, its updated ViT backbone network weights are maintained, and the ViT backbone network and fine classifier are trained based on the labeled dataset.

10. A spatial analytical single-cell state modeling system based on domain adaptation and hierarchical fine-tuning according to claim 6, characterized in that, The interpretability analysis specifically includes: Attention map visualization: Extract the attention map of the last encoder block of the ViT backbone network and highlight the subcellular regions that the state embedding generative model focuses on when making decisions in the form of a heatmap; Feature space visualization: Extract the classification tokens generated by the state embedding generative model for all sub-regions within the cell image block, reduce the dimensionality through principal component analysis and map them to the RGB color space to generate a semantic segmentation map that intuitively reflects the model's understanding of subcellular structures.

Citation Information

Patent Citations

  • Modeling method and device based on cell state, electronic equipment and storage medium

    CN118800318A