Evaluation methods, systems, equipment, and media for small sample cell counting models

CN122990691APending Publication Date: 2026-10-27HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611296004.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

现有少样本细胞计数模型多采用随机划分方式在单一数据集上进行训练与评估,其性能评估通常仅在同类数据分布下进行

Benefits of technology

本申请实施例为病理图像块标注由物种信息、器官信息和细胞类型信息共同构成的生物学上下文标签,构建了具备生物学维度区分能力的初始数据集。通过统计初始数据集中各物种的样本数量确定主导物种,进而针对主导物种的每个器官统计各细胞类型的样本数量以确定代表性细胞类型,将主导物种信息、器官信息和代表性细胞类型信息三者组合为域内判定基准,实现了域内判定基准构建的客观性和自动化。在此基础上,以各样本的生物学上下文标签与域内判定基准进行一一匹配,将匹配成功的样本划分至域内数据集,将匹配不成功的样本划分至域外数据集,使得域内数据集中的样本所对应的生物学上下文标签与训练阶段可见的生物组合完全一致,域外数据集中的样本所对应的生物学上下文标签均为训练阶段未曾见过的全新生物组合,从而建立了域内为已知场景、域外为全新未知生物场景之间的强对应关系。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122990691A_ABST
    Figure CN122990691A_ABST
Patent Text Reader

Abstract

This application provides a method, system, device, and medium for evaluating few-sample cell counting models, belonging to the field of model evaluation technology. The method includes: labeling each pathological image patch with a biological context label; associating each pathological image patch, its corresponding cell labeling information, and the biological context label as a sample, obtaining an initial dataset containing multiple samples; determining the combination of dominant species information, organ information, and representative cell type information as the intra-domain judgment benchmark corresponding to the organ; matching each sample's biological context label with the intra-domain judgment benchmark one-to-one, assigning successfully matched samples to the intra-domain dataset and unmatched samples to the extra-domain dataset; evaluating the target few-sample cell counting model based on the intra-domain dataset and / or the extra-domain dataset, obtaining multiple evaluation results. This application can improve the comprehensiveness and accuracy of few-sample cell counting model evaluation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of model evaluation technology, and more specifically, it relates to methods, systems, equipment and media for evaluating small sample cell counting models. Background Technology

[0002] Cell counting is a fundamental task in computational pathology quantitative analysis. To reduce reliance on large-scale labeled data, few-shot learning techniques have been introduced into this field. Existing few-shot cell counting models are mostly trained and evaluated on a single dataset using random partitioning, and their performance is typically evaluated only under similar data distributions. However, pathological images exhibit significant distributional diversity due to differences in species, organs, staining methods, etc. A model performing well on one data distribution does not guarantee its effectiveness on others. Due to the lack of a systematic evaluation mechanism capable of distinguishing between known and unknown scenarios, existing techniques struggle to effectively measure the model's true performance when faced with entirely new biological samples. Therefore, how to comprehensively and accurately evaluate few-shot cell counting models under multiple distribution conditions has become a critical problem urgently needing to be solved in this field. Summary of the Invention

[0003] The purpose of this application is to provide a method, system, device, and medium for evaluating small sample cell counting models, so as to improve the comprehensiveness and accuracy of small sample cell counting model evaluation.

[0004] A first aspect of this application provides a method for evaluating a small-sample cell counting model, comprising: Obtain the original pathological image database, which contains multiple whole-slice images and their corresponding tissue region annotations; Each whole-slice image is segmented to obtain multiple pathological image blocks; cell instance segmentation is performed on each pathological image block to obtain the cell annotation information corresponding to that pathological image block; biological context labels are labeled for each pathological image block, which are composed of species information, organ information, and cell type information; each pathological image block, the corresponding cell annotation information, and the biological context label are associated as a sample to obtain an initial dataset containing multiple samples. The number of samples for each species in the initial dataset is counted, and the species with the most samples is identified as the dominant species, and the dominant species information is obtained. For each organ of the dominant species, the number of samples for each cell type under that organ is counted, and the cell type with the most samples is identified as the representative cell type of that organ, and the representative cell type information for each organ is obtained. The combination of the dominant species information, organ information, and representative cell type information is determined as the domain judgment benchmark for that organ. Each sample is matched one-to-one with the domain-specific criteria using its biological context label. Samples that match successfully are assigned to the domain dataset, while samples that do not match are assigned to the external dataset. The domain dataset and the external dataset are independent of each other and have no overlap. The target small sample cell counting model was evaluated based on in-domain and / or out-of-domain datasets, resulting in multiple evaluation results.

[0005] A second aspect of this application provides a small-sample cell counting model evaluation system, comprising: The data acquisition module is used to acquire the original pathological image database, which contains multiple whole-slice images and their corresponding tissue region annotations. The dataset construction module is used to cut each whole slice image to obtain multiple pathological image blocks; to perform cell instance segmentation on each pathological image block to obtain the cell annotation information corresponding to the pathological image block; to annotate each pathological image block with a biological context label, which is composed of species information, organ information and cell type information; and to associate each pathological image block, the corresponding cell annotation information and biological context label as a sample to obtain an initial dataset containing multiple samples. The domain-specific criterion determination module is used to count the number of samples for each species in the initial dataset, identify the species with the most samples as the dominant species, and obtain the dominant species information; for each organ of the dominant species, it counts the number of samples for each cell type under that organ, identifies the cell type with the most samples as the representative cell type of that organ, and obtains the representative cell type information for each organ; the combination of the dominant species information, organ information, and representative cell type information is determined as the domain-specific criterion for that organ. The domain partitioning module is used to match each sample's biological context label with the domain-specific criteria one by one. Samples that match successfully are assigned to the domain dataset, while samples that do not match are assigned to the external dataset. The domain dataset and the external dataset are independent of each other and have no overlap. The evaluation module is used to evaluate the target small sample cell counting model based on in-domain and / or out-of-domain datasets, and obtain multiple evaluation results.

[0006] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above-described small sample cell counting model evaluation method.

[0007] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described small sample cell counting model evaluation method.

[0008] The beneficial effects of the small sample cell counting model evaluation method, system, device, and medium provided in this application are as follows: This application's embodiments annotate pathological image blocks with biological context labels composed of species information, organ information, and cell type information, constructing an initial dataset with biological dimension discrimination capabilities. By statistically analyzing the number of samples of each species in the initial dataset, the dominant species is determined. Then, for each organ of the dominant species, the number of samples of each cell type is statistically analyzed to determine representative cell types. The dominant species information, organ information, and representative cell type information are combined to form the intra-domain judgment benchmark, achieving objectivity and automation in the construction of the intra-domain judgment benchmark. Based on this, the biological context labels of each sample are matched one-to-one with the intra-domain judgment benchmark. Successfully matched samples are assigned to the intra-domain dataset, while unmatched samples are assigned to the extra-domain dataset. This ensures that the biological context labels corresponding to samples in the intra-domain dataset are completely consistent with the biological combinations seen during the training phase, while the biological context labels corresponding to samples in the extra-domain dataset are all novel biological combinations not seen during the training phase. This establishes a strong correspondence between the intra-domain being a known scene and the extra-domain being a completely new and unknown biological scene.

