Post-training quantification method for medical image segmentation basic model

By combining infinite norm constraints and coordinate descent optimization algorithms, the performance degradation problem of the basic medical image segmentation model under low bit-width quantization is solved, and efficient deployment and inference are achieved in resource-constrained environments.

CN121660005APending Publication Date: 2026-03-13SOUTHWEST JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing medical image segmentation models suffer severe performance degradation with low bit-width quantization, and post-training quantization methods are difficult to deploy in resource-constrained environments, failing to effectively maintain model performance.

Method used

We employ a weight standardization and coordinate descent optimization algorithm under infinite norm constraints. By using uniform quantization, we optimize the weight distribution during the quantization stage, reducing projection error and algorithm approximation error, thus achieving lightweight model without increasing inference overhead.

Benefits of technology

It improves the deployment capability and practicality of the basic medical image segmentation model with low bit width, maintains the model's efficient inference performance, and adapts to various medical imaging modalities and downstream segmentation tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121660005A_ABST
    Figure CN121660005A_ABST
Patent Text Reader

Abstract

The invention provides a post-training quantification method for a medical image segmentation basic model, and belongs to the field of medical images. The method comprises the following steps: acquiring a to-be-quantized medical image segmentation basic model and a pre-training weight; constructing a medical segmentation image standard data set, and performing preprocessing; determining a target bit width, and selecting uniform quantization as a basic quantization mode; obtaining a new weight matrix; alternately solving an integer coding matrix and a scaling factor; and constructing a quantized medical image segmentation basic model, and performing reasoning on the medical segmentation image standard data set. The technical problem that the performance of an existing post-training quantification method is seriously degraded under a low bit width due to the fact that the weight distribution of a medical image segmentation basic model is highly heterogeneous in various medical imaging modes and downstream segmentation tasks is solved; and additional calculation or memory overhead is not introduced in the reasoning stage, so that the deployment feasibility of the quantized medical image segmentation basic model in resource-limited clinical / edge equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of medical imaging, and in particular relates to a post-training quantization method for a basic model of medical image segmentation. Background Technology

[0002] Recent advances in foundational models are driving a revolutionary development in artificial intelligence, with medical image segmentation foundational models emerging as powerful tools for assisting clinical diagnosis. However, medical images differ fundamentally from natural photographs in their acquisition mechanisms and statistical characteristics, commonly exhibiting low contrast and high inter-regional similarity between different organs, lesions, and tissues. Therefore, even general-purpose visual foundational models, such as those capable of handling zero-shot and small-shot scenarios, often perform poorly when transferred to the medical field. This has led to the emergence of numerous specialized medical image segmentation foundational models (MedFMs). By pre-training on large-scale medical datasets and incorporating flexible interactive prompts, MedFMs can achieve broad generalization across numerous downstream tasks while significantly reducing annotation requirements compared to task-specific processing pipelines.

[0003] While Medical Image Segmentation Foundation Models (MedFMs) exhibit strong robustness to medical segmentation targets, their increasing architectural complexity leads to rapidly escalating computational and memory demands, hindering their deployment in resource-constrained clinical environments. This makes it difficult for even high-performing MedFMs to truly serve frontline healthcare workers. Researchers have explored lightweighting methods such as compact architecture design, pruning, or distillation, but these approaches still require fine-tuning the processed models; the resources required for fine-tuning are often comparable to retraining a completely new MedFM. However, in the medical field, obtaining sufficient training data and computational resources to support fine-tuning is particularly challenging.

[0004] Quantization offers an alternative lightweight approach: mapping floating-point values ​​to integers during model inference to reduce model size and accelerate inference; furthermore, integer arithmetic is particularly efficient on edge hardware. In practice, converting 32-bit floating-point (FP32) to INT8 typically yields approximately 4x memory compression and 2–4x speedup, with even greater gains at lower bit widths. Existing quantization methods are mainly divided into two categories: Quantization-Aware Training (QAT) and Post-Training Quantization (PTQ). QAT co-optimizes weights and quantizers, but still requires fine-tuning; PTQ avoids fine-tuning, but a poor quantization algorithm can lead to decreased accuracy. Therefore, under strict privacy and data security constraints, the advantages of PTQ are particularly significant if it can effectively maintain model performance. Figure 1 This paper analyzes the challenges of adapting current basic medical models to the requirements of lightweight design.

[0005] From a mathematical perspective, PTQ errors mainly stem from two aspects: Inherent Projection Error (IPE) and Algorithm-Induced Approximation Error (AAE). Under INT8 quantization, IPE has a relatively small impact on quantization error, but it becomes dominant at extremely low bit widths (such as INT2). In this case, a small number of large-value weights will squeeze the effective dynamic range of the remaining weights, thus limiting the upper limit of PTQ's compression capability. To mitigate the impact of IPE, some researchers use a linear transformation of the weights in the current layer before quantization to reduce the influence of objective errors on quantization. That is, given features X and weights W, a linear transformation T is applied. Describe the new quantization process. During quantization, quantization operators are used. This is applied to the TW layer to obtain the output representation of the quantization layer, i.e. and The purpose of this approach is to make the transformed weights TW more favorable for quantization than the original W. However, this approach introduces significant inference overhead: on the one hand, the inference stage requires additional computation of the product of the inverses of X and T; on the other hand, additional memory is needed to store the inverse matrix. Overall, handling IPE is quite complex, and its impact is most significant at low bit widths; at the same time, these additional overheads also significantly reduce the practical experience of inference acceleration. Therefore, many PTQ methods choose to ignore IPE and focus only on minimizing AAE through calibration based on backpropagation or solvers based on second-order information. These PTQ algorithms risk overfitting to small-scale calibration sets, thereby impairing the generalization ability of the quantized model. Therefore, a unified method is needed to reduce both IPE and AAE without increasing inference overhead. Summary of the Invention

[0006] To address the aforementioned shortcomings in existing technologies, this invention provides a post-training quantization method for a basic medical image segmentation model. This method solves the technical problem that the performance of existing post-training quantization methods is severely degraded at low bit widths due to the highly heterogeneous weight distribution in various medical imaging modalities and downstream segmentation tasks. Furthermore, this invention does not introduce additional computational or memory overhead during the inference phase, thereby improving the deployment feasibility of the quantized basic medical image segmentation model in resource-constrained clinical / edge devices.

[0007] To achieve the above objectives, the technical solution adopted by this invention is: a post-training quantization method for a basic model of medical image segmentation, comprising the following steps: S1. Obtain the basic model and pre-trained weights for medical image segmentation to be quantized; S2. Construct a standard dataset of medical segmentation images and preprocess the standard dataset of medical segmentation images; S3. Based on the application requirements of the basic medical image segmentation model, the target bit width is determined, and uniform quantization is selected as the basic quantization method. Among them, the post-training quantization of the basic medical image segmentation model is uniform quantization. S4. Based on the infinite norm constraint, perform pre-trained weight standardization to obtain a new weight matrix; S5. Based on the new weight matrix, the integer encoding matrix and scaling factor are alternately solved by the post-training quantization algorithm based on coordinate descent without backpropagation to complete the quantization process of the basic medical image segmentation model to be quantized. S6. Based on the solved integer encoding matrix and scaling factor, construct the quantized basic model for medical image segmentation, and perform inference on the preprocessed standard dataset of medical segmentation images to complete the post-training quantization of the basic model for medical image segmentation.

