A method for automatic grading of canine infiltrative breast cancer nuffield histology based on transunet and yolov5

CN123029020APending Publication Date: 2026-11-03LUOYANG VOCATIONAL&TECHNICAL COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611215157.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-11
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Traditional Nottingham histological grading relies heavily on manual examination, is time-consuming, and is subject to human interpretation differences, making it difficult to achieve efficient and standardized scoring of canine invasive breast cancer.

Method used

The TransUNet and YOLOv5 models were used to automatically segment breast hyperplasia regions, detect the degree of duct formation, mitotic count, and nuclear pleomorphism, and combine them with scoring rules to achieve automatic grading.

Benefits of technology

An automated Nottingham histological grading of canine invasive mammary cancer was achieved, improving efficiency and standardization while reducing human interpretation variability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123029020A_ABST
    Figure CN123029020A_ABST
Patent Text Reader

Abstract

The application provides a method for automatic grading of canine infiltrative breast cancer Nottingham histology based on TransUNet and YOLOv5, and belongs to the technical field of automatic grading of canine breast cancer. The method comprises the following steps: (1) performing uniform scale transformation on a digital pathology section sample, and obtaining a breast hyperplasia region by using a TransUNet segmentation model; (2) detecting the degree of gland tube formation, the mitotic figure count and the nuclear pleomorphism in the breast hyperplasia region, and scoring according to the set rules; (3) calculating the total score of the section sample according to the scores of the degree of gland tube formation, the mitotic figure count and the nuclear pleomorphism; and (4) realizing automatic grading of canine infiltrative breast cancer Nottingham histology according to the total score. The whole scoring process is automatically completed by a computer, without manual intervention, and a feasible scheme is provided for standardized analysis of large-scale veterinary pathology data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of automatic grading technology for canine mammary cancer, and particularly relates to a method for automatic histological grading of canine invasive mammary cancer in Nottingham based on TransUNet and YOLOv5. Background Technology

[0002] Accurate identification of malignant proliferative activity in breast tumor sections and standardized histological grading are core criteria for prognostic assessment and guiding clinical treatment. The Nottingham histological grading system, a widely adopted international standard, comprehensively evaluates invasive breast cancer from three dimensions: tuple formation (TF), mitotic count (MC), and nuclear pleomorphism (NP). Each of the three indicators is scored independently from 1 to 3, and the sum of these scores classifies invasive breast cancer into three grades: G1 (low grade, 3-5 points), G2 (intermediate grade, 6-7 points), and G3 (high grade, 8-9 points). However, the traditional Nottingham histological grading system heavily relies on manual examination by pathologists, which is time-consuming, inefficient, and prone to significant human interpretation variability in each dimension's scores. Therefore, this invention is proposed. Summary of the Invention

[0003] In view of this, the purpose of this invention is to provide a method for automatic histological grading of canine invasive breast cancer in Nottingham based on TransUNet and YOLOv5.

[0004] To achieve the above-mentioned objectives, the present invention provides the following technical solution: This invention provides a method for automated histological grading of canine invasive breast cancer in Nottingham based on TransUNet and YOLOv5, comprising the following steps: (1) Perform uniform scaling transformation on digital pathological slide samples and use the TransUNet segmentation model to obtain the breast hyperplasia region; (2) The degree of duct formation, mitotic count, and nuclear pleomorphism in the hyperplastic area of ​​the breast were detected and scored according to the grading rules; (3) Calculate the total score of the slide sample based on the degree of glandular formation, the count of mitotic figures, and the score of nuclear pleomorphism; (4) Automatic Nottingham histological grading of canine invasive mammary cancer based on total score; When the total score is 3-5 points, it is G1; when the total score is 6-7 points, it is G2; when the total score is 8-9 points, it is G3.

[0005] Preferably, the degree of gland formation is scored based on the proportion of glandular structure, and the proportion of glandular structure is calculated using a segmentation mask.

[0006] Preferably, the formula for calculating the proportion of glandular structures is: proportion of glandular structures = total number of glandular pixels in the breast hyperplasia area / total number of pixels in the breast hyperplasia area × 100%; If the proportion of glandular structures is less than 10%, 3 points are awarded; if the proportion of glandular structures is between 10% and 75%, 2 points are awarded; if the proportion of glandular structures is less than 75%, 1 point is awarded.

[0007] Preferably, the mitotic figure counting is performed using the YOLOv5 mitotic figure detection model.

[0008] As a preferred approach, with a field of view diameter of d=0.5mm at 40× magnification in the clinical scoring threshold table as a reference, the area with the highest density of mitotic figures is selected, and 10 fields of view are observed consecutively and the total number of mitotic figures is counted. The maximum value of the total number of mitotic figures in the 10 fields of view is taken as the mitotic figure count. The mitotic figure count ≤ 7 is scored as 1 point; 8 ≤ mitotic figure count ≤ 14 is scored as 2 points; and 15 ≤ mitotic figure count is scored as 3 points.

[0009] Preferably, the nuclear pleomorphism is classified using the YOLOv5 classification model.

[0010] Preferably, the scoring of nuclear pleomorphism is a binary classification, and the scoring criteria are as follows: when the nuclei of tumor epithelial cells in the active area of ​​breast hyperplasia have three or more of the following morphological characteristics, it is scored as 3 points: (1) the nuclei are significantly different in size, and the ratio of the area of ​​the largest nucleus to the area of ​​the smallest nucleus in the same 40× field of view exceeds 2; (2) the nuclei are obviously irregular in shape, with lobed, twisted or irregular polygonal nuclei appearing; (3) the chromatin is coarse, clotted and unevenly distributed; (4) the nucleoli are obvious, the diameter of the nucleoli is greater than one-tenth of the diameter of the nucleus, and more than one nucleoli can be seen in the same nucleus; when the nuclei of tumor epithelial cells in the active area of ​​breast hyperplasia do not meet the above 3-point criteria, it is scored as 1 point.

[0011] Preferably, the digital pathological slide sample is a canine mammary tumor slide stained with hematoxylin-eosin (HE) and then digitally scanned at 40× magnification using a digital slide scanner to output a whole-field digital slide image (WSI).

[0012] Preferably, the physical resolution of the WSI is 0.26 μm / px.

[0013] Compared with the prior art, the present invention has the following beneficial effects: This invention first performs a uniform scaling transformation on the entire digital pathological slide (reducing the number of pixels while maintaining geometric realism). The TransUNet segmentation model is then used to identify and segment the breast hyperplasia region within the slide. Based on the segmentation mask of the breast hyperplasia region, the ductal ratio (GR) is calculated, and a TF score is obtained based on the ductal ratio. Secondly, within the breast hyperplasia region, a YOLOv5 mitotic figure detection model is used to identify and count mitotic figures, obtaining a MC score. Finally, within the same region, a YOLOv5 classification model is used to assess nuclear pleomorphism, obtaining an NP score. The three scores are then combined to obtain the Nottingham histological grading score, automatically outputting the histological grading result for canine invasive breast cancer. Attached Figure Description