[0009] Under limited sample conditions, traditional random partitioning methods cannot guarantee the independence and isolation of the test set and training set in terms of biological combinations due to the extremely limited number of labeled samples available for training in each basic category. This easily leads to data leakage and inflated evaluation results. This embodiment of the application ensures, during the data partitioning stage, that the triples of each sample in the external test set do not appear in the internal training set or internal validation set by matching biological context labels one-to-one with the domain-specific decision benchmark. This avoids data leakage and allows the external evaluation results to truly reflect the model's generalization performance baseline when facing novel biological combinations. The internal evaluation results reflect the upper limit of the model's accuracy on known biological combinations, while the external evaluation results reflect the lower limit of the model's generalization on novel biological combinations. Both results directly quantify the model's cross-domain generalization ability. Therefore, this embodiment of the application provides users with an objective and quantifiable decision-making basis for judging whether a model has the conditions for cross-scenario generalization deployment, effectively guiding the model's iteration direction and improving the comprehensiveness and accuracy of the evaluation of limited sample cell counting models. Attached Figure Description

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

[0011] Figure 1 A schematic flowchart illustrating a method for evaluating a small-sample cell counting model according to an embodiment of this application; Figure 2 A flowchart illustrating the overall architecture of a small-sample cell counting model evaluation method provided in an embodiment of this application; Figure 3 This is a structural block diagram of a small-sample cell counting model evaluation system provided in an embodiment of this application; Figure 4 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0012] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0013] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.

[0014] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for evaluating a small-sample cell counting model according to an embodiment of this application. The method can be executed by an electronic device and includes: S101: Obtain the original pathological image database, which contains multiple whole-slice images and their corresponding tissue region annotations.

[0015] In this embodiment, the original pathological image database is obtained from a public pathological image database and contains multiple whole-slice images and corresponding tissue region annotations for each whole-slice image. A whole-slice image is a complete digital image file generated after high-resolution scanning of a pathological tissue sample; this file contains all the morphological information of the tissue sample. Tissue region annotations are spatial annotation data accompanying the whole-slice images, used to indicate the boundaries of the effective tissue regions within the whole-slice images.

[0016] S102: Segment each whole-slice image to obtain multiple pathological image blocks; perform cell instance segmentation on each pathological image block to obtain the cell annotation information corresponding to the pathological image block; label each pathological image block with a biological context label, which is composed of species information, organ information and cell type information; associate each pathological image block, the cell annotation information corresponding to the pathological image block and the biological context label as a sample to obtain an initial dataset containing multiple samples.

[0017] In this embodiment, each whole-slice image is segmented to obtain multiple pathological image blocks, including: The tissue region mask for each full-slice image is determined based on the tissue region annotation; Within the organization region mask, each full-slice image is cut according to a preset physical size to obtain multiple original image blocks; The resolution of each original image block is normalized to obtain the corresponding resolution-normalized image block; The image blocks normalized to each resolution were subjected to staining normalization, and the image blocks after staining normalization were used as pathological image blocks.

[0018] In this embodiment, the tissue region mask is a binary image generated based on the tissue region annotation. Regions with a mask value of 1 represent valid tissue regions, and regions with a mask value of 0 represent background regions. The tissue region annotation file accompanying each full-slice image is parsed to extract the geometric coordinate sequence of the tissue region contour. This coordinate sequence defines the boundary position of the tissue region in the coordinate system of the full-slice image. A binary image matrix with the same resolution as the full-slice image is created in the coordinate system of the full-slice image. All pixels in this matrix are initialized to 0. Each pixel position within the polygonal area enclosed by the tissue region contour coordinate sequence is traversed, and the corresponding value in the binary image matrix for each position is set to 1. After processing, the tissue region mask is obtained.

[0019] The pixel spacing parameter, measured in micrometers per pixel, is read from the metadata of each full-slice image. The number of pixels required for cutting is calculated based on the preset physical dimensions and pixel spacing parameter. In the coordinate system of the full-slice image, all pixel positions with a mask value of 1 in the tissue region mask are used as the effective cutting range. Multiple non-overlapping cutting start points are generated according to the calculated row and column pixel steps. For each cutting start point, a rectangular region image data with the starting point as its upper left corner and a size equal to the calculated number of pixels is extracted from the full-resolution image data of the full-slice image. If the edge of the rectangular region exceeds the tissue region mask range, that position is skipped. The extracted rectangular region image data constitutes the original image patch of each full-slice image.

[0020] Obtain the pixel spacing parameters of the source full-slice image for each original image block, calculate the scaling ratio required to scale from the original pixel spacing to the target pixel spacing, and use bilinear interpolation to perform spatial coordinate mapping and pixel value resampling for each pixel channel of each original image block. After scaling, all original image blocks have a uniform pixel spacing and corresponding target pixel size, resulting in image blocks with resolution normalized.

[0021] A pre-defined standard staining reference image is selected, from which staining reference vectors and staining concentration reference values ​​are extracted. The resolution-normalized image patch is converted from the RGB color space to the optical density space. Principal component analysis is performed on the pixel value distribution to estimate the staining vectors of the two main staining agents and the staining concentration values ​​at each pixel location. The 99th percentile of the staining concentration values ​​is extracted as the maximum staining saturation. The staining concentration values ​​at each pixel location are linearly mapped according to the ratio between this maximum staining saturation and the staining concentration reference value, aligning the mapped staining concentration distribution with the reference image. The mapped staining concentration is then combined with the staining reference vector to reconstruct the RGB color space, obtaining a staining-normalized image patch, which is used as the pathological image patch for subsequent processing.

[0022] This embodiment limits the cutting range to the effective tissue area of ​​the whole-slice image by determining a tissue region mask, avoiding the cutting of invalid background areas and improving the efficiency and quality of dataset construction. Cutting according to preset physical dimensions ensures that each original image block corresponds to the same actual tissue area, eliminating the impact of differences in scanning magnification. Resolution normalization and staining normalization eliminate technical differences in pixel scale and staining style, respectively, making the final pathological image blocks consistent in physical scale and color space. This provides standardized input data for subsequent cell instance segmentation operations, ensuring the accuracy and comparability of the segmentation results.

[0023] In this embodiment, cell instance segmentation is performed on each pathological image block to obtain the cell annotation information corresponding to that pathological image block, including: Each pathological image patch is input into a pre-trained cell segmentation model to obtain the initial cell instance segmentation results for each pathological image patch. The initial cell instance segmentation results include the bounding boxes of each cell and the initial cell type. The initial cell instance segmentation results of each pathological image block are subjected to quality control, and the initial cell instance segmentation results that pass the quality control are used as the cell annotation information corresponding to the pathological image block. Quality control includes: extracting samples to be audited from each pathological image block; submitting the pathological image block corresponding to each sample to be audited to pathology experts; having the pathology experts manually count the effective cell types in the pathological image block corresponding to the sample to be audited; calculating the relative deviation between the cell count in the initial cell instance segmentation result of each sample to be audited and the manual count result; and determining the initial cell instance segmentation result of the pathological image block corresponding to the sample to be audited with a relative deviation less than or equal to a preset threshold as having passed quality control.