[0008] Furthermore, in S3, selecting uniform quantization as the basic quantization method specifically means: for a given floating-point weight... Using step size and zero point Map it to an integer encoding matrix The expression for the quantization result is as follows: ; ; ; in, This represents the quantization result, where b represents the bit width of the quantization target, and m represents the number of elements in the weight matrix. This represents a range constraint function, used to restrict the range to a representable range of integers.

[0009] Furthermore, step S4 includes the following steps: S401, Input feature matrix and the original weight matrix Based on this, a new weight matrix is ​​constructed. The first optimization objective is obtained: ; S402. By transforming the constraint term of the first optimization objective into a penalty term, the output maintains the constraint and the weight norm penalty together to form an optimizable regularized objective function:

[0010] in, Describe the Frobenius norm. Represents the regularization parameter. Represents the weight matrix The Column vectors Indicates the column index. As an infinite norm penalty term; S403. The regularization objective function is split into a smooth part and a non-smooth part. The smooth part is a quadratic term, and the gradient can be directly calculated. The non-smooth part is a regularization term with an infinite norm, corresponding to the non-differentiable norm constraint. S404. Based on the splitting results, iterative updates are performed using proximal gradients; S405. Based on the iterative update results, Moro decomposition and 1-norm sphere projection are used to accelerate the computation of the proximal operator. S406. Combining the Caro-Kun-Tucker condition (TTK), the optimal solution to the projection problem is characterized, and the optimal solution is explicitly defined as a soft threshold form: S407. Execute S401-S406. When the layer output change is lower than the preset threshold or the number of iterations reaches the upper limit, a new weight matrix is ​​obtained. .

[0011] Furthermore, the iterative update process is represented as follows:

[0012]

[0013] in, Indicates the optimization step size. Indicates the first The updated weight matrix obtained in the next iteration Describes the proximal operator of the infinite norm. Indicates the first The updated weight matrix obtained in the next iteration express gradient, This represents the smooth part of the objective function, i.e. , express The largest eigenvalue, This represents the input feature matrix. express The transpose of .

[0014] Furthermore, S406 includes the following steps: Use the original feasibility check to examine the original input. Whether it has fallen within the 1 norm sphere, where if the point to be projected is already inside the constraint sphere, it is directly retained; if it is outside the sphere, it is scaled onto the sphere to achieve a unified constraint on the weight norm. Based on the inspection results, by combining first-order optimality with the partial derivative of the 1-norm, the optimal solution is explicitly defined as a soft threshold form:

[0015] in, This represents the optimal solution. The function that preserves the direction of a vector. This represents the intermediate variable after gradient descent. This refers to the Lagrange multiplier that makes the Caro-Kun-Tucker condition TTK true.

[0016] Furthermore, step S5 includes the following steps: S501, Construct with scaling factor and integer encoding matrix The quantification objective for variables:

[0017] Where m and n represent integer encoding matrices respectively. The number of rows and columns, This represents the input feature matrix. This represents the new weight matrix. Represents the set of integers under the target bit width. Represents the set of real numbers; S502. Based on the quantization objective, coordinate descent is used to decompose the high-dimensional problem into one-dimensional optimization sub-problems. S503. Repeat S502 until the error converges to obtain the optimal integer encoding matrix and scaling factor, thus completing the quantization of the basic model for medical image segmentation.

[0018] Furthermore, step S502 includes the following steps: Based on the quantization objective, all quantization variables are used as several coordinates, where the quantization variables include all scaling factors and corresponding integer encoding matrices in each layer; In each iteration, only one coordinate or a set of similar coordinates is updated, while other coordinates remain unchanged. This decomposes the high-dimensional problem into one-dimensional optimization subproblems. The decomposition process is as follows: With a fixed scaling factor In this case, the residual matrix is ​​introduced to update the integer encoding matrix. ; In a fixed integer encoding matrix In this case, update the scaling factor .

[0019] Furthermore, step S6 includes the following steps: S601. Based on the solved integer encoding matrix and scaling factor, quantization weights are formed; S602. Load the quantized weights into the basic medical image segmentation model to construct the quantized basic medical image segmentation model. S603. Using the quantized medical image segmentation basic model, perform segmentation inference on the standard dataset of medical segmentation images to complete the post-training quantization of the medical image segmentation basic model.

[0020] The beneficial effects of this invention are: This invention first standardizes the complex weight distribution among different base models under the constraint of the infinite norm, thereby solving for weights that are easy to quantize. Then, a coordinate descent optimization algorithm is used to efficiently solve for the low-bit representation, completing the quantization process of the medical image segmentation base model. Finally, inference is performed on a standard dataset of medical segmentation images using the quantized medical image segmentation base model. This scheme does not introduce additional computational or memory overhead during the inference phase, further improving the deployment capability and practicality of the quantized model. By systematically analyzing and mitigating the inherent errors in the quantization process, this invention achieves comprehensive leading performance in the field of low-bit compression. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method of the present invention.

[0022] Figure 2 This diagram illustrates the differences between the current PTQ algorithm and the algorithm proposed in this invention.

[0023] Figure 3 This is a schematic diagram showing the spatial changes in weight values ​​before and after standardization. Detailed Implementation

[0024] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.

[0025] Example Medical image segmentation foundation models (MedFMs) have demonstrated powerful capabilities across various imaging modalities and downstream clinical tasks. However, their complex architecture and computational requirements hinder deployment in resource-constrained clinical environments. The high training cost of MedFMs makes lightweight solutions requiring fine-tuning impractical. Furthermore, the superior efficiency of integer operations compared to floating-point operations on edge devices remains underutilized. Post-training quantization (PTQ) can significantly compress model size and greatly accelerate the inference process without fine-tuning. However, existing PTQ methods struggle to adapt to the highly heterogeneous weight distribution characteristics of MedFMs, leading to severe performance degradation at low bit widths. To address this challenge, this invention proposes a general PTQ method. First, this invention standardizes the complex weight distribution among different foundation models under an infinite norm constraint, thereby solving for a weight matrix suitable for quantization. Then, a coordinate descent optimization algorithm is used to efficiently solve for the low-bit representation. This invention does not introduce additional computational or memory overhead during the inference phase, further enhancing the deployment capability and practicality of the quantized model. By systematically analyzing and mitigating the inherent errors in the quantization process, this invention achieves comprehensive leading performance in the field of low-bit compression.