[0014] Figure 1 This is a flowchart of the present invention. Detailed Implementation

[0015] This invention provides a method for automated histological grading of canine invasive breast cancer in Nottingham based on TransUNet and YOLOv5, comprising the following steps: (1) Perform uniform scaling transformation on digital pathological slide samples and use the TransUNet segmentation model to obtain the breast hyperplasia region; (2) The degree of duct formation, mitotic count, and nuclear pleomorphism in the breast hyperplasia area were detected and scored according to the established rules; (3) Calculate the total score of the slide sample based on the degree of glandular formation, the count of mitotic figures, and the score of nuclear pleomorphism; (4) Automatic Nottingham histological grading of canine invasive mammary cancer based on total score; when the total score is 3-5 points, it is G1; when the total score is 6-7 points, it is G2; when the total score is 8-9 points, it is G3.

[0016] In this invention, a preferred method is to scale the original image to 1866×880 pixels before segmenting the breast hyperplasia region using the TransUNet segmentation model. Then, pathologists segment and label the breast hyperplasia region. After labeling, a dataset is constructed for model training. The TransUNet network used in this invention consists of an encoder and a decoder. The encoder is further divided into a convolutional neural network feature extraction stage and a Transformer global modeling stage. The decoder adopts an upsampling architecture consistent with UNet. The convolutional neural network extracts multi-level local convolutional features from the input image, while the Transformer establishes pixel-level global dependencies, extracting spatial correlation features between tumor tissue and adjacent normal tissue. The UNet decoder is responsible for restoring the spatial resolution from coarse to fine. The decoder employs a stepwise upsampling strategy to gradually restore the feature map resolution to the original input resolution.

[0017] In this invention, a glandular duct refers to a tubular structure formed by a central true secretory glandular lumen surrounded by cancer cells arranged in a polar pattern. The glandular duct structure proportion refers to the percentage of mammary glandular ducts in the entire mammary hyperplasia area. It is defined as follows:

[0018] in, For pixel binary discrimination function, when pixel The value is 1 when the pixel belongs to a glandular structure (i.e., the pixel is identified as a glandular structure in the breast hyperplasia area), and 0 otherwise. This represents the total number of pixels in the breast hyperplasia region, which is defined by the breast hyperplasia region mask output by the TransUNet segmentation model. The breast hyperplasia region mask is mapped back to WSI, and the number of duct pixels and the total number of pixels in the breast hyperplasia region are counted separately. The degree of duct formation is scored based on the proportion of duct structure. The formula for calculating the proportion of duct structure is: Duct structure proportion = Total number of duct pixels in the breast hyperplasia region / Total number of pixels in the breast hyperplasia region × 100%; where, duct structure proportion < 10%, 3 points are awarded; 10% ≤ duct structure proportion ≤ 75%, 2 points are awarded; 75% < duct structure proportion, 1 point is awarded.

[0019] In this invention, the mitotic figure counting is performed using the YOLOv5 mitotic figure detection model. Using a clinical scoring threshold table with a field of view diameter of d=0.5mm at 40× magnification as a reference, the area with the highest mitotic figure density is selected, and 10 consecutive fields of view are observed and the total number of mitotic figures is counted. The maximum value of the total number of mitotic figures in the 10 fields of view is used as the mitotic figure count. A mitotic figure count ≤ 7 is scored as 1 point; 8 ≤ mitotic figure count ≤ 14 is scored as 2 points; and 15 ≤ mitotic figure count is scored as 3 points. The YOLOv5 mitotic figure detection model detects a slice of the breast hyperplasia area, and the output result is a normalized coordinate position. The detection results are mapped back to WSI. Based on the positional offset of each image block in WSI, the local predicted coordinates are mapped to the global coordinate system of the original image, thereby unifying the local detection results scattered in each sub-block into the coordinate reference system of the entire slice. Then, a transformation is performed on the pixel coordinates using a physical scaling factor λ=0.26μm / px to complete the coordinate transformation from the pixel domain to the physical domain.

[0020] In this invention, to efficiently determine candidate fields of view for high-density clustering regions of mitotic figures, the physical space covered by the set of coordinate points of mitotic figures detected by YOLOv5 is divided into regular grids. For each non-empty grid cell, the average coordinate value of all coordinate points falling within that cell is used as the initial candidate center, thereby generating a set of candidate center points in the global space. Using the field of view diameter d=0.5mm at 40× magnification in the clinical scoring threshold table as a parameter, for each center point in the candidate center point set, the average coordinate value of all coordinate points falling within that cell is used as the initial candidate center. Let be the number of cleavage images within a circular region centered at d, with diameter . Based on the number of coverage points corresponding to each candidate center, the candidate center set is sorted in descending order, prioritizing the candidate field of view with the highest enrichment of cleavage images. This sorting result provides a deterministic traversal order for subsequent greedy approximation solutions, ensuring that the algorithm always starts iteratively from the candidate field of view with the densest coverage during the selection process.

[0021] This invention introduces a conflict graph to abstract the spatial geometric relationships of candidate fields of view. Specifically, each center of the candidate circle center set is used as a node in the graph. If there is geometric overlap between the circular regions defined by any two candidate circle centers (i.e., the distance between the two circle centers is less than the field of view diameter d), it is considered that a conflict relationship exists, and an undirected connecting edge is added between the corresponding two nodes. After the above construction is completed, the conflict graph fully encodes the spatial state between all pairs of candidate regions.

[0022] In this invention, a greedy approximation algorithm is used to solve the spatial deduplication problem of candidate visions. First, candidate visions are evaluated. If the graph node corresponding to the current candidate vision has no conflicting edges with any node in the already selected vision set (i.e., no spatial overlap with the circular coverage areas of any selected vision), it is included in the final selected vision set; otherwise, the region is skipped and the next candidate is processed. This evaluation and iteration process is repeated until the candidate queue is traversed. The final output vision set satisfies the constraint that there is no spatial overlap between any two visions. Redundant detection is removed using the greedy approximation algorithm, achieving spatial deduplication of candidate visions. This invention uses the sum of the coverage points of each vision in the final selected vision set as an estimate of the kernel splitting image count for that region.