[0024] In this embodiment, the pre-trained cell segmentation model adopts an encoder-decoder architecture. The encoder performs layer-by-layer feature extraction on the input pathological image patch: the first convolutional layer of the encoder receives the pathological image patch as input and extracts shallow features through convolution operations, capturing the edge and texture information of the cell nucleus; the middle layers of the encoder gradually reduce the spatial resolution of the feature map through downsampling operations, while increasing the number of channels in the feature map, extracting mid-level semantic features and capturing the morphology and size information of the cell nucleus; the last layer of the encoder outputs a high-dimensional feature map, which contains the deep semantic features and spatial distribution information of the cell nucleus. The decoder receives the high-dimensional feature map output by the encoder, gradually restores the spatial resolution of the feature map through upsampling operations, and concatenates the features output by each layer of the encoder with the features of the corresponding layer of the decoder through feature fusion operations, fusing shallow detail features and deep semantic features, and finally outputs a segmentation prediction map with the same resolution as the input image.

[0025] The segmentation prediction map output by the model contains two types of information: the probability value of belonging to a cell nucleus at each pixel location, and the probability distribution of belonging to different cell categories at each pixel location. Post-processing of the segmentation prediction map is performed through connected component analysis: First, pixels with a probability value of belonging to a cell nucleus higher than a preset threshold are selected from the segmentation prediction map; then, adjacent pixels in these locations are clustered into the same connected region, with each connected region corresponding to a cell instance; a unique instance number is assigned to each connected region; and the initial cell type of the cell instance is determined based on the maximum probability distribution of each pixel location belonging to different cell categories within the connected region. The contour boundary of each cell instance is extracted, and the minimum bounding rectangle enclosing the contour is calculated. The bounding box of the cell instance is represented by four values: the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner. This yields the initial cell instance segmentation results for each pathological image patch, which include the bounding box and initial cell type of each cell instance.

[0026] This embodiment extracts audit samples from each pathological image block according to the stratified sampling principle. The combination of species information, organ information, and cell type information is used as the stratification dimension, with each unique combination defined as a sampling stratum. The sampling quantity of each stratum is no less than 5% of the total number of samples in that stratum, and at least 3 samples are audited per stratum. For categories with fewer than 3 samples, a full audit is performed. For each extracted audit sample, its corresponding pathological image block and initial cell instance segmentation results are obtained. These results are submitted to pathology experts, who visually count the cells belonging to valid cell types in the pathological image block, obtaining the manual count result for the audit sample. For each audit sample, the total number of cells of valid cell types is calculated from the initial cell instance segmentation results, and this total number is used as the model count. The absolute value of the difference between the model count and the manual count is calculated, divided by the model count, and multiplied by 100% to obtain the relative deviation of the sample. The relative deviation is compared with a preset threshold (e.g., 20%, which can be set empirically): if the relative deviation is less than or equal to the preset threshold, the initial cell instance segmentation result of the sample is considered to have passed quality control; if the relative deviation is greater than the preset threshold, the initial cell instance segmentation result of the sample is considered to have failed quality control. All initial cell instance segmentation results that pass quality control are used as cell annotation information for the corresponding pathological image blocks and stored in a structured format. Each cell record includes a cell identifier, cell type label, and bounding box coordinate data. For pathological image blocks that fail quality control, their corresponding initial cell instance segmentation results are not adopted as cell annotation information for those pathological image blocks, and those pathological image blocks are not included in the initial dataset.

[0027] This embodiment utilizes a pre-trained cell segmentation model for automated cell instance segmentation, achieving efficient conversion from pathological images to structured labeled data and significantly reducing the time and labor costs required for manual annotation. Building upon this, a quality control mechanism is introduced. Stratified sampling ensures that the annotation quality of different species, organ, and cell type combinations is verified, avoiding quality blind spots caused by reviewing only specific categories. Using manual counting by pathology experts as a reference standard, reliable automatic segmentation results are quantitatively and objectively selected through relative deviation calculation and preset threshold judgment, guaranteeing the accuracy and credibility of the final cell annotation information.

[0028] In this embodiment, species information identifies the species category from which the pathological image block originates, organ information identifies the name of the tissue or organ from which the pathological image block originates, and cell type information identifies the cell type contained in the pathological image block. The biological context labels are determined based on the metadata information of the whole-slice image from which each pathological image block originates. In the original pathological image database, each whole-slice image is associated with a corresponding metadata record, which contains the species name, organ name, and cell type information contained in the slice. When a pathological image block is cut from a whole-slice image, the image block inherits the metadata information of the source whole-slice image, recording its corresponding species information, organ information, and cell type information, thus completing the annotation of the biological context labels.

[0029] After obtaining the cell annotation information and biological context labels for each pathological image patch, each pathological image patch, its corresponding cell annotation information, and its biological context label are associated as a sample. During association, the filename of the pathological image patch is used as a unique identifier. This filename already contains the identification information of the source whole-slice image and its spatial location information within the slice, making it unique across the entire dataset. Using this filename as the association key, the image data file, the corresponding cell annotation information file, and the corresponding biological context label record of the pathological image patch are bound together to form a complete sample record. In this sample record, the image data file records the pixel information of the pathological image patch, the cell annotation information file records the spatial location and category of each valid cell in the image patch, and the biological context label records the species, organ, and cell type from which the image patch originated. All sample records are then combined to form an initial dataset containing multiple samples.

[0030] This embodiment ensures that each sample in the initial dataset carries a complete three-in-one information structure: image data, cell annotation, and biological context labeling. This association method guarantees the integrity and traceability of data throughout the processing flow, and the association mechanism using pathological image block file names as unique identifiers avoids data confusion and mismatch. Biological context labels serve as the biological identity of each sample, providing a direct data source and basis for subsequent intra- and extra-domain classification based on biological context. This allows the classification operation to be performed using structured label matching, rather than relying on manual judgment or external information.

[0031] S103: Count the number of samples for each species in the initial dataset, identify the species with the most samples as the dominant species, and obtain the dominant species information; for each organ of the dominant species, count the number of samples for each cell type under that organ, identify the cell type with the most samples as the representative cell type of that organ, and obtain the representative cell type information for each organ; combine the dominant species information, organ information, and representative cell type information to determine the domain judgment benchmark for that organ.

[0032] In this embodiment, each sample in the initial dataset is traversed, species information is extracted from the biological context labels of each sample, all samples are classified and statistically analyzed according to the species information, the number of samples corresponding to each species information is calculated, the number of samples corresponding to each species is compared, the species with the largest number of samples is determined as the dominant species, and the species information of the dominant species is recorded as the dominant species information.