[0026] like Figure 1 As shown, this invention provides a post-training quantization method for a basic model of medical image segmentation, comprising the following steps: S1. Obtain the basic model and pre-trained weights for medical image segmentation to be quantized; In this embodiment, a pre-trained medical image segmentation baseline model for the target medical imaging modality (such as fundus photography, optical coherence tomography, OCT, etc.) and its corresponding floating-point precision pre-trained weights are obtained. The medical image segmentation baseline model can have any structure, such as the MedSAM-Lite model. This invention does not depend on a specific model structure and can be adapted to various medical segmentation baseline models.

[0027] S2. Construct a standard dataset of medical segmentation images and preprocess the standard dataset of medical segmentation images; In this embodiment, a labeled medical segmentation image dataset is selected as the calibration dataset. Although this invention does not rely on a specific medical modality, it can select an imaging modality consistent with the target application scenario, reducing additional model performance loss caused by deviations from the statistical characteristics of the actual deployment scenario. The medical calibration images are preprocessed according to the input requirements of the target medical image segmentation base model, including image size transformation, normalization, and other operations, to obtain calibration input samples that meet the model input requirements.

[0028] S3. Based on the application requirements of the basic medical image segmentation model, the target bit width is determined, and uniform quantization is selected as the basic quantization method. Among them, the post-training quantization of the basic medical image segmentation model is uniform quantization. Choosing uniform quantization as the basic quantization method specifically means: for a given floating-point weight... Using step size and zero point Map it to an integer encoding matrix .

[0029] In this embodiment, the corresponding weight quantization bit width and activation quantization bit width are determined for different basic model application requirements, and the quantization configuration by layer or by channel is specified. The quantization configuration supports multiple weight bit widths including 2 bits, 3 bits, 4 bits, and 8 bits, and 4-bit or 8-bit activation quantization can be optionally configured to balance accuracy and deployment cost. (In resource-constrained scenarios, 2-bit or 3-bit weight quantization can be used to achieve a higher compression ratio. In scenarios requiring near-floating-point 32-bit (FP32) precision, an 8-bit weight and 8-bit activation configuration can be used, and quantization can be performed at the channel granularity to further reduce accuracy loss.) Uniform quantization is selected as the basic quantization method. For a given floating-point weight... or activation value Using step size and zero point Map it to an integer encoding matrix .

[0030] S4. Based on the basic quantization method, perform weight standardization to obtain a new weight matrix. The implementation method is as follows: S401, Input feature matrix and the original weight matrix Based on this, a new weight matrix is ​​constructed. Thus, the first optimization objective is obtained; S402. By transforming the constraint term of the first optimization objective into a penalty term, the output maintains the constraint and the weight norm penalty together to form an optimizable regularized objective function. S403. The regularization objective function is split into a smooth part and a non-smooth part. The smooth part is a quadratic term, and the gradient can be directly calculated. The non-smooth part is a regularization term with an infinite norm, corresponding to the non-differentiable norm constraint. S404. Based on the splitting results, iterative updates are performed using proximal gradients; S405. Based on the iterative update results, Moro decomposition and 1-norm sphere projection are used to accelerate the computation of the proximal operator. S406. Combining the Caro-Kun-Tucker condition (TTK), the optimal solution to the projection problem is characterized, and the optimal solution is explicitly defined as a soft threshold form. The implementation method is as follows: Use the original feasibility check to examine the original input. Whether it has fallen within the 1-norm sphere, if the point to be projected is already inside the constraint sphere, it is directly retained; if it is outside the sphere, it is scaled onto the sphere to achieve a unified constraint on the weight norm; based on the check results, the optimal solution is defined as a soft threshold form by combining first-order optimality with the partial derivative of the 1-norm. S407. Execute S401-S406. When the layer output change is lower than the preset threshold or the number of iterations reaches the upper limit, a new weight matrix is ​​obtained. .

[0031] In this embodiment, this step compresses the dynamic range of weights without changing the output of each layer, thereby reducing the adverse effects of extreme values ​​on low-bit quantization. This is the first stage of the present invention.

[0032] 1. Construct a weight reconstruction objective with infinite norm constraints: Input feature matrix and the original weight matrix Based on this, construct a new weight matrix. The requirement is to compress the range of weight values ​​while keeping the layer output essentially unchanged. The corresponding formal expression is: ; The "output preservation constraint" and the "weight norm penalty" are combined to form an optimizable regularization objective function. The corresponding formal expression is: ,in, Describe the Frobenius norm. Represents the regularization parameter. Represents the weight matrix The Column vectors Indicates the column index. As an infinite norm penalty term.

[0033] Used to constrain the layer output, ensuring that the layer output closely approximates the original output. As an infinite norm penalty, the magnitude of the weights in each column is contracted as a whole, thereby reducing the maximum absolute value and compressing the dynamic range.

[0034] 2. Solve for the standardized weights using proximal gradient iteration: The objective function is split into smooth and non-smooth parts: the smooth part is a quadratic term, and the gradient can be calculated directly; the non-smooth part is a regular term with an infinite norm, corresponding to the non-differentiable norm constraint. The proximal gradient method is used for iterative updates: first, a gradient descent update is performed on the smooth part; then, the proximal operator corresponding to the regularization term is applied to the update result to achieve "soft contraction" of the norm of each column weight vector.

[0035] 3. Utilizing Moreau decomposition and Norm sphere projection accelerates proximal operator computation: The norm proximal operator, which is difficult to solve directly, is transformed into an equivalent 1-norm sphere projection problem by Moreau decomposition, so that the projection result can be quickly calculated in closed form. Combining the Carlow-Kun-Tucker condition (TTK), the optimal solution to the projection problem is characterized: if the point to be projected is already inside the constraint sphere, it is directly retained; if it is outside the sphere, it is scaled onto the sphere to achieve a unified constraint on the weight norm. The final proximal update can be written as a soft threshold form that retains the direction vector and only reduces the magnitude, thus compressing the dynamic range of the weights while keeping the output unchanged.

[0036] 4. Obtain the standardized weight matrix: The above proximal gradient iteration is performed sequentially on each linear layer in the model that needs to be quantized. When the change in the layer output is lower than a preset threshold or the number of iterations reaches the upper limit, a new standardized weight matrix is ​​obtained. This standardization process is performed only during the quantization phase and does not introduce any additional computational or storage overhead during the inference phase.

[0037] S5. Based on the new weight matrix, the integer encoding matrix and scaling factor are alternately solved using a post-training quantization algorithm based on coordinate descent without backpropagation to complete the quantization processing of the basic medical image segmentation model to be quantized. The implementation method is as follows: S501, Construct with scaling factor and integer encoding matrix The goal of quantifying variables; S502. Based on the quantization objective, coordinate descent is used to decompose the high-dimensional problem into one-dimensional optimization subproblems. The implementation method is as follows: Based on the quantization objective, all quantization variables are used as several coordinates, where the quantization variables include all scaling factors and corresponding integer encoding matrices in each layer; In each iteration, only one coordinate or a set of similar coordinates is updated, while other coordinates remain unchanged. This decomposes the high-dimensional problem into one-dimensional optimization subproblems. The decomposition process is as follows: With a fixed scaling factor In this case, the residual matrix is ​​introduced to update the integer encoding matrix. ; In a fixed integer encoding matrix In this case, update the scaling factor ; S503. Repeat S502 until the error converges to obtain the optimal integer encoding matrix and scaling factor, thus completing the quantization of the basic model for medical image segmentation.