[0023] In this invention, nuclear pleomorphism refers to the differences between tumor cell nuclei, manifested in variations in nuclear size, shape, staining intensity, number of nuclei, and number of nucleoli. The Nottingham Histological Grading System's nuclear pleomorphism scoring involves two aspects: nuclear size and nuclear pleomorphism. Clinically, pathologists observe the size, shape, chromatin distribution, and nucleolus prominence of cell nuclei under 40× fields, assigning a score of 1-3 for nuclear pleomorphism. However, in veterinary practice interpreting breast tumors, the scoring of nuclear pleomorphism is highly subjective. Different breeds of dogs exhibit inherent differences in the nuclear morphology of normal mammary epithelial cells; this biological heterogeneity makes pleomorphism assessment difficult to quantify. Furthermore, untimely fixation or uneven fixative penetration during section preparation often leads to artificial artifacts in the cell nuclei, further increasing the difficulty of interpretation. The nuclear pleomorphism described in this invention is evaluated using the YOLOv5 classification model, which determines whether the cell nucleus exhibits pleomorphism that meets the following conditions. When the nuclei of tumor epithelial cells in the active area of ​​breast hyperplasia have three or more of the following morphological characteristics, they are scored as 3 points: (1) The nuclei are significantly different in size, with the ratio of the largest to the smallest nucleus area in the same 40× field of view exceeding 2; (2) The nuclei are obviously irregular in shape, with lobed, twisted, or irregular polygonal nuclei appearing; (3) The chromatin is coarse, clotted, and unevenly distributed; (4) The nucleoli are prominent, with a diameter greater than one-tenth of the diameter of the nucleus, and more than one nucleolus can be seen in the same nucleus. When the nuclei of tumor epithelial cells in the active area of ​​breast hyperplasia do not meet the above 3-point criteria, they are scored as 1 point. Although this method simplifies the score calculation precision compared to the three-level scoring method, its advantages lie in its clear interpretation criteria, strong repeatability, and suitability for the design of automated detection systems.

[0024] In this invention, the digital pathological slide sample is a canine mammary tumor slide that has undergone HE staining, digitized at 40× magnification using a digital slide scanner to complete a full-field digital scan, outputting a WSI image. The physical resolution of the WSI is 0.26 μm / px.

[0025] In this invention, three independent modules were used to calculate the proportion of glandular structures, the count of mitotic figures, and the detection of nuclear pleomorphism. The Nottingham Histological Grading System specifies that the total score is the sum of the three independent scores. The values ​​for the proportion of glandular structures and the count of mitotic figures range from 1 to 3 points, while the scores for nuclear pleomorphism are 1 and 3 points respectively; therefore, the total score ranges from 3 to 9 points. Based on the total score, the tumor is classified into three grades: G1 (low grade, 3-5 points), G2 (intermediate grade, 6-7 points), and G3 (high grade, 8-9 points). Finally, the histological grading result of the tumor (G1 / G2 / G3) is automatically output based on the total score range. The entire scoring process is completed automatically by computer without human intervention, providing a feasible solution for the standardized analysis of large-scale veterinary pathology data.

[0026] The technical solutions provided by the present invention will be described in detail below with reference to the embodiments, but they should not be construed as limiting the scope of protection of the present invention.

[0027] The slides used in this invention were obtained from clinical cases of Ruipai Pet Hospital Management Co., Ltd. and Ruichen Pet Hospital Group Co., Ltd. After surgical collection, they were fixed, dehydrated, and embedded in paraffin according to standard procedures, resulting in continuous sections of 4μm thickness and HE staining. The stained sections were interpreted by qualified veterinary pathologists, and data annotation was completed by veterinary pathologists using LabelMe software.

[0028] Data annotation includes the following steps. First, pathologists use dividing lines to annotate the breast hyperplasia area on the WSI after uniform scaling. Then, the breast hyperplasia area is divided into 1000×780 images at 40× magnification. Pathologists interpret each segmented image and annotate mitotic figures with rectangular boxes. Finally, the pleomorphism of the cell nuclei is interpreted on the segmented images. Significantly varying cell sizes, with the ratio of the largest to the smallest nucleus area exceeding 2 within the same 40× field of view; markedly irregular cell morphology, including lobulated, twisted, or irregular polygonal nuclei; coarse, clumpy, and unevenly distributed chromatin; prominent nucleoli, with a diameter greater than one-tenth of the cell nucleus diameter, and more than one nucleolus visible within the same nucleus; cells meeting three or more of the above four criteria are classified into one category, and those not meeting the criteria are classified into another category. The two categories are stored separately.

[0029] Example 1: TransUnet segmentation model training process

[0030] The TransUNet segmentation model described in this invention is used to segment the mammary hyperplasia region from the background region in HE-stained WSI of canine mammary tumors. It is a prerequisite for assessing the degree of duct formation and also a prerequisite for counting mitotic figures and classifying nuclear pleomorphism. The training process of this model includes four stages: data acquisition and preprocessing, data annotation and dataset construction, TransUNet segmentation model architecture, model training, and results.

[0031] 1. Training data acquisition and preprocessing

[0032] HE-stained pathological sections of canine mammary tumors were collected and digitally scanned at 40× magnification using a whole-slice scanner (Leica Aperio GT450) to obtain whole-slice indices (WSI). The WSIs were then subjected to uniform scaling to reduce the image resolution to 1866×880 pixels.

[0033] 2. Data labeling and dataset construction

[0034] Images after uniform scaling were labeled. Pathologists used LabelMe software to label breast hyperplasia areas, obtaining pixel-level label masks. The labeled areas covered the actively proliferating regions of the breast tumor, excluding background, adipose tissue, necrotic areas, and vacuoles. The labeling results were reviewed by pathologists; in case of disagreement, a consensus was reached, and the consensus label was used as the training label. A total of 153 labeled images were obtained, split into training and testing sets in a 7:3 ratio, with 107 images in the training set and 46 images in the testing set.

[0035] 3. TransUnet Segmentation Model Architecture

[0036] The TransUNet segmentation model employs an encoder-decoder architecture. The encoder uses a hybrid backbone structure, specifically R50 + ViT-B_16, which balances the convolutional network's ability to extract fine local texture features with the Transformer's ability to model global contextual information. The decoder uses UNet's skip connection mechanism. The specific architecture is as follows: ResNet-50 employs a residual network structure, consisting of an input convolutional layer and four residual stages, with the number of residual blocks in each stage configured as 3, 4, 6, and 3. It is responsible for extracting multi-scale hierarchical feature maps from the input image.

[0037] The ViT-B_16 module maps the feature maps output by ResNet-50 to a sequence via linear projection, appends learnable one-dimensional positions, and then inputs it into the Transformer encoder. The Transformer encoder is configured with ViT-Base and contains 12 encoder layers, each including a multi-head self-attention mechanism and a multi-layer perceptron. Layer normalization and residual connections are used to stabilize the training process of deep networks and preserve information flow. The ViT-B_16 module models global contextual information and long-range spatial dependencies on the sequential feature representation, compensating for the shortcomings of pure convolutional networks in global information modeling. After the feature sequence output by the Transformer encoder is restored to a two-dimensional spatial feature map, it is concatenated with the feature map output by ResNet-50 along the channel dimension to form a deep feature representation that integrates local details and global semantics.

[0038] The decoder adopts the UNet decoder structure, which includes three upsampling stages. Each stage improves the spatial resolution of the feature map by a factor of 2 through transposed convolution. Each upsampling stage concatenates the feature map of the corresponding layer of the encoder with the feature map in the channel dimension through skip connections, thus fusing the high-resolution local detail information extracted by the encoder with the semantic information of the decoder. After each concatenation, a convolution operation is performed to gradually reduce the channel dimension. At the end of the decoder, the number of channels is reduced to 2 through convolution, and the prediction result for each pixel is output.