[0033] After identifying the dominant species, samples whose species information matches the dominant species information are selected from the initial dataset to form a subset of dominant species samples. Each sample in this subset is traversed, and organ and cell type information is extracted. Using organ information as the first-level grouping dimension, the samples in the dominant species sample subset are divided into multiple organ groups, each corresponding to one organ. For each organ group, using cell type information as the second-level grouping dimension, the samples within that organ group are further divided into multiple cell type groups, each corresponding to one cell type. The number of samples corresponding to each cell type group within each organ group is counted. For each organ, the number of samples corresponding to each cell type under that organ is compared, and the cell type with the largest number of samples is determined as the representative cell type of that organ, and its cell type information is recorded as the representative cell type information for that organ.

[0034] After completing the above operations, the dominant species information, organ information, and representative cell type information corresponding to each organ are obtained for the initial dataset. For each organ, the dominant species information, organ information, and representative cell type information are combined into a triple, and this triple is determined as the intra-domain decision criterion for that organ.

[0035] For example, when the dominant species is human, the organ is lung, and the representative cell type is lymphocyte, the domain determination criterion for the human lung organ is a tripartite consisting of human species information, lung organ information, and lymphocyte type information.

[0036] This implementation method determines the dominant species by statistically analyzing the number of samples for each species, thus establishing the intra-domain determination criteria based on objective data distribution facts and avoiding subjective setting. It determines the representative cell types by statistically analyzing the number of samples for each cell type for each organ, ensuring its statistical representativeness. The tripartite consisting of dominant species information, organ information, and representative cell type information provides a clear, objective, and automatically executable matching standard for subsequent automated division within and outside the domain.

[0037] S104: Match each sample's biological context label with the domain-specific criteria one by one. Successfully matched samples are assigned to the domain dataset, while unsuccessfully matched samples are assigned to the external dataset. The domain dataset and the external dataset are independent of each other and have no overlap.

[0038] In this embodiment, each sample's biological context label is matched one-to-one with the domain-specific decision criteria, including: For each sample, species information, organ information, and cell type information from the biological context label of that sample are extracted as three types of target information; The dominant species information, organ information, and representative cell type information in the domain determination criteria are used as the three types of criterion information; The three types of target information were compared one by one with the three types of benchmark information; If each of the three target information categories is consistent with each of the three benchmark information categories, then the biological context label of the sample is determined to be a successful match with the domain judgment benchmark. If at least one of the three types of target information is inconsistent with each of the three types of benchmark information, then the biological context label of the sample is determined to be an unsuccessful match with the domain-specific benchmark.

[0039] In this embodiment, the biological context label of each sample is matched one-to-one with the intra-domain decision benchmark, and the sample is assigned to either the intra-domain dataset or the extra-domain dataset based on the matching results. For the currently traversed sample, its biological context label is read, and species information, organ information, and cell type information are extracted as three types of target information. Using the organ information of the current sample as the search key, the intra-domain decision benchmark matching the organ information is searched among all intra-domain decision benchmarks. The dominant species information, organ information, and representative cell type information in the found intra-domain decision benchmarks are used as the three types of benchmark information. The three types of target information are compared one by one with the three types of benchmark information: whether the target species information matches the benchmark dominant species information, whether the target organ information matches the benchmark organ information, and whether the target cell type information matches the benchmark representative cell type information. If all three comparison results are consistent, the match is considered successful, and the sample is assigned to the intra-domain dataset; if at least one is inconsistent, the match is considered unsuccessful, and the sample is assigned to the extra-domain dataset. The above operation is performed on each sample in the initial dataset until all samples are assigned. Through the above sample-by-sample matching and partitioning, there is no sample overlap between the in-domain dataset and the out-of-domain dataset, and the two datasets are independent of each other.

[0040] This implementation method compares data item by item across three dimensions: species information, organ information, and cell type information. A successful match is achieved when all three dimensions match, and a mismatch in any dimension results in an unsuccessful match. This achieves automated and objective partitioning of the in-domain and out-of-domain datasets. The independent and non-overlapping design of the in-domain and out-of-domain datasets ensures that there is no overlap between training and testing data in subsequent evaluations, avoiding data leakage that could interfere with the evaluation results.

[0041] S105: Evaluate the target small sample cell counting model based on in-domain datasets and / or out-of-domain datasets to obtain multiple evaluation results.

[0042] In this embodiment, the target few-shot cell counting model includes: an initial few-shot cell counting model and a trained few-shot cell counting model; the target few-shot cell counting model is evaluated based on an in-domain dataset and / or an out-of-domain dataset to obtain multiple evaluation results, including: The first test set is selected from the dataset within the domain. A second test set was selected from the dataset outside the domain. The first and second test sets are input into an initial few-sample cell counting model loaded with pre-trained weights to obtain the basic predicted cell counts for each pathological image patch; each basic predicted cell count is compared with its corresponding real cell count to generate a basic generalization ability evaluation result; the real cell count is determined by the cell annotation information corresponding to each pathological image patch. The first test set is input into the trained few-sample cell counting model to obtain the first predicted cell count for each pathological image block; the first predicted cell count is compared with the corresponding real cell count to generate the first evaluation result under the known scenario. The second test set is input into the trained few-sample cell counting model to obtain the second predicted cell count for each pathological image block; based on the comparison between each second predicted cell count and its corresponding real cell count, a second evaluation result for unknown scenarios is generated.

[0043] In this embodiment, the initial few-shot cell counting model is a model loaded with pre-trained weights derived from pre-training on a publicly available large-scale counting dataset. The model has not yet been exposed to the in-domain and out-of-domain data involved in this evaluation method. The trained few-shot cell counting model is the model obtained after few-shot fine-tuning training based on the aforementioned initial few-shot cell counting model.

[0044] In this embodiment, during the basic evaluation, the first and second test sets are input into an initial few-shot cell counting model loaded with pre-trained weights. The initial few-shot cell counting model performs forward inference on each pathological image block in the first and second test sets, outputting a predicted density map for each pathological image block. Spatial integration is performed on the predicted density map, and the integral value is used as the predicted cell count for that pathological image block. Cell annotation information corresponding to each pathological image block is obtained, and the total number of effective cells for that pathological image block is counted from the cell annotation information, and this total number is used as the true cell count. For each pathological image block in the first and second test sets, the absolute error and squared error between the predicted cell count and the true cell count are calculated. When the true cell count is greater than zero, the absolute percentage error is calculated. The sum of the absolute errors of all samples and divided by the total number of samples yields the mean absolute error; the sum of the squared errors of all samples and divided by the total number of samples, then squared, yields the root mean square error; the sum of the absolute percentage errors of all samples and divided by the number of effective samples yields the mean absolute percentage error. The above three indicators are used as the basic generalization ability evaluation results.

[0045] In this embodiment, when performing few-shot evaluation in a known scenario, a first test set is input into a pre-trained few-shot cell counting model. The pre-trained few-shot cell counting model performs forward inference on each pathological image patch in the first test set and outputs the predicted density map corresponding to that pathological image patch. Spatial integration is performed on the predicted density map to obtain the predicted cell count. Each predicted cell count is compared with the corresponding real cell count, and the mean absolute error, root mean square error, and mean absolute percentage error are calculated in the same way as the basic evaluation to generate the first evaluation result for the known scenario.