[0038] In this embodiment, this step constructs a hybrid optimization problem based on standardized weights, and achieves post-training quantization without backpropagation by alternately solving the integer encoding matrix and scaling factor through coordinate descent. This is the second stage of the present invention.

[0039] 1. Construct using scaling factors and integer encoding matrix The quantification objective for variables: The corresponding formal expression is: Where m and n represent integer encoding matrices respectively. The number of rows and columns, This represents the input feature matrix. This represents the new weight matrix. Represents the set of integers under the target bit width. It represents the set of real numbers.

[0040] 2. Use coordinate descent to decompose high-dimensional problems into one-dimensional subproblems: All quantized variables (including all scaling factors and their corresponding integer codes in each layer) are treated as coordinates. In each iteration, only one coordinate or a set of similar coordinates is updated, while the remaining variables remain unchanged. This decomposes the original high-dimensional joint optimization into a series of quadratic function minimization problems. Since the subproblems in each coordinate direction are univariate quadratic functions with closed-form solutions, the coordinate descent method can iterate efficiently and guarantee that the objective decreases monotonically.

[0041] 3. Update the integer encoding matrix with a fixed scaling factor: In one update cycle, first fix the scaling factor of the layer. The objective function is viewed as a function of integer encoding matrix. The function introduces the residual matrix. This is used to represent the difference between the current quantized output and the true output; Encoding matrix for integers Each channel is updated sequentially: A univariate quadratic minimization subproblem corresponding to the current residual is constructed; the optimal real-valued solution for the row in floating-point space is obtained through inner product calculation; this real-valued solution is normalized by the quantization step size and rounded to the nearest integer grid point, then truncated to the integer range allowed by the bit width to obtain a new integer code for the row; the residual matrix is ​​updated using the new row code. This provides corrected error information for subsequent row updates.

[0042] 4. Update the scaling factor with fixed integer encoding: When the integer encoding matrix of all rows in this layer After the update is complete, maintain the integer encoding matrix. Remaining unchanged, the objective function is transformed into one with respect to the scaling factor. The continuous optimization problem is a strictly convex quadratic function, which can be solved directly by a closed-form formula with a unique optimal solution, without the need for iteration and discretization. The obtained optimal scaling factor is used to update the quantization operator to achieve the optimal fit of the quantization mapping to the current integer code.

[0043] 5. Iterate alternately until the error converges: Update the integer encoding matrix "and "update scaling factor" "This is considered as two sub-steps, executed alternately in multiple rounds; after each iteration, the layer output error based on calibration data is calculated, and iteration stops when the error decreases below a preset threshold or the number of iterations reaches the upper limit; thus obtaining the optimal..." and .

[0044] S6. Based on the solved integer encoding matrix and scaling factor, a quantized basic model for medical image segmentation is constructed, and inference is performed on the preprocessed standard dataset of medical segmentation images to complete the post-training quantization of the basic model for medical image segmentation. The implementation method is as follows: S601. Based on the solved integer encoding matrix and scaling factor, quantization weights are formed; S602. Load the quantized weights into the basic medical image segmentation model to construct the quantized basic medical image segmentation model. S603. Using the quantized medical image segmentation basic model, perform segmentation inference on the standard dataset of medical segmentation images to complete the post-training quantization of the medical image segmentation basic model.

[0045] In this embodiment, the quantized weights obtained from each layer (composed of an integer encoding matrix and a scaling factor) are loaded back into the basic medical image segmentation model to form a quantized model version. During the inference phase, integer arithmetic and a small number of scaling operations are used to perform segmentation inference on the input medical image. Since the weight normalization step is only performed during the quantization phase, no additional computation or memory overhead is added during inference, ensuring overall inference efficiency and deployment friendliness.

[0046] In this embodiment, bold lowercase letters represent vectors, and bold uppercase letters represent matrices. A set of positive integers from 1 to n is described as [n]:={1,2,…,n}. For any two vectors... Their transpose can be described as In subsequent vector-related calculations, their inner product is represented as... The outer product is described as In element-wise vector computation, the Hadamard product is calculated using... This indicates that the Hadamard division rule is denoted as For different norms, this invention expresses vector norms in the following way: Denotes the Euclidean norm; Represents the 1-norm; Represents the infinity norm. For any matrix... , It is its transpose, and its Frobenius norm is Other matrix-related calculations are represented in the same way as vectors.

[0047] Post-training quantization (PTQ) maps high-precision weights to low-bit weights. Based on whether the intervals of the mapped values ​​are the same, it can be further divided into uniform quantization and non-uniform quantization. Although non-uniform quantization often results in less loss of precision, obtaining the optimal non-uniform quantized weights requires solving for a very large number of parameters, making it very difficult to implement and computationally complex. Furthermore, on general-purpose hardware, the bit operations required for non-uniform quantization require additional computation, such as lookup tables (LUTs), for mapping between the floating-point quantized output and its binary representation, resulting in lower efficiency compared to uniform quantization. Therefore, this invention adopts uniform quantization in its algorithm design. The process of uniform quantization can be described as follows: given a high-precision weight to be quantized... It will use a predefined quantization step size and zero point , The bit width used to represent the quantization target. In fact, the quantization process is the process of converting weights... Mapped to a set of discrete sets By performing certain mathematical transformations on the above process, the quantification result can be obtained. .

[0048] Post-trained quantization (PTQ) often employs layer-by-layer or channel-by-channel quantization when processing the model to be quantized, in order to better control accuracy loss. Layer-by-layer quantization utilizes the weight matrix of that layer. The input feature matrix X and the quantizer Seeking satisfaction Quantized weight matrix Directly using the weight matrix Find the weight matrix When this happens, the quantization error in the solution process can be inferred as follows: Step size This is related to the difference between the maximum and minimum values ​​in the weights. This theoretically proves that the existence of Inherent Projection Error (IPE) does indeed lead to an amplification of the quantization interval, causing most weights to approach the quantization zero point, resulting in severe information distortion and loss. Therefore, post-training quantization (PTQ) of the Medical Image Segmentation Foundation Model (MedFMs) can be decomposed into two optimization problems.

[0049] 1. Reduce the weight The IPE is caused by the matrix itself. Therefore, a new weight matrix W needs to be found, which must satisfy its maximum amplitude. To minimize the size while maintaining consistency with the original layer output, i.e. Therefore, the first optimization objective is obtained: (1) The quantization algorithm is optimized to improve quantization efficiency and reduce subjective errors generated during the quantization mapping process. The new weights W are quantized to obtain... , yes The integer bit encoding matrix. The second optimization objective is: (2) To reduce the performance loss and generalization ability of the model after quantization, this invention first converts the pre-trained weights into quantization-friendly alternative weights. Then, coordinate descent is used to obtain the integer weights and quantization step size. Figure 2 The existing post-training quantization (PTQ) methods are summarized and compared with the present invention.