[0039] An attention gate module is introduced on the skip connection path to adaptively weight the feature maps transmitted by the encoder. The attention gate performs spatial attention weighting on the skip connection features through a gating signal, suppressing feature responses in irrelevant regions and enhancing feature representation in the breast hyperplasia region, thereby improving the accuracy of segmentation boundaries.

[0040] 4. Model Training and Selection

[0041] The TransUNet segmentation model of this invention employs a transfer learning strategy, loading officially pre-trained weight parameters for model initialization. The pre-trained model architecture is R50+ViT-B_16, and the pre-training dataset is ImageNet-21k.

[0042] The model was trained using a single-card setup, and the optimization algorithm chosen was stochastic gradient descent. The momentum parameter was set to 0.9, and the weight decay coefficient was set to 0.0001 to accelerate gradient convergence and suppress overfitting. The base learning rate was set to 0.01, and a polynomial decay strategy was introduced. This strategy maintains a high learning rate in the early stages of training to quickly approach the optimal parameter region, and then decays smoothly according to a polynomial curve, allowing for fine-tuning of parameters in the later stages of training and improving convergence stability.

[0043] To improve the model's generalization ability and robustness, data augmentation strategies were employed during model training. These strategies included geometric transformations, color space perturbations, and noise simulation. For geometric transformations, the training images were randomly flipped horizontally and vertically with a probability of 0.5, followed by an affine transformation with random rotations within the range of [-45°, +45°] and random shearing within the range of [-0.3, 0.3] to simulate deformation from non-frontal viewpoints. Simultaneously, multi-scale scaling and translation operations were implemented, with random scaling at a magnification of [0.6, 1.4] and random translation within 30% of the image's width and height. For color space perturbations, the images were converted to the HSV color space, and the V channel was multiplied by a random factor of [0.4, 1.6] and truncated beyond its bounds to simulate extreme lighting changes in reality. In terms of noise simulation, 3×3, 5×5 or 7×7 Gaussian kernels are randomly applied for smoothing and noise reduction, or random Gaussian noise with variance between [10, 30] is superimposed to enhance the robustness of the model to sensor hardware noise.

[0044] The model is trained for a total of 150 rounds, with a batch size of 12 samples. After 75 rounds of training, the model weights are saved every 50 rounds. At the end of training, the final evaluation weight file is output for final evaluation on the test set.

[0045] Example 2: Training Process of YOLOv5 Nucleus Splitting Detection Model

[0046] The YOLOv5 mitotic figure detection model described in this invention is used to detect mitotic figures in breast hyperplasia areas and is a prerequisite for mitotic figure counting. The model training process includes four stages: data preprocessing, data annotation, model architecture, and model training and selection.

[0047] 1. Data Preprocessing

[0048] The breast hyperplasia areas marked by the pathologist were mapped back to WSI, and the marked areas were cropped at 40× magnification to obtain pathological image blocks of 1000×780 pixels. The cropping range was limited to the breast hyperplasia areas marked by the pathologist to avoid introducing negative sample noise in normal breast tissue, adipose tissue, or stromal areas. Cropping at 40× field of view ensured that the microscopic morphological details of cell nuclei were preserved in each image block.

[0049] 2. Data labeling and dataset construction

[0050] The pathological image blocks obtained after preprocessing were screened and labeled by pathologists one by one. Two types of samples were retained for screening and labeling: (1) pathological image blocks containing mitotic figures, and pathologists used LableMe software to label the detection boxes. (2) Image blocks that do not contain mitotic figures but contain morphologically similar structures such as apoptotic bodies, condensed nuclei, and overlapping nuclei as negative samples, so that the model can distinguish true positive targets from morphological interference. Pathological image blocks that do not contain mitotic figures and have dissimilar morphological structures were removed. The removal step reduced the proportion of general negative samples in the training data, so that the training set focused on samples containing diagnostic value targets, and avoided the model being dominated by general negative samples and ignoring the detection of mitotic figures.

[0051] 3. Model Architecture

[0052] The YOLOv5 mitotic figure detection model of this invention uses pre-trained weight parameters on a general object detection dataset as initial weights. These pre-trained weights provide the model with general visual feature representation capabilities, enabling it to achieve a good initial state even with limited training samples of pathological images, thereby shortening the training convergence period and reducing the risk of overfitting.

[0053] The YOLOv5 model's network architecture mainly consists of a backbone network, a feature fusion network, and a detection head.

[0054] The backbone network adopts the CSPDarknet structure, which divides the input feature map into two parts along the channel dimension through a cross-stage local network: one part is directly connected to the module output, and the other part is transformed through a deep convolutional path and then concatenated with the connected part. This reduces redundant computation while retaining richer gradient information, making the training of deep networks more stable. The backbone network extracts semantic features at different levels by downsampling layer by layer and outputs multi-scale feature maps for use by the feature fusion network and the detection head.

[0055] The feature fusion network adopts the PANet structure, which performs bidirectional feature fusion through a top-down feature pyramid path and a bottom-up path enhancement mechanism. This allows high-level semantic features and low-level spatial location features to be mutually transferred, enabling the full fusion of detection information for targets at different scales. The introduction of the P6 layer expands the network's receptive field, enabling it to capture targets at larger scales. At the same time, multi-scale feature fusion enhances the detection capability for small nuclear splitting images.

[0056] The detection head adopts a four-scale structure, corresponding to the feature maps of four scales (P3, P4, P5, and P6) output by the feature fusion network. Each scale detection head independently performs the detection task, sequentially performing 1×1 convolution channel adjustment and 3×3 convolution feature extraction on the fused feature map, and outputting the bounding box regression parameters, target confidence, and class probability of each grid cell at that scale. Among them, the P3 detection head corresponds to the shallow high-resolution feature map and is responsible for detecting small-scale mitotic figures; the P4 and P5 detection heads correspond to the intermediate-scale feature map and are responsible for detecting medium-scale targets; and the P6 detection head corresponds to the deep low-resolution feature map and is responsible for detecting large-scale or morphologically abnormal mitotic figures. The collaborative output of the four-scale detection heads enables the model to cover the detection needs of mitotic figures of different sizes in pathological images.

[0057] 4. Model Training and Results

[0058] This invention is based on the hyperparameter configuration of the official YOLOv5 training framework. Model training employs a stochastic gradient descent optimizer, which incorporates a Nesterov momentum acceleration mechanism to accelerate the consistency of gradient update directions while maintaining convergence stability. The core momentum parameter is 0.937, and the weight decay parameter is 0.0005. The initial learning rate is set to 0.01, and a linear decay strategy is used. In the first three epochs of the initial training phase, a learning rate warm-up operation is performed, gradually increasing the learning rate linearly from its minimum value to the preset initial learning rate. The momentum gradually transitions from 0.8 to the main training momentum of 0.937 to stabilize the parameter update process in the early stages of training.