[0046] In this embodiment, when performing few-sample evaluation in unknown scenarios, a second test set is input into a pre-trained few-sample cell counting model. This model has never encountered any samples in the second test set during the training phase. The pre-trained few-sample cell counting model performs forward inference on each pathological image patch in the second test set, outputting a predicted density map for each pathological image patch, and obtaining the predicted cell count through spatial integration. Each predicted cell count is compared with the corresponding real cell count, and the mean absolute error, root mean square error, and mean absolute percentage error are calculated in the same way as the basic evaluation to generate the second evaluation result for the unknown scenario.

[0047] In the above process, when the target few-shot cell counting model performs inference, it needs to receive supporting cell examples corresponding to each pathological image patch as a reference. These supporting cell examples are extracted from the cell annotation information of the pathological image patch, are of the same type as the cell to be predicted, and their number is a preset number of examples, such as three, five, or ten. Based on the spatial location and morphological information of the supporting cell examples, the target few-shot cell counting model predicts the total number of cells of the same type in the pathological image patch. For each preset number of examples, the above evaluation process is performed to obtain evaluation results under different example number conditions, which are used to verify the performance stability of the target few-shot cell counting model under different supporting conditions.

[0048] Evaluation metrics include at least mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAP), which quantify the model's counting accuracy from different perspectives. MAE is the average of the absolute differences between predicted and actual cell counts; a smaller MAE value indicates higher model accuracy and reflects the model's average performance on typical samples. RMSE, by squaring the error, assigns a higher penalty weight to large errors; a smaller RMSE value indicates more stable model performance on heavily biased samples and reflects the model's reliability in extreme cases. MAP measures prediction accuracy as a relative proportion; a smaller MAP value indicates more consistent model performance across different count scales and can eliminate the influence of absolute count scale on error evaluation.

[0049] This embodiment achieves a comprehensive quantitative evaluation of the performance of a target small-sample cell counting model by combining the above three evaluation modes. The basic evaluation results reflect the model's basic generalization ability without any domain adaptation; the first evaluation results in the known scenario reflect the model's rapid adaptation ability and upper limit of accuracy on known distributions; and the second evaluation results in the unknown scenario reflect the model's cross-domain generalization ability when facing novel biological combinations.

[0050] In this embodiment, the first test set is selected from the domain dataset, including: Samples with the same organ information and the same cell type information in the dataset within the domain are grouped into a set of basic categories; The samples in each basic category are balanced to ensure that the number of samples in each basic category is equal. A first preset number of samples are selected from each of the equalized basic categories to form the first test set.

[0051] In this embodiment, all samples in the domain dataset have biological context labels, which include species information, organ information, and cell type information. Since all samples in the domain dataset belong to the same dominant species, organ information and cell type information are used as grouping dimensions to group samples with the same organ information and the same cell type information into the same basic category. Each basic category corresponds to a unique organ-cell type combination, such as the lung-lymphocyte combination or the liver-hepatocyte combination.

[0052] Iterate through all base categories and count the total number of samples in each base category. Find the minimum sample size among all base categories and use this minimum as the equalization target value. For base categories with a sample size greater than the target value, randomly sample without replacement from the sample pool of that base category, selecting a sample size equal to the target value and discarding any excess samples that were not selected. For base categories with a sample size equal to the target value, retain all samples. For base categories with a sample size less than the target value, in this implementation's equalization process, since the target value is the minimum sample size of all base categories, there is no case where the sample size is less than the target value. After the above processing, the sample size of each base category is equal.

[0053] After equalization, each base category has the same total number of samples. For each base category, a specified number of samples are randomly sampled without replacement from the sample pool of that base category according to a first preset number. The remaining samples in each base category that are not selected can be used as the source of subsequent training and validation sets in this embodiment for fine-tuning the initial few-sample cell counting model. The samples extracted from each base category are then aggregated and merged to form the first test set.

[0054] This embodiment eliminates evaluation bias caused by differences in sample size between different organ-cell type combinations by grouping samples with the same organ and cell type information in the domain dataset into basic categories and performing equalization processing. This ensures that each basic category has an equal sample contribution in the first test set. A first set of samples is constructed by selecting a first preset number of samples from each equalized basic category, making the sample distribution of the first test set balanced across categories. This avoids bias in model evaluation due to too many or too few samples in some categories, ensuring that the evaluation results can truly reflect the comprehensive performance of the model on different organ-cell type combinations.

[0055] In this embodiment, the second test set is selected from the dataset outside the domain, including: Obtain the number of samples for each basic category in the first test set, calculate the average number of samples for each basic category, and use the average as the target benchmark value; The samples in the out-of-domain dataset are divided into multiple out-of-domain categories based on a combination of organ information and cell type information. For each out-of-domain category in the out-of-domain dataset, count the total number of candidate samples belonging to that out-of-domain category; The total number of candidate samples for each out-of-domain category is compared with the target benchmark value, and the smaller value between the total number of candidate samples and the target benchmark value is taken as the final sampling number for that out-of-domain category. Based on the final sampling quantity of each out-of-domain category, random sampling is performed from the candidate samples of each out-of-domain category, and the sampled samples are used as the second test set.

[0056] In this embodiment, all basic categories are traversed to obtain the number of samples for each basic category in the first test set. The sample counts of each basic category are added together and then divided by the total number of basic categories to obtain the average number of samples. This average number is used as the target benchmark value.

[0057] Using organ information as the first-level grouping dimension and cell type information as the second-level grouping dimension, samples with the same organ information and the same cell type information are grouped into the same out-of-domain category. After the division, each out-of-domain category corresponds to a unique organ-cell type combination, and there must be at least one difference in organ information or cell type information between out-of-domain categories.

[0058] The total number of candidate samples for each out-of-domain category is compared with the target benchmark. If the total number of candidate samples is greater than the target benchmark, the final sampling quantity for that out-of-domain category is set as the target benchmark. If the total number of candidate samples is less than or equal to the target benchmark, the final sampling quantity for that out-of-domain category is set as the total number of candidate samples; that is, the smaller of the total number of candidate samples and the target benchmark is taken as the final sampling quantity for that out-of-domain category. Random sampling is performed from the candidate samples of each out-of-domain category according to the final sampling quantity. For each out-of-domain category, a number of samples equal to the final sampling quantity for that out-of-domain category are randomly drawn from its candidate sample pool. The samples obtained from each out-of-domain category are then aggregated and merged to form the second test set.

[0059] This embodiment uses the average number of samples from each basic category in the first test set as the target benchmark, thus linking the construction criteria of the second test set to the category size of the first test set and ensuring comparability between the two test sets in terms of category size. For each out-of-domain category, the smaller value between the total number of candidate samples and the target benchmark is taken as the sampling quantity. This ensures that the number of samples for each out-of-domain category is as close as possible to the target benchmark within the data allowance, while avoiding invalid operations caused by the specified sampling quantity exceeding the actual capacity of the category. This mechanism ensures that each out-of-domain category in the second test set receives relatively balanced sample representation, making the out-of-domain evaluation results unaffected by differences in the number of samples from different categories, and objectively reflecting the model's comprehensive generalization performance across different out-of-domain categories.