[0050] Having explored the main sources of error in Post-Training Quantization (PTQ), and identifying the errors that need to be reduced as Inherent Projection Error (IPE) and Algorithm-Induced Approximation Error (AAE), this invention first utilizes weight standardization based on infinite norm constraints to reduce IPE. For ease of solution, the constraint term in Equation (1) is transformed into a penalty term, making it equivalent to an unconstrained regularized optimization problem: in, Ensure the output is close to the original output. Apply infinite norm regularization to each column to compress the weights. The value range is determined to maintain the layer output. The regularization parameter is usually set to a small positive value. However, in this optimization problem, the infinity norm regularization term is not differentiable. Therefore, it cannot be solved directly using the gradient descent algorithm. To address this, this invention employs the proximal gradient method, which is specifically designed for optimizations containing non-smooth terms. Its core idea is to decompose the objective function into: a smooth part ( ) and non-smooth parts ( ).in, The gradient can be calculated as follows: Therefore, the iterative optimization process can be described as follows: (3) in, This represents the smooth part of the objective function, i.e. , This represents the non-smooth part of the objective function. express gradient, This represents the optimization step size. To ensure the convergence of the optimization process in formula (2), The value of needs to satisfy . yes The largest eigenvalue. It is a proximal operator of the infinite norm. Therefore, the core of the above optimization problem is transformed into... Solving for: (4) in, , The regularization parameter is represented by Equation (4), which is still difficult to solve directly. Therefore, this invention introduces Moreau decomposition. Moreau decomposition can simplify the difficult Equation (4) into a known and efficiently solvable 1-norm sphere projection problem through the duality of the infinite norm and the 1-norm. Therefore, the complex regularization parameter in Equation (4) is solved by Equation (4). Regular proximal operations can be transformed into: (5) Because formula (5) and its constraints are convex functions, the Karush-Kuhn-Tucker (TTK) conditions provide sufficient and necessary conditions for solving this problem (KKT conditions include: stationarity, primal feasibility, dual feasibility, and complementary slackness). This invention introduces Lagrange multipliers. Construct the Lagrange function: (6) Therefore, the optimal point is characterized using KKT conditions. During the characterization process, the original input is first checked for feasibility. Has it already fallen into the norm 1 ball? when If the original point already satisfies the constraints, then the optimal solution is... ; when At that time, dual feasibility conditions Naturally, this is introduced as a bridge connecting the Lagrange multipliers and constraints, providing a basis for subsequent gradient balancing in the solution. At this point, the complementary relaxation condition states that if... Then the optimal solution It must lie on the boundary of the norm 1 sphere, that is... Finally, by applying the stationary point condition (i.e., first-order optimality) and combining it with the subdifferential of the 1-norm, we can determine the optimality. The optimal solution is explicitly expressed in the form of a soft threshold: (6) in, This represents the optimal solution. This represents a function that preserves vector direction, ensuring that magnitude compression maintains the original feature direction. This represents the intermediate variable after gradient descent. Let represent the Lagrange multiplier that makes the KKT conditions hold. In summary, the optimization process of formula (3) can be rewritten as: (7) (8) Through the above processing, the original weights of the basic model are... It has become a new weight W with a more concentrated value range. Now we need to find a series of... and The basic model quantization is completed. Therefore, the solution process of formula (2) can be transformed into real number variables. and integer encoding matrix The problem involves a complex high-dimensional joint optimization problem. However, equation (2) exhibits significant non-convexity and discreteness, making direct solution not only inefficient but also extremely difficult. Therefore, this invention employs a coordinate descent strategy to transform the complex high-dimensional joint optimization problem into a series of simple one-dimensional optimization subproblems. All variables... and Treat them as coordinate variables. In each iteration, only one variable (or a set of similar variables) is updated while the others remain unchanged. Since the subproblems of the objective function in each coordinate direction are quadratic functions with closed-form analytical solutions, coordinate descent becomes a very efficient choice. Specifically, first fix... Treating the objective function as only about function, for each The corresponding univariate minimization problem is constructed. To ensure ordered computation, this invention introduces a residual matrix. This represents the difference between the current quantized output and the actual output. Each line of encoding is updated... The residuals were then adjusted as follows: At this point, it is necessary to minimize the local error: (9) in, Remove from the current residual The part in the row. The problem of formula (9) is transformed into the problem of minimizing a quadratic function in one variable over the integer field. This minimization problem can be solved efficiently by inner product calculation and rounding: .

[0051] After updating all integer encoding matrices Then, a fixed integer encoding matrix. Transform the problem into a problem concerning continuous variables. Minimization problem: The question is about The optimal solution of the convex quadratic function can be directly obtained as: This step involves no discreteness, requires minimal computation, and yields accurate results. This allows us to obtain a suitable set of... and Then, perform the above two steps (update). and updates Alternately, iterate repeatedly. Repeat this process until the error no longer decreases significantly. Finally, the quantized weight matrix is ​​obtained. .

[0052] As shown in Table 1, on the IDRiD (Modal: Fundus) dataset, the proposed invention achieves the best or best segmentation accuracy across all bit widths and two quantization granularities, effectively suppressing performance degradation caused by low-bit-width quantization. Compared to RTN and GPTQ, the invention exhibits significant robustness at extremely low bit widths: the W2A32 achieves a channel-wise quantization accuracy of 75.54% / 76.49% (DSC / NSD), significantly better than GPTQ's 60.44% / 61.99% and RTN's 45.17% / 48.98%, with a loss of only 3.9 / 4.0 percentage points from the floating-point 32-bit (FP32) baseline (79.44% / 80.50%). Although RTN completely collapses in 2-bit layer-by-layer quantization scenarios, and GPTQ also significantly degrades (11.70% / 19.69%), this invention improves the accuracy to 28.19% / 32.65%, indicating that it can still significantly reduce quantization errors even under the most extreme settings. After increasing the bit width to 3 bits, the accuracy of this invention has essentially recovered to near that of floating-point 32-bit (FP32): W3A32's channel-by-channel quantization is 76.36% / 77.35%, and layer-by-layer quantization is 76.35% / 77.87%, both significantly outperforming the comparison methods. At medium bit widths, this advantage is further amplified: W4A32's layer-by-layer quantization exceeds that of floating-point 32-bit (FP32) (80.18% / 81.32%), and layer-by-layer quantization is also significantly better than GPTQ (69.36% / 70.42 vs. 54.19% / 55.50) and RTN (66.27% / 68.07). In more demanding settings with simultaneous quantization activation, this invention maintains its lead: W4A4 achieves 78.49% / 79.91% quantization, approaching FP32 (79.44% / 80.50%), significantly higher than GPTQ (55.09% / 57.03%) and RTN (61.95% / 64.26%); although quantization still incurs losses (59.07% / 60.88%), it still outperforms both baselines. At higher bit widths, this invention even shows a trend of "outperforming FP32": W8A32 achieves 81.52% / 82.45% quantization, and W8A8 achieves 80.49% / 81.47% quantization. In W8A8 configuration, quantization reaches a maximum of 81.78% / 82.75%, consistently outperforming RTN and GPTQ in both quantization granularities. The above results systematically verify the ability of the proposed framework to adapt to heterogeneous weight distribution in the post-quantization scenario of the basic medical segmentation model. In particular, it significantly reduces the accuracy loss under difficult settings such as low bit width and layer-by-layer quantization, and even achieves performance exceeding that of floating-point baselines in 8-bit and some 4-bit configurations.