[0059] During model training, YOLOv5 employs multi-scale adaptive data augmentation strategies, primarily including Mosaic data augmentation, MixUp image aliasing, and color and geometric perturbation.

[0060] Mosaic data augmentation randomly selects four images from the dataset, randomly scales, crops, and arranges each image, and then stitches them together into a new synthetic image. This strategy effectively enriches the background context of the detected targets in the training samples, enhancing the model's adaptability to complex organizational structures.

[0061] MixUp image aliasing randomly selects two different images and performs pixel-level weighted fusion according to preset weight coefficients to generate new training samples. The bounding box labels of the fused images are also linearly superimposed in the same way, achieving simultaneous expansion of the sample space and label space. MixUp enhancement can smooth decision boundaries and improve the robustness of the model near boundary samples.

[0062] Regarding color space perturbation, random perturbations were applied to the hue, saturation, and lightness channels of the image in the HSV color space, with perturbation amplitudes set to ±0.015, ±0.7, and ±0.4, respectively, to simulate color shifts caused by differences in staining batches, staining durations, and HE staining depths. Regarding geometric perturbation, random rotation, translation, scaling, translation stretching, and shearing transformations were applied to the image to simulate spatial deformations generated during WSI scanning, slide preparation, and slicing positioning.

[0063] The YOLOv5 mitotic figure detection model was trained for 150 epochs, and the weights of the model with the best training performance were saved as the final model for mitotic figure detection.

[0064] Example 3: Training Process of YOLOv5 Cell Nuclear Polymorphism Classification Model

[0065] The YOLOv5 nuclear pleomorphism classification model described in this invention is used to detect nuclear pleomorphism in mammary hyperplasia areas and is a prerequisite for nuclear pleomorphism scoring. In the Nottingham histological grading system for canine mammary tumors, nuclear pleomorphism is scored into three levels: 1, 2, and 3, based on the size, morphology, chromatin characteristics, and degree of pleomorphism of the nucleus. To improve the automation and reproducibility of nuclear pleomorphism determination, this invention maps the three levels, which are difficult to distinguish pathologically, into a binary classification problem, and enables the model to automatically distinguish nuclear pleomorphism through supervised learning. The training process of this classification model includes four stages: data preprocessing, data labeling, model architecture, and model training and selection.

[0066] 1. Data Preprocessing

[0067] The breast hyperplasia areas marked by the pathologist were mapped back to the original full-view digital slide image. The marked areas were then cropped at 40x magnification to obtain pathological image blocks of 1000×780 pixels. The cropping range was limited to the breast hyperplasia areas marked by the pathologist to avoid introducing negative sample noise into normal breast tissue, adipose tissue, or stromal areas. Cropping at 40x magnification ensured that the microscopic morphological details of cell nuclei were preserved in each image block.

[0068] 2. Data labeling

[0069] The preprocessed pathological image blocks were individually screened and labeled by pathologists. Screening primarily removed images lacking nuclear pleomorphism, retaining those containing it. Pathologists then categorized the images according to a nuclear pleomorphism scoring standard, classifying them into two categories: 1 and 3. These two categories were stored in separate directory folders, with the directory name serving as the category identifier. The first category's directory was named 1, and the second category's directory was named 3. The model automatically reads the image blocks according to the directory structure and maps their respective directory names to the corresponding category labels. That is, image blocks in directory 1 are assigned category label 0, and image blocks in directory 3 are assigned category label 1. This completes the automatic pairing of the feature vectors of the training samples with the category labels, enabling the model to learn the discriminative boundary between the two types of nuclear pleomorphism features during training.

[0070] 2. Model Architecture

[0071] This invention uses the YOLOv5 nuclear polymorphism classification model, pre-trained on a general natural image dataset, as its initial weights. The classification model is based on the backbone feature extraction network of the YOLOv5 object detection network. The feature fusion network and detection head of the original object detection network are removed and replaced with a classification head consisting of a global average pooling layer, a random deactivation layer, and a fully connected classification layer connected sequentially. The global average pooling layer compresses the deep feature map output by the backbone network into a one-dimensional feature vector along the spatial dimension. The random deactivation layer randomly zeros some feature channels during training to suppress overfitting. The fully connected classification layer maps the feature vector to the category dimension and outputs the predicted probabilities for each category.

[0072] The YOLOv5 nuclear polymorphism classification model's backbone network adopts a CSPDarknet architecture, consisting of convolutional modules, cross-stage local bottleneck modules, and fast spatial pyramid pooling modules. The convolutional modules are composed of 2D convolutional layers, batch normalization layers, and SiLU activation functions connected sequentially. The cross-stage local bottleneck module divides the input feature map into two parts along the channel dimension: one part is directly connected to the module output, while the other part undergoes feature transformation through a deep convolutional path composed of multiple residual blocks, and is then concatenated with the connected part along the channel dimension. This cross-stage splitting design reduces redundancy in gradient calculations while preserving richer gradient information, making the deep network more stable during training. The fast spatial pyramid pooling module performs three 5×5 max pooling operations on the input feature map sequentially, concatenating the pooling results with the original feature map along the channel dimension. This achieves feature aggregation across multiple receptive fields under single-scale convolution, enhancing the network's ability to perceive nuclear features at different scales.

[0073] The YOLOv5 nuclear polymorphism classification model removes the feature fusion network and detection head from the detection task and replaces them with a three-layer dedicated classification head for classification tasks. The first layer is a global average pooling layer, which performs global average pooling along the spatial dimension of the deep feature map, compressing the 7×7 spatial response of each channel into a single scalar value, outputting a 1×1×1280 feature vector. This operation not only eliminates the rigid constraint of the fully connected layer on the input spatial size but also effectively suppresses local spatial noise through spatial dimensional aggregation, allowing the model to focus on global nuclear morphological features rather than the texture response of a single spatial location. The second layer is a random deactivation layer, placed before the fully connected classification layer. During training, it randomly sets some elements of the feature vector to zero, preventing the network from relying on the response of a single channel during training, thus enhancing the model's generalization ability and reducing the risk of overfitting. The third layer is a fully connected classification layer, mapping the 1280-dimensional feature vector to the number of categories, outputting a two-dimensional predicted logistic value. During the inference phase, the predicted logistic value is transformed into the corresponding category using a normalized exponential function.

[0074] 3. Model Training and Selection

[0075] The model described in this invention incorporates data augmentation strategies during training, including random cropping and scaling, random horizontal flipping and rotation, HSV color space perturbation, and random erasure. Specifically, image patches are randomly cropped within the input size and then randomly scaled to enhance the model's adaptability to changes in cell nucleus scale; the image is horizontally flipped or rotated at 90° multiples with preset probabilities to expand the pose diversity of the samples; hue, saturation, and brightness are randomly perturbed in the HSV color space to simulate color shifts caused by differences in different staining batches, staining durations, and scanning equipment; and random erasure is used to randomly occlude local areas of the image, allowing the model to focus on global cell nucleus distribution features rather than local texture details, thereby improving the model's robustness and generalization performance in real clinical pathological slides.