[0060] In this embodiment, the trained few-shot cell counting model is obtained by training the initial few-shot cell counting model in the following manner: From each equalized base category, a second preset number of samples are selected from the remaining samples after the first test set has been selected as the training set, and the remaining samples after the training set has been selected as the validation set. Based on the pathological image blocks in the training set and their corresponding cell annotation information, the initial few-sample cell counting model is trained until the preset stopping condition is met, and the trained few-sample cell counting model is obtained. The preset stopping condition is that the evaluation metric of the validation set does not decrease in multiple consecutive training rounds during the training process.

[0061] In this embodiment, each equalized base category has the same total number of samples, from which a first preset number of samples have been selected as the first test set. For the remaining samples, a second preset number of samples are selected as the training set, and the remaining samples after selecting the training sets from each base category are used as the validation set. The samples in the training set are used for learning and updating model parameters, and the samples in the validation set are used to monitor the model's generalization performance during training. The training set samples from each base category are aggregated and merged to form a complete training set, and the validation set samples from each base category are aggregated and merged to form a complete validation set.

[0062] For each pathological image patch in the training set, the cell type to be predicted is determined. From the cell annotation information of that pathological image patch, all cell instances with the same cell type as the cell type to be predicted are selected as candidate supporting cells. A predetermined number of cell instances are randomly sampled from the candidate supporting cell pool as supporting cell examples for that pathological image patch. The predetermined number is denoted as N, and N can be a configurable positive integer, such as 3, 5, or 10. The pathological image patch and supporting cell examples are input together into an initial few-sample cell counting model. Based on the reference information of the supporting cell examples, the model predicts the total number of all cells in the pathological image patch with the same cell type as the cell type to be predicted, and outputs a prediction density map. The predicted cell count is obtained by spatial integration of the prediction density map, and the true cell count of the cell type to be predicted in the pathological image patch is obtained. The loss value between the predicted cell count and the true cell count is calculated, and the model parameters are updated through backpropagation.

[0063] During training, after each training epoch, the current model is evaluated on the validation set, and the validation set evaluation metric, using mean absolute error, is calculated. The validation set evaluation metric for the current epoch is compared with the historical best value. If the current epoch's evaluation metric is better than the historical best value, the historical best value is updated, and the current model weights are saved. If the validation set evaluation metric does not decrease in multiple consecutive training epochs (i.e., it is not better than the historical best value), a preset stopping condition is triggered, the training process is terminated, and the saved historical best model weights are used as the trained small sample cell counting model.

[0064] This embodiment divides the remaining samples after the first test set into training and validation sets, ensuring no overlap between the training, validation, and first test sets. This fundamentally avoids data leakage interfering with training and evaluation. An early stopping mechanism, which triggers the stop if the evaluation metric on the validation set does not decrease across multiple training epochs, effectively prevents model overfitting and improves training efficiency while maintaining model accuracy.

[0065] As can be seen from the above, the embodiments of this application annotate pathological image blocks with biological context labels composed of species information, organ information, and cell type information, constructing an initial dataset with biological dimension discrimination capabilities. By statistically analyzing the number of samples of each species in the initial dataset, the dominant species is determined. Then, for each organ of the dominant species, the number of samples of each cell type is statistically analyzed to determine the representative cell type. The dominant species information, organ information, and representative cell type information are combined into an intra-domain judgment benchmark, realizing the objectivity and automation of the intra-domain judgment benchmark construction. On this basis, the biological context labels of each sample are matched one-to-one with the intra-domain judgment benchmark. Samples that match successfully are assigned to the intra-domain dataset, and samples that do not match successfully are assigned to the extra-domain dataset. This ensures that the biological context labels corresponding to the samples in the intra-domain dataset are completely consistent with the biological combinations seen during the training phase, while the biological context labels corresponding to the samples in the extra-domain dataset are all novel biological combinations not seen during the training phase. This establishes a strong correspondence between the intra-domain being a known scene and the extra-domain being a completely new and unknown biological scene.

[0066] Under limited sample conditions, traditional random partitioning methods cannot guarantee the independence and isolation of the test set and training set in terms of biological combinations due to the extremely limited number of labeled samples available for training in each basic category. This easily leads to data leakage and inflated evaluation results. This embodiment of the application ensures, during the data partitioning stage, that the triples of each sample in the external test set do not appear in the internal training set or internal validation set by matching biological context labels one-to-one with the domain-specific decision benchmark. This avoids data leakage and allows the external evaluation results to truly reflect the model's generalization performance baseline when facing novel biological combinations. The internal evaluation results reflect the upper limit of the model's accuracy on known biological combinations, while the external evaluation results reflect the lower limit of the model's generalization on novel biological combinations. Both results directly quantify the model's cross-domain generalization ability. Therefore, this embodiment of the application provides users with an objective and quantifiable decision-making basis for judging whether a model has the conditions for cross-scenario generalization deployment, effectively guiding the model's iteration direction and improving the comprehensiveness and accuracy of the evaluation of limited sample cell counting models.

[0067] Figure 2 This is a flowchart illustrating the overall architecture of a small-sample cell counting model evaluation method provided in an embodiment of this application; as follows: Figure 2 As shown, this embodiment is divided into three main modules from top to bottom: the benchmark dataset construction module, the dataset partitioning and model training module, and the multi-level evaluation module, which are marked by three dashed box areas respectively.

[0068] The benchmark dataset construction module corresponds to the area within the dashed box at the top of the attached diagram. This embodiment first obtains raw data from a publicly available pathological image database. This raw data contains multiple whole-slice images and their corresponding tissue region annotations. After preprocessing, the raw data outputs an image set and a mask, i.e., pathological image blocks and their corresponding tissue region masks. Subsequently, cell instance segmentation is performed on the image blocks using automatic annotation, outputting initial segmentation results. After expert review and quality control, the initial segmentation results output a qualified standard file, i.e., cell annotation information that has passed quality control. Data assembly and export associates image blocks, cell annotation information, and biological context labels as samples, outputting a standardized dataset (i.e., an initial dataset containing multiple samples). Based on task definition and data partitioning, the standardized dataset is used to plan four subset paths and metadata tasks, resulting in an out-of-domain test set B (i.e., the second test set), an in-domain test set A (i.e., the first test set), an in-domain validation set, and an in-domain training set.

[0069] In the dataset partitioning and model training module, the officially published weights (i.e., the pre-trained weights shown above) are used as the weights of the initial few-sample cell counting model. The module receives the training set and validation set within the domain to train and validate the initial few-sample cell counting model, outputs the best model weights and saves them (i.e., obtains the trained few-sample cell counting model) for use by the subsequent multi-level evaluation module.

[0070] In the multi-level evaluation module, three evaluation modes are executed according to the evaluation experiment parameters. The basic evaluation loads the officially published weights and performs inference on both the in-domain test set A and the out-of-domain test set B. The in-domain few-shot evaluation loads the weights of the best-trained model and performs inference on the in-domain test set A. The out-of-domain few-shot evaluation loads the weights of the best-trained model and performs inference on the out-of-domain test set B. Each evaluation mode outputs a prediction density map and true counts. After calculating and aggregating performance metrics, a final cross-domain generalization performance evaluation report is output.