[0053] Table 1 shows the performance changes of the MedSAM-Lite model after different quantization methods. Both the test and calibration datasets are IDRid (modal data in Fundus format). 0.0000 indicates that the model completely fails and cannot be segmented.

[0054] Table 1

[0055] Table 2 shows the cross-modal quantization results for different schemes. The test dataset is IDRid (modality: Fundus). The calibration dataset is Intraretinal-Cystoid-Fluid (modality: OCT). 0.0000 indicates that the model completely fails and cannot be segmented.

[0056] Table 2

[0057] Next, quantization was completed using the OCT modality as the calibration dataset, but the performance loss of the model was tested on the Fundus modality to evaluate the data dependency and generalization of the PTQ algorithm. As shown in Table 2, under the cross-modal quantization setting of using the OCT modality as the calibration set and the Fundus modality as the test set, the present invention maintains the best or tied-best performance overall across all bit widths and two quantization granularities, and significantly reduces the performance loss caused by the calibration-test distribution offset. With low bit width, the method is particularly robust to cross-modal perturbations: In W2A32 / layer-by-layer quantization, this invention achieves 69.82% / 71.39% (DSC / NSD), an improvement of 12.44 / 11.64 percentage points over GPTQ and 38.41 / 37.51 percentage points over RTN. Although 2-bit layer-by-layer quantization remains extremely challenging (RTN is 0 / 0, GPTQ is only 1.30 / 3.25), this invention still improves the accuracy to 14.39 / 19.08, demonstrating effective convergence of quantization errors even in the most unfavorable scenarios. With a bit width increased to 3 bits, cross-modal loss converges significantly: layer-by-layer quantization in W3A32 reaches 74.46 / 75.79, only 4.98 / 4.70 percentage points lower than the FP32 baseline, while also showing an improvement of 27.68 / 26.66 percentage points over GPTQ in layer-by-layer quantization. The median width further demonstrates the advantages of layered granularity: the layer-by-layer quantization accuracy of W4A32 is 78.61 / 79.72, which is less than 1 percentage point different from the FP32 baseline, and is 19.59 / 18.87 and 17.30 / 17.07 percentage points higher than RTN and GPTQ, respectively. When quantization is activated simultaneously (W4A4), this advantage is significantly amplified, with layer-by-layer quantization reaching 78.49 / 79.91, with only a loss of 0.95 / 0.58 percentage points compared to FP32, while GPTQ and RTN are only 47.32 / 49.21 and 44.19 / 46.77, respectively. At high bit widths, the proposed method even outperforms FP32 in cross-modal scenarios: W8A8's channel-wise quantization and layer-wise quantization achieve 82.48 / 83.51 and 80.46 / 81.50 respectively, representing improvements of up to 3.04 / 3.01 and 1.03 / 1.00 percentage points over the baseline; in W8A32 settings, it also consistently outperforms both comparative methods, with only a slight difference of less than 0.5 percentage points compared to the baseline. In summary, this invention consistently demonstrates stronger generalization and stability than RTN and GPTQ in calibration-test combinations with significant modal differences: it effectively mitigates performance collapse at extremely low bit widths and achieves segmentation accuracy close to or even exceeding floating-point baselines in 4-bit layer-wise and 8-bit configurations, thus verifying its low sensitivity to data dependence and the transferability of cross-modal PTQ.

[0058] Table 3 shows the experimental results using only the quantization algorithm proposed in this invention, without standardization. Both the test and calibration datasets are IDRiD (modal data of Fundus), where 0.0000 indicates that the model completely fails and cannot be segmented.

[0059] Table 3

[0060] First, quantization is performed using only the mathematical closed-form solution based on coordinate gradient descent proposed in this paper, without using standardization under the infinite norm constraint, to verify the advantages of the quantization solution proposed in this invention. As shown in Table 3, when both calibration and testing are set to IDRiD and only the closed-form quantization solution based on coordinate descent is retained (without introducing infinite norm constraint standardization), the proposed solver significantly outperforms RTN and GPTQ in most bit widths and both quantization granularities, and is almost equivalent to the floating-point 32-bit (FP32) baseline at high bit widths. Specifically, the model is essentially lossless under high bit width: W8A32's channel-wise quantization / layer-wise quantization reaches 79.51% / 80.55% and 80.35% / 81.38% respectively, which is only 0.07 / 0.05 and 0.91 / 0.89 percentage points higher than FP32; W8A8 also has only a very small difference from the baseline (channel-wise quantization has only a loss of 0.04 / 0.16 percentage points, and layer-wise quantization has only a loss of 1.15 / 1.21 percentage points). In the mid-width scenario, the solver delivers stable and considerable gains: the W4A32's per-channel quantization is 77.25% / 78.32%, representing improvements of 4.13 / 4.18 percentage points compared to GPTQ and 5.56 / 5.51 percentage points compared to RTN; its layer-by-layer quantization is 68.26% / 69.48%, representing improvements of 14.07 / 13.99 and 1.99 / 1.41 percentage points compared to GPTQ and RTN, respectively. Furthermore, under the more stringent setting of simultaneous quantization activation, the W4A4 still achieves a significant advantage: per-channel quantization is 57.99% / 59.95%, representing improvements of 4.87 / 5.02 percentage points compared to GPTQ; its layer-by-layer quantization is 66.64% / 68.17%, representing improvements of 11.54 / 11.14 percentage points compared to GPTQ and 4.69 / 3.91 percentage points compared to RTN. At low bit widths, the solver significantly mitigates accuracy collapse: the W3A32 achieves 74.46% / 75.79% per channel quantization, an improvement of 3.55 / 3.68 percentage points compared to GPTQ, and 49.49% / 51.34% per layer quantization, an improvement of 7.08 / 6.92 percentage points compared to GPTQ. The W2A32's 69.32% / 70.77% per channel quantization is also significantly better than GPTQ and RTN, but it is still at a low level under per layer quantization (9.18% / 11.60%, lower than GPTQ's 11.70% / 19.69%), indicating that in the extreme scenario of 2-bit per layer quantization, it is still difficult to completely cancel quantization noise by using the solver alone. Overall, even without standardization, the closed-loop solver can achieve stable and reproducible gains with a bit width of 3–4 bits or more, and is almost equivalent to floating-point precision in an 8-bit configuration; however, there is still room for further optimization in the most difficult settings such as 2-bit layer-by-layer quantization.