[0076] Based on the data augmentation strategies described above, the model was trained for a nuclear polymorphism classification task. The AdamW optimizer was used for training, with hyperparameters set to first-order moment estimation parameter β1 = 0.9, second-order moment estimation parameter β2 = 0.999, and weight decay of 0.05. The initial learning rate was set to 0.001. During training, an adaptive cosine annealing strategy was employed, allowing the learning rate to smoothly decrease from its initial value along a cosine curve until it reached the preset minimum learning rate boundary at the end of 50 training epochs. The cosine annealing strategy maintains a relatively high learning rate in the early stages of training to quickly approach the optimal region, while gradually reducing the learning rate in the later stages to achieve fine-tuning of parameters, thereby improving the model's convergence stability and final classification performance on the nuclear polymorphism binary classification task. The model was iteratively trained on the complete training set for 50 epochs, and the model weights with the highest classification accuracy on the training set were saved as the optimal model.

[0077] Example 4

[0078] Reference Figure 1 The method described herein involves obtaining HE-stained sections of a surgically removed mammary tumor specimen from an 8-year-old unspayed female poodle with confirmed invasive breast cancer. These sections were digitally scanned using a whole-slice scanner (Leica Aperio GT450) at 40× magnification to obtain WSI images. The highest resolution image resolution was approximately 186683×88092 pixels. The method of this invention was used to grade the cancer and determine its Nottingham histological grading, as detailed below.

[0079] (1) WSI original image downsampling: The highest resolution WSI image is subjected to uniform scale transformation to reduce the image resolution to 1866×880 pixels. While ensuring that the breast hyperplasia area is identifiable, the total number of pixels is reduced from 16.4 billion to about 1.6 million.

[0080] (2) Segmentation of breast hyperplasia regions and calculation of the proportion of glandular structures (GR): The transformed 1866×880 pixel image was input into the well-trained TransUNet segmentation model. The model identified breast hyperplasia regions and obtained a binary mask of the breast hyperplasia regions. The identified breast hyperplasia regions were mapped to WSI. The glandular structure regions and stroma regions were further distinguished.

[0081] Statistics show that the total number of pixels in the breast hyperplasia region, A_active, is 281,656 pixels (corresponding to an actual area of ​​approximately 19,040 μm²), and the total number of pixels in the ductal structures, A_gland, is 38,768 pixels (corresponding to an actual area of ​​approximately 2,621 μm²). GR is calculated as follows: GR = 38768 / 281656 × 100% = 13.77% The GR of 13.77% falls between 10% and 75%. According to the scoring rules, the degree of glandular formation is moderate, and the TF score is 2 points.

[0082] (3) Detection of nuclear mitotic figures: Based on the binary breast hyperplasia region mask obtained in step (2), the detection range is limited to the breast hyperplasia region, excluding the background and other regions.

[0083] Image patches of breast hyperplasia regions were extracted from a 40× field of view, each patch measuring 1000×780 pixels. These patches were then input into a trained YOLOv5 mitotic figure detection model for mitotic figure detection. The model output the normalized coordinates of each detected mitotic figure. Next, based on the positional offset of each image patch in the original WSI, the local predicted coordinates were mapped to the global coordinate system of the original image. Finally, the pixel coordinates were calibrated to physical coordinates using a physical scaling factor λ = 0.26 μm / px, completing the coordinate transformation from the pixel domain to the physical domain.

[0084] The coordinates of the center points of detected mitotic figures are used as spatial representations to form a two-dimensional coordinate point set P. The physical space covered by coordinate point set P is divided into a regular grid. For each non-empty grid, the average coordinates of all coordinate points falling within that grid are used as the initial candidate circle center, thus generating a candidate circle center set in the global space. Using the clinical scoring threshold table with a field of view diameter d=0.5mm at 40× magnification as a parameter, the number of mitotic figures falling within the circular area of ​​each circle center in the candidate circle center set is counted. Based on the number of coverage points corresponding to each candidate circle center, the candidate circle center set is sorted in descending order. Then, a conflict graph is constructed, and a greedy selection is performed by traversing the candidate queue. Finally, the total number of mitotic figures N=58 across 10 fields of view is obtained.

[0085] N=58>15, according to the scoring rules, the MC score is 3 points.

[0086] (4) Nuclear pleomorphism assessment: The detection range was limited using the binary mask of the breast hyperplasia region obtained in step (2). The image patches segmented in step (3) were input into the trained YOLOv5 nuclear pleomorphism classification model. This model classified the detected nuclear pleomorphism and output whether there were tumor epithelial cell nuclear image patches within the breast hyperplasia region that met the 3-point standard. Tumor epithelial cell nuclear image patches that met the 3-point standard were detected.

[0087] According to the binary decision rule, the NP score is 3 points.

[0088] Overall score and graded output: Calculate the Nottingham histology score = TF + MC + NP = 2 + 3 + 3 = 8 points.

[0089] A total score of 8 points falls within the 8-9 point range, which corresponds to histological grade G3 (high level) and a high risk level.

[0090] Output: The histological grade of this sample is "G3 (high grade, high risk)", with a total score of 8 points for Nottingham histological grading, and sub-item scores of TF=2 points, MC=3 points, and NP=3 points.

[0091] Verification Example 1

[0092] Forty-six HE-stained pathological slides of canine invasive mammary gland disease were selected. Pathologists segmented and marked the hyperplastic mammary regions on the slides. Two veterinarians with over ten years of experience in veterinary pathology independently completed three-dimensional index scoring. When the two veterinarians disagreed on their scores, they reached a consensus, and the consensus was used as the final score for each slide. These slides were then systematically evaluated using the method of this invention to verify the effectiveness of the method.

[0093] (1) Experimental results of TransUNet segmentation model

[0094] The TransUNet segmentation model was evaluated on a test set consisting of 46 canine invasive breast cancer pathology images (WSI). Four metrics were used to measure the overlap between the segmentation results and the human annotations: Dice coefficient (the degree of overlap between the predicted region and the ground truth annotation), Intersection over Union (IoU) (the ratio of the union and intersection of the predicted region and the ground truth annotation), Precision (the proportion of pixels correctly predicted as the target region), and Recall (the proportion of pixels correctly identified in the ground truth target region).

[0095] The results show that the Dice coefficient is 0.8562, indicating that the TransUNet segmentation model of this invention can effectively segment the mammary hyperplasia region of canine mammary tumors. The IoU is 0.7900, indicating that the predicted region and the labeled region are relatively close in scale, without serious oversegmentation (predicted region much larger than labeled region) or undersegmentation (predicted region much smaller than labeled region), and the segmentation boundary localization is relatively accurate. The precision reaches 0.8836, meaning that 88.36% of the pixels predicted by the model as mammary hyperplasia regions match the manually labeled real mammary hyperplasia regions. The recall reaches 0.8774, meaning that 87.74% of the real mammary hyperplasia regions are correctly identified by the model. These indicators show that the TransUNet segmentation model used in this invention performs well in controlling both false positives and false negatives, without significant bias errors. This characteristic is particularly important for the auxiliary diagnosis of pathological images: false positives can lead to misclassifying normal tissue as tumors, resulting in overdiagnosis; false negatives can lead to tumor regions not being included in the analysis, resulting in missed diagnosis.