[0071] Corresponding to the small sample cell counting model evaluation method in the above embodiments, Figure 3 This is a structural block diagram of a small-sample cell counting model evaluation system provided in one embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 3 The small sample cell counting model evaluation system 20 includes: a data acquisition module 21, a dataset construction module 22, a domain determination module 23, a domain partitioning module 24, and an evaluation module 25.

[0072] Among them, the data acquisition module 21 is used to acquire the original pathological image database, which contains multiple whole slice images and their corresponding tissue region annotations. The dataset construction module 22 is used to cut each whole slice image to obtain multiple pathological image blocks; to perform cell instance segmentation on each pathological image block to obtain the cell annotation information corresponding to the pathological image block; to annotate each pathological image block with a biological context label, which is composed of species information, organ information and cell type information; and to associate each pathological image block, the cell annotation information corresponding to the pathological image block and the biological context label into a sample to obtain an initial dataset containing multiple samples. The domain determination benchmark module 23 is used to count the number of samples of each species in the initial dataset, determine the species with the most samples as the dominant species, and obtain the dominant species information; for each organ of the dominant species, count the number of samples corresponding to each cell type under that organ, determine the cell type with the most samples as the representative cell type of that organ, and obtain the representative cell type information corresponding to each organ; the combination of the dominant species information, organ information, and representative cell type information is determined as the domain determination benchmark corresponding to that organ; The domain partitioning module 24 is used to match each sample's biological context label with the domain-specific criteria one by one, assigning successfully matched samples to the domain dataset and unmatched samples to the domain dataset; the domain dataset and the domain dataset are independent of each other and have no sample overlap. Evaluation module 25 is used to evaluate the target small sample cell counting model based on in-domain datasets and / or out-of-domain datasets, and obtain multiple evaluation results.

[0073] In one embodiment of this application, the dataset construction module 22 is specifically used for: The tissue region mask for each full-slice image is determined based on tissue region annotation; Within the organization region mask, each full-slice image is cut according to a preset physical size to obtain multiple original image blocks; The resolution of each original image block is normalized to obtain the corresponding resolution-normalized image block; The image blocks normalized to each resolution were subjected to staining normalization, and the image blocks after staining normalization were used as pathological image blocks.

[0074] In one embodiment of this application, the domain partitioning module 24 is specifically used for: For each sample, species information, organ information, and cell type information from the biological context label of that sample are extracted as three types of target information; The dominant species information, organ information, and representative cell type information in the domain determination criteria are used as the three types of criterion information; The three types of target information were compared one by one with the three types of benchmark information; If each of the three target information categories is consistent with each of the three benchmark information categories, then the biological context label of the sample is determined to be a successful match with the domain judgment benchmark. If at least one of the three types of target information is inconsistent with each of the three types of benchmark information, then the biological context label of the sample is determined to be an unsuccessful match with the domain judgment benchmark.

[0075] In one embodiment of this application, the target few-shot cell counting model includes: an initial few-shot cell counting model and a trained few-shot cell counting model; the evaluation module 25 is specifically used for: The first test set is selected from the dataset within the domain. A second test set was selected from the dataset outside the domain. The first and second test sets are input into an initial few-sample cell counting model loaded with pre-trained weights to obtain the basic predicted cell counts for each pathological image patch; each basic predicted cell count is compared with its corresponding real cell count to generate a basic generalization ability evaluation result; the real cell count is determined by the cell annotation information corresponding to each pathological image patch. The first test set is input into the trained few-sample cell counting model to obtain the first predicted cell count for each pathological image block; the first predicted cell count is compared with the corresponding real cell count to generate the first evaluation result under the known scenario. The second test set is input into the trained few-sample cell counting model to obtain the second predicted cell count for each pathological image block; based on the comparison between each second predicted cell count and its corresponding real cell count, a second evaluation result for unknown scenarios is generated.

[0076] In one embodiment of this application, the evaluation module 25 is specifically used for: Samples with the same organ information and the same cell type information in the dataset within the domain are grouped into a set of basic categories; The samples in each basic category are balanced to ensure that the number of samples in each basic category is equal. A first preset number of samples are selected from each of the equalized basic categories to form the first test set.

[0077] In one embodiment of this application, the evaluation module 25 is specifically used for: Obtain the number of samples for each basic category in the first test set, calculate the average number of samples for each basic category, and use the average as the target benchmark value; The samples in the out-of-domain dataset are divided into multiple out-of-domain categories based on a combination of organ information and cell type information. For each out-of-domain category in the out-of-domain dataset, count the total number of candidate samples belonging to that out-of-domain category; The total number of candidate samples for each out-of-domain category is compared with the target benchmark value, and the smaller value between the total number of candidate samples and the target benchmark value is taken as the final sampling number for that out-of-domain category. Based on the final sampling quantity of each out-of-domain category, random sampling is performed from the candidate samples of each out-of-domain category, and the sampled samples are used as the second test set.

[0078] In one embodiment of this application, the evaluation module 25 is specifically used for: From each equalized base category, a second preset number of samples are selected from the remaining samples after the first test set has been selected as the training set, and the remaining samples after the training set has been selected as the validation set. Based on the pathological image blocks in the training set and their corresponding cell annotation information, the initial few-sample cell counting model is trained until the preset stopping condition is met, and the trained few-sample cell counting model is obtained. The preset stopping condition is that the evaluation metric of the validation set does not decrease in multiple consecutive training rounds during the training process.

[0079] See Figure 4 , Figure 4 This is a schematic block diagram of an electronic device provided according to an embodiment of this application. Figure 4 The electronic device 300 in this embodiment may include one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The processors 301, input devices 302, output devices 303, and memories 304 communicate with each other via a communication bus 305. The memories 304 store computer programs, including program instructions. The processors 301 execute the program instructions stored in the memories 304. Specifically, the processors 301 are configured to invoke the program instructions to perform the functions of each module / unit in the above-described device embodiments, for example... Figure 3 The functions of the data acquisition module 21, dataset construction module 22, domain determination benchmark module 23, domain partitioning module 24, and evaluation module 25 are shown.

[0080] It should be understood that, in the embodiments of this application, the processor 301 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0081] Input device 302 may include a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint orientation information), a microphone, etc., and output device 303 may include a display (LCD, etc.), a speaker, etc.

[0082] The memory 304 may include read-only memory and random access memory, and provides instructions and data to the processor 301. A portion of the memory 304 may also include non-volatile random access memory.

[0083] In specific implementations, the processor 301, input device 302, and output device 303 described in the embodiments of this application can execute the implementation method described in the few-sample cell counting model evaluation method provided in the embodiments of this application, or they can execute the implementation method of the electronic device described in the embodiments of this application, which will not be repeated here.

[0084] In another embodiment of this application, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions implement all or part of the processes in the methods described above. Alternatively, the computer program can instruct related hardware to complete the process. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0085] The computer-readable storage medium can be an internal storage unit of the electronic device in any of the foregoing embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the electronic device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0086] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

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

[0088] In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces or units, or they may be electrical, mechanical, or other forms of connection.

