Intelligent recognition method and system for liver single cell necrosis based on deep learning, and storage medium
By employing a deep learning training strategy involving multiple ROI stacking and low-positive-value rebalancing, a ResUNet model was constructed, which solved the efficiency and accuracy issues in identifying single-cell necrosis of the liver, achieving efficient and accurate identification and visualization of single-cell necrosis of the liver.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DINGTAI MEDICINE RES CO LTD
- Filing Date
- 2026-01-23
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, the identification of liver single-cell necrosis relies on manual visual observation, which is inefficient and subject to large subjective differences. Traditional methods cannot adapt to differences between samples, and AI analysis tools cannot easily process WSI images, resulting in unsatisfactory identification accuracy.
A ResUNet model based on encoder-decoder symmetric architecture is constructed using a data preprocessing method based on multiple ROI stacking and a deep learning training strategy based on low positive rebalancing. The model is trained using a composite loss function that fuses BCE loss, Dice loss and Tversky loss to achieve real-time WSI image inference verification.
It achieves efficient, accurate, and standardized identification of single-cell necrosis in the liver, providing interactive, real-time reasoning feedback and visualization results, thus improving identification efficiency and accuracy.
Smart Images

Figure CN121563996B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, and more specifically to a method, system, and storage medium for intelligent identification of single-cell necrosis of the liver based on deep learning. Background Technology
[0002] Currently, the assessment of single-cell necrosis in the liver mainly relies on manual visual observation by pathologists. The assessment of whole-slide imaging (WSI) of a single liver slice often takes several hours. The efficiency of manual identification of single-cell necrosis is low, and there are significant subjective differences, making it difficult to guarantee consistency. There is a lack of quantitative objective assessment standards and repeatable assessment procedures.
[0003] In image processing-based recognition algorithms, SCN accounts for a very low percentage (usually <1%) in tissue slices, which is a typical small target detection problem. The low positive percentage of liver single cell necrosis makes recognition difficult. Furthermore, there are significant differences between low-positive samples and high-positive samples (samples with different degrees of positivity). Traditional methods use a fixed threshold to process all samples, which cannot adapt to the significant differences between samples, resulting in unsatisfactory recognition accuracy and difficulty in accurately and effectively performing stratified evaluation.
[0004] Currently, common AI analysis tools typically do not support direct processing and real-time inference of WSI images (.svs, .ndpi, etc.), making it difficult to perform interactive model validation on WSI images. Summary of the Invention
[0005] In view of the technical problems existing in the identification of single-cell necrosis of liver using full-view sample images (WSI images) of a single liver slice, the present invention aims to provide a deep learning-based intelligent identification method for single-cell necrosis of liver. This method employs a data preprocessing approach based on multi-ROI overlay, generating consistent annotations through a unified overlay rendering strategy. Then, considering the extremely low percentage of SCN (<1%), a low-positive rebalancing deep learning training strategy is used to train the model. The resulting identification model is then validated using real-time WSI image inference, outputting the identification results of single-cell necrosis of liver, providing an efficient, accurate, and standardized technical solution for toxicological pathology assessment.
[0006] According to a first aspect of the present invention, a deep learning-based intelligent identification method for single-cell necrosis of the liver is proposed, comprising the following steps:
[0007] Step 1: Obtain the WSI annotation file after annotating single-cell necrosis lesions in liver WSI images, and associate the WSI annotation file with the source WSI image;
[0008] Step 2: Segment the WSI annotation file to obtain segmented Tile and Mask files. The Tile output format is PNG image, and the Mask output format uses PNG and NPY dual formats in parallel, with the same size as the Tile. Each Tile corresponds to two Mask formats. When a Tile contains multiple overlapping lesion areas, the multiple lesions are merged using a fusion operation in the Mask, and the positive percentage of each Mask is recorded and saved in the positive percentage log.
[0009] Step 3: Based on the Tile and Mask files obtained from the segmentation operation, a dataset partitioning strategy based on lesion level and WSI internal stratification is adopted to generate training and test sets;
[0010] Step 4: Construct a ResUNet model based on an encoder-decoder symmetric architecture: Extract multi-scale features from the tiles through the encoder to obtain fused deep features; Upsample the deep features through the decoder and connect the outputs of the corresponding encoders through skip connections to achieve multi-scale feature fusion, retaining deep semantic features used to distinguish lesions from the background and shallow detail features used to locate lesion boundaries.
[0011] Step 5: Train the ResUNet model based on the encoder-decoder symmetric architecture using the training set, and guide the model training process based on a composite loss function that fuses BCE loss, Dice loss and Tversky loss to obtain a liver single-cell necrosis recognition model; the BCE loss introduces weights based on the proportion of positive pixels to amplify the loss of positive samples.
[0012] Step 6: After evaluating and validating the liver single-cell necrosis recognition model using the test set, a trained recognition model is obtained;
[0013] Step 7: After encapsulating and deploying the trained recognition model, intelligent recognition is performed on the input WSI image, and the single-cell necrosis lesion recognition result is output.
[0014] According to a second aspect of the present invention, a computer system is provided, comprising:
[0015] One or more inference engines, including CPUs and / or GPUs; and
[0016] Memory stores instructions that can be operated.
[0017] When the instructions are executed by one or more inferencers, they cause one or more processors to perform operations, including the process of executing the deep learning-based intelligent identification method for liver single-cell necrosis of the foregoing embodiments.
[0018] In a third aspect of the invention, a computer-readable storage medium is provided for storing one or more programs, said one or more programs including instructions or instruction sets executable by one or more inferencers; the inferencers include a CPU and / or a GPU;
[0019] When the instructions or instruction set are executed by one or more inferencers, they perform the process of the deep learning-based intelligent identification method for liver single-cell necrosis described in the foregoing embodiments.
[0020] Based on the above, this invention provides a deep learning-based method for identifying single-cell necrosis of the liver. On one hand, it employs a multi-ROI overlay data preprocessing method, generating consistent annotations through a unified overlay rendering strategy. On the other hand, it constructs a ResUNet model based on an encoder-decoder symmetric architecture, and, considering the extremely low SCN (<1%) proportion, uses a low-positive-rebalancing deep learning training strategy for model training. This results in a recognition model that is validated in real-time using WSI (Weighted Image Inference) images, outputting the identification results of single-cell necrosis lesions. This liver single-cell necrosis identification method enables interactive, real-time inference feedback and visualization results, providing an efficient, accurate, and standardized technical solution for toxicological pathology assessment.
[0021] It should be understood that all combinations of the foregoing concepts and the additional concepts described in more detail below may be considered part of the inventive subject matter of this disclosure, provided that such concepts do not contradict each other. Furthermore, all combinations of the claimed subject matter are considered part of the inventive subject matter of this disclosure.
[0022] The foregoing and other aspects, embodiments, and features of the teachings of the present invention will be more fully understood from the following description in conjunction with the accompanying drawings. Other additional aspects of the invention, such as features and / or beneficial effects of exemplary embodiments, will become apparent from the following description or may be learned through practice of specific embodiments according to the teachings of the present invention. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating a deep learning-based method for identifying single-cell necrosis of the liver according to an embodiment of the present invention.
[0024] Figure 2 This is a schematic diagram of a Tile file containing four single-cell necrosis foci according to an embodiment of the present invention.
[0025] Figure 3 It is based on Figure 2 This is a schematic diagram of a sample Tile file and the Mask formed by fusing four individual necrotic foci within it.
[0026] Figure 4This is a schematic diagram of the ResUNet model based on an encoder-decoder symmetric architecture according to an embodiment of the present invention.
[0027] Figure 5 This is a schematic diagram of an inference verification interface based on a Web architecture and deploying a trained recognition model according to an embodiment of the present invention.
[0028] Figure 6 This is a schematic diagram illustrating the results of liver single-cell necrosis inference performed by the inference verification platform according to an embodiment of the present invention. Detailed Implementation
[0029] To better understand the technical content of the present invention, specific embodiments are described below in conjunction with the accompanying drawings.
[0030] Various aspects of the invention are described in this disclosure with reference to the accompanying drawings, which illustrate numerous illustrative embodiments. The embodiments of this disclosure are not necessarily intended to encompass all aspects of the invention. It should be understood that the various concepts and embodiments described above, as well as those described in more detail below, can be implemented in any of many ways, because the concepts and embodiments disclosed herein are not limited to any particular implementation. Furthermore, some aspects of the invention disclosed may be used alone or in any suitable combination with other aspects of the invention disclosed.
[0031] Combination Figures 1-6 As shown, the intelligent identification method for liver single-cell necrosis based on deep learning according to an embodiment of the present invention includes the following steps:
[0032] Step 1: Obtain the WSI annotation file after annotating single-cell necrosis lesions in liver WSI images, and associate the WSI annotation file with the source WSI image. The annotation file adopts GeoJSON format.
[0033] Step 2: Segment the WSI annotation file to obtain segmented Tile and Mask files. The Tile output format is PNG image, and the Mask output format uses PNG and NPY dual formats in parallel, with the same size as the Tile. Each Tile corresponds to two Mask formats. When a Tile contains multiple overlapping lesion areas, the multiple lesions are merged using a fusion operation in the Mask, and the positive percentage of each Mask is recorded and saved in the positive percentage log.
[0034] Step 3: Based on the Tile and Mask files obtained from the segmentation operation, a dataset partitioning strategy based on lesion level and WSI internal stratification is adopted to generate training and test sets;
[0035] Step 4: Construct a ResUNet model based on an encoder-decoder symmetric architecture. In the ResUNet model, the encoder extracts multi-scale features from the tiles to obtain fused deep features. The decoder upsamples the deep features and fuses them with the shallow features of the corresponding layer of the encoder through skip connections. This achieves multi-scale feature fusion, preserving the deep semantic features used to distinguish lesions from the background and the shallow detail features used to locate lesion boundaries.
[0036] Step 5: Train the ResUNet model based on the encoder-decoder symmetric architecture using the training set, and guide the model training process based on a composite loss function that fuses BCE loss, Dice loss and Tversky loss to obtain the liver single-cell necrosis recognition model; the BCE loss introduces weights based on the proportion of positive pixels to amplify the loss of positive samples.
[0037] Step 6: After evaluating and validating the liver single-cell necrosis recognition model using the test set, a trained recognition model is obtained;
[0038] Step 7: After encapsulating and deploying the trained recognition model, intelligent recognition is performed on the input WSI image, and the single-cell necrosis lesion recognition result is output.
[0039] In a further embodiment, in step 1, based on the liver WSI image (source image), a pathologist can annotate it using the pathological image annotation tool QuPathv0.4.4 to obtain a WSI annotation file, which is in GeoJSON format.
[0040] For annotation processing, cross-annotation can be performed by physicians with senior liver pathology experience. The Dice coefficient of the cross-annotation results should be ≥0.9. After review and consistency verification, the final WSI annotation file is formed and matched with the liver WSI image as the source image to ensure a one-to-one correspondence between the two.
[0041] Then, it is split using WSI and converted into Tile and Mask files that can be trained by the model.
[0042] As an optional embodiment, in step 2, by randomly generating an offset within the ± offset range with each lesion center as the origin, a Tile is generated to ensure that the Tile covers the core area of the lesion; if the proportion of lesion pixels in the Tile is <0.1% (i.e. <65 pixels), it is automatically discarded to avoid invalid data.
[0043] For example, the offset is randomly generated within a random offset range, with the lesion center as the origin.
[0044] As an optional embodiment, the Tile output PNG format image is 256×256 pixels in size, with a default random offset range of 64 pixels and a minimum offset range of 16 pixels. 10 Tile are generated for each lesion, improving the data diversity of low-positive samples.
[0045] As an optional implementation, Mask outputs NPY and PNG formats in parallel and synchronously.
[0046] The NPY format image output by Mask is 256×256 pixels in size. Pixel values of 0 represent the background and 1 represent the positive area. The data type is float32.
[0047] The PNG format image output by Mask is 256×256 pixels in size. Pixel value 0 represents the background and 255 represents the positive area. The data type is unit8.
[0048] Combination Figure 2 , Figure 3 As shown, when a Tile contains multiple overlapping lesion regions, the multiple lesions are merged using a fusion operation in the Mask, and the positive percentage of each Mask is calculated and recorded and saved in the positive percentage log, which is used to dynamically calculate the weights of the loss function during training.
[0049] In Mask, multiple lesions are merged using a fusion operation, and consistent annotations are generated through a unified overlay drawing strategy, including:
[0050] If a tile contains multiple independent or overlapping necrotic lesion regions (ROIs) within its field of view, a separate Mask file will not be generated for each lesion; instead, they will be mapped into the same two-dimensional matrix.
[0051] For any pixel (x, y) on the Mask, as long as the point falls within the labeled area of any ROI, the pixel value is set to positive. The pixel value of the overlapping area is "1" to represent positive, ensuring that the mask is binary; for non-overlapping areas, the original label value is used, with positive being 1 and background being 0.
[0052] Then, Gaussian filtering is applied to the fused boundary to smooth the edges.
[0053] In the optional example, Gaussian filtering smoothing uses a 3×3 Gaussian kernel with a standard deviation σ=1.0 to avoid jagged edges. For example, if a tile contains 3 overlapping lesions (areas of 18, 22, and 15 pixels), the number of positive pixels after fusion is 52, and the positive percentage is approximately 52 / 65536 ≈ 0.079%.
[0054] Combination Figure 2 , Figure 3 As shown, in Figure 2In a typical H&E-stained liver tissue section tile, four clearly labeled independent single-cell necrotic foci (labeled 1, 2, 3, 4) are clearly visible in the field of view, representing a "dispersed ROI". After fusion, these four dispersed red circles were transformed into four white connected regions against a single black background. Figure 3 As shown, the edges of the white areas are relatively smooth, which is the result of applying the Gaussian filter (σ=1.0) mentioned above. Thus, all necrotic lesions are uniformly integrated into a single 256×256 image. Unifying the scattered vector annotations into a standard semantic segmentation mask allows the model (ResUNet) to learn all lesion features within the entire field of view at once, without introducing complex detection boxes. This also eliminates minor errors and overlaps inherent in manual annotation, providing higher quality ground truth.
[0055] In this example, the output Tile and Mask files are named as follows:
[0056] For the Tile file: {WSI filename}_tile_{5-digit index}.png;
[0057] For Mask files: {WSI filename}_mask_{5-digit index}.png; {WSI filename}_mask_{5-digit index}.npy.
[0058] As an optional embodiment, in step 3, a dataset partitioning strategy based on lesion level and WSI internal stratification is adopted to generate a training set and a test set. The dataset partitioning strategy includes:
[0059] (1) Stratified sampling within WSI: Each WSI is randomly processed and divided according to a certain ratio to ensure a balanced distribution of data across different WSIs;
[0060] (2) Lesion level classification: The 10 tiles and corresponding masks generated by the same lesion will not be included in the training set and the test set at the same time to avoid data leakage.
[0061] The division ratio refers to the ratio of the training set to the test set, using 9:1 as an example.
[0062] In an optional embodiment, the dataset partitioning also follows these principles:
[0063] Stratify WSI by the percentage of positive SCNs (low <1%, medium 1%-5%, high >5%) to ensure that each layer has a consistent percentage in the training / test set and avoid data distribution shift.
[0064] In an embodiment of the present invention, for each tile, each training round undergoes 7 random draws to generate a random number between 0 and 1, and the enhancement is performed according to the following rules:
[0065] (1) Reflection transformation: Reflect randomly along the horizontal / vertical axis with a 50% probability. The execution condition is: random number < 0.5, otherwise skip;
[0066] (2) Horizontal flip: Mirror flip left and right, execution condition: random number < 0.5, otherwise skip;
[0067] (3) Vertical flip: Mirror flip vertically. The execution condition is: random number < 0.5, otherwise skip;
[0068] (4) 90° rotation: Rotate 90 degrees clockwise. The execution condition is: random number < 0.5, otherwise skip.
[0069] (5) Hue and saturation adjustment: Hue offset ±10, saturation offset ±15, execution condition: random number < 0.5, otherwise skip;
[0070] (6) Brightness and contrast adjustment: Brightness offset ±10, contrast offset ±15. The execution condition is: random number < 0.5, otherwise skip;
[0071] (7) Gaussian blur: kernel size 3×3, standard deviation σ is configured as a random value between 0.5 and 1.0, execution condition is: random number < 0.3, otherwise skip;
[0072] During rotation, flipping, and reflection transformations, the Mask remains consistent with the corresponding Tile; during hue and color adjustments, the effect is applied to the Tile, but the Mask remains unaffected.
[0073] In embodiments of the present invention, the training and test sets further include data standardization processing before training to facilitate model computation:
[0074] (1) Batch processing for tiles includes:
[0075] Input a NumPy array of type uint8, in the format [256,256,3];
[0076] Then, through RGB normalization, the pixel values from 0 to 255 are mapped to [-1.0, +1.0].
[0077] Then, a format conversion is performed to convert the NumPy array to a PyTorch tensor. The PyTorch tensor format uses the float32 type.
[0078] Finally, the dimensions are transposed, transforming [256,256,3] into [3,256,256] to adapt to PyTorch channels;
[0079] (2) NPY batch processing for Mask includes:
[0080] Input a NumPy array of type float32, in the format [256, 256];
[0081] Then, channel expansion is performed by adding channel dimensions, expanding [256,256] to [256,256,1].
[0082] Then, a format conversion is performed to convert the NumPy array to a PyTorch tensor while maintaining the float32 type;
[0083] Finally, the dimensions are transposed, transforming [256,256,1] into [1,256,256].
[0084] As an optional embodiment, for the training and recognition task of Tile / Mask of liver single-cell necrosis, a ResUNet model based on encoder-decoder symmetric architecture is constructed. In this model, multi-scale features are extracted from the Tile by the encoder to obtain fused deep features. The deep features are upsampled by the decoder and fused with the shallow features of the corresponding layer of the encoder by skip connections. This achieves multi-scale feature fusion, preserving the deep semantic features used to distinguish lesions from the background and the shallow detail features used to locate lesion boundaries.
[0085] Based on the design of the ResUNet model in this embodiment, combined with Figure 4 As shown, as a specific example, the ResUNet model structure includes an input layer, a four-connected encoder, a bottleneck layer, a four-connected encoder, and an output layer, which combines residual connections and skip connections.
[0086] The input layer receives the standardized Tile file in the format [3,256,256] (number of channels × height × width), which is downsampled by four encoders. After outputting the feature map, the global semantic features [1024,16,16] are obtained by fusion through the bottleneck layer, which is used to distinguish lesions from the background.
[0087] The decoder upsamples deep features based on global semantic features and fuses them with the shallow features of the corresponding encoder layer through skip connections. Finally, it performs channel concatenation through 1×1 convolution of the output layer, integrates multi-scale features for multi-scale feature fusion, and outputs the results. This preserves the deep semantic features used to distinguish lesions from the background and the shallow detail features used to locate lesion boundaries, thus restoring spatial resolution.
[0088] Among them, residual blocks in the encoder and decoder alleviate the gradient vanishing problem in deep networks. They directly pass gradients through identity mapping (skip connection), allowing for the training of deeper networks.
[0089] Simultaneously, feature maps from each encoder layer are directly concatenated to the corresponding decoder layer via skip connections (U-shaped structure), achieved through channel-level concatenation. Figure 4 As shown, the input of decoding layer 1 is [512 upsampled] + [512 encoded layer 4] = 1024 channels, thus preserving detailed information, restoring spatial resolution, and improving segmentation accuracy.
[0090] As a specific example, the encoder (downsampling) design of the ResUNet model is as follows:
[0091] Input layer: Receives the normalized Tile([3,256,256]);
[0092] Encoder 1: 2 x 3 x 3 convolutions (padding=1) + BN + ReLU + residual connection; max pooling (2 x 2, stride=2), outputting a 64 x 128 x 128 feature map to extract low-level texture features (such as edges and brightness differences).
[0093] Encoder 2: Two 3×3 convolutions + BN + ReLU + residual connections; max pooling processing, outputting a 128×64×64 feature map to extract cell contour feature information;
[0094] Encoder 3: 2 x 3 convolutions + BN + ReLU + residual connections; max pooling processing, outputting a 256 x 32 x 32 feature map to extract high-level semantic features, such as differences in cell structure;
[0095] Encoder 4: 2 x 3 x 3 convolutions + BN + ReLU + residual connections; max pooling processing, outputting a 512 x 16 x 16 feature map to extract deep lesion features and characterize necrotic cell specificity.
[0096] As a specific example, the bottleneck layer of the ResUNet model is designed as follows:
[0097] Bottleneck layer: 2 3×3 convolutions + BN + ReLU + residual connection (no pooling), outputting a 1024×16×16 feature map to obtain global semantic features (distinguishing between lesions and background).
[0098] Combination Figure 4As shown, as an optional embodiment, the specific design of the decoder (upsampling) of the ResUNet model corresponds to that of the encoder. Each decoder, after upsampling (2x upsampling) via transposed convolution, is concatenated with the corresponding encoder output through skip connections, and then sequentially passes through residual blocks of 256 channels, 128 channels, 64 channels, and 64 channels, respectively, before outputting the reconstructed features.
[0099] Finally, a [1, 256, 256] feature map is output through a 1×1 convolution of the output layer, with a channel number of 1, i.e., a single-channel probability map.
[0100] In this way, by splicing and integrating multi-scale features, we can preserve both deep semantics to distinguish lesions from the background and shallow details to accurately locate lesion boundaries.
[0101] In embodiments of this invention, after multiple downsampling operations, the spatial location information of small targets (single-cell necrosis of the liver) is severely lost, resulting in blurred and rough edges on the mask recovered from upsampling, making it impossible to accurately delineate the cell outline. Therefore, in this embodiment, the model utilizes skip connections to directly concatenate the shallow features in the encoder, which retain rich spatial details (such as cell edges and textures), to the corresponding deep features in the decoder, achieving multi-scale feature fusion of deep semantic features and shallow detail features. Deep features are responsible for "finding the right target" (accurate classification), while shallow features are responsible for "drawing the right target" (clear boundaries), overcoming the technical challenge of pixel-level small targets easily "disappearing" or "diffusing at the edges" in deep networks. This allows the output mask to accurately fit the physical boundaries of necrotic cells, providing a high-precision quantitative basis for subsequent calculation of the positive percentage.
[0102] In an embodiment of the present invention, an example of a specific model training process is illustrated using 8 batches (Batch=8).
[0103] In the optional example, the input to the model training process is as follows:
[0104] Data format: PyTorch tensors, format [Batch, 3, 256, 256];
[0105] Numerical range: RGB three channels, normalized to [-1.0, +1.0];
[0106] Batch size: 8 tiles (adjustable);
[0107] Data type: torch.float32.
[0108] The output of the model training process is as follows:
[0109] Data format: PyTorch tensors, format [Batch, 1, 256, 256];
[0110] Numerical meaning: The logits value of each pixel (the raw score without sigmoid activation);
[0111] Value range: theoretically (-∞, +∞), practically approximately [-10, +10];
[0112] Post-processing: Convert to [0, 1] probability values using the sigmoid function;
[0113] The labels (Ground Truth) used in the model training process are defined as follows:
[0114] Data format: PyTorch tensors, format [Batch, 1, 256, 256];
[0115] Numerical range: {0.0, 1.0}, where 0 represents background and 1 represents single-cell necrosis;
[0116] Data type: torch.float32.
[0117] As an optional implementation, the training process for each iteration is as follows:
[0118] Read 8 Tile-PNGs from train_tiles (Tile files in the training set) and 8 corresponding Mask-NPYs from train_masks (Mask files in the training set), ensuring that the filenames are matched correctly;
[0119] Normalize the Tile and Mask and convert them into PyTorch tensor format;
[0120] Composition of batches: Tile batch [8,3,256,256]; Mask batch [8,1,256,256];
[0121] Tile batches are input into the model for training, and the model output is: prediction Mask[8,1,256,256];
[0122] Calculate the loss between the predicted Mask and the actual labeled data (Mask batch): Loss = Triple_Loss(predicted Mask, Mask batch);
[0123] Model parameters are updated based on loss: The model is updated based on backpropagation and AdamW optimizer. The training is iterated until the stopping condition is met, and the optimal model weights are finally output: best_model.pth (128MB, including weights and biases of convolutional layers and BN layers).
[0124] It should be understood that the Mask batch [8, 1, 256, 256] here is the Ground Truth label [8, 1, 256, 256] used as the true basis for subsequent model loss calculation.
[0125] During training, the Tile batches are input into the encoder of the ResUNet model. After feature extraction and downsampling in the encoding process, feature reconstruction and upsampling are performed in the encoding process. Then, the output layer outputs the prediction Mask [8, 1, 256, 256] through 1×1 convolution, thus obtaining a single-channel probability map.
[0126] Furthermore, during training, the training process is guided and evaluated through loss calculation, where loss = Triple_Loss(predicted Mask, Ground Truth Mask).
[0127] The inputs for loss calculation are the single-channel probability map logits [8, 1, 256, 256] (abbreviated as logits) output by the model and the Ground Truth labels [8, 1, 256, 256] (abbreviated as GT). The BCE loss is automatically applied with pos_weight=50.0.
[0128] During training, backpropagation is performed based on the loss calculation results, and the AdamW optimizer is used to update the model parameters for iterative training.
[0129] In an embodiment of the present invention, during the training process using the training set data, a low-positive-rebalancing strategy is employed to resolve the positive-negative imbalance problem of SCN samples, thereby training a high-precision ResUNet model for use as a recognition model.
[0130] As an optional embodiment, considering that single-cell necrosis accounts for a very low proportion in pathological images (typical value <5%, some samples <1%), a rebalancing strategy is adopted for training. Before training, the proportion of positive pixels in the training set pos_ratio is automatically counted, the class weight pos_weight is dynamically calculated, and the weight is passed into the BCE loss function to automatically amplify the gradient of positive samples.
[0131] As an optional embodiment, the dynamic weight calculation process for positive samples is as follows:
[0132] (1) Traverse all training set Mask files and calculate the proportion of positive pixels;
[0133] (2) Weight calculation formula: pos_weight=(1-pos_ratio) / pos_ratio×1.2.
[0134] Where pos_weight (final weight) represents the weight coefficient of positive samples in the loss function.
[0135] pos_ratio (positive ratio) represents the proportion of positive pixels in the training set mask. It is calculated by counting all mask files: pos_ratio = Σ(number of pixels with a value of 1.0 in the mask) / Σ(total number of pixels in the mask).
[0136] For example, the total number of pixels in the training set = 17690 × 65536 ≈ 1.16 × 10 9 The total number of positive pixels is 4.06 × 10. 6 pos_ratio≈0.0035, pos_weight≈(0.9965 / 0.0035)×1.2≈341.6 (meaning the loss weight of positive samples is 341.6 times that of negative samples).
[0137] In an embodiment of the present invention, based on the weighted sum of three loss functions, a fused composite loss function Triple_Loss is calculated for different optimization objectives of low-positive samples:
[0138] Triple_Loss=0.4×BCE(logits,GT,pos_weight)+0.3×Dice(logits,GT)+0.3×Tversky(logits,GT,α=0.8,β=0.2).
[0139] Among them, BCE loss is a pixel-level classification loss, which is used to amplify the positive sample loss by combining it with pos_weight based on the positive ratio to solve the class imbalance; class imbalance is handled by pos_weight to force the model to focus on sparse positive samples; and a scalar loss value is output with a weight of 0.4.
[0140] Dice loss represents the region overlap loss, which measures the overlap between the prediction and the annotation, optimizes the intersection-union ratio between the predicted and the real regions, and improves the boundary quality; it outputs a scalar loss value with a weight of 0.3.
[0141] Tversky loss is designed with asymmetric weights:
[0142] TverskyLoss=1-TP / (TP+α×FP+β×FN);
[0143] In this model, α = 0.8 (false positive weight) and β = 0.2 (false negative weight) prioritize penalizing missed detections. By setting α > β, the model's penalty for missed detections is stronger than for false positives, significantly improving the recall rate of low-positive samples. TP (True Positive), FP (False Positive), and FN (False Negative) represent, respectively, a sample that is actually positive being correctly predicted as positive, a sample that is actually negative being incorrectly predicted as positive (also known as a "false positive"), and a sample that is actually positive being incorrectly predicted as negative (also known as a "false negative").
[0144] As an optional implementation method, the training parameters are set as follows:
[0145] Optimizer: Adam (β1=0.9, β2=0.999, ε=1e-8);
[0146] Learning rate decay: ReduceLROnPlateau strategy, monitor and verify Dice coefficient. If there is no improvement after 5 rounds, the learning rate is multiplied by 0.5, and the learning rate is reduced to a minimum of 1e-6.
[0147] Finally, the model's accuracy and robustness can be further evaluated using a test set to verify the effectiveness of the hierarchical processing strategy.
[0148] During the evaluation process, inference performance is calculated by combining the actual input mask and the predicted mask results.
[0149] a. Precision: Calculates the proportion of true positive pixels among those predicted as positive. Precision = Number of true positive pixels ÷ (Number of true positive pixels + Number of false positive pixels);
[0150] b. Recall: The proportion of actual lesions that are correctly identified. Recall = Number of true positive pixels ÷ (Number of true positive pixels + Number of false negative pixels);
[0151] c. Dice coefficient calculation: The degree of overlap between the predicted result and the actual annotation. Dice coefficient = (2 × number of overlapping pixels) ÷ (number of predicted positive pixels + number of actual positive pixels);
[0152] d. Specificity calculation: The proportion of actual negative pixels that are correctly identified as negative. Specificity = Number of true negative pixels ÷ (Number of true negative pixels + Number of false positive pixels).
[0153] Furthermore, the trained recognition model is deployed and used.
[0154] In a particularly preferred example, a web architecture is built based on OpenSeadragon and FastAPI, and the aforementioned trained recognition model is deployed. This supports real-time input of WSI images for browsing, interactive ROI annotation, and instant inference feedback based on the recognition model. The resulting visualized intelligent recognition results are represented in the browsed WSI image file for users to verify.
[0155] For example, for WSI data services, OpenSlide is used to read large tiles and generate DeepZoom multi-level tiles for front-end display. Users can draw rectangular regions of interest on the tiles; the RGB pixel data of the user-annotated regions will be extracted, the engine will be called to perform segmentation prediction, and the prediction mask will be displayed on the original tiles in a semi-transparent (color semi-transparent, etc.) overlay to visualize the results.
[0156] As an optional method, statistics on numerical indicators such as the number of positive pixels, the percentage of positive pixels, and inference time can also be performed.
[0157] Combination Figure 5 The user interface shown allows users to draw Regions of Interest (ROIs) using the rectangle tool. The system status bar indicates that the ROI size is 1794*912 pixels, and morphological observation reveals six single-cell necrosis foci within this region. Figure 6 The diagram shows the results of the inference for single-cell necrosis of the liver. After calculation, the output of the visualized inference results shows that the inference time was 26.80 seconds, the positive area was 10820 pixels, the ROI ratio was 0.66%, and the visualized positive area was consistent with the morphological observation and the boundary with normal tissue was well identified.
[0158] Based on the deep learning-based intelligent identification method for liver single-cell necrosis proposed in this invention, and considering that liver single-cell necrosis is typically a small target (usually accounting for less than 1% of pixels) in WSI images, during the downsampling process of deep convolutional neural networks, the spatial resolution of the image continuously decreases as the receptive field expands and the feature dimension increases. For large targets, the ambiguity of location information has a relatively small impact, but for small lesions like SCN, excessive downsampling can lead to the complete loss of its spatial location information in the deep feature map, causing the model to "only know that there is a lesion, but not where it is" and thus be unable to output an answer. To achieve accurate masking, this invention proposes a ResUNet model based on an encoder-decoder symmetric architecture. It extracts and trains classification features using segmented tiles and masks, employing a U-shaped symmetric architecture. The shallow feature map from the encoder, rich in spatial details (such as cell edges and texture boundaries), is directly concatenated to the deep feature map of the corresponding layer in the decoder. The encoder (downsampling path) acts as a feature extractor, sacrificing spatial resolution for a high degree of abstraction of the semantic features of single-cell necrosis through layers of convolution and pooling, thus solving the recognition problem under complex background interference. The symmetrically designed decoder (upsampling path) acts as a reconstructor, gradually restoring the spatial dimension.
[0159] Therefore, by employing a symmetrically designed multi-scale feature fusion strategy, the decoder can regain the boundary information of the tiny lesions lost during the encoding stage when upsampling to restore the image size. For the SCN recognition task, this ensures that the model can not only use deep semantic features to determine whether cells are necrotic, but also use shallow detail features to accurately delineate the physical outline of necrotic cells. This guarantees a high degree of consistency between the generated mask and the actual pathological morphology. While understanding "this is a necrotic cell", the model can accurately map the recognition result back to the pixel coordinates of the original image, realizing the processing from semantic judgment to spatial localization, and meeting the stringent requirements of pathological assessment for localization accuracy.
[0160] Meanwhile, since the morphological features of early or atypical liver single-cell necrosis are very subtle, they are easily confused with normal hepatocyte steatosis, nuclear condensation, or artifacts in the slide preparation process. Ordinary shallow networks cannot extract deep features sufficient to distinguish these subtle differences, and forcibly deepening the network will lead to gradient vanishing, making training unable to converge. Therefore, the recognition method of the present invention introduces residual blocks in each layer of the encoder and decoder. By employing the identity mapping mechanism, original features are allowed to be directly passed across layers, and gradients flow directly to shallow layers during backpropagation. This effectively solves the degradation problem of deep networks, enabling the network to be built deeper and the model to extract higher-dimensional global semantic features (1024 channels of global semantic features). This allows the model to capture extremely subtle high-dimensional features of necrotic cells in terms of texture, nucleocytoplasmic ratio, and staining depth. These deep features contain the essential biological patterns that distinguish necrotic cells from background noise, significantly improving the model's ability to identify difficult-to-distinguish samples, effectively reducing false positives caused by background interference, and ensuring recognition accuracy under conditions of low positive rate.
[0161] In conjunction with the above embodiments, the present invention also proposes a computer system, comprising:
[0162] One or more inference engines, including CPUs and / or GPUs; and
[0163] Memory stores instructions that can be operated.
[0164] When the aforementioned instructions are executed by one or more inferencers, they cause one or more processors to perform operations, including the process of executing the deep learning-based intelligent identification method for liver single-cell necrosis in any of the aforementioned embodiments.
[0165] In conjunction with the above embodiments, the present invention also proposes a computer-readable storage medium for storing one or more programs, the one or more programs including instructions or instruction sets executable by one or more inferencers; the inferencers include CPUs and / or GPUs.
[0166] When the instructions or instruction set are executed by one or more inferencers, they perform the process of the deep learning-based intelligent identification method for liver single-cell necrosis in any of the foregoing embodiments.
[0167] While the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention shall be determined by the claims.
Claims
1. A deep learning-based intelligent recognition method for liver single cell necrosis, characterized in that, Includes the following steps: Step 1: Obtain the WSI annotation file after annotating single-cell necrosis lesions in liver WSI images, and associate the WSI annotation file with the source WSI image; Step 2: Segment the WSI annotation file to obtain segmented Tile and Mask files. The Tile output format is PNG image, and the Mask output format uses PNG and NPY dual formats in parallel, with the same size as the Tile. Each Tile corresponds to two Mask formats. When a Tile contains multiple overlapping lesion areas, the multiple lesions are merged using a fusion operation in the Mask, and the positive percentage of each Mask is recorded and saved in the positive percentage log. Step 3: Based on the Tile and Mask files obtained from the segmentation operation, a dataset partitioning strategy based on lesion level and WSI internal stratification is adopted to generate training and test sets; Step 4: Construct a ResUNet model based on an encoder-decoder symmetric architecture; Step 5: Train the ResUNet model based on the encoder-decoder symmetric architecture using the training set, and guide the model training process based on a composite loss function that integrates BCE loss, Dice loss and Tversky loss to obtain a liver single-cell necrosis recognition model; wherein a weight based on the positive percentage is introduced into the BCE loss to amplify the loss of positive samples. Step 6: After evaluating and validating the trained liver single-cell necrosis recognition model using the test set, a well-trained recognition model is obtained. Step 7: After encapsulating and deploying the trained recognition model, intelligent recognition is performed on the input WSI image, and the single-cell necrosis lesion recognition result is output. 2.The deep learning-based intelligent recognition method for liver single cell necrosis according to claim 1, characterized in that, In step 2, the size of the PNG format image output by Tile is 256×256 pixels, the random offset range is 64 pixels by default, the minimum offset range is 16 pixels, and 10 tiles are generated for each lesion. Mask outputs in NPY format, with a size of 256×256 pixels. Pixel values of 0 represent the background and 1 represent the positive area. The data type is float32. The PNG format image output by Mask is 256×256 pixels in size. Pixel value 0 represents the background and 255 represents the positive area. The data type is unit8. 3.The deep learning-based intelligent recognition method for liver single cell necrosis according to claim 1, characterized in that, In step 2, during the WSI segmentation operation, the lesion center is used as the origin, and an offset is randomly generated within a random offset range so that the resulting Tile covers the core area of the lesion. Furthermore, if the percentage of diseased pixels in a tile is less than 0.1%, i.e. less than 65 pixels, the tile will be automatically discarded. 4.The deep learning-based intelligent recognition method for liver single cell necrosis according to claim 1, characterized in that, In step 2, multiple lesions are merged using a fusion operation in the Mask, including: If a tile contains multiple independent or overlapping necrotic lesion regions (ROIs) within its field of view, a separate Mask file will not be generated for each lesion; instead, they will be mapped into the same two-dimensional matrix. For any pixel (x, y) on the Mask, as long as the point falls within the labeled area of any ROI, the pixel value is set to positive. The pixel value of the overlapping area is "1" to represent positive, ensuring that the mask is binary; for non-overlapping areas, the original label value is used, with positive being 1 and background being 0. Gaussian filtering is used to smooth the edges of the fused boundary. 5.The deep learning-based intelligent recognition method for liver single cell necrosis according to claim 1, characterized in that, In step 3, a dataset partitioning strategy based on lesion level and WSI internal stratification is adopted to generate training and testing sets. The dataset partitioning strategy includes: (1) Stratified sampling within WSI: Each WSI is randomly processed and divided according to a certain ratio to ensure a balanced distribution of data across different WSIs; (2) Lesion grade classification: The 10 tiles and corresponding masks generated by the same lesion will not be included in the training set and the test set at the same time; The division ratio refers to the ratio of the training set to the test set. 6.The deep learning-based intelligent recognition method for liver single cell necrosis according to claim 1, characterized in that, The training and test sets also undergo data standardization processing before training: (1) Batch processing for tiles includes: Input a NumPy array of type uint8, in the format [256,256,3]; Then, through RGB normalization, the pixel values from 0 to 255 are mapped to [-1.0, +1.0]. Then, a format conversion is performed to convert the NumPy array to a PyTorch tensor. The PyTorch tensor format uses the float32 type. Finally, the dimensions are transposed, transforming [256,256,3] into [3,256,256] to adapt to PyTorch channels; (2) NPY batch processing for Mask includes: Input a NumPy array of type float32, in the format [256, 256]; Then, channel expansion is performed by adding channel dimensions, expanding [256,256] to [256,256,1]. Then, a format conversion is performed to convert the NumPy array to a PyTorch tensor while maintaining the float32 type; Finally, the dimensions are transposed, transforming [256,256,1] into [1,256,256]. 7.The deep learning-based intelligent recognition method for liver single cell necrosis according to claim 1, characterized in that, During training, for each tile, each training round involves 7 random draws to generate a random number between 0 and 1, and the augmentation is performed according to the following rules: (1) Reflection transformation: Reflect randomly along the horizontal / vertical axis with a 50% probability. The execution condition is: random number < 0.5, otherwise skip; (2) Horizontal flip: Mirror flip left and right, execution condition: random number < 0.5, otherwise skip; (3) Vertical flip: Mirror flip vertically. The execution condition is: random number < 0.5, otherwise skip; (4) 90° rotation: Rotate 90 degrees clockwise. The execution condition is: random number < 0.5, otherwise skip. (5) Hue and saturation adjustment: Hue offset ±10, saturation offset ±15, execution condition: random number < 0.5, otherwise skip; (6) Brightness and contrast adjustment: Brightness offset ±10, contrast offset ±15. The execution condition is: random number < 0.5, otherwise skip; (7) Gaussian blur: kernel size 3×3, standard deviation σ is configured as a random value between 0.5 and 1.0, execution condition is: random number < 0.3, otherwise skip; During rotation, flipping, and reflection transformations, the Mask remains consistent with the corresponding Tile; during hue and color adjustments, the effect is applied to the Tile, while the Mask remains unaffected. 8.The deep learning-based intelligent recognition method for liver single cell necrosis according to any one of claims 1-7, characterized in that, In the ResUNet model based on the encoder-decoder symmetric architecture, multi-scale features are extracted from the tiles by the encoder to obtain fused deep features; The decoder upsamples the fused deep features and connects them to the output of the corresponding encoder via skip connections to achieve multi-scale feature fusion, preserving deep semantic features for distinguishing lesions from the background and shallow detail features for locating lesion boundaries. 9.The deep learning-based intelligent recognition method of liver single cell necrosis according to claim 1, characterized in that, The method further includes the following steps: A web architecture is built based on OpenSeadragon and FastAPI, and the trained recognition model is deployed to support real-time input of WSI images for browsing, interactive ROI annotation, and instant inference feedback based on the recognition model. This results in visualized intelligent recognition and is simultaneously represented in the browsed WSI image file for users to verify.
10. A computer system, characterized by include: One or more inference engines, including CPUs and / or GPUs; as well as Memory stores instructions that can be operated. When the instructions are executed by one or more inferencers, they cause one or more of the aforementioned processors to perform operations, including the process of executing the deep learning-based intelligent identification method for liver single-cell necrosis as described in any one of claims 1-9. 11.A computer-readable storage medium storing one or more programs for execution, the one or more programs comprising instructions for: The one or more programs include instructions or instruction sets that can be executed by one or more inferencers; the inferencers include CPUs and / or GPUs; When the instructions or instruction set are executed by one or more inferencers, they perform the process of the deep learning-based intelligent identification method for liver single-cell necrosis as described in any one of claims 1-9.
Citation Information
Patent Citations
Gastric adenocarcinoma tumor image segmentation method with intestinal mother cell differentiation and storage medium
CN118918328A
Construction method and application of histopathologic quantitative evaluation model of choroidal neovascularization
CN119295407A