[0096] (2) Consistency results of glandular duct formation degree scoring

[0097] In all 46 test samples, the WSI of each slice was preprocessed, segmented, and quantified using the method of this invention to calculate the proportion of glandular structures and score the degree of glandular formation according to mapping rules. The comparison results between the scores automatically output by the method of this invention based on GR values ​​and the manual scores are as follows.

[0098] Of the 46 test samples, 39 samples (84.8%) had completely consistent automatic and manual scores; 7 samples (15.2%) had a deviation of 1 point; and no samples had a deviation of 2 points or more. The percentage consistency rate was 84.8%. The 7 discrepancies all involved a manual score of 3 and an automatic score of 2. The GR values ​​of these 7 samples were 0.1274, 0.1290, 0.1348, 0.1363, 0.1493, 0.1550, and 0.1726, respectively, all falling within the 10%–75% scoring range. The automatic score, based on the quantification mapping rule, assigned 2 points, while the manual assessment assigned 3 points. The manual assessment considered factors such as incomplete glandular structures and the proportion of solid growth areas in some fields of view, and the degree of glandular formation was difficult to quantify manually. This discrepancy reflects a systematic difference between the quantification rule and subjective human judgment on boundary samples: the automatic method, based on the GR value of the entire region, has higher objectivity and repeatability, while the manual assessment tends to focus more on local morphological features.

[0099] (3) Consistency results of nuclear mitotic figure count scoring

[0100] The YOLOv5 mitotic figure detection model was used to automatically detect and count mitotic figures, and a score was output based on the counting results. The following is a comparison of the automatically generated scores and the manual scores from pathologists in 46 test samples.

[0101] Forty samples (87.0%) showed complete agreement; five samples (10.9%) showed a deviation of 1 point; and one sample (2.2%) showed a deviation of 2 points. The calculated percentage agreement rate was 87.0%. The six cases of discrepancy in MC scores all involved an algorithmic score of 3 while a manual score was less than 3. One case received a manual score of 1, and five received 2. The algorithmic mitotic counts for these six samples were 17, 24, 25, 31, 32, and 34, all greater than 15, and were therefore assigned a score of 3 according to the algorithmic scoring rules. The discrepancy stems from the fact that pathologists routinely select 10 high-power fields from the slides for mitotic counts. However, due to the subjectivity of manual selection, the selected 10 fields may not represent the 10 areas with the highest mitotic density in the slide, leading to sampling bias and a tendency to underestimate the mitotic count. In contrast, the method of the present invention effectively avoids the subjective bias of manually selecting the field of view by conducting complete detection and statistics of nuclear splitting images of the entire slice, and its counting results are more objective.

[0102] (4) Consistency results of nuclear polymorphism scores

[0103] The YOLOv5 nuclear pleomorphism classification model was used to assess nuclear pleomorphism. An NP score was output based on a binary judgment of whether image patches of tumorous epithelial cell nuclei meeting a score of 3 were detected. The results of the algorithm's automatic scoring and the pathologist's scoring in 46 test samples are shown below.

[0104] Of the 41 cases (89.1% of the total sample), all were completely consistent, while 5 cases (10.9% of the total sample) had a discrepancy of 1 point. In the 5 discrepancies, the pathology score was 2 and the algorithm score was 3. The number of nuclear pleomorphism (NP) sub-images detected in these 5 samples were 21, 23, 25, 23, and 5 respectively, indicating low NP levels. The algorithm used a binary judgment method, outputting an NP of 3 points as long as any tumor epithelial cell nucleus image patch meeting the 3-point standard was detected. Pathologists, however, used a traditional three-tier scoring system, assigning a score of 2 to samples that did not meet the 1 or 3 NP criteria. This discrepancy stems from the difference in scale between the binary judgment mechanism of the method of this invention and the traditional three-tier scoring system, representing a systematic difference. If the pathology NP scores of 2 and 3 are combined into a single category of "presence of nuclear pleomorphism," the consistency rate becomes 100%.

[0105] (5) Overall consistency results

[0106] The Nottingham histological grading score is obtained by summing the three sub-scores TF, MC, and NP. Based on the threshold ranges of 3~5, 6~7, and 8~9, it is mapped to G1, G2, and G3. The comprehensive grading results are compared with the results classified by the pathologists as follows.

[0107] In the comprehensive Nottingham histological grading results of 46 test samples, there was 1 sample manually assessed as G1 and 6 samples as G2. Of these, the method of this invention correctly classified 1 sample as G1, 4 as G2, and 2 as G3. There were 39 samples manually assessed as G3, all of which were classified as G3 by the method of this invention, with no misclassifications as G2. From the perspective of the output of this invention's method: the method of this invention classified 1 sample as G1, 4 as G2 (all manually assigned G2, no false positives), and 41 as G3 (39 of which were consistent with manual classification, and 2 were actually manually assigned G2). Of the 46 samples, 44 were completely consistent with manual classification, resulting in an overall grading accuracy of 95.7%, indicating that the method described in this invention has a high degree of consistency with pathologist manual assessment in Nottingham histological grading.

[0108] The five inconsistencies in the NP dimension all stemmed from systematic differences in the scoring mechanisms, specifically due to variations between binary judgments and three-tiered scoring scales, rather than deficiencies in the model's recognition capabilities. The direction of bias in all inconsistent cases is reasonable from a clinical safety perspective.

[0109] Verification Example 2

[0110] The method of this invention was used to evaluate the Western blot (WSI) of seven HE-stained images of invasive mammary cancer in cats, and compared with various manual scores and histological grades. The results are as follows: (1) Results of TransUNet segmentation model On the cat test set, the TransUNet segmentation model achieved a Dice coefficient of 0.8243, an IOU of 0.7113, a precision of 0.8289, and a recall of 0.8325. The Dice coefficient decreased by approximately 3.2% compared to the canine test set, the IOU decreased by approximately 8.0%, the precision decreased by approximately 5.5%, and the recall decreased by approximately 4.5%.

[0111] Without species-specific fine-tuning, the TransUNet segmentation model of this invention significantly outperforms the cat test set in all four core segmentation metrics on the canine test set, indicating that the method has significant species-specific adaptability to canine mammary tumor pathological tissue images.

[0112] (2) Consistency results of glandular duct formation degree scoring

[0113] The following is a comparison of the TF score automatically generated based on the GR value and the manual TF score obtained by the method of this invention.

[0114] Of the 7 test samples, 5 samples (71.4%) had completely consistent automatic and manual TF scores (0 points of deviation); 2 samples (28.6%) had a deviation of 1 point (automatic score was lower than manual score); and there were no samples with a deviation of more than 2 points. The percentage consistency rate was 71.4%.

[0115] The two instances of inconsistency in TF scoring both involved a human score of 3 and an automated score of 2. The GR values ​​for these two samples were 0.1798 and 0.1610, respectively, both falling within the 10%–75% scoring range. The automated score, based on the quantification rules, assigned a score of 2. This inconsistency pattern is similar to that observed in the canine test set, reflecting the difference between the quantification rules and subjective human judgment on boundary samples. This indicates that the error in the consistency scoring of glandular formation is not a random error of the method of this invention, but rather a tendency to overestimate the proportion of glandular structures in the 10%–15% critical range due to the difficulty for pathologists to visually calculate it. The method of this invention, based on objective quantification at the pixel-level segmentation, can effectively correct the subjective bias of human scoring.

[0116] (3) Consistency results of nuclear mitotic figure count scoring

[0117] The following is a comparison between the MC score output by the YOLOv5 mitotic figure detection model and the pathologist's score, based on the detection and counting results of the method of this invention.

[0118] Of the 7 samples, 5 were completely consistent (0 points of deviation), accounting for 71.4%; 2 were inconsistent (1 point of deviation, the algorithm score was higher than the pathological score), accounting for 28.6%; and the samples with no deviation of 2 points had a consistency rate of 71.4%.

[0119] The two cases of discrepancy in MC scores both showed that the algorithmic score was higher than the human score. In these two cases, the algorithm detected mitotic counts of 10 and 12, respectively, and automatically output a score of 2 according to the algorithmic scoring rules; while the pathologists gave an MC score of 1 in both cases.

[0120] (4) Consistency results of nuclear polymorphism scores

[0121] The method of this invention compares the NP score output by the YOLOv5 nuclear polymorphism classification model with the pathologist's score as follows.

[0122] Of the 7 samples, 5 were completely consistent (0 points of deviation), accounting for 71.4%; 2 were biased by 1 point (the algorithm score was higher than the pathological score), accounting for 28.6%; and there were no samples with a bias of more than 2 points. The percentage consistency rate was 71.4%.

[0123] In both of the aforementioned cases where the deviation was 1 point, the algorithm output an NP score of 3, while the pathologist rated it as 2. This difference stems from the scale difference between the binary judgment mechanism and the traditional three-level scoring.

[0124] (5) Overall consistency results

[0125] The Nottingham histological grading score is obtained by summing the three sub-scores: TF, MC, and NP. The scores are then mapped to grades G1, G2, and G3 based on threshold ranges of 3-5, 6-7, and 8-9. The overall grading results are compared with the results determined by the pathologists as follows.

[0126] In the comprehensive Nottingham histological grading results of 7 test samples, 3 samples were rated G2 by pathologists, of which 2 were correctly classified as G2 by the method of this invention, and 1 was misclassified as G3; 4 samples were rated G3 by pathologists, of which all 4 were classified as G3 by the method of this invention, with no misclassifications as G2. The method of this invention classified 2 samples as G2 (both pathologist G2, no false positives) and 5 samples as G3 (4 consistent with pathologist assessments, 1 actually a pathologist G2). In 6 out of the 7 samples, the automatic grading was completely consistent with the pathologist's assessment, with an overall grading accuracy of 85.7%, indicating that the method described in this invention has a certain degree of consistency with the pathologist's assessment results in the comprehensive Nottingham histological grading.

[0127] The results above show that although the method of the present invention can also be used to grade breast tumors in other species, its accuracy is lower than that in dogs. This indicates that when different species are used for detection, a suitable detection method must be used, and the method cannot be directly applied.

[0128] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for automated histological grading of canine invasive breast cancer in Nottingham City based on TransUNet and YOLOv5, characterized in that, Includes the following steps: (1) Perform uniform scaling transformation on digital pathological slide samples and use the TransUNet segmentation model to obtain the breast hyperplasia region; (2) The degree of duct formation, mitotic count, and nuclear pleomorphism in the breast hyperplasia area were detected and scored according to the established rules; (3) Calculate the total score of the slide sample based on the degree of glandular formation, the count of mitotic figures, and the score of nuclear pleomorphism; (4) Automatic Nottingham histological grading of canine invasive mammary cancer based on total score; When the total score is 3-5 points, it is G1; when the total score is 6-7 points, it is G2; when the total score is 8-9 points, it is G3.

2. The method according to claim 1, characterized in that, The degree of glandular formation is scored based on the proportion of glandular structure, which is calculated using a segmentation mask.

3. The method according to claim 2, characterized in that, The formula for calculating the proportion of glandular structures is: Proportion of glandular structures = Total number of glandular pixels in the breast hyperplasia area / Total number of pixels in the breast hyperplasia area × 100%; If the proportion of glandular structures is less than 10%, 3 points are awarded; if the proportion of glandular structures is between 10% and 75%, 2 points are awarded; if the proportion of glandular structures is less than 75%, 1 point is awarded.

4. The method according to claim 1, characterized in that, The mitotic figures were identified and counted using the YOLOv5 mitotic figure detection model.

5. The method according to claim 4, characterized in that, When using the clinical scoring threshold table with a field of view diameter of d=0.5mm at 40× magnification as a reference, select the area with the densest mitotic figures and observe 10 fields of view consecutively and count the total number of mitotic figures. The maximum value of the total number of mitotic figures in the 10 fields of view is taken as the mitotic figure count. The mitotic figure count ≤ 7 is scored as 1 point; 8 ≤ mitotic figure count ≤ 14 is scored as 2 points; and 15 ≤ mitotic figure count is scored as 3 points.

6. The method according to claim 1, characterized in that, The nuclear polymorphism was classified using the YOLOv5 classification model.

7. The method according to claim 6, characterized in that, The scoring of nuclear pleomorphism is a two-category system. The scoring criteria are as follows: when the nuclei of tumor epithelial cells in the active area of ​​breast hyperplasia have three or more of the following morphological characteristics, it is scored as 3 points: (1) The nuclei are significantly different in size, and the ratio of the area of ​​the largest nucleus to the area of ​​the smallest nucleus in the same 40× field of view exceeds 2; (2) The nuclei are obviously irregular in shape, with lobed, twisted or irregular polygonal nuclei; (3) The chromatin is coarse, clotted and unevenly distributed; (4) The nucleoli are obvious, the diameter of the nucleoli is greater than one-tenth of the diameter of the nucleus, and more than one nucleoli can be seen in the same nucleus; when the nuclei of tumor epithelial cells in the active area of ​​breast hyperplasia do not meet the above 3-point criteria, it is scored as 1 point.

8. The method according to any one of claims 1 to 7, characterized in that, The digital pathological slide samples were canine mammary tumor slides stained with hematoxylin and eosin, which were then digitally scanned at 40× magnification using a digital slide scanner to obtain full-field digital slide images.

9. The method according to claim 8, characterized in that, The physical resolution of the full-view digital slice is 0.26 μm / px.