[0061] Then, the applicability of the infinite norm constraint standardization proposed in this invention to other methods was tested. First, the changes in model weights before and after standardization were visualized. For example... Figure 3 As shown, Figure 3Table 4 shows the spatial changes in weight values ​​before and after standardization. The first column is a histogram of weight value distribution; the second column shows a continuous weight segment at a random sampling location; and the third column shows the change in the difference between the maximum and minimum values ​​of each channel before and after standardization. The weight values ​​are predominantly near 0, but some values ​​are still relatively large. These larger values ​​share a quantization step size with smaller values, leading to information loss. Standardization significantly shrinks the weight value space, which is very helpful for quantization. Therefore, as shown in Table 4, combining the proposed infinite norm constraint standardization with existing PTQ quantization algorithms (RTN, GPTQ) can stably bring gains across all bit widths and two quantization granularities, verifying the plug-and-play nature and universality of the proposed scheme. The benefits are most significant at extremely low bit widths: In the layer-by-layer quantization of W2A32, standardization increases RTN and GPTQ from 45.17% / 48.98% and 60.44% / 61.99% to 64.13% / 65.90% and 64.98% / 66.54%, respectively; layer-by-layer quantization is more effective in suppressing distribution heterogeneity, with GPTQ increasing significantly from 11.70% / 19.69% to 24.90% / 28.64%, while RTN, although still close to failure, is slightly improved compared to unstandardized (0 / 0 increases to 0.14 / 2.77). When the bit width increases to 3–4 bits, standardization brings about a leapfrog improvement in layer-by-layer quantization: the GPTQ-layer-by-layer quantization of W3A32 increases from 42.41% / 44.42% to 73.92% / 75.35%, and RTN also increases from 3.57% / 6.94% to 41.05% / 45.25%; the RTN-layer-by-layer quantization of W4A32 increases from 66.27% / 68.07% to 78.61% / 79.72%, and the GPTQ-layer-by-layer quantization increases from 54.19% / 55.50% to 62.43% / 63.99%. With high bit-width configurations, standardization further narrows the gap with FP32 and surpasses it in several settings: Layer-by-layer quantization in W8A32 improves RTN and GPTQ to 81.16% / 82.12% and 80.79% / 81.74% respectively; although the improvement is small, it still shows a consistent upward trend. In W8A8, RTN-layer-by-layer quantization reaches 82.48% / 83.51%, and GPTQ-layer-by-layer quantization reaches 80.75% / 81.74%, both exceeding the floating-point baseline. Even in more demanding scenarios with simultaneous quantization activation, standardization significantly enhances robustness: In layer-by-layer quantization in W4A4, RTN and GPTQ improve from 61.95% / 64.26% and 55.09% / 57.03% to 71.31% / 72.85% and 59.40% / 61.61% respectively.In summary, the infinity norm constraint standardization effectively unifies and compresses the differences in weight scales between layers, significantly reducing the propagation of quantization errors caused by distribution heterogeneity. When combined with different PTQ algorithms, it brings decisive benefits under difficult settings such as low bit width and layer-by-layer quantization. In 8-bit and some 4-bit configurations, it achieves segmentation performance close to or exceeding that of floating point.

[0062] Table 4 shows the improvement of the standardization scheme proposed in this invention over other quantization algorithms. Both the test and calibration datasets are IDRid (modal data is Fundus). 0.0000 indicates that the model completely fails and cannot be segmented.

[0063]

[0064] This invention systematically alleviates IPE and AAE generated during PTQ, significantly reducing model performance degradation when compressing pre-trained MedFMs to a low bit width. This invention employs a weight normalization strategy constrained by the infinity norm. This strategy can compress the value range of pre-trained weights that differ significantly under different training environments, thereby enhancing the quantization capability of this invention in complex medical scenarios. Furthermore, to prevent the quantized MedFMs from overfitting modal features in calibration data, a coordinate descent quantization method without backpropagation is used. This process relies only on dot product and rounding operations, with a computational complexity of only [missing information - likely a value]. .

[0065] Although this invention consists of two sequentially executed sub-algorithms, it is important to emphasize that normalization occurs only during the quantization phase, introducing no additional overhead during inference. Furthermore, the weight normalization strategy of this invention is compatible with other PTQ methods, significantly enhancing their quantization robustness. Even using only the backpropagation-free quantization scheme of this invention, competitive accuracy can be achieved under various quantization settings.

[0066] The aforementioned advantages indicate that this invention has the potential to become a general-purpose quantization tool for fundamental medical image models. With multiple compression and acceleration, medical personnel can perform real-time analysis of various medical data via terminal medical devices. Doctors in remote areas can also obtain AI-assisted diagnostic capabilities comparable to those in top hospitals. Sensitive patient data does not need to be uploaded to the cloud; all analysis and processing can be completed locally. Furthermore, the applicability of this invention is expected to expand beyond medical vision tasks. This is because this invention exhibits robust performance on networks composed of common operators (such as fully connected layers and depthwise separable convolutions); and its core optimization steps correspond to a minimization problem with closed-form solutions, requiring no modification or adjustment of hyperparameters, and are expected to be quickly transferred to other fundamental models beyond medical image segmentation.

[0067] In summary, this invention provides a cost-effective, robust, and highly generalizable PTQ quantization scheme. We anticipate its application in broader basic model quantization and edge intelligent deployment, driving medical artificial intelligence from centralized computing to efficient clinical practice.

[0068] To verify the generalization ability of this invention, the MedSAM-Lite model was selected for performance testing in both intramodal and cross-modal scenarios. Experimental results show that this invention can significantly reduce the accuracy loss of the model after low-bit quantization while maintaining its segmentation performance, providing a general quantization paradigm for the deployment of MedFMs in clinical settings. In summary, the main contributions of this invention are as follows: This approach mitigates the performance degradation caused by IPE in low-bit quantization by formally shrinking the dynamic range of weights without altering the output of any layer. First, functionally equivalent and quantization-friendly weights are identified, and their maximum absolute value is minimized to reduce the amplification effect of IPE on effective quantization error at its source. Since "keeping the layer output unchanged" is treated as a hard constraint and only the weight distribution is altered, this method possesses inherent plug-and-play characteristics for any PTQ algorithm. Empirical results show that this "standardization first, quantization later" process systematically alleviates IPE-driven information loss, stably improves low-bit precision and generalization robustness, and does not introduce additional inference overhead into the quantized MedFMs.

[0069] To reduce AAE (Advanced Effects) during the high-bit to low-bit quantization process, a PTQ algorithm based on coordinate gradient descent without backpropagation is proposed. This transforms the complex quantization process into solving a series of quadratic functions with closed-form solutions. The process only requires rounding and dot product operations, achieving a time complexity of O(log n). This avoids the overfitting problem of the calibration dataset by the backpropagation-based quantization algorithm.