[0089] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.

[0090] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0091] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for evaluating a small-sample cell counting model, characterized in that, include: Obtain the original pathological image database, which contains multiple whole-slice images and their corresponding tissue region annotations; Each whole-slice image is segmented to obtain multiple pathological image blocks; cell instance segmentation is performed on each pathological image block to obtain the cell annotation information corresponding to the pathological image block; biological context labels are labeled for each pathological image block, and the biological context labels are composed of species information, organ information and cell type information; each pathological image block, the cell annotation information corresponding to the pathological image block and the biological context label are associated as a sample to obtain an initial dataset containing multiple samples; The number of samples for each species in the initial dataset is counted, and the species with the most samples is identified as the dominant species, and dominant species information is obtained. For each organ of the dominant species, the number of samples for each cell type under that organ is counted, and the cell type with the most samples is identified as the representative cell type of that organ, and representative cell type information for each organ is obtained. The combination of the dominant species information, the organ information, and the representative cell type information is determined as the domain determination criterion for that organ. Each sample is matched one-to-one with the domain-specific criteria using its biological context label. Samples that match successfully are assigned to the domain-specific dataset, while samples that do not match are assigned to the domain-specific dataset. The domain-specific dataset and the domain-specific dataset are independent of each other and have no overlap. The target small sample cell counting model was evaluated based on the in-domain dataset and / or the out-of-domain dataset, resulting in multiple evaluation results.

2. The method for evaluating a small-sample cell counting model as described in claim 1, characterized in that, The process of cutting each of the whole slice images to obtain multiple pathological image blocks includes: The tissue region mask for each of the full-slice images is determined based on the tissue region annotations; Within the masked area of ​​the tissue region, each full-slice image is cut according to a preset physical size to obtain multiple original image blocks; Each of the original image blocks is normalized in resolution to obtain the corresponding resolution-normalized image block. Each resolution-normalized image block is subjected to staining normalization, and the staining-normalized image block is used as the pathological image block.

3. The method for evaluating a small-sample cell counting model as described in claim 1, characterized in that, The step of matching each sample's biological context label with the domain-specific criteria includes: For each sample, the species information, organ information, and cell type information in the biological context label of that sample are extracted as three types of target information; The dominant species information, the organ information, and the representative cell type information in the domain determination criteria are used as three types of criterion information; The three types of target information are compared one by one with the three types of benchmark information; If each of the three types of target information is consistent with each of the three types of benchmark information, then the biological context label of the sample is determined to be a successful match with the domain determination benchmark. If at least one of the three types of target information is inconsistent with each of the three types of benchmark information, then the biological context label of the sample is determined to be an unsuccessful match with the domain-specific benchmark.

4. The method for evaluating a small-sample cell counting model as described in claim 1, characterized in that, The target few-sample cell counting model includes: an initial few-sample cell counting model and a trained few-sample cell counting model; the evaluation of the target few-sample cell counting model based on the in-domain dataset and / or the out-of-domain dataset yields multiple evaluation results, including: The first test set is selected from the dataset within the domain; A second test set is selected from the aforementioned external dataset; The first test set and the second test set are input into the initial few-sample cell counting model loaded with pre-trained weights to obtain the basic predicted cell counts for each pathological image block; each basic predicted cell count is compared with its corresponding real cell count to generate a basic generalization ability evaluation result; the real cell count is determined by the cell annotation information corresponding to each pathological image block; The first test set is input into the trained few-sample cell counting model to obtain the first predicted cell count for each pathological image block; the first predicted cell count is compared with the corresponding real cell count to generate the first evaluation result under the known scenario. The second test set is input into the trained few-sample cell counting model to obtain the second predicted cell count for each pathological image block; based on the comparison between each second predicted cell count and its corresponding real cell count, a second evaluation result for unknown scenarios is generated.

5. The method for evaluating a small-sample cell counting model as described in claim 4, characterized in that, The step of selecting the first test set from the dataset within the domain includes: Samples with the same organ information and the same cell type information in the dataset within the domain are grouped into a set of basic categories; The samples in each of the basic categories are balanced to make the number of samples in each of the basic categories equal. A first preset number of samples are selected from each of the equalized basic categories to form the first test set.

6. The method for evaluating a small-sample cell counting model as described in claim 5, characterized in that, Based on the selection of a second test set from the aforementioned external dataset, including: Obtain the number of samples for each basic category in the first test set, calculate the average number of samples for each basic category, and use the average number as the target benchmark value; The samples in the extra-domain dataset are divided into multiple extra-domain categories according to the combination of the organ information and the cell type information; For each out-of-domain category in the out-of-domain dataset, the total number of candidate samples belonging to that out-of-domain category is counted; The total number of candidate samples for each out-of-domain category is compared with the target benchmark value, and the smaller value between the total number of candidate samples and the target benchmark value is taken as the final sampling number for that out-of-domain category. According to the final sampling quantity of each of the aforementioned out-of-domain categories, random sampling is performed from the candidate samples of each of the aforementioned out-of-domain categories, and the sampled samples are used as the second test set.

7. The method for evaluating a small-sample cell counting model as described in claim 5, characterized in that, The trained few-shot cell counting model was obtained by training the initial few-shot cell counting model in the following manner: From each equalized base category, a second preset number of samples are selected from the remaining samples after the first test set has been selected as the training set, and the remaining samples after the training set has been selected are used as the validation set. Based on each pathological image patch in the training set and its corresponding cell annotation information, the initial few-sample cell counting model is trained until the preset stopping condition is met, and the trained few-sample cell counting model is obtained. The preset stopping condition is that the evaluation metric of the validation set does not decrease in multiple consecutive training rounds during the training process.

8. A small-sample cell counting model evaluation system, characterized in that, include: The data acquisition module is used to acquire the original pathological image database, which contains multiple whole-slice images and their corresponding tissue region annotations. The dataset construction module is used to cut each of the whole slice images to obtain multiple pathological image blocks; to perform cell instance segmentation on each pathological image block to obtain the cell annotation information corresponding to the pathological image block; to annotate each pathological image block with a biological context label, which is composed of species information, organ information and cell type information; and to associate each pathological image block, the cell annotation information corresponding to the pathological image block and the biological context label as a sample to obtain an initial dataset containing multiple samples. The domain-specific determination module is used to count the number of samples for each species in the initial dataset, identify the species with the most samples as the dominant species, and obtain dominant species information; for each organ of the dominant species, count the number of samples corresponding to each cell type under that organ, identify the cell type with the most samples as the representative cell type of that organ, and obtain representative cell type information for each organ; the combination of the dominant species information, the organ information, and the representative cell type information is determined as the domain-specific determination benchmark for that organ; The domain partitioning module is used to match each sample's biological context label with the domain-specific criteria one by one, assigning successfully matched samples to the domain-specific dataset and unmatched samples to the domain-specific dataset; the domain-specific dataset and the domain-specific dataset are independent of each other and have no sample overlap. The evaluation module is used to evaluate the target small sample cell counting model based on the in-domain dataset and / or the out-of-domain dataset, and obtain multiple evaluation results.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.