MACHINE LEARNING MODEL COMPRESSION FOR DIGITAL PATHOLOGY ANALYSIS
Techniques for compressing machine learning (ML) models for digital pathology analysis are described. More specifically, the techniques are applicable to ML models having skip connections, such as skip connections within residual units of a ML model and/or skip connections between an encoder branch and a decoder branch of a ML model. Initially, a ML model is trained. Subsequent to training the ML model, a skip connection within the ML model is identified (e.g., by identifying interconnections between various layers within the model). Subsequently, one or more filters of the ML model are pruned, while maintaining dimensional integrity of the skip connection within the ML model.
This application is a continuation of International Patent Application No. PCT/US2025/014455, filed on Feb. 5, 2024, which claims priority to U.S. Provisional Patent Application No. 63/549,932, filed on Feb. 5, 2024, titled “MACHINE LEARNING MODEL COMPRESSION FOR DIGITAL PATHOLOGY ANALYSIS”. The entire disclosures of the aforementioned applications are incorporated by reference herein in their entireties for all purposes.
BACKGROUNDDigital pathology is often used to guide a medical professional in diagnosis, prognosis and treatment assessment of a patient's disease. Stained biological samples (e.g., stained tissue slices) are mounted on glass microscope slides and are digitally imaged. A human pathologist or computational algorithm analyzes individual sections (referred to as patches) and characterizes cells in each patch. For example, it may be determined, for each patch, whether tumor cells are depicted in the patch, a quantity of tumor cells, a spatial distribution of tumor cells, etc. Such results can inform a diagnosis, treatment selection, treatment efficacy assessment, and so on.
Technological advances have enabled the digitization of histopathology slides into high-resolution images, providing opportunities to develop computer vision tools for a wide range of clinical applications. High-resolution, digital images of microscope slides make it possible to use computer-based analysis of slides. For example, machine learning models have shown promise as a tool in medical diagnostic applications and in predicting treatment outcomes.
In recent years, Artificial Intelligence has made significant progress and has achieved state-of-the-result in a variety of tasks from different domains/modalities. Much of this success comes from the availability of large training dataset and ever-increasing size of the model(s) employed. Massive models such as vision models come at an increase in computational costs and often require the use of multiple high-end GPUs. Hospitals and the healthcare industry may lack the infrastructure required to fully leverage the increasingly performant yet computationally-costly models due to these increased computational costs.
SUMMARYIn various embodiments, a non-transitory computer-readable medium includes instructions that when executed by one or more processors, cause the one or more processors to perform operations including: training a machine learning (ML) model; subsequent to training the ML model, identifying a skip connection within the ML model; and pruning one or more filters of the ML model, while maintaining dimensional integrity of the skip connection within the ML model.
In an example, pruning the one or more filters of the ML model while maintaining dimensional integrity of the skip connection comprises: configuring a first layer of the ML model to have a first output including a first number of channels, wherein a second layer and a third layer are in series with the first layer of the ML model; pruning the second layer of the ML model, such that second layer has a second output including a second number of channels, wherein the second number of channels is less than the first number of channels; pruning the third layer of the ML model, such that third layer has a third output including the first number of channels; and summing or concatenating (i) the first output having the first number of channels and (ii) the third output having the first number of channels. In an example, the operations further include: prior to summing or concatenating the first output and the third output, processing each of the first output and the third output, wherein processing the first output comprises prior to summing or concatenating, performing, without altering a dimensionality of a number of channels of the first output, one or more of (i) an activation operation, (ii) a batch normalization operation, and/or (iii) a convolution operation on the first output; and wherein processing the third output comprises prior to summing or concatenating, performing, without altering a dimensionality of a number of channels of the third output, one or more of (i) another activation operation, (ii) another batch normalization operation, and/or (iii) another convolution operation on the third output.
In an example, the first output by the first layer has N number of channels, where Nis a positive integer that is the first number; the second output by the second layer has N/a number of channels, where N/a is the second number, and wherein “a” is a positive integer pruning ratio implemented by the second layer; and the third output by the third layer has the N number of channels. In an example, prior to pruning the ML model, the second output by the second layer has the N number of channels. In an example, the operations further include: prior to summing or concatenating the first output and the third output, processing the third output by a fourth layer, wherein the fourth layer does not change a dimensionality of the first output, such that the output of the fourth layer includes the first number of channels, wherein the first layer, the second layer, the third layer, and the fourth layer implement corresponding convolution operations.
In an example, the operations further include: subsequent to summing or concatenating the first output and the third output, providing a summed or concatenated output to a fourth layer of the ML model. In an example, the skip connecting is from the first layer to a layer performing the summing or concatenating; and maintaining the dimensional integrity of the skip connection within the ML model comprising ensuring that the first output and the third output being summed or concatenated have the same first number of channels. In an example, pruning the one or more filters of the ML model comprises: configuring a fourth layer of the ML model to receive a combined output, wherein the combined output is the sum or concatenation of the first output and the third output, and wherein the combined output has a third number of channels; pruning the fourth layer such that the fourth layer has a fourth output including a fourth number of channels that is less than the third number of channels, wherein a fifth layer is in series with the fourth layer of the ML model; pruning the fifth layer of the ML model, such that fifth layer has a fifth output including the third number of channels; and summing or concatenating (i) the combined output having the third number of channels and (ii) the fifth output having the third number of channels.
In an example, the operations further include: identifying the second layer of the ML model as a first candidate for pruning, so as to reduce a size of the ML model; identifying the third layer of the ML model as a second candidate for pruning, so as to maintain the dimensional integrity of the skip connection within the ML model; calculating a first pruning ratio for the second layer; calculating a second pruning ratio for the third layer, the second pruning ratio is calculated based on the first pruning ratio, such that the third layer reverses the channel reduction achieved by the second layer; and pruning one or more filters of the ML model comprises pruning the second layer and the third layer in accordance with the first pruning ration and the second pruning ration, respectively. In an example, summing or concatenating the first output and the third output comprises summing, in a summer, the first output and the third output; the second layer, the third layer, and the summer are within a residual unit of the ML model; and the first output from the first layer forms an input to the residual unit. In an example, summing or concatenating the first output and the third output comprises concatenating, in a concatenation layer, the first output and the third output; the ML model is a U-Net model; the first layer, the second layer, and the third layer are within an encoder of the U-Net model; and the concatenation layer is within a decoder of the U-Net model.
In an example, the operations further include: subsequent to pruning the one or more filters of the ML model, fine tuning the ML model by at least in part retraining the ML model. In an example, the ML model is usable to process digital pathology images. In an example, the ML model has one of a HoVer-Net architecture, a ResNet architecture, or a U-Net architecture.
In various embodiments, a method comprises: training a machine learning (ML) model; subsequent to training the ML model, identifying a skip connection within the ML model; and pruning one or more filters of the ML model, while maintaining dimensional integrity of the skip connection within the ML model. In an example, pruning the one or more filters of the ML model while maintaining dimensional integrity of the skip connection comprises: configuring a first layer of the ML model to have a first output including a first number of channels, wherein a second layer and a third layer are in series with the first layer of the ML model; pruning the second layer of the ML model, such that second layer has a second output including a second number of channels, wherein the second number of channels is less than the first number of channels; pruning the third layer of the ML model, such that third layer has a third output including the first number of channels; and summing or concatenating (i) the first output having the first number of channels and (ii) the third output having the first number of channels. In an example, the method further comprises: using the pruned ML model to process digital pathology images.
In various embodiments, a system comprises: one or more data processors; and a non-transitory computer readable storage medium containing instructions which, when executed on the one or more data processors, cause the one or more data processors to perform a set of actions including: training a machine learning (ML) model; subsequent to training the ML model, identifying a skip connection within the ML model; and pruning one or more filters of the ML model, while maintaining dimensional integrity of the skip connection within the ML model. In an example, the set of actions further comprises: configuring a first layer of the ML model to have a first output including a first number of channels, wherein a second layer and a third layer are in series with the first layer of the ML model; pruning the second layer of the ML model, such that second layer has a second output including a second number of channels, wherein the second number of channels is less than the first number of channels; pruning the third layer of the ML model, such that third layer has a third output including the first number of channels; and summing or concatenating (i) the first output having the first number of channels and (ii) the third output having the first number of channels.
In some embodiments, a system is provided that includes one or more data processors and a non-transitory computer readable storage medium containing instructions which, when executed on the one or more data processors, cause the one or more data processors to perform part or all of one or more methods disclosed herein.
In some embodiments, a computer-program product tangibly embodied in a non-transitory machine-readable storage medium, including instructions configured to cause one or more data processors to perform part or all of one or more methods or processes disclosed herein.
In some embodiments, a system is provided that includes one or more means to perform part or all of one or more methods or processes disclosed herein.
The terms and expressions which have been employed are used as terms of description and not of limitation, and there is no intention in the use of such terms and expressions of excluding any equivalents of the features shown and described or portions thereof, but it is recognized that various modifications are possible within the scope of the invention claimed. Thus, it should be understood that although the present invention as claimed has been specifically disclosed by embodiments and optional features, modification and variation of the concepts herein disclosed may be resorted to by those skilled in the art, and that such modifications and variations are considered to be within the scope of this invention as defined by the appended claims.
The patent or application file contains at least one drawing executed in color. Copies of this patent or patent application publication with color drawing(s) will be provided by the Office upon request and payment of the necessary fee.
The present disclosure is described in conjunction with the appended figures:
Model complexity and the required computing power have become an issue across many machine learning applications. For example, machine learning (ML) models have shown promise as a tool in medical diagnostic applications and in predicting treatment outcomes, and used in processing digital pathology images, and such ML models are massive, resulting in an increase in computational costs and use of multiple high-end Graphic Processing Unit(s) (GPUs). To reduce the model size and thus reduce the computational costs of the ML models, model compression techniques may be used.
Model pruning is a type of model compressing technique. In model pruning, a ML model is trained initially. Subsequently, unnecessary or relatively unimportant model parameters are removed from the trained ML model, thereby decreasing a size of the ML model, which in turn reduces cost of storage and/or execution of the ML model.
However, many ML models used in digital pathology image processing applications have shortcuts or skip connections, which pose additional challenges in applying model pruning techniques to such ML models. Skip connections are used in deep learning architectures, and involve bypassing one or more layers by adding shortcut or skip connections. For example, in a ML model, a layer may feed into the next layer, and also feed into another layer few hops away (such as about 2-3 hops away). Thus, in a skip connection, output of a first layer is fed to a downstream second layer. Furthermore, a third layer (which is downstream of the first and second layers) receives (i) an output of the second layer and also (i) the output of the first layer. Thus, the output of the first layer is transmitted to the third layer (i) via the second layer, and (ii) directly to the third layer by bypassing or skipping the second layer. For example, a summer may add the outputs of the second layer and the first layer, and the summed output may be provided to the third layer. For example, a residual unit is a building block of many ML models, where a residual unit may include skip connections, in which a direct connection between the first layer and the third layer may skip one or more intermediate layers (e.g., including the above-described second layer).
In addition to residual units, skip connections are also observed in other types of ML models used in digital pathology image processing applications. For example, a HoVer-Net architecture or a U-Net architecture may include an encoder branch and at least one decoder branch. There may be several layers within each of the encoder branch and the decoder branch. A skip connection (also referred to herein as a shortcut connection) directly provides a connection from a layer of the encoder to a corresponding layer of the decoder. For example, as will be described below in further detail, at the decoder, a concatenation operation is performed, where an output from a corresponding layer of the encoder and an output from another corresponding layer of the decoder is concatenated, and the concatenated feature maps are then processed at the decoder. In this example, the output from the layer of the encoder to the concatenation layer is the skip or shortcut connection. Multiple such skip connections may exist between the encoder and the decoder.
Thus, some ML models used in digital pathology image processing applications may include one or both of the following two types of skip connections-(i) skip connections within individual residual units, and (ii) skip connections from the encoder to the decoder. However, applying model pruning to some ML models, such as those ML models in which skip connections are included, poses additional challenges. For example, it may be challenging to prune an ML model including a skip connection (such as a model including a residual unit, and/or a model including a skip connection between an encoder and a decoder path), e.g., because the skip connections in a layer impact model dimensions downstream, thereby possibly making dimensions for skip connections incompatible. For example, because in a skip connection two inputs are to be summed or concatenated, any incompatible dimensions due to the pruning may render such a model non-operational. Thus, while implementing pruning of a ML model including one or more skip connections, additional mitigating strategies has to be implemented. For example, pruning strategies undertaken has to maintain dimensional integrity of the skip connections within the ML model, as described below in detail.
For example, as will be described below in further detail, a layer of a ML model may be pruned actively or passively. An “active” pruning refers to pruning output channel dimension of a layer of a ML model, so as to compress the ML model. For convolutional layers, the output channel dimension may be changed (such as reduced), e.g., by changing (such as reducing) a number of filters used in the convolution layer. However, an actively pruned layer impacts the pruning of a subsequent layer (such as an immediate subsequent layer), and may cause incompatibility in the summer or concatenator associated with a skip connection.
Thus, to allow for active pruning of a layer and yet maintain dimensional integrity of the skip connection within the ML model, one or more downstream layers have to be passively pruned. In a passive pruning, an output channel dimension of a convolution layer “has” to be pruned, to accommodate the active pruning of an inter-connected previous convolution layer and to maintain dimensional integrity of skip connections.
For example, assume a residual unit having at least three convolution layers (a first, a second, and a third convolution layer in series), and one or more batch normalization layers and one or more rectified linear units (ReLU) layers. Note that the batch normalization layers and the ReLU activation layers do not affect dimensionality, and hence, in this disclosure, these layers may be ignored when discussing channel dimensionality of inputs and outputs of convolution layers. The residual unit has an input, which is received by the first convolution layer from an upstream layer. Output of the first convolution layer is provided to the second convolution layer, and output of the second convolution layer is provided to the third convolution layer. A summer at the end of the third convolution layer receives (i) the input to the residual unit (via a skip connection) and (ii) the output of the third convolution layer. Thus, to maintain dimensional integrity of the skip connection, the channel dimensions of the following should match: (i) the input to the residual unit and (ii) the output of the third convolution layer. Now assume (merely as an example and without limiting the scope of this disclosure) that prior to pruning the ML model (e.g., in the unpruned and trained ML model), each of the first, second, and third convolution layers, as well as the input to the residual unit, have an output channel dimension of 64. Also assume that due to upstream pruning (e.g., upstream of the residual unit described here), in the pruned ML model, the input to the residual unit now has a channel dimension of 64/a, where “a” is a pruning ratio and is a positive integer (e.g., can be 1, 2, 4, 8, 16, or the like). Further assume that the first convolution layer of the residual unit is pruned (such as an “active” pruning is performed on the first convolution layer), such that the output of the pruned first convolution layer has now a channel dimension of 64/b, where “b” is a pruning ratio different from “a” and is a positive integer. If this channel dimension is left unchanged in the second and third layer, there would be channel dimension incompatibility in the summer. Accordingly, to maintain channel dimensional integrity of the skip connection at the summer, the second convolution layer (or the third convolution layer) is also pruned (such as a “passive” pruning is performed on the second convolution layer), such that the output of the second convolution layer is back to 64/a. In an example, the third convolution layer may not alter a dimensionality, and hence, the third convolution layer also outputs feature maps with a channel dimension of 64/a. Now, the summer receives (i) the input to the residual unit (via a skip connection) with a channel dimension of 64/a, and (ii) the output of the third convolution layer with a channel dimension of 64/a. This ensures that the channel dimensions of the two inputs to the summer matches, and dimensional integrity of the skip connection is maintained. This example use case is discussed in further detail with respect to
Note that similar to maintaining the dimensional integrity of the skip connection within a residual unit, similar strategies can also be adapted for skip connections from an encoder to a decoder of a ML model, as also described below in further detail. Numerous configurations and embodiments will be apparent in light of this disclosure.
ML Models with Skip Connections (Such as HoVer-Net Architecture, Residual Units, U-Net Architecture)
As described above, techniques are described herein for compressing ML Models. As also described above, applying compression techniques for ML models employing skip connections pose additional challenges. This section of this disclosure describes various ML models that employ skip connections, where various compression techniques (such as pruning techniques) described herein may be applied to one or more of these models but is not limited thereto. The described techniques may be applied to other models with similar architectures.
The ML model 100 receives an input Image 102. The ML model 100 processes, for example, an RGB (red, blue, green) image or an image of another type and of an appropriate dimension, such as a 270×270×3 RGB image.
The ML model 100 comprises a feature extraction branch 103 (also referred to as a feature extraction backbone) to extract features from the input image 102. The feature extraction branch 103 includes a convolution layer 104 processing the input image 102. Note that convolution layers are labelled as “conv” in at least some of the figures of this disclosure. Merely as an example, a 7×7 kernel of the convolution layer 104 processes the input image 102. The output of the convolution layer 104 is processed by a series of residual units 108a, 108b, 108c, 108d. In an example, residual units are a part of a ResNet architecture and facilitate in training deep networks effectively by introducing skip connections, as described below in further detail (see
The output of the convolution layer 112 is branched in three different branches, such as a nuclear pixel branch 120, a HoVer (Horizontal and Vertical) branch 130, and a nuclear classification branch 140. The branches 120, 130, and 140 are task specific, each configured to perform a specific task.
The nuclear pixel branch 120, in an example, predicts a binary segmentation map of one or more nuclei (such as differentiates between foreground versus background). The nuclear pixel branch 120 comprises a plurality of up-sampling layers 121a, 121b, 121c, a plurality of convolution layers 122a, 122b, 122c, 122d, 122e, 122f, and a plurality of decoder units 124a, 124b. In an example, the nuclear pixel branch 120 outputs a binary mask of nuclei.
The HoVer branch 130 predicts horizontal and vertical maps, which encode spatial displacement of nuclear pixels from the center of each nucleus. The HoVer branch 130 comprises a plurality of up-sampling layers 131a, 131b, 131c, a plurality of convolution layers 132a, 132b, 132c, 132d, 132e, 132f, and a plurality of decoder units 134a, 134b. In an example, the HoVer branch 130 outputs one or more horizontal and vertical displacement maps.
The nuclear classification branch 140 classifies nuclei into categories based on their type (e.g., epithelial, lymphocyte, etc.). The nuclear classification branch 140 comprises a plurality of up-sampling layers 141a, 141b, 141c, a plurality of convolution layers 142a, 142b, 142c, 142d, 142e, 142f, and a plurality of decoder units 144a, 144b. In an example, the nuclear classification branch 140 outputs categorical maps for nuclear types.
The feature extraction branch 103 forms an encoder of the ML model 100, and the nuclear pixel branch 120, the HoVer branch 130, and the nuclear classification branch 140 form three decoder branches of the ML model 100. Thus, the ML model 100 is a multi-branch encoder-decoder network. As described above, the encoder (e.g., the feature extraction branch 103) extracts features from the input image 102, which will be used by multiple decoder branches. After feature extraction, the ML model 100 splits into three separate decoder branches to perform different tasks, as described above.
As illustrated in
Furthermore. there are one or more corresponding skip connections between the feature extraction branch 103 (e.g., the encoder branch) and each of the decoder branches (such as the nuclear pixel branch 120, the HoVer branch 130, and the nuclear classification branch 140). These skip connections are illustrated using dotted lines in
Thus, the ML model 100 includes two types of skip connections—(i) skip connections within the residual units 108a, . . . , 108d, and (ii) skip connections between the feature extraction branch 103 and each of the three decoder branches. These skip connections pose additional challenges in compressing (such as pruning) the ML model 100, and techniques for compressing the ML model 100, while maintaining dimensional integrity of the skip connection within the ML model 100, are described below in further detail.
In an example, the section 200 is a part of a ResNet architecture. In an example, the section 200 is a part of a HoVer-Net architecture (such as part of the feature extraction branch 103 of the ML model 100 of
In a network with residual units, a layer may feed into the next layer, and also into another layer few hops away (such as about 2-3 hops away in
In an example, the residual units 204a, 204b, 204c are bottleneck residual units. For example, a bottleneck residual unit is a type of residual unit, where a bottleneck residual unit uses relatively fewer parameters, e.g., by introducing a 1×1 convolution for dimensionality reduction before applying heavier 3×3 convolutions.
The section 200 comprises a convolution layer 203a processing an input 201, followed by a batch normalization layer 203b. An output of the batch normalization layer 203b is provided to the residual unit 204a.
The residual units 204a, 204b are illustrated in further detail in
As illustrated in
Note that in an example where the residual units 204a, 204, 204c are bottleneck residual units, a first convolution layer of the residual unit (such as the convolution layer 210) and/or a last convolution layer (such as the convolution layer 216) of the residual unit may be a 1×1 convolution layer, whereas an intermediate convolution layer of the residual unit (such as the convolution layer 213) may be a higher dimension convolution layer, such as a 3×3 convolution layer.
In addition to the input 202 propagating through various layers of the residual unit 204a, the input 202 also traverses through a residual branch 220 (also referred to as a skip connection branch 220), and is summed at a summer 218 with an output of the batch normalization layer 217, as illustrated in
Although
Similarly, the residual unit 204b receives an input 222 from the residual unit 204b (such as from the summer 218, through a ReLu layer 219), and processes the input 222 using convolution layers 230, 233, 236, batch normalization layers 231, 234, 237, and ReLU layers 232, 235, 239, where these layers are arranged in the manner illustrated in
In addition to the input 222 propagating through various layers of the residual unit 204b, the input 222 also traverses through a residual branch 240 (or a skip connection branch 240), and is summed at a summer 238 with an output of the batch normalization layer 237, as illustrated in
The U-Net ML model 300 of
Various layers 304a, 304b, . . . , 3400 of the encoder 362 are illustrated, and various layers 304p, 304q, . . . , 304z, 304aa of the decoder 364 are illustrated in
In the encoder 362, the convolution of the layers 304a, . . . , 3040 reduces spatial dimensions of the input, and increases feature depth, and facilitates in understanding the global context of the input image. In the encoder 362, after each layer 304c, 304f, 304i, 3041, corresponding max pooling operations 308a, 308b, 308c, 308d, respectively, are performed.
In the decoder path 364, the convolution of the layers 304s, . . . , 304z, 304aa decreases feature depth. Furthermore, up-convolutions (or transposed convolutions) of the input are performed at 312a, . . . , 312d, as illustrated in
Furthermore, there are a plurality of skip connections 320a, 320b, 320c, 320d. Each skip connection 320 is from a corresponding layer of the encoder 362 to a corresponding layer of the decoder 364. For example, the skip connection 320a servers as a bridge between the layer 304l of the encoder 362 and the layer 304p of the decoder 364. For example, output of the layer 304l and output of the layer 3040 are concatenated and then convoluted at the layer 304p. Similarly, output of the layer 304i and output of the layer 304r are concatenated and then convoluted at the layer 304s. Similarly, output of the layer 304f and output of the layer 304u are concatenated and then convoluted at the layer 304c. Finally, output of the layer 304c and output of the layer 304x are concatenated and then convoluted at the layer 304y. The concatenation operations are labelled as “concat” in
Various models (such as the HoVer-Net ML model 100, the ResNet ML model 200, and/or the U-Net model 300 described above) may be relatively large in size, and such a massive sized model increases the computational costs and requires high processing power to execute, thereby increasing cost of organizations employing these models. Accordingly, in an example, it may be intended to reduce the model size and reduce the computational costs of the one or more of these models. Techniques available for such compression of ML models include model pruning, knowledge distillation, quantization, etc.
In model pruning, unnecessary or relatively unimportant model parameters are removed from a ML model, thereby decreasing a size of the ML model, which in turn reduces cost of storage and/or execution of the ML model. However, applying model pruning to some ML models, such as those ML models in which skip connections are included, present additional challenges. For example, it may be challenging to prune an ML model including a skip connection (such as a model including a residual unit, and/or a model including a skip connection between an encoder and a decoder path), e.g., because the skip connections in a layer impact model dimensions downstream, thereby possibly making dimensions for skip connections incompatible. For example, because in a skip connection two inputs are to be summed or concatenated, any incompatible dimensions due to the pruning may render such a model non-operational. Thus, while implementing pruning of a ML model including one or more skip connections, additional mitigating strategies has to be implemented for (i) skip connections between an encoder and a decoder and/or (ii) the skip connections within a residual unit. For example, pruning strategies undertaken has to maintain dimensional integrity of the skip connections within the ML model, as described below in detail.
Accordingly, in various embodiments and as will be described below in further detail, for pruning a ML model including skip connections, two layers that are interconnected through a skip connection are identified. In an example, this may be the layers 304i and 304r between the encoder 362 and the decoder 364, respectively, in
In an example, once the two layers (e.g., that are interconnected through a skip connection) are identified, the pruning of the ML model is performed such that the pruning does not lead to incompatibility among the inter-connected layers. For example, pruning strategies undertaken maintain dimensional integrity of the skip connections within the ML model.
For example, the ML model is pruned such that the same number of filters in convolutional layers and/or the convolution filters with the same indexing are pruned, ensuring that the skip-connected layers (e.g., layers connected via skip connections) have the same filter numbers.
For example, referring to
Similarly, when concatenating in a U-Net (such as concat operations 316a, 316b, 316c, 316d), the height and width of the feature maps to be concatenated have to match. Also, in an example, the number of channels of the feature maps to be concatenated may have to match. To account for any mismatch in height and width of the feature maps, cropping and/or padding may be employed. However, in an example, any pruning of the channel size of the features maps has to be taken into account, to ensure matching of the channel sizes of the feature maps to be concatenated.
Columns 4 and 5 respectively illustrate number of input channels and number of output channels in the pruned version of the ML model (e.g., subsequent to pruning). Thus, for example, pruning of the ML model changes the output channels of the layer 210 from 64 in the original ML model to 64/a in the pruned ML model.
The pruning settings for two example residual units 204a and 204b of
For example, actively pruning (“active” pruning is described below in further detail) the convolutional layer 210 results in an output channel dimension of 64/a, where “a” is the pruning ratio setting, which may be an appropriate integer (e.g., 2, 4, 8, etc.). For example, “a” being equal to 4 implies that the output channel dimension of layer 210 is 16. Thus, for the example in which “a” is 4, 25% or 16 of the 64 original channels remain in the output of the layer 210 after pruning.
Note that the batch normalization layer 211 receives the feature maps with channel dimension of 64/a, and transmits the feature maps with channel dimension of 64/a (after batch normalization) to the ReLu 212, and then to the convolution layer 213 (see
To maintain compatibility in the channel dimensions and dimensional integrity of the skip connection, the convolution layer 213 converts the 64/a number of channels back to 64 channels. Accordingly, the output of the convolution layer 213 has 64 channels.
Note that the output of the convolution layer 213 in the original unpruned ML model and in the pruned ML model are the same (e.g., 64). However, the input to the convolution layer 213 in the original unpruned ML model is 64, whereas the input to the convolution layer 213 in the pruned ML model is 64/a.
In an example (such as where the residual unit 204a is a bottleneck residual unit), the convolution layer 216 is a 1×1 convolution layer, and does not change a number of channels, and generates feature map outputs with 64 channels to the summer 218. Also, the output of the convolution layer 203a (which is also the input to the convolution layer 210) has 64 channels, which is also transmitted to the summer 218. Accordingly, both inputs to the summer 218 has the same channel dimensions of 64, resulting in compatibility in channel dimensions in the summer 218, thereby maintaining dimensional integrity of the skip connection 220 within the ML model 200.
Similarly, for example, for the residual unit 204b, the input to the convolution layer 230 (which is also an input to the summer 238) is 64, and the output of the convolution layer 236 (which is also another input to the summer 238) is also 64. Note that in intermediate layers of the residual unit 204b, the channel dimensions are pruned from 64 to 64/b (where “b” is another prune ratio setting, and where a and b may be the same or different), and then back to 64. Accordingly, as illustrated in
Accordingly, with this pruning described above with respect to
In
Similarly, for the residual block 204b, the input to the residual block 204b (e.g., the input to the convolution layer 230) has a channel dimension of 64/a. Also, the output of the residual block 204b (e.g., the output of the convolution layer 236) has a channel dimension of 64/a. Thus, both the inputs to the summer 238 have the channel dimension of 64/a, thereby maintaining dimensional integrity of the skip connection 240 within the ML model 200.
Note that in table 500, the channel dimension of the output of the convolution layer 203a (which is 64/a in
Note that the matching of the channel dimensions also holds for other types of skip connections, such as a skip connection between an encoder and a decoder of the U-Net ML model 300 of
Referring to the tables 400 and 500 of
A convolution layer may be pruned actively or passively. An “active” pruning refers to pruning output channel dimension of a layer of a ML model, so as to compress the ML model. For convolutional layers, the output channel dimension may be changed (such as reduced), e.g., by changing (such as reducing) a number of filters used in the convolution layer. An actively pruned layer impacts the pruning of a subsequent layer (such as an immediate subsequent layer), as described above with respect to
In a passive pruning, an output channel dimension of a convolution layer “has” to be pruned, to accommodate the output dimension of an inter-connected previous convolution layer and to maintain dimensional integrity of skip connections within the ML model. For example, the convolution layer 213 has to be pruned, such that the output channel dimension of this layer becomes 64 (see
The active pruning can be thought of as a choice, where a convolution layer is actively pruned for ML model compression purposes. In contrast, the passive pruning of a convolution layer is necessitated by pruning of a previous convolution layer, in order to maintain dimension compatibility at a summer or a concatenation layer.
Unstructured, Structured, and Semi-Structured PruningBased on how the model parameters are pruned, pruning algorithms may be classified into different categories, such as unstructured pruning, structured pruning, and semi-structured pruning. In unstructured pruning, using one or more pruning heuristic, a determination is made as to a relative importance of individual parameters of the ML model, and relatively unimportant ones are pruned by replacing them with zero values. Unstructured pruning may be relatively easier to implement, and may not significantly degrade model performance. However, available hardware may not be suitable (such as optimized) for unstructured sparse matrices, and thus, in an example, unstructured pruning may not improve the latency or inference speedup (e.g., unless specific hardware and corresponding software and/or firmware system designs are developed specifically for unstructured pruning).
In structured pruning, pruning is done following a fixed pattern. For example, an entire filter of a convolutional layer or an entire layer may be removed. In contrast to the unstructured pruning, since the entire convolution layer or an entire filter is removed, such pruning induces model speedup. Different pruning heuristics for structured pruning, such as L1 pruning, L2 pruning, iterative magnitude pruning, non-uniform pruning, network slimmer, etc. have been described below in further detail.
Semi-structured pruning explores sparsity patterns between unstructured and structured pruning. For example, in contrast to structured pruning where an entire filter may be completely removed, semi-structured pruning explores sparsity patterns between unstructured and structured pruning, such as block sparsity or n: m sparsity. Semi-structured pruning selectively prunes groups of weights while preserving some structure, achieving a balance between efficiency and hardware compatibility.
Type of PrunersVarious types of pruners may be used, such as pruning based on L1 norm, pruning based on L2 norm, iterative magnitude pruning, non-uniform pruning, network slimmer, etc., as described below.
L1 PruningIn L1 pruning, the pruner prunes relatively less important filters from a trained model and optionally minimizing the accuracy drop via fine tuning (e.g., subsequent to pruning). Such a pruning method uses an L1 norm of one or more filters (such as each filter) of a convolution layer as a heuristic, to measure a relative importance of each filter. For example, the motivation is that filters with relatively smaller magnitudes (where selection of filters are described below) tend to produce feature maps with weak activations as compared to the other filters in the layer. As such, after pruning the filters with the relatively smaller magnitude, the ML model predictions may not change significantly. For L1 pruning, the pruning mechanism is as follows. For each filter in a convolution layer, a sum of its absolute kernel weight (e.g., L1 norm weight) is calculated. For example, if the filter is a 3×3 kernel, then a sum of absolute values of the 9 entries of the kernel is calculated. A plurality of filters of the convolution layer is sorted in ascending order in a list. A specific number (such as M number of filters) of bottom-most filters from the list are selected, where the number of selected filters may be based on a target sparsity ratio. To ensure correct dimension for matrix multiplication, the kernels of the same indices in each filter of the next convolution layers are also correspondingly pruned, as described above. Optionally, the pruned and compressed model may be fine tuned to recover any drop in performance.
L2 PruningL2 pruning is at least in part similar to L1 pruning. However, in L2 pruning, the L2 norm of the kernel weights is calculated. For example, if the filter is a 3×3 kernel, then the L2 norm of a vector comprising the 9 entries of the kernel is calculated. L2 pruning will be evident to those skilled in the art, based on the above description with respect to the L1 pruning.
Iterative Magnitude PruningIterative Magnitude Pruning (IMP) involves repeatedly pruning low-magnitude weights, retraining the model, and iterating this process multiple times. An algorithm for IMP to achieve desired sparsity ratio of ‘m’ is as follows. The full or uncompressed ML model is initialized randomly (such as with random weights). The full model is trained for a specific number (e.g., k number) of epochs and/or iterations, and m/n number of weights are pruned. The model is trained further and m/n number of weights are further pruned. This process is iteratively repeated (e.g., for n number of times). After completion of the n number of iterations, the final pruned model is achieved. The final model has a desired sparsity level of m. Here, “n” refers to the number of iterations to achieve “m” sparsity ratio. For example, with m of 80% and n being 10, this means pruning 80/10=10% of filters (or other target model components) at each iteration for 10 iterations.
Non-Uniform PruningIn an example, not all the layers in a given ML model are equally important. For example, some of the layers can learn relatively more important information and pruning such layers may result in relatively higher performance drop (e.g., compared to pruning layers that are of relatively less important). In contrast to the uniform pruning where all the layers are pruned with the same ratio, in an example, in non-uniform pruning, relatively more important layers are identified. The identification may be based on a goal of the ML model, role of individual layers in achieving the goal, and/or other heuristic or deterministic factors. The identified relatively more important layers are then pruned to a lower sparsity ratio. The actual pruning can be achieved using any of the techniques discussed herein (e.g., L1 pruning, L2 pruning, IMP, etc.), in an example.
Network SlimmerA network slimmer is a pruning technique in which redundant or less important parameters are pruned. In an example, a network slimmer focuses on channel pruning, where entire channels or filters in convolutional layers are removed rather than just individual weights. In an example, network slimmer uses L1-regularization on the scaling factors of BatchNorm layers during model training to induce sparsity of the scaling factors. That is, L1-norm of the scaling factor in the loss function pushes relatively less important scaling factors corresponding to the less important feature maps close to zero. Therefore, instead of calculating the L1 and/or L2 norm of the filters, network slimmer selects filters with a smaller scaling factor after training, e.g., as a heuristic for pruning filters.
Pruning ApproachesBelow are discussions on three example pruning approaches, such as pruning (i) using condition statements, (ii) separation of model components and pruning strategies, and (iii) pruning based on identification of connected layers,
Pruning Approach 1: Using Condition StatementsIn an example, an ML model pruning program may be implemented using condition statements (e.g., using “if . . . then” clauses). For example, one or more convolution layer may be associated with such condition statements. Merely as an example, referring to
In an example, pruning functionalities may be separated from model components, thereby reducing any model architectural dependency for model pruning. In an example, different pruning settings (such as the pruning ratios described above with respect to
In an example, in this pruning approach, the pruning can be performed automatically for any given ML model. This approach involves two steps: (i) initially, a connectivity searching program scans a ML model architecture and identifies one or more (such as all) model layers and connections between various layers, and (ii) subsequently, a configuration file dictates the pruning program as to which layers are to be pruned and corresponding the pruning strategies.
A difference between the above-described pruning approach 2 (separation of model components and pruning strategies) and pruning approach 3 (pruning based on identification of layers of the model) lies in how the layer connections are identified. For example, in the pruning approach 2, a user or a programmer manually identifies roles of individual layers, and provides information associated with layer connectivity and layer-wise pruning dependencies (e.g., in the form of configuration files, identifying whether active or passive pruning settings are to be applied to a layer, etc.). In contrast, in the pruning approach 3, the layer connectivity and layer-wise pruning dependencies are automatically identified by a connectivity searching program. For example, the connectivity searching program applies an appropriate technique (such as graph theory) to identify connectivity between various layers. As an example, with pruning approach 3, a user has the option to not explicitly specify “passive” pruning layers in the configuration file, but only include which layers to be “actively” pruned, since one or more (such as all) the interconnected layers to be “passively” pruned are already identified automatically by the connectivity searching program.
MethodologiesAt 712, one or more filters of the ML model are pruned, while maintaining dimensional integrity of the skip connection within the ML model. For example, as described above, one or more layers (such as layer 210, see
At 716, the pruned ML model may be fine-tuned, e.g., by retraining the pruned ML model. For example, pruned weights may be further adjusted during the retraining process. In an example, operations 712 and 716 may be iteratively repeated, e.g., until a desired pruning sparsity is achieved.
Experimental Results Cell-Level Instance Segmentation and Classification ModelingIn an example, the HoverNet model may be used for evaluating pruning methods for digital pathology. The HoverNet model is trained on PanNuke dataset, which is a relatively challenging nuclei instance segmentation datasets, comprising about 200,000 annotated Nuclei into 5 clinically relatively important classes across 19 tissue types. Following the same training paradigm as; the encoder is initialized with the pre-trained ImageNet weights and the encoder is frozen for the initial few epochs of the training. An Adam optimizer is used with a learning rate of 1e-4. As described above, HoverNet architecture has three decoder branches-NP branch (e.g., nuclear pixel branch 120, see
In an example, an effectiveness of model pruning for the tile-wise classification of slide artifacts was validated, e.g., by applying a L2-norm based pruning of ResNet18 (e.g., where L2 norm-based pruning has been described above). ResNet18 is a commonly ResNet family model used for biomedical image analysis. The classification model classifies each image tile into two classes, such as either non-artifact or artifact. For example, the artifact tiles are at least partly occupied by pen marks (pen mark colors include red, green, blue, black, etc.). For example,
The training set comprises about 115.7 million hematoxylin and eosin (H&E) image tiles generally used in histopathological images, the validation set comprises about 30.4 million tiles, and the testing set comprises 19.5 million image tiles (e.g., collected from a set of independent slide images). In an example, one or more (such as all) such image tiles are of 224×224 pixels in size. ImageNet pretrained ResNet18 model may be used as starting point, and the model may be fine-tuned with the training data, e.g., with a learning rate of 0.0000005, a maximum epoch number of 60, and with early stopping when validation loss does not improve for 3 or more epochs. One-shot uniform pruning is then applied with target sparsity ratios of 25%, 50%, 75%, 87.5%, and 93.75% for each experiment, respectively, which is followed by fine-tuning with a maximum epoch number of 25 and the same early stopping as the initial fine-tuning.
Metrics UsedOne or more of the following metrics may be used.
Dice Coefficient MetricsDice Coefficient is used to statistically measure a similarity between the ground truth segmentation mask and the predicted or generated segmentation mask. Mathematical, dice coefficient between two masks X and Y may be described in terms of set operations as:
2*|X∩Y|/(|X|+|Y|)
Detection Quality (DQ) is a metric used for evaluation of segmentation methods. DQ is a F1 score that measures the quality of instance detection. Mathematically, it can be described as:
Segmentation Quality (SQ) measures how close each correctly detected instance is to their ground truth mask. Mathematically, it can be described as:
Panoptic Quality (PQ) is a unified score for comparing both segmentation and classification between the predicted labels and ground truth. Mathematically, PQ is the product of DQ and SQ described above.
Results and Observation Cell SegmentationDifferent pruning methods (e.g., heuristics pruning methods) to compress the original HoverNet architecture are used to reduce its latency and memory footprint. As HoverNet has separate branches for classification and segmentation, the HoverNet model is evaluated with and without the classification branch.
Uniformly Prune all Prunable Layers with L1-Norm Pruner
In this experiment, L1 pruner is used to uniformly prune one or more (such as all) the layers of HoverNet with only the segmentation branch. Dice loss is used as the validation loss.
Pruning filters reduces a number of parameters in the model and therefore reduces the memory footprint of the model.
To compare different pruning methods for the HoverNet model, the pruning methods for both segmentation and classification branches are evaluated.
To compare the latency, the same GPU hardware with the same batch size are used.
To further improve the performance of the pruned, iterative pruning is performed for compressing the HoverNet model.
Here experimental results on pruning ResNet18 adopted for classifying slide pen mark artifacts are demonstrated. With one-shot pruning of the residual blocks independently of each other, even when pruning up to 93.75% of the filters in the first convolution layer, the first batch-normalization layers and the input dimension of the second convolution filters in each residual block (this is referred to as sparsity level 93.75%), it is observed that model performance did not degrade, indicating the prunablity of such models in this use case.
The computer system 1805 of the exemplary system 1800 includes a processing system with one or more Central Processing Unit(s) (CPU), Graphic Processing Unit(s) (GPU), processors, and/or one or more memories. The computer system 1805 may also include a memory for storing a plurality of processing modules or logical instructions that are executed by the one or more processors coupled. The computer memory that stores data may also be maintained on a computer readable medium including magnetic disks, optical disks, organic memory, and any other Volatile (e.g., Random Access Memory (“RAM)) or non-volatile (e.g., Read-Only Memory (“ROM), flash memory, etc.) mass storage system readable by the CPU. The computer readable medium includes cooperating or interconnected computer readable medium, which exist exclusively on the processing system or can be distributed among multiple interconnected processing systems that may be local or remote to the processing system.
The communications network 1815 may include, internet, an intranet, a wired Local Area Network (LAN), a wireless LAN (WiLAN), a Wide Area Network (WAN), a Metropolitan Area Network (MAN), Public Switched Telephone Network (PSTN) and other types of communications networks. The communications network 1815 may include one or more gateways, routers, or bridges. The communications network 1815 may include one or more servers and one or more web-sites accessible by users to send and receive information usable by the one or more computers 1805. The one or more servers may also include one or more associated databases for storing electronic information. The communications network 1815 includes, but is not limited to, data networks using the Transmission Control Protocol (TCP), User Datagram Protocol (UDP), Internet Protocol (IP) and other data protocols.
Besides processors and memory, the computer system 1805 may also include user input and output devices such as a keyboard, mouse, stylus, and a display/touchscreen. For instance, the computer system 1805 may provide a means for inputting image data from one or more scanned IHC slides to memory. Image data may include data related to color channels or frequency channels. A biological specimen, for example a tissue section, may need to be stained for biomarkers associated with chromogenic stains for brightfield imaging or fluorophores for fluorescence imaging. Staining assays can use chromogenic stains for brightfield imaging, or combinations of organic fluorophores, synthetic fluorophores, or quantum dots for fluorescence imaging. In the analysis of biological specimens, different stains may be specified to identify one or more types of biomarkers.
In an example, the computer system 1805 may be loaded with a ML model for analysis images received from the image generation system 1820. In an example, the ML model may be trained and/or pruned at another computer system, which may be at least in part similar to, or different from the computer system 1805. In an example, a computer system in which the ML model may be trained and/or pruned may also include a processing system with one or more CPUs, GPUs, processors, and/or one or more memories. Such a computer system may also include a memory for storing a plurality of processing modules or logical instructions that are executed by the one or more processors coupled. The computer memory that stores data may also be maintained on a computer readable medium including magnetic disks, optical disks, organic memory, and any other Volatile (e.g., RAM) or non-volatile (e.g., ROM, flash memory, etc.) mass storage system readable by the CPU. The computer readable medium includes cooperating or interconnected computer readable medium, which exist exclusively on the processing system or can be distributed among multiple interconnected processing systems that may be local or remote to the processing system.
The term ‘sample’ may be understood as material derived from a biological organism, comprising but not limited to hair, skin samples, tissue samples, cultured cells, cultured cell media, and biological fluids. The term ‘tissue’ refers to a mass of interconnected cells (e.g., lung tissue, neural tissue, or eye tissue) derived from a human or other animal and includes the connecting material and the liquid material in association with the cells. In the context of histopathology, the term “slide” refers to a glass microscope slide carrying a thin section of tissue that has been stained for microscopic examination. The term ‘sample’ also includes media containing isolated cells. One skilled in the art may determine the quantity of samples required to obtain a reaction by standard laboratory techniques.
A tissue slicer 1920 then slices the fixed and/or embedded tissue sample (e.g., a sample of a tumor) to obtain a series of sections, with each section having a thickness of, for example, 4-5 microns. Such sectioning can be performed by first chilling the sample and then slicing the sample in a warm water bath. The tissue can be sliced using (for example) a vibratome or compresstome.
Because the tissue sections and the cells within them are virtually transparent, preparation of the slides typically includes staining (e.g., automatically staining) the tissue sections to render relevant structures more visible. In some instances, the staining is performed manually. In some instances, the staining is performed semi-automatically or automatically using a staining system 1925.
The staining can include exposing an individual section of the tissue to one or more different stains (e.g., consecutively, or concurrently) to reveal different characteristics of the tissue. For example, each section may be exposed to a predefined volume of a staining agent for a predefined period of time. The staining agent can include (for example) an RNA probe, protein probe (e.g., nuclear-protein probe or cytoplasm-protein probe), an immunohistochemistry stain, a probe for a secreted substance, etc. In some instances, the staining agent is one that stains for KAPPA mRNA or LAMBDA mRNA.
One exemplary type of tissue staining is histochemical staining, which uses one or more chemical dyes (e.g., acidic dyes, basic dyes) to stain tissue structures. Histochemical staining may be used to indicate general aspects of tissue morphology and/or cell microanatomy (e.g., to distinguish cell nuclei from cytoplasm, to indicate lipid droplets, etc.). One example of a histochemical stain is hematoxylin and eosin (H&E). Other examples of histochemical stains include trichrome stains (e.g., Masson's Trichrome), Periodic Acid-Schiff (PAS), silver stains, and iron stains. The molecular weight of a histochemical staining reagent (e.g., dye) is typically about 500 kilodaltons (kD) or less, although some histochemical staining reagents (e.g., Alcian Blue, phosphomolybdic acid (PMA)) may have molecular weights of up to two or three thousand kD. One case of a high-molecular-weight histochemical staining reagent is alpha-amylase (about 55 kD), which may be used to indicate glycogen.
Another type of tissue staining is immunohistochemistry (IHC, also called “immunostaining”), which uses a primary antibody that binds specifically to a target antigen of interest (biomarker). IHC may be direct or indirect. In direct IHC, the primary antibody is directly conjugated to a label (e.g., a chromophore or fluorophore). In indirect IHC, the primary antibody is first bound to the target antigen, and then a secondary antibody that is conjugated to a label (e.g., a chromophore or fluorophore) is bound to the primary antibody. The molecular weights of IHC reagents are much higher than those of histochemical staining reagents, as the antibodies have molecular weights of about 150 kD or more.
The sections may then be individually mounted on corresponding slides, which an imaging system 1930 can then scan to generate raw multiplex digital-pathology images 1935a-n. Each section may be mounted on a slide, which is then scanned to create a digital image that may be subsequently examined by digital pathology image analysis and/or interpreted by a human pathologist (e.g., using image viewer software). The imaging may include capturing bright-field images of the slide section.
In some instances, a pathologist or other expert may review and manually annotate the digital images of the slides (e.g., tumor area, necrosis, etc.). In some instances, annotation of regions of interest are performed automatically using a computer-vision technique. Some of the digital-pathology images 1935a-n may be used by a color demultiplexing system 300.
A digital histopathology image (e.g., 1935a) typically includes an array, usually a rectangular matrix, of pixels. Each ‘pixel’ is one picture element and is a digital quantity that is a value that represents some property of the image at a location in the array corresponding to a particular location in the image. Typically, in monochrome tone black and white images the pixel values represent a gray scale value. Pixel values for a digital image typically conform to a specified range. For example, each array element may be one byte (i.e., eight bits) representing pixel values in the range of 0 to 255. In a gray scale image, a 255 may represent absolute white and zero total black (or visa-versa). Color images consist of three-color planes, generally corresponding to red, green, and blue (RGB). For a particular pixel, there is one value for each of these color planes, (i.e., a value representing the red component, a value representing the green component, and a value representing the blue component). By varying the intensity of these three components, all colors in the color spectrum typically may be created.
Some embodiments of the present disclosure include a system including one or more data processors. In some embodiments, the system includes a non-transitory computer readable storage medium containing instructions which, when executed on the one or more data processors, cause the one or more data processors to perform part or all of one or more methods and/or part or all of one or more processes disclosed herein. Some embodiments of the present disclosure include a computer-program product tangibly embodied in a non-transitory machine-readable storage medium, including instructions configured to cause one or more data processors to perform part or all of one or more methods and/or part or all of one or more processes disclosed herein.
The terms and expressions which have been employed are used as terms of description and not of limitation, and there is no intention in the use of such terms and expressions of excluding any equivalents of the features shown and described or portions thereof, but it is recognized that various modifications are possible within the scope of the invention claimed. Thus, it should be understood that although the present invention as claimed has been specifically disclosed by embodiments and optional features, modification and variation of the concepts herein disclosed may be resorted to by those skilled in the art, and that such modifications and variations are considered to be within the scope of this invention as defined by the appended claims.
The present description provides preferred exemplary embodiments only, and is not intended to limit the scope, applicability or configuration of the disclosure. Rather, the present description of the preferred exemplary embodiments will provide those skilled in the art with an enabling description for implementing various embodiments. It is understood that various changes may be made in the function and arrangement of elements without departing from the spirit and scope as set forth in the appended claims.
Specific details are given in the present description to provide a thorough understanding of the embodiments. However, it will be understood that the embodiments may be practiced without these specific details. For example, circuits, systems, networks, processes, and other components may be shown as components in block diagram form in order not to obscure the embodiments in unnecessary detail. In other instances, well-known circuits, processes, algorithms, structures, and techniques may be shown without unnecessary detail in order to avoid obscuring the embodiments.
Claims
1. A non-transitory computer-readable medium including instructions that when executed by one or more processors, cause the one or more processors to perform operations including:
- training a machine learning (ML) model;
- subsequent to training the ML model, identifying a skip connection within the ML model; and
- pruning one or more filters of the ML model, while maintaining dimensional integrity of the skip connection within the ML model.
2. The non-transitory computer-readable medium of claim 1, wherein pruning the one or more filters of the ML model while maintaining dimensional integrity of the skip connection comprises:
- configuring a first layer of the ML model to have a first output including a first number of channels, wherein a second layer and a third layer are in series with the first layer of the ML model;
- pruning the second layer of the ML model, such that second layer has a second output including a second number of channels, wherein the second number of channels is less than the first number of channels;
- pruning the third layer of the ML model, such that third layer has a third output including the first number of channels; and
- summing or concatenating (i) the first output having the first number of channels and (ii) the third output having the first number of channels.
3. The non-transitory computer-readable medium of claim 2, wherein the operations further include:
- prior to summing or concatenating the first output and the third output, processing each of the first output and the third output,
- wherein processing the first output comprises prior to summing or concatenating, performing, without altering a dimensionality of a number of channels of the first output, one or more of (i) an activation operation, (ii) a batch normalization operation, and/or (iii) a convolution operation on the first output; and
- wherein processing the third output comprises prior to summing or concatenating, performing, without altering a dimensionality of a number of channels of the third output, one or more of (i) another activation operation, (ii) another batch normalization operation, and/or (iii) another convolution operation on the third output.
4. The non-transitory computer-readable medium of claim 2, wherein:
- the first output by the first layer has N number of channels, where Nis a positive integer that is the first number;
- the second output by the second layer has N/a number of channels, where N/a is the second number, and wherein “a” is a positive integer pruning ratio implemented by the second layer; and
- the third output by the third layer has the N number of channels.
5. The non-transitory computer-readable medium of claim 4, wherein prior to pruning the ML model, the second output by the second layer has the N number of channels.
6. The non-transitory computer-readable medium of claim 2, wherein the operations further include:
- prior to summing or concatenating the first output and the third output, processing the third output by a fourth layer, wherein the fourth layer does not change a dimensionality of the first output, such that the output of the fourth layer includes the first number of channels,
- wherein the first layer, the second layer, the third layer, and the fourth layer implement corresponding convolution operations.
7. The non-transitory computer-readable medium of claim 2, wherein the operations further include:
- subsequent to summing or concatenating the first output and the third output, providing a summed or concatenated output to a fourth layer of the ML model.
8. The non-transitory computer-readable medium of claim 2, wherein:
- the skip connecting is from the first layer to a layer performing the summing or concatenating; and
- maintaining the dimensional integrity of the skip connection within the ML model comprising ensuring that the first output and the third output being summed or concatenated have the same first number of channels.
9. The non-transitory computer-readable medium of claim 2, wherein pruning the one or more filters of the ML model comprises:
- configuring a fourth layer of the ML model to receive a combined output, wherein the combined output is the sum or concatenation of the first output and the third output, and wherein the combined output has a third number of channels;
- pruning the fourth layer such that the fourth layer has a fourth output including a fourth number of channels that is less than the third number of channels, wherein a fifth layer is in series with the fourth layer of the ML model;
- pruning the fifth layer of the ML model, such that fifth layer has a fifth output including the third number of channels; and
- summing or concatenating (i) the combined output having the third number of channels and (ii) the fifth output having the third number of channels.
10. The non-transitory computer-readable medium of claim 2, wherein the operations further include:
- identifying the second layer of the ML model as a first candidate for pruning, so as to reduce a size of the ML model;
- identifying the third layer of the ML model as a second candidate for pruning, so as to maintain the dimensional integrity of the skip connection within the ML model;
- calculating a first pruning ratio for the second layer;
- calculating a second pruning ratio for the third layer, the second pruning ratio is calculated based on the first pruning ratio, such that the third layer reverses the channel reduction achieved by the second layer; and
- pruning one or more filters of the ML model comprises pruning the second layer and the third layer in accordance with the first pruning ration and the second pruning ration, respectively.
11. The non-transitory computer-readable medium of claim 2, wherein:
- summing or concatenating the first output and the third output comprises summing, in a summer, the first output and the third output;
- the second layer, the third layer, and the summer are within a residual unit of the ML model; and
- the first output from the first layer forms an input to the residual unit.
12. The non-transitory computer-readable medium of claim 2, wherein:
- summing or concatenating the first output and the third output comprises concatenating, in a concatenation layer, the first output and the third output;
- the ML model is a U-Net model;
- the first layer, the second layer, and the third layer are within an encoder of the U-Net model; and
- the concatenation layer is within a decoder of the U-Net model.
13. The non-transitory computer-readable medium of claim 1, wherein the operations further include:
- subsequent to pruning the one or more filters of the ML model, fine tuning the ML model by at least in part retraining the ML model.
14. The non-transitory computer-readable medium of claim 1, wherein the ML model is usable to process digital pathology images.
15. The non-transitory computer-readable medium of claim 1, wherein the ML model has one of a HoVer-Net architecture, a ResNet architecture, or a U-Net architecture.
16. A method comprising:
- training a machine learning (ML) model;
- subsequent to training the ML model, identifying a skip connection within the ML model; and
- pruning one or more filters of the ML model, while maintaining dimensional integrity of the skip connection within the ML model.
17. The method of claim 16, wherein pruning the one or more filters of the ML model while maintaining dimensional integrity of the skip connection comprises:
- configuring a first layer of the ML model to have a first output including a first number of channels, wherein a second layer and a third layer are in series with the first layer of the ML model;
- pruning the second layer of the ML model, such that second layer has a second output including a second number of channels, wherein the second number of channels is less than the first number of channels;
- pruning the third layer of the ML model, such that third layer has a third output including the first number of channels; and
- summing or concatenating (i) the first output having the first number of channels and (ii) the third output having the first number of channels.
18. The method of claim 16, further comprising:
- using the pruned ML model to process digital pathology images.
19. A system comprising:
- one or more data processors; and
- a non-transitory computer readable storage medium containing instructions which, when executed on the one or more data processors, cause the one or more data processors to perform a set of actions including: training a machine learning (ML) model; subsequent to training the ML model, identifying a skip connection within the ML model; and pruning one or more filters of the ML model, while maintaining dimensional integrity of the skip connection within the ML model.
20. The system of claim 19, wherein the set of actions further comprises:
- configuring a first layer of the ML model to have a first output including a first number of channels, wherein a second layer and a third layer are in series with the first layer of the ML model;
- pruning the second layer of the ML model, such that second layer has a second output including a second number of channels, wherein the second number of channels is less than the first number of channels;
- pruning the third layer of the ML model, such that third layer has a third output including the first number of channels; and
- summing or concatenating (i) the first output having the first number of channels and (ii) the third output having the first number of channels.
Type: Application
Filed: Jul 30, 2026
Publication Date: Nov 26, 2026
Applicants: Ventana Medical Systems, Inc. (Tucson, AZ), Roche Sequencing Solutions, Inc. (Pleasanton, CA)
Inventors: Mohammed Adnan (Toronto), Qinle Ba (San Mateo, CA), Shivam Kalra (Waterloo), Auranuch Lorsakul (Santa Clara, CA), Satarupa Mukherjee (Fremont, CA), Nazim Nisar Shaikh (Sunnyvale, CA)
Application Number: 19/760,437