[0070] By combining infinite norm constraint standardization with closed-form quantization based on coordinate gradient descent, this invention can efficiently quantize basic medical models with only a small amount of calibration data, which better meets the real-world needs of data privacy requirements and the complexity of basic model structures in medical scenarios.

[0071] The quantization performance of this invention was verified on the highly representative medical basic model MedSAM-Lite. Extensive experiments show that this invention consistently achieves optimal or near-optimal performance across various settings, and this advantage is particularly significant at low bit widths.

[0072] The post-training quantization method proposed in this invention is primarily aimed at foundational models for medical image segmentation tasks, such as those used for organ, lesion, and tissue region segmentation. By standardizing the weights and performing low-bit quantization on these large-scale pre-trained medical image segmentation models, this invention significantly reduces the size of the medical image segmentation model, lowers GPU and memory usage, and accelerates inference, while maintaining almost no loss in segmentation accuracy. This is achieved by quantizing the pre-trained weights and activation values ​​during inference from 32-bit floating-point values ​​to low-bit integer values ​​(such as INT8, INT4, INT2, etc.), enabling application deployment under limited computing power and power consumption. This allows the model to be deployed on ordinary computing servers within hospitals, portable terminal devices, and even edge-side acquisition workstations, achieving real-time segmentation and remote medical assistance. Furthermore, this invention has low requirements for calibration data, effectively maintaining the generalization ability of the quantized model while meeting the requirements of medical data security and privacy.

Claims

1. A post-training quantization method for a basic model of medical image segmentation, characterized in that, Includes the following steps: S1. Obtain the basic model and pre-trained weights for medical image segmentation to be quantized; S2. Construct a standard dataset of medical segmentation images and preprocess the standard dataset of medical segmentation images; S3. Based on the application requirements of the basic medical image segmentation model, the target bit width is determined, and uniform quantization is selected as the basic quantization method. Among them, the post-training quantization of the basic medical image segmentation model is uniform quantization. S4. Based on the infinite norm constraint, perform pre-trained weight standardization to obtain a new weight matrix; S5. Based on the new weight matrix, the integer encoding matrix and scaling factor are alternately solved by the post-training quantization algorithm based on coordinate descent without backpropagation to complete the quantization process of the basic medical image segmentation model to be quantized. S6. Based on the solved integer encoding matrix and scaling factor, construct the quantized basic model for medical image segmentation, and perform inference on the preprocessed standard dataset of medical segmentation images to complete the post-training quantization of the basic model for medical image segmentation.

2. The post-training quantization method for a basic medical image segmentation model according to claim 1, characterized in that, In S3, selecting uniform quantization as the basic quantization method specifically means: for a given floating-point weight... Using step size and zero point Map it to an integer encoding matrix The expression for the quantization result is as follows: ; ; ; in, This represents the quantization result, where b represents the bit width of the quantization target, and m represents the number of elements in the weight matrix. This represents a range constraint function, used to restrict the range to a representable interval of integers.

3. The post-training quantization method for a basic medical image segmentation model according to claim 1, characterized in that, S4 includes the following steps: S401, Input feature matrix and the original weight matrix Based on this, a new weight matrix is ​​constructed. The first optimization objective is obtained: ; S402. By transforming the constraint term of the first optimization objective into a penalty term, the output maintains that the constraint and the weight norm penalty together form an optimizable regularized objective function: in, Describe the Frobenius norm. Represents the regularization parameter. Represents the weight matrix The Column vectors Indicates the column index. As an infinite norm penalty term; S403. The regularization objective function is split into a smooth part and a non-smooth part. The smooth part is a quadratic term, and the gradient can be directly calculated. The non-smooth part is a regularization term with an infinite norm, corresponding to the non-differentiable norm constraint. S404. Based on the splitting results, iterative updates are performed using proximal gradients; S405. Based on the iterative update results, Moro decomposition and 1-norm sphere projection are used to accelerate the computation of the proximal operator. S406. Combining the Caro-Kun-Tucker condition (TTK), the optimal solution to the projection problem is characterized, and the optimal solution is explicitly defined as a soft threshold form: S407. Execute S401-S406. When the layer output change is lower than the preset threshold or the number of iterations reaches the upper limit, a new weight matrix is ​​obtained. .

4. The post-training quantization method for a basic medical image segmentation model according to claim 3, characterized in that, The iterative update process is represented as follows: in, Indicates the optimization step size. Indicates the first The updated weight matrix obtained in the next iteration Describes the proximal operator of the infinite norm. Indicates the first The updated weight matrix obtained in the next iteration express gradient, This represents the smooth part of the objective function, i.e. , express The largest eigenvalue, This represents the input feature matrix. express The transpose of .

5. The post-training quantization method for a basic medical image segmentation model according to claim 4, characterized in that, S406 includes the following steps: Use the original feasibility check to examine the original input. Whether it has fallen within the 1 norm sphere, where if the point to be projected is already inside the constraint sphere, it is directly retained; if it is outside the sphere, it is scaled onto the sphere to achieve a unified constraint on the weight norm. Based on the inspection results, by combining first-order optimality with the partial derivative of the 1-norm, the optimal solution is explicitly defined as a soft threshold form: in, This represents the optimal solution. The function that preserves the direction of a vector. This represents the intermediate variable after gradient descent. This refers to the Lagrange multiplier that makes the Caro-Kun-Tucker condition TTK true.

6. The post-training quantization method for a basic medical image segmentation model according to claim 1, characterized in that, S5 includes the following steps: S501, Construct with scaling factor and integer encoding matrix The quantification objective for variables: Where m and n represent integer encoding matrices respectively. The number of rows and columns, This represents the input feature matrix. This represents the new weight matrix. Represents the set of integers under the target bit width. Represents the set of real numbers; S502. Based on the quantization objective, coordinate descent is used to decompose the high-dimensional problem into one-dimensional optimization sub-problems. S503. Repeat S502 until the error converges to obtain the optimal integer encoding matrix and scaling factor, thus completing the quantization of the basic model for medical image segmentation.

7. The post-training quantization method for a basic medical image segmentation model according to claim 6, characterized in that, S502 includes the following steps: Based on the quantization objective, all quantization variables are used as several coordinates, where the quantization variables include all scaling factors and corresponding integer encoding matrices in each layer; In each iteration, only one coordinate or a set of similar coordinates is updated, while other coordinates remain unchanged. This decomposes the high-dimensional problem into one-dimensional optimization subproblems. The decomposition process is as follows: With a fixed scaling factor In this case, the residual matrix is ​​introduced to update the integer encoding matrix. ; In a fixed integer encoding matrix In this case, update the scaling factor .

8. The post-training quantization method for a basic medical image segmentation model according to claim 1, characterized in that, S6 includes the following steps: S601. Based on the solved integer encoding matrix and scaling factor, quantization weights are formed; S602. Load the quantized weights into the basic medical image segmentation model to construct the quantized basic medical image segmentation model. S603. Using the quantized medical image segmentation basic model, perform segmentation inference on the standard dataset of medical segmentation images to complete the post-training quantization of the medical image segmentation basic model.