Skin-scope image classification method, device and medium based on importance perception wavelet adaptive fine-tuning
By constructing a wavelet domain adapter at the weight matrix of the frozen visual base model and utilizing the joint optimization of wavelet sparse coefficients and gating parameters to dynamically select frequency points and adapters, the problems of uneven lesion discrimination information and overfitting in dermoscopic image classification are solved, achieving efficient and lightweight dermoscopic image classification.
Patent Information
- Application Number
- CN202611294591.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies for dermoscopic image classification suffer from problems such as uneven distribution of lesion discrimination information in the frequency domain, numerous candidate weight matrices in the visual basic model, and limited sample size. These issues exacerbate the risk of overfitting and increase computational overhead, making it difficult to meet the requirements of real-time clinical diagnosis.
A wavelet domain adapter is constructed at the weight matrix of the frozen visual base model. Frequency points and adapters are dynamically selected through joint optimization of wavelet sparse coefficients and gating parameters to achieve adaptive selection at the frequency point level and module level. After training, the incremental weights are merged with the base model to form the deployment model.
It effectively adapts to the uneven frequency domain distribution of lesion information in dermoscopic images, suppresses the risk of overfitting, reduces storage overhead and inference latency, improves parameter utilization efficiency and classification accuracy, and meets the needs of real-time clinical diagnosis.
Smart Images

Figure CN123181908A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing, and in particular to a dermoscopic image classification method, device, and medium based on importance-aware wavelet adaptive fine-tuning. Background Technology
[0002] Dermoscopy images can reveal fine-grained information about skin lesions, such as pigment networks, boundary irregularities, color distribution, striae, dot-like structures, and vascular morphology, making them an important tool for clinical screening and auxiliary diagnosis of skin tumors. With the rapid development of deep learning technology, dermoscopy image classification methods based on visual models have gradually become the mainstream technical approach in this field.
[0003] However, the annotation cost of large-scale medical image datasets is high and sample acquisition is difficult. Training deep neural network models from scratch for skin tumor classification tasks is usually not feasible. Therefore, adapting pre-trained visual base models to dermoscopy image classification tasks has become an important research direction.
[0004] Existing adaptation methods mainly include full fine-tuning, linear probing, low-rank adaptation, and wavelet domain sparse high-rank adaptation, but these methods still have significant limitations in dermoscopic image classification tasks. In dermoscopic images, lesion discrimination information is not uniformly distributed in the frequency domain. The overall contour, asymmetry, and large-scale color structure of the lesion mainly affect the low-frequency components, while fine-grained textures such as edges, pigment grids, dots, and small blood vessels affect the mid-to-high-frequency components. Existing wavelet domain sparse adaptation methods often use fixed-ratio sampling or uniform random sampling for frequency point selection. Their allocation strategies lack effective matching with the frequency domain physical characteristics of dermoscopic images and cannot be dynamically adjusted based on classification task feedback, resulting in limited parameters being dispersed to low-contribution frequencies. Simultaneously, the visual base model has a large number of candidate weight matrices. If adapters are inserted equally at all candidate positions, it will cause significant parameter redundancy and additional computational overhead. Under conditions of limited dermoscopic sample size, long-tailed categories, and significant differences in acquisition devices, the risk of overfitting is further exacerbated. In actual clinical deployment, if all adapter branches are retained during inference, the model structure will deviate significantly from the original base model, resulting in additional computational latency and storage overhead, making it difficult to meet the stringent requirements of real-time clinical diagnosis for inference efficiency.
[0005] In summary, the key bottleneck for this technical approach to gain widespread clinical application in the field of dermoscopic image classification lies in establishing an efficient parameter fine-tuning mechanism that can simultaneously achieve frequency-level and module-level adaptive selection while freezing the basic visual model, and then integrating the selected incremental weights with the basic model after training with zero additional inference overhead. Summary of the Invention
[0006] To address the problems of uneven distribution of lesion discrimination information in the frequency domain and the long-tail scenario with numerous candidate weight matrices and limited sample size in the visual base model in existing technologies, the main objective of this invention is to provide a dermoscopic image classification method, device, and medium based on importance-aware wavelet adaptive fine-tuning. This method can achieve efficient dermoscopic image classification with fewer trainable parameters while freezing the base model, and output the classification of dermoscopic images with the same inference structure as the original base model after training.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a dermoscopic image classification method based on importance-aware wavelet adaptive fine-tuning, comprising: A wavelet domain adapter is constructed at at least one weight matrix of the frozen visual fundamental model that participates in feature transformation; wherein the visual fundamental model is used for feature extraction of a two-dimensional image; In the two-dimensional wavelet coefficient space, different initial sampling amounts of candidate frequency points are assigned to different sub-bands based on the frequency physical characteristics of each sub-band. Sampling is performed according to the initial sampling amounts to obtain a first number of candidate frequency points. Trainable wavelet sparse coefficients are set for the candidate frequency points. Spatial domain incremental weights are obtained by inverse discrete wavelet transform, which are directly mapped by the wavelet sparse coefficients. Learnable gating parameters are set for each adapter, the importance of each candidate frequency point is determined based on the correlation between the classification loss and the wavelet sparse coefficients, and progressive pruning from the first number to the second number is performed on the candidate frequency points in the same adapter based on the importance, and the classification loss for the classification task and the sparsity regularization term for the gating parameters are jointly minimized. After training, the second number of frequency points in each adapter are retained. According to the final value of the gating parameter, adapters below the preset threshold are deleted, and the retained spatial domain incremental weights are merged with the frozen weights to obtain the deployment model. The dermoscopic image to be tested is input into the deployment model to obtain the classification result.
[0008] As a preferred embodiment, determining the importance of each candidate frequency point based on the correlation between the classification loss and the wavelet sparse coefficients includes: Using the product of the gradient magnitude of the classification loss with respect to the wavelet sparse coefficients and the magnitude of the wavelet sparse coefficients as the basic importance, an exponential moving average is used to smooth the basic importance to obtain the importance of the candidate frequency points; the formula for calculating the exponential moving average is: ; in, Let k be the importance of the k-th candidate frequency point within the i-th adapter in the t-th training round. The wavelet sparse coefficients of the candidate frequency points, For the classification loss, β represents the importance of the previous round, and β is the smoothing coefficient.
[0009] As a preferred embodiment, the progressive pruning includes: Every preset training round, the candidate frequency points within the same adapter are sorted from highest to lowest importance, and candidate frequency points with lower importance are deleted, so that the number of frequency points gradually decreases from the first number to the second number according to a preset decreasing schedule; the decreasing schedule is as follows: ; in, Let k be the number of frequency points retained in the t-th pruning round, k be the second number, and nK be the first number. The frequency pruning cycle ends.
[0010] As a preferred embodiment, the allocation of different initial sampling amounts for candidate frequency points to different sub-bands includes: The initial sampling amount of the low-frequency sub-band is greater than that of the mid-to-high-frequency sub-band, and the initial sampling amount of the mid-frequency sub-band in the mid-to-high-frequency sub-band is greater than that of the highest frequency sub-band.
[0011] As a preferred embodiment, the classification loss is a weighted focus loss, wherein the weights of the weighted focus loss are inversely correlated with the class frequency, and a focus factor is introduced into the weighted focus loss; the formula for calculating the weighted focus loss is: ; in, Let the weight of the j-th category be , γ is the predicted probability of the j-th category, and γ is the focusing factor.
[0012] As a preferred embodiment, the candidate weight matrix is located at least one of the feature projection layers before the attention query projection layer, key projection layer, value projection layer, output projection layer, feedforward network layer, point convolutional layer, or classification head of the visual base model, and the visual base model is a visual Transformer model or a ConvNeXt model.
[0013] As a preferred approach, after acquiring the dermoscopic image set, the training set, validation set, and test set are divided according to patient identification or lesion identification, so that multiple images of the same lesion are in the same dataset; before the training phase and before the inference phase, the dermoscopic images are preprocessed, and the preprocessing includes at least one of hair artifact suppression, scale artifact suppression, bubble artifact suppression, color constancy, and lesion region cropping.
[0014] As a preferred embodiment, merging the retained spatial domain incremental weights with the frozen weights to obtain the deployment model includes: The product of the scaling factor corresponding to the retained adapter, the learnable gating parameter, and the spatial domain incremental weight is added to the corresponding frozen weight and stored together; or, The coordinates and values of the sparse coefficients of the visual base model and the adapter are saved respectively; the preset threshold is a configurable threshold determined based on the final value distribution of the gating parameters.
[0015] In a second aspect, the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described dermoscopic image classification method.
[0016] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described dermoscopic image classification method.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) In this invention, a wavelet domain adapter is constructed on the frozen visual basic model. Differentiated initial sampling amounts are allocated to different frequency bands using the frequency physical characteristics of wavelet subbands to prioritize coverage of the overall structure of lesions. During training, frequency points within the adapter are progressively eliminated through a frequency point evaluation mechanism driven by classification loss. At the same time, learnable gating parameters are set for each adapter, and low-contribution adapters are automatically made to approach zero by jointly optimizing the classification loss and the gating sparsity regularization term. After training, low-contribution adapters are deleted according to the final gating value, and the filtered incremental weights are merged with the frozen weights to complete the dermoscopic image classification. The synergistic cooperation of the above technical means enables this application to dynamically allocate limited parameters to the frequency points and adapter positions that contribute most to the current classification task by only updating the wavelet sparsity coefficients and gating parameters. This effectively adapts to the uneven frequency distribution of lesion information in dermoscopic images while maintaining the original expressive power of the frozen model, suppresses the risk of overfitting under long-tail distribution conditions, and reduces the storage overhead and inference latency during deployment.
[0018] (2) In this invention, furthermore, during the frequency point selection stage, the contribution of frequency points is evaluated by multiplying the gradient magnitude and the coefficient magnitude, and an exponential moving average is used to smooth batch fluctuations. Simultaneously, during the pruning stage, the number of frequency points is gradually reduced after sorting according to a preset period. The product of the gradient magnitude and the coefficient magnitude allows the importance to simultaneously reflect the frequency point's sensitivity to classification loss and its own parameter magnitude, while the exponential moving average effectively filters out gradient noise caused by small-batch training, and progressive pruning ensures that the reduction in the number of frequency points is smooth and controllable. The combination of these methods enables the frequency point-level parameter allocation to be continuously optimized as the classification task progresses, improving parameter utilization efficiency and enhancing the model's adaptive capture ability of different skin tumor category discrimination information.
[0019] (3) In this invention, furthermore, during the deployment phase, the selected incremental weights and frozen weights are merged and stored to achieve zero extra branches during inference, or the coordinates and values of the base model and sparse coefficients are saved separately to achieve reuse of the base model in multiple scenarios, and the pruning threshold is determined based on the final value distribution of the gating parameters. Merging and storing makes the inference network structure completely consistent with the original base model, while saving separately facilitates the independent saving of adaptation parameters for different data sources or different classification tasks. The configurable threshold allows the pruning decision to be adaptively adjusted according to the distribution characteristics of the gating values during actual training. The above deployment scheme ensures classification performance while taking into account deployment efficiency and flexibility in adapting to multiple scenarios. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating a dermoscopic image classification method based on importance-aware wavelet adaptive fine-tuning according to an embodiment of this application. Figure 2 This is a schematic diagram comparing the principles of the LoRA adapter and the wavelet domain adapter of the embodiments of this application; wherein, Figure 2 (a) shows that the LoRA adapter decomposes the incremental weights into the product of two low-rank matrices and adds them to the pre-trained weights. Figure 2 (b) shows that the wavelet domain adapter used in the embodiments of this application constructs a sparse matrix in the wavelet domain and generates spatial domain incremental weights through inverse discrete wavelet transform, while controlling the contribution intensity of the incremental weights through a gating unit.
[0021] Figure 3 This is a scatter plot comparing the performance of the embodiments of this application and various parameter efficient fine-tuning methods in terms of the relationship between the number of trainable parameters and accuracy; Figure 4 This is a line graph comparing the accuracy of embodiments of this application with FourierFT and WaveFT on three medical image datasets, namely APTOS 2019, ISIC, and Chest X-Ray, under different numbers of sampling points (K); Figure 5This is a schematic diagram of the structural framework of an electronic device according to an embodiment of this application. Detailed Implementation
[0022] To better illustrate the objectives, technical solutions, and advantages of the present invention, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0023] like Figure 1 As shown, this application provides a dermoscopic image classification method based on importance-aware wavelet adaptive fine-tuning. The method of this application achieves skin tumor classification from dermoscopic images through a frozen visual base model and lightweight adaptation parameters. It is particularly suitable for skin tumor datasets with limited training samples and uneven class distribution, effectively improving parameter utilization efficiency and classification accuracy, while maintaining low inference latency during deployment. The method includes the following steps: S100. Construct a wavelet domain adapter at at least one weight matrix of the frozen visual fundamental model that participates in feature transformation; wherein the visual fundamental model is used for feature extraction of a two-dimensional image.
[0024] The visual foundation model refers to a deep neural network model pre-trained on a large-scale general image dataset for feature extraction from two-dimensional images. The candidate weights of the pre-trained visual foundation model can be denoted as... The weights are frozen during the training phase, where d1 and d2 are the row and column dimensions of the candidate weight matrix, respectively. The candidate weight matrix refers to the position of the weight matrix in the visual base model where the adapter can be inserted. This can include attention query projection layers, key projection layers, value projection layers, output projection layers, feedforward network layers, point convolutional layers, or feature projection layers before the classification head. The wavelet domain adapter generates spatial domain incremental weights by setting trainable wavelet sparse coefficients in the wavelet domain and performing inverse discrete wavelet transform. This allows the visual base model to adapt to the classification task incrementally without modifying the original frozen weights.
[0025] S200. In the two-dimensional wavelet coefficient space, different initial sampling amounts of candidate frequency points are assigned to different sub-bands based on the frequency physical characteristics of each sub-band. Sampling is performed according to the initial sampling amounts to obtain a first number of candidate frequency points. Trainable wavelet sparse coefficients are set for the candidate frequency points. Spatial domain incremental weights are obtained by inverse discrete wavelet transform, which are directly mapped by the wavelet sparse coefficients.
[0026] The frequency physical characteristics of each sub-band refer to the fact that the low-frequency sub-band carries information such as the overall contour of the lesion, the mid-frequency sub-band carries information such as the edge and pigment mesh, and the highest frequency sub-band carries information such as the dot-sphere structure and small blood vessels. Based on these physical characteristics, the initial sampling amount of the low-frequency sub-band is greater than that of the mid- and high-frequency sub-bands, and the initial sampling amount of the mid-frequency sub-band is greater than that of the highest frequency sub-band. The first quantity is the total number of candidate frequency points obtained from the initial sampling. The spatial domain incremental weights are directly mapped from the wavelet sparse coefficients through the inverse discrete wavelet transform, and are not constrained by low-rank decomposition. Specifically, the above process can be expressed as: setting trainable coefficients at the candidate frequency point positions. Set the remaining positions to zero to form a wavelet domain sparse matrix. ;right Perform a two-dimensional inverse discrete wavelet transform (IDWT) to obtain spatial domain incremental weights. Its mathematical form is: , ; , ; ; in, Let i be the set of candidate frequency points in the i-th adapter. denoted as the wavelet sparse coefficient corresponding to the k-th candidate frequency point.
[0027] S300. Set learnable gating parameters for each adapter, determine the importance of each candidate frequency point based on the correlation between the classification loss and the wavelet sparse coefficients, and perform progressive pruning from the first number to the second number of candidate frequency points in the same adapter based on the importance, and jointly minimize the classification loss for the classification task and the sparsity regularization term for the gating parameters.
[0028] The learnable gating parameters, after being mapped by the Sigmoid function, yield gating values in the range of 0 to 1, which are used to control the contribution level of the adapter. Specifically, the learnable gating parameters for each adapter... via the Sigmoid function The gating value is obtained after mapping. Then the effective weights of the adapter during training Represented as: ; ; in, For frozen pre-trained weights, The spatial domain incremental weights are generated by the inverse discrete wavelet transform. The scaling factor is a preset or learnable factor. The classification loss can be a weighted cross-entropy loss or a weighted focus loss. The importance is determined based on the product of the gradient magnitude of the wavelet sparse coefficients and the magnitude of the coefficients, and can be supplemented with exponential moving average smoothing. The second quantity is the number of frequencies retained after progressive pruning, and the first quantity is greater than the second quantity. Progressive pruning refers to sorting by importance and deleting low-contribution frequencies every preset training epoch, so that the number of frequencies gradually decreases according to a preset decreasing schedule. The sparsity regularization term is an L1 regularization term for the gating parameters, used to drive the gating value of the low-contribution adapter to approach zero.
[0029] S400. After training, retain the second number of frequency points in each adapter, delete adapters that are below the preset threshold according to the final value of the gating parameter, and merge the retained spatial domain incremental weights with the frozen weights to obtain the deployment model. Input the dermoscopy image to be tested into the deployment model to obtain the classification result.
[0030] The preset threshold is used to determine whether the adapter needs to be retained. It can be a preset fixed value or a configurable threshold determined based on the final value distribution of the gating parameters. The merged deployment model structure is consistent with the original vision base model, without adding additional adapter branch calculations.
[0031] It is worth noting that in the practical application of dermoscopy image classification, it is divided into two parts: the training stage and the inference application stage.
[0032] During the training phase, training dermoscopy images with category labels are acquired. Specifically, the acquired set of dermoscopy images can be represented as follows: ,in This is an RGB dermoscopy image. The model identifies one of C skin tumor categories. Wavelet domain adapters are constructed at the candidate weight matrices of the frozen visual baseline model, with each adapter corresponding to a candidate weight matrix. Each adapter generates spatial domain incremental weights through inverse discrete wavelet transform using wavelet domain sparse coefficients, and these incremental weights are then superimposed on the corresponding frozen weights to update the model's output during training. During training, learnable gating parameters automatically adjust the contribution intensity of each adapter based on feedback from the classification loss. The correlation between the classification loss and wavelet sparse coefficients is used to dynamically determine the importance of each candidate frequency point and perform progressive pruning accordingly. Simultaneously, the sparsity regularization term drives the gating values of low-contribution adapters to approach zero.
[0033] After training, adapters that should be retained are selected, and the retained spatial domain incremental weights are merged with the frozen weights to form a deployment model that can be directly used for inference. It can be understood that through frequency-level progressive pruning and adapter-level gating, the final deployment model retains only the frequencies and adapters that contribute most to the classification task. The number of training parameters and deployment parameters can be precisely controlled by preset frequency budgets and gating thresholds, enabling the model to be flexibly deployed under different GPU and storage resource constraints, making it particularly suitable for grassroots medical scenarios with limited computing resources.
[0034] In the inference application phase, the classification system acquires the dermoscopic image to be tested and inputs it into the deployment model. The visual base model extracts multi-layer features of the image, and the merging weights of the deployment model adaptively adjust the extracted features. Finally, the classification head outputs the probability distribution of each skin tumor category, completing the output of the classification results.
[0035] It is understandable that, since the spatial domain incremental weights have been merged with the frozen weights after training, the inference structure of the deployed model is completely consistent with the original visual base model, without adding any additional adapter branch computation and memory access overhead. The single-image inference latency is comparable to that of the original base model, which can meet the real-time requirements of batch screening of dermoscopy images.
[0036] It is understandable that biased initial sampling based on frequency physical characteristics and dynamic frequency point selection driven by classification loss enable the model to effectively capture the macroscopic contours and microscopic texture features of lesions in dermoscopic images. The classification results cover a more complete lesion area, and the configurable pruning threshold determined by the final value of the gating parameter can flexibly balance classification accuracy and storage overhead, providing doctors with highly reliable auxiliary diagnostic evidence. It also facilitates the rapid transfer and adaptation of parameters between different hospitals or devices without the need to repeatedly train the complete basic model.
[0037] As can be seen from the embodiments of this application, dual adaptive sparsity at the frequency point level and the adapter level can be realized, so that the limited parameters are dynamically concentrated at the position that contributes most to the classification task, effectively improving the parameter utilization efficiency and classification accuracy, suppressing the risk of overfitting under long-tail distribution conditions, and realizing lightweight inference with zero additional inference latency in the deployment stage.
[0038] In this embodiment, in step S100, a wavelet domain adapter is constructed at the candidate weight matrix of the frozen visual base model. The visual base model can be a visual Transformer model or a ConvNeXt model. The visual Transformer model performs global modeling of the image patch sequence through a self-attention mechanism. Its query projection layer, key projection layer, and value projection layer are responsible for calculating the attention weights between image patches, the output projection layer is responsible for fusing the output of multi-head attention, and the feedforward network layer is responsible for performing nonlinear transformations on the features of each image patch. The ConvNeXt model adopts a convolutional neural network architecture, achieving efficient feature extraction through depthwise separable convolutions and inverted bottleneck structures. Its candidate weight matrix can be located at positions such as the point convolutional layer or the feature projection layer before the classification head.
[0039] Understandably, in the visual Transformer model, the attention query projection layer maps input features to query vectors, the key projection layer maps them to key vectors, and the value projection layer maps them to value vectors. The weight matrices of these three projection layers directly affect the calculation results of the attention mechanism, thus influencing the model's attention level to different regions in the image. The output projection layer is responsible for fusing the outputs of multi-head attention, and the feedforward network layer is responsible for performing nonlinear transformations on the features. Inserting wavelet domain adapters at these locations allows the incremental weights of the adapters to directly participate in attention calculation and feature transformation, thereby enabling targeted adjustments to the model's feature extraction process while freezing the weights of the base model.
[0040] Taking the discrimination of melanoma in dermoscopy images as an example, melanoma lesions typically have irregular boundaries and asymmetrical pigment distribution. These characteristics require the model to make comprehensive judgments at multiple levels. Inserting adapters into the attention query projection layer and key projection layer can adjust the model's attention weights for different image regions, making the model pay more attention to the boundaries and asymmetry of the lesion region. Inserting an adapter into the output projection layer can adjust the feature representation after multi-head attention fusion, making the model more prominent in features related to melanoma. Adapters at different locations act on different stages of the model's feature extraction, working together to effectively capture information for melanoma discrimination.
[0041] Understandably, after acquiring the dermoscopic image set, it's necessary to divide it into training, validation, and test sets based on patient or lesion identifiers to ensure that multiple images of the same lesion are within the same dataset. During dermoscopic image acquisition, the same patient or lesion may contain multiple images, which are highly correlated. If random partitioning is used, multiple images of the same lesion might belong to different sets, leading to inflated test set evaluation results due to data leakage, failing to objectively reflect the model's true generalization ability. Partitioning by patient or lesion identifier ensures that multiple images of the same lesion are always within the same dataset, thus guaranteeing the objectivity of validation and test evaluations. For example, if three images of the same lesion from the same patient are acquired, random partitioning might result in two images entering the training set and one entering the test set. During test set evaluation, the model might have already learned the lesion's features from the training set, leading to inflated evaluation results. Partitioning by lesion identifier avoids this problem, ensuring that the test set evaluation results reflect the model's true classification ability for lesions not observed.
[0042] In this embodiment, the training phase can utilize publicly available dermoscopic image data to establish a training set, such as the HAM10000 dataset or the ISIC skin lesion image dataset. Example categories include melanoma (MEL), nevus (NV), basal cell carcinoma (BCC), squamous cell carcinoma (SCC), actinic keratosis (AK), benign keratodermal lesions (BKL), dermatofibroma (DF), and vascular lesions (VASC), which can also be combined into benign or malignant categories depending on the specific task. Data is divided into training, validation, and test sets based on patient or lesion identifiers. Images can be scaled to 224×224 or 384×384 pixels. During the training phase, random flipping, ±20° rotation, 0.8 to 1.2x scaling, and moderate color perturbation are performed. During the validation and testing phases, only deterministic scaling, center cropping, and normalization are performed. The base model can be ViT-B / 16, and the candidate weight matrix positions can be the query projection layer, key projection layer, value projection layer, output projection layer, and two feedforward network layers in 12 Transformer blocks, for a total of no more than 72 candidate weight matrix positions; if other projection layers are also included, the number of candidate weight matrix positions can be expanded to 96. In this embodiment, the training parameter configuration is shown in Table 1.
[0043] Table 1 Training Parameters
[0044] In this embodiment of the application, in step S200, different initial sampling amounts of candidate frequencies are assigned to different sub-bands based on the frequency physical characteristics of each sub-band. Specifically, the allocation process follows the following principles: the initial sampling amount of the low-frequency sub-band is greater than the initial sampling amount of the mid-to-high-frequency sub-band, and the initial sampling amount of the mid-frequency sub-band in the mid-to-high-frequency sub-band is greater than the initial sampling amount of the highest-frequency sub-band.
[0045] Understandably, the two-dimensional discrete wavelet transform decomposes an image into LL subbands (low-frequency subbands), LH subbands (a type of mid-frequency subband), HL subbands (a type of mid-frequency subband), and HH subbands (the highest frequency subband). Each subband carries image information within a different frequency range. The LL subband carries information such as the overall contour of the lesion, asymmetry, and large-scale color structure; the LH and HL subbands carry information such as the lesion edges and pigment grids; and the HH subband carries information such as dot-sphere structures and small blood vessels. Since the overall contour and asymmetry of the lesion in dermoscopic images mainly depend on the low-frequency components, which have a fundamental impact on classification decisions, more than half of the candidate frequency points are allocated to the low-frequency subbands during the initialization phase. The mid-to-high frequency subbands are used to characterize edge and texture details, playing an auxiliary role in discrimination, and have the next highest sampling rate. The highest frequency subband is greatly affected by acquisition noise and has sparse effective semantic information, so it has the lowest sampling rate. Based on the above physical characteristics, in the initialization phase, this application embodiment allocates more candidate frequency points to the LL subband, so that the model can preferentially cover the macroscopic structural features of the lesion. At the same time, it retains a sufficient number of candidate frequency points in the LH and HL subbands to cover edge and texture information, and retains a small number of candidate frequency points in the HH subband to cover fine-grained structural information.
[0046] As an example, the initial sampling ratio of each subband can be set as follows: 60% for the LL subband, 30% for the LH and HL subbands combined, and 10% for the HH subband (i.e., a 6:3:1 ratio). This ratio can be adaptively adjusted according to the actual data distribution. This example ratio corresponds to an allocation scheme with an oversampling factor of 4 and a final frequency budget of 500, i.e., 1200 candidate frequency points are allocated to the LL subband, 600 candidate frequency points are allocated to the LH and HL subbands combined, and 200 candidate frequency points are allocated to the HH subband. This allocation strategy prioritizes the distribution of limited candidate frequency points in the LL subband, which carries the overall contour information of the lesion. At the same time, candidate frequency points covering texture information such as edges and pigment grids are reserved in the LH and HL subbands, and candidate frequency points covering information such as dot-shaped structures and small blood vessels are reserved in the HH subband. This provides a candidate parameter pool that conforms to the distribution pattern of lesion information in dermoscopic images for subsequent importance-based dynamic screening.
[0047] Taking the discrimination of melanoma in dermoscopy images as an example, melanoma lesions typically have irregular boundaries and asymmetrical pigment distribution. These features involve both the LL subband (overall contour and asymmetry) and the LH and HL subbands (boundary irregularities) in the frequency domain. A biased initialization strategy prioritizes allocating candidate frequency points in the LL subband, enabling the model to capture the overall structural features of melanoma from the early stages of training. Simultaneously, it retains a sufficient number of candidate frequency points in the LH and HL subbands for subsequent boundary detail adjustments, thus providing a good initial parameter foundation for accurate melanoma classification.
[0048] In this embodiment of the application, in step S300, the classification loss can be a weighted focus loss. Specifically, the weighted focus loss is calculated as follows: ; in, Let the weight of the j-th category be , Let γ be the predicted probability of the model for the j-th category, and γ be the focusing factor.
[0049] Understandably, the weighted focus loss introduces weights that are inversely correlated with class frequency. And the focus factor γ, which makes the model pay more attention to difficult-to-classify samples and infrequent minority class samples during training. Weights The weighting is inversely correlated with class frequency; that is, the lower the frequency of a class, the greater its weight. This causes the model to penalize misclassification of minority classes more severely during optimization, effectively mitigating the problem of model bias towards the majority class (e.g., benign nevi) caused by the scarcity of samples in minority malignant classes (e.g., melanoma) in skin tumor datasets. The focusing factor γ (which can be set to 2, ranging from 0 to 5) is used to adjust the model's attention to difficult-to-classify samples. When γ is greater than 0, the model assigns larger gradient weights to samples with lower predicted probabilities, allowing the model to focus more optimization efforts on samples that are currently difficult to classify correctly, thus gradually improving its ability to identify difficult samples during training. When γ approaches 0, the weighted focus loss degenerates into the weighted cross-entropy loss.
[0050] Taking the category distribution in dermoscopic image classification as an example, melanoma, as a minority category, typically has far fewer samples than benign moles. Weighted focus loss, by assigning higher weights to the melanoma category, makes the model pay more attention to the discriminative features of melanoma during training, thus effectively improving the sensitivity to melanoma identification while maintaining the accuracy of the majority class classification. Simultaneously, the introduction of the focus factor makes the model pay more attention to melanoma samples with lower confidence levels, which helps in the effective identification of early melanomas with atypical morphologies.
[0051] In this embodiment, biased initialization and weighted focus loss, starting from the two dimensions of frequency domain physical prior and class imbalance, provide a high-quality initial parameter pool and supervision signal for subsequent dynamic screening. Biased initialization, through candidate frequency point allocation guided by physical prior, enables the model to capture the macroscopic contours and microscopic texture structures of lesions in dermoscopic images from the early stages of training, providing a candidate frequency point set that conforms to the distribution patterns of lesion information for subsequent frequency-level progressive pruning. Weighted focus loss, through the synergistic effect of the inverse correlation between weights and class frequencies and the focusing factor, enables the model to effectively address the challenge of scarce samples in a few malignant classes in skin tumor datasets during training, providing a more robust classification loss supervision signal for subsequent frequency point evaluation and adapter screening. The two work together to improve the parameter utilization efficiency and classification accuracy of the model in multi-class classification tasks of dermoscopic images.
[0052] In this embodiment of the application, in step S300, the importance of each candidate frequency point is determined based on the correlation between classification loss and wavelet sparse coefficients, and progressive pruning is performed based on this importance. Specifically, this process includes the following sub-steps.
[0053] S310: Determine the importance of each candidate frequency point.
[0054] The importance of each candidate frequency point is determined by the product of the gradient magnitude of the wavelet sparse coefficient corresponding to the candidate frequency point and the magnitude of the wavelet sparse coefficient.
[0055] Understandably, the gradient magnitude of the wavelet sparse coefficients in the classification loss reflects the degree to which small changes in these coefficients affect the classification loss. A larger gradient magnitude indicates a higher sensitivity of the coefficient to the classification loss, meaning that the frequency point contributes more significantly to the current classification task. The magnitude of the wavelet sparse coefficients reflects the order of magnitude of the coefficient in the spatial domain incremental weights; a larger magnitude indicates a greater contribution of the coefficient to the incremental weights. Using the product of the gradient magnitude and the coefficient magnitude as the basic importance score simultaneously considers both the gradient response and the parameter magnitude, thus accurately identifying the candidate frequencies that contribute most to the classification of skin tumors.
[0056] To further reduce the interference of gradient fluctuations caused by small batches of samples during training on importance assessment, this embodiment employs an exponential moving average to smooth the base importance. Specifically, the importance of each training round is obtained by weighted averaging the base importance calculated in the current round and the importance in the previous round, as shown in the following formula: ; in, Let k be the importance of the k-th candidate frequency point within the i-th adapter in the t-th training round. The wavelet sparse coefficients of the candidate frequency points, For the classification loss, The importance of the previous round is represented by β, which is the smoothing coefficient (e.g., it can be set to 0.9, with a range of 0 to 0.99).
[0057] Taking the discrimination of melanoma in dermoscopy images as an example, melanoma lesions typically have irregular boundaries and asymmetrical pigment distribution. These features may involve multiple candidate frequency points in both the low-frequency and mid-frequency subbands in the frequency domain. The product of the gradient magnitude and the coefficient magnitude can effectively identify those frequency points that have the greatest impact on the melanoma classification loss, thus enabling the model to focus its parameters on the frequency points most relevant to melanoma identification during training, rather than distributing them evenly across all frequency points.
[0058] S320: Sort and prune each candidate frequency point every preset training round.
[0059] After obtaining the importance of each candidate frequency point, every preset training round, all candidate frequency points within the same adapter are sorted from highest to lowest importance, and low-contribution candidate frequency points with lower importance are deleted, so that the number of frequency points gradually decreases from the first number to the second number according to a preset decreasing schedule. The preset training rounds can be set to 5 rounds (ranging from 1 to 10 rounds) to ensure that the rhythm of frequency point pruning matches the training progress.
[0060] In this embodiment, the first quantity refers to the total number of candidate frequency points obtained from the initial sampling, which is determined by the oversampling factor and the final frequency point budget. The oversampling factor can be set to 4 (range 2 to 8) to provide enough candidate frequency points for importance evaluation and screening in the early stages of training. The second quantity refers to the number of candidate frequency points ultimately retained in each adapter after progressive pruning, i.e., the final frequency point budget, which can be set to 500 (range 100 to 8000, adjusted according to the weight matrix size). The first quantity is greater than the second quantity, and the difference between the two reflects the transition process of progressive pruning from candidate exploration to parameter focusing.
[0061] The decreasing schedule can be represented by a smooth decreasing curve in the form of a cubic function. For example, the number of frequency points retained at the t-th pruning round is: , Where k is the second quantity and nK is the first quantity. End of pruning cycle for frequency points (e.g.) It can be set to half of the total number of training rounds, such as when the total number of rounds is 50. (Can be set to 25). The decreasing schedule decreases rapidly in the early stages of pruning, quickly reducing the number of frequency points to eliminate obviously inefficient candidate frequency points. In the later stages of pruning, the decrease gradually flattens out, allowing the model to have enough iterations to fully verify the importance of the remaining candidate frequency points, avoiding the accidental deletion of potential key frequency points due to excessively rapid pruning.
[0062] Taking the discrimination of basal cell carcinoma in dermoscopy images as an example, basal cell carcinoma often presents with pearly margins and dendritic vessels. These features may correspond to multiple frequency points in the mid-frequency and highest-frequency sub-bands in the frequency domain. The progressive pruning process can explore effective frequency point combinations related to basal cell carcinoma features in the early stage of training by using a large number of candidate frequency points. In the later stage of training, through multiple iterations, the parameters are gradually focused on the confirmed key frequency points, thereby achieving accurate capture of basal cell carcinoma discrimination information.
[0063] In this embodiment, the importance assessment and progressive pruning sub-steps work closely together to achieve refined screening and dynamic scheduling of frequency-level parameters. In the early stages of training, by retaining a large number of candidate frequencies, the model can fully explore effective frequency combinations related to various skin tumor characteristics. As training progresses, importance assessment and progressive pruning gradually concentrate parameters on key frequencies confirmed through multiple iterations, enabling the model to have a stronger adaptive capture capability for the discriminative features of different types of skin tumors such as melanoma, basal cell carcinoma, and squamous cell carcinoma.
[0064] In this embodiment of the application, in step S400, after training is completed, the second number of frequency points in each adapter are retained, adapters that are lower than the preset threshold are deleted according to the final value of the gating parameter, and the retained spatial domain incremental weights are merged with the frozen weights to obtain the deployment model.
[0065] When merging the retained spatial domain incremental weights and frozen weights to obtain the deployment model, a merged storage method can be adopted. This involves adding the product of the retained adapter scaling factor, learnable gating parameter, and spatial domain incremental weights to the corresponding frozen weights and merging them for storage. This merged storage method ensures that the inference structure of the deployment model is completely consistent with the original visual base model, without adding any extra adapter branch computations. Therefore, the inference latency is comparable to the original base model, meeting the real-time requirements of batch screening of dermoscopic images. This method is particularly suitable for primary healthcare scenarios with limited computing resources, enabling rapid inference without additional hardware support.
[0066] In scenarios requiring flexible multi-task deployment, a separate saving approach can be adopted. This involves saving the sparse coefficient coordinates and values of the visual base model and the adapter separately, without pre-merging them. This separate saving method allows the same frozen visual base model to independently save small-volume adaptation parameters for different skin tumor data sources, different hospitals, or different classification tasks. This enables flexible switching and rapid deployment across multiple scenarios without repeatedly transferring or loading the complete base model. For example, adaptation parameters trained at Hospital A can be independently saved and deployed to Hospital B. Hospital B does not need to retrain; it only needs to load the adaptation parameters to complete model adaptation, thus achieving rapid sharing and reuse of model parameters across different medical institutions.
[0067] A preset threshold is used to determine whether an adapter should be retained. This preset threshold can be a fixed value or a configurable threshold determined based on the final value distribution of the gating parameters. It's understood that the final value of the gating parameters reflects the actual contribution of each adapter to the classification task after training. If the preset threshold is determined based on the final value distribution of the gating parameters, the threshold can be adaptively set according to the statistical distribution of all adapter gating values after training, such as using the median or a certain quantile of all gating values as the threshold, thus avoiding the subjectivity of manually setting the threshold. During final deployment, adapters with gating values below the threshold are deleted, while those with gating values above the threshold are retained, achieving a reasonable balance between maintaining classification accuracy and storage efficiency in model deployment.
[0068] Taking a multi-hospital collaborative deployment scenario as an example, dermoscopic images from different hospitals differ in acquisition equipment, lighting conditions, and patient population distribution, requiring separate model adaptation for each hospital. By storing these separately, the visual baseline model trained at the central hospital can be used as a foundation, while each branch hospital independently stores its adaptation parameters and corresponding sparse coefficient coordinates and values. Branch hospitals only need to load the adaptation parameters to complete model deployment. During model updates, only the adaptation parameters need to be updated, without retransmitting or loading the complete baseline model. This significantly reduces the transmission costs and storage overhead of multi-hospital deployments, facilitating the large-scale promotion and application of dermoscopic image classification methods in real-world clinical scenarios.
[0069] like Figure 2 As shown, Figure 2 The adapter structures of two efficient parameter fine-tuning methods were compared.
[0070] Figure 2 (a) shows the LoRA adapter structure, where the input embedding k1 is processed by frozen pre-trained weights to obtain the first intermediate result. Simultaneously, the input embedding k1 is processed by the product of two low-rank matrices A and B in the trainable LoRA layer (where the elements of matrix A follow a mean of 0 and a variance of σ). 2 The incremental features are obtained by following a normal distribution with rank r and matrix B initialized to 0. The first intermediate result is added element-wise to the incremental features to obtain the output embedding k2.
[0071] Figure 2(b) is the frequency domain fine-tuning structure of this embodiment. The input embedding k1 is processed by frozen pre-trained weights to obtain a second intermediate result. Simultaneously, the input embedding k1 is adjusted by a Sigmoid gate unit before entering the frequency domain fine-tuning layer. This frequency domain fine-tuning layer includes a trainable frequency domain sparse matrix and an inverse discrete wavelet transform (IDWT). The frequency domain sparse matrix consists of coefficients n and sub-band weights, including LL, LH, HL, and HH sub-bands. The coefficients n correspond to the trainable wavelet sparse coefficients of the candidate frequency points in each sub-band. The frequency domain sparse matrix is processed by the inverse discrete wavelet transform to generate spatial domain incremental weights ΔW. These incremental weights ΔW are then multiplied element-wise by a scaling factor α and a gate value g. After that, it is added element-wise to the frozen pre-trained weights. ) Obtain effective weights Finally, the input embedding k1 is multiplied by the effective weights W to obtain the output embedding k2.
[0072] Specifically, LoRA reduces the number of trainable parameters through low-rank decomposition, but its expressive power is constrained by the integer rank r. When the incremental weights need to express complex dermoscopic lesion features, the loss of expressive power caused by low-rank decomposition will affect the classification accuracy. In this embodiment, a sparse matrix is constructed in the wavelet domain through a frequency domain fine-tuning layer, and incremental weights that are not constrained by low rank are generated through inverse discrete wavelet transform. This enables high-rank expression with a smaller number of parameters, and the contribution strength of the adapter is adaptively controlled by a sigmoid gating unit.
[0073] The frequency domain fine-tuning layer used in the embodiments of this application and Figure 2(a) shows a fundamental difference in LoRA structure: LoRA constructs incremental features through low-rank matrix multiplication, and its effective weights are constrained by rank r; the embodiments of this application generate incremental weights by setting sparse coefficients in the wavelet domain and generating them through inverse discrete wavelet transform, which is not constrained by low-rank decomposition. Meanwhile, in the frequency point initialization stage, this application embodiment allocates different initial sampling amounts of candidate frequency points to different sub-bands based on the frequency physical characteristics of each sub-band (as described in step S200 above, the initial sampling amount of the low-frequency sub-band is greater than that of the mid-to-high-frequency sub-band, and the initial sampling amount of the mid-frequency sub-band is greater than that of the highest-frequency sub-band), so that the initial parameter distribution matches the frequency domain physical characteristics of the dermoscopy image; during the training process, the importance of each candidate frequency point is dynamically evaluated based on the correlation between the classification loss and the wavelet sparse coefficients, and progressive pruning is performed (as described in step S300 above, the importance is determined by the product of the gradient magnitude and the coefficient magnitude, and is supplemented by exponential moving average smoothing, and the number of frequency points is gradually compressed after sorting according to a preset period); and this application embodiment optimizes the classification loss and the gated sparse regularization term together, so that the gate value of the low contribution adapter automatically approaches zero during the training process, and finally deletes the low contribution adapter based on the final value of the gate parameter, and merges the retained spatial domain incremental weights and frozen weights to achieve deployment with zero additional inference latency. The embodiments of this application, through the synergistic use of the above-mentioned technical means, further improve the efficiency of parameter utilization and classification accuracy, enabling them to achieve superior performance compared to the comparison methods in multiple medical image classification tasks.
[0074] In this embodiment, the specific configurations of the wavelet transform, frequency pruning, and gated pruning parameters are as follows: The wavelet basis is Haar wavelet, the oversampling factor n is set to 4, the final frequency K is set to 500, and the pruning period... Set to 5 rounds, importance smoothing coefficient β is set to 0.9, and gating sparsity coefficient is set to... Set to 1×10 -4 The gating threshold τ is set to 0.5, and the focus loss factor γ is set to 2. The specific values of the above parameters are shown in Table 2.
[0075] Table 2 Wavelet, Pruning, and Loss Parameters
[0076] During training, only wavelet coefficients, gating parameters, and classification head parameters are set as trainable parameters, and other parameters are not calculated or updated; the model with the best balance between accuracy and macro-average AUC on the validation set is saved in each round.
[0077] To verify the technical effectiveness of the embodiments of this application, performance comparison experiments were conducted on three publicly available medical image datasets, and the embodiments of this application were compared with various existing parameter-efficient fine-tuning methods. The three datasets are the APTOS 2019 diabetic retinopathy grading dataset, the ISIC skin lesion image dataset, and the Chest X-Ray chest X-ray pneumonia detection dataset. The comparison methods include full-parameter fine-tuning (FFT), linear probing, bias fine-tuning (BitFit), low-rank adaptation (LoRA) and its improved variants (RSLoRA, AdaLoRA, DoRA), sparse high-rank adaptation (SHiRA), Fourier domain fine-tuning (FourierFT), and wavelet domain fine-tuning (WaveFT). The comparison metrics include the number of trainable parameters, accuracy (Acc), and AUC. Experimental data are shown in Table 3.
[0078] Table 3. Performance comparison of each method on three medical image datasets.
[0079] As shown in Table 3, the number of trainable parameters in this embodiment is 0.101M, the smallest among all compared methods, far lower than FourierFT and WaveFT's 0.485M, and even lower than LoRA and its variants' approximately 2.4M trainable parameters. On the APTOS dataset, the accuracy of this embodiment is 83.69%, and the AUC is 94.57%, outperforming all PEFT methods and approaching the 84.36% and 96.09% of full parameter fine-tuning (FFT). On the ISIC skin lesion dataset, the accuracy of this embodiment is 93.98%, and the AUC is 99.26%, outperforming all PEFT methods and approaching the 94.08% and 99.34% of full parameter fine-tuning (FFT). On the Chest X-Ray dataset, the accuracy of this embodiment is 97.75%, and the AUC is 99.68%, also outperforming all PEFT methods and second only to the 98.28% and 99.80% of full parameter fine-tuning (FFT).
[0080] like Figure 3 As shown, to verify the parameter efficiency of the embodiments of this application, the embodiments of this application were compared among different efficient parameter fine-tuning methods. Figure 3 The horizontal axis represents the number of trainable parameters (in millions), and the vertical axis represents accuracy (in %). Figure 3As can be seen, the embodiments of this application achieved a maximum accuracy of approximately 84% with a trainable parameter count of 0.101M. In comparison, LoRA and its variants have a trainable parameter count of approximately 2.4M to 2.5M, while FourierFT and WaveFT have a trainable parameter count of 0.485M, all of which are significantly higher than the embodiments of this application. Figure 3 The results show that the embodiments of this application achieve a classification accuracy superior to all comparative methods when the number of trainable parameters is much smaller than that of the comparative methods, thus realizing a simultaneous improvement in parameter efficiency and classification performance.
[0081] like Figure 4 As shown, to further verify the robustness of the embodiments of this application under different frequency budgets, the embodiments of this application were compared with FourierFT and WaveFT on three datasets: APTOS 2019, ISIC, and Chest X-Ray, with different numbers of sampling points K. Figure 4 The three subplots each have the number of sampling points K on the horizontal axis and the accuracy on the vertical axis. Figure 4 As can be seen, on all three datasets, the embodiments of this application outperform FourierFT and WaveFT at all sampling point K values. Particularly when the K value is low (e.g., K=500), the accuracy of the embodiments of this application is significantly higher than the comparative methods. Furthermore, the embodiments of this application reach a high performance saturation point when the K value reaches 2000 to 3000, while the comparative methods require a larger K value to achieve a similar level. This demonstrates that the importance-aware sampling strategy of the embodiments of this application, based on classification loss and frequency physical characteristics, can efficiently identify the frequency points that contribute most to the classification task with fewer sampling points, maintaining excellent classification performance even with a low parameter budget.
[0082] Table 4. Comparison of classification performance of different sampling strategies on the APTOS 2019 dataset
[0083] As shown in Table 4, this embodiment further compares the impact of different sampling strategies on classification performance on the APTOS 2019 dataset. Table 4 shows the performance comparison results of different sampling strategies on the APTOS 2019 dataset. As can be seen from Table 4, the accuracy of random sampling is 82.82%, and the AUC is 94.12%; the accuracy of fixed-ratio sampling is 82.08%, and the AUC is 93.89%; while the accuracy of the importance-aware sampling strategy used in this embodiment is 83.69%, and the AUC is 94.57%. The accuracy and AUC of this embodiment are both superior to those of random sampling and fixed-ratio sampling. This experimental result verifies the effectiveness of the technique used in this embodiment, which assigns different initial sampling amounts of candidate frequencies to different sub-bands based on the frequency physical characteristics of each sub-band, and dynamically determines the importance of each candidate frequency by combining the correlation between classification loss and wavelet sparsity coefficients.
[0084] Table 5 Comparison of adapter parameter quantity and number before and after gated pruning (ISIC dataset)
[0085] As shown in Table 5, the embodiments of this application further verified the actual effect of gated pruning in the deployment stage on the ISIC dataset. Table 5 shows the comparison results of the number of adapter parameters and the number of adapters before and after gated pruning. As can be seen from Table 5, without gated pruning, the number of adapter parameters is 120.09K and the number of adapters is 96; after gated pruning, the number of adapter parameters is 51.29K and the number of adapters is 41, with both the number of parameters and the number of adapters reduced by more than half. This experimental result verifies the effectiveness of the technical means of deleting low-contribution adapters based on the final value of gated parameters in the deployment stage in practical applications. Through gated pruning, the inference structure of the deployed model is completely consistent with the original visual base model, achieving lightweight deployment with zero additional inference latency, while significantly reducing the storage overhead required for model storage.
[0086] The experimental data above show that the embodiments of this application have achieved a significant improvement in parameter efficiency, achieving classification performance close to that of full parameter fine-tuning with fewer trainable parameters. This verifies the effectiveness of the techniques proposed in the embodiments of this application, such as biased initialization based on frequency physical characteristics, dynamic frequency point evaluation and progressive pruning driven by classification loss, and joint optimization of gating and sparse regularization.
[0087] To facilitate understanding of the evaluation indicators in the above performance comparison experiments, Table 6 provides the definitions and calculation methods for each indicator.
[0088] Table 6 Definition of Evaluation Indicators
[0089] To further verify the interpretability of the embodiments of this application, LoRA, fixed-sampling WaveFT, and Grad-CAM or attention heatmaps of the embodiments of this application were generated for the same dermoscopy image. The heatmaps were compared to see if the heatmap covered lesion boundaries, asymmetric areas, pigment grids, and abnormal blood vessels. Two or more dermatologists scored the results in a blinded state. This score can be used as supplementary evidence and does not replace quantitative classification indicators.
[0090] like Figure 5 As shown, based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also discloses an electronic device, including a memory 1020, a processor 1010, and a computer program stored on the memory 1020 and running on the processor 1010. When the processor 1010 executes the computer program, it implements the dermoscopic image classification method described in any of the above embodiments.
[0091] Specifically, the electronic device includes a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected within the device via the bus 1050.
[0092] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor 1010, application-specific integrated circuit (ASIC), GPU (Graphics Processing Unit), or one or more integrated circuits, to execute the computer program stored in the memory 1020 to implement the dermoscopy image classification method provided in this application embodiment. By executing the computer program, the processor 1010 can drive the device to complete the method flow described in the preceding steps, including constructing a wavelet domain adapter at the candidate weight matrix of the frozen visual base model, allocating initial sampling amounts of candidate frequency points in the two-dimensional wavelet coefficient space based on the frequency physical characteristics of each sub-band, setting learnable gating parameters for each adapter and jointly optimizing the classification loss and gating sparsity regularization term, performing progressive pruning, merging the retained spatial domain incremental weights with the frozen weights to form a deployment model, and inputting the dermoscopy image to be tested into the deployment model to obtain the classification result.
[0093] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this application are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and implemented by the processor 1010.
[0094] The input / output interface 1030 is used to connect input / output modules to enable information input and output. Input / output modules can be configured as components within the device or connected externally to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, projectors, speakers, vibrators, indicator lights, etc. In clinical applications, doctors can input dermoscopic images of the subject through the input device and view the classification results through the output device.
[0095] The communication interface 1040 is used to connect the communication module to enable communication and interaction between this device and other devices. The communication module can communicate via wired means (e.g., USB (Universal Serial Bus), network cable, etc.) or wireless means (e.g., mobile network, WIFI (Wireless Fidelity), Bluetooth, etc.). The communication interface 1040 enables the electronic device to interact with dermatoscope acquisition equipment or hospital information systems, receiving dermatoscope images and transmitting classification results to a terminal or server.
[0096] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0097] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all of the above-described components.
[0098] The electronic device described in the above embodiments is used to implement the corresponding dermoscopic image classification method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments. That is, through dual adaptive sparsity at the frequency point level and the adapter level, the limited parameters are dynamically concentrated at the position that contributes most to the classification task, effectively improving parameter utilization efficiency and classification accuracy, suppressing the risk of overfitting under long-tail distribution conditions, and achieving lightweight inference with zero additional inference latency in the deployment stage.
[0099] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also discloses a computer-readable storage medium storing a computer program thereon, which, when executed by processor 1010, implements the dermoscopic image classification method described in any of the above embodiments.
[0100] The computer-readable storage medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer-readable storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0101] The computer instructions stored in the storage medium of the above embodiments are used to enable the computer to implement the dermoscopic image classification method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments. That is, through the combination of multi-level technical means such as biased initialization, dynamic frequency point evaluation, progressive pruning, joint optimization of gating and sparse regularization, and lightweight deployment, the frozen visual basic model can adapt to the uneven frequency domain distribution of lesion information in dermoscopic images by only updating wavelet sparse coefficients and gating parameters, effectively suppressing the risk of overfitting under long-tail distribution conditions, and achieving lightweight inference with zero additional inference latency in the deployment stage.
[0102] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0103] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A dermoscopic image classification method based on importance-aware wavelet adaptive fine-tuning, characterized in that, include: A wavelet domain adapter is constructed at at least one weight matrix of the frozen visual fundamental model that participates in feature transformation; wherein the visual fundamental model is used for feature extraction of a two-dimensional image; In the two-dimensional wavelet coefficient space, different initial sampling amounts of candidate frequency points are assigned to different sub-bands based on the frequency physical characteristics of each sub-band. Sampling is performed according to the initial sampling amounts to obtain a first number of candidate frequency points. Trainable wavelet sparse coefficients are set for the candidate frequency points. Spatial domain incremental weights are obtained by inverse discrete wavelet transform, which are directly mapped by the wavelet sparse coefficients. Learnable gating parameters are set for each adapter, the importance of each candidate frequency point is determined based on the correlation between the classification loss and the wavelet sparse coefficients, and progressive pruning from the first number to the second number is performed on the candidate frequency points in the same adapter based on the importance, and the classification loss for the classification task and the sparsity regularization term for the gating parameters are jointly minimized. After training, the second number of frequency points in each adapter are retained. According to the final value of the gating parameter, adapters below the preset threshold are deleted, and the retained spatial domain incremental weights are merged with the frozen weights to obtain the deployment model. The dermoscopic image to be tested is input into the deployment model to obtain the classification result.
2. The dermoscopic image classification method according to claim 1, characterized in that, The determination of the importance of each candidate frequency point based on the correlation between the classification loss and the wavelet sparse coefficients includes: Using the product of the gradient magnitude of the classification loss with respect to the wavelet sparse coefficients and the magnitude of the wavelet sparse coefficients as the basic importance, an exponential moving average is used to smooth the basic importance to obtain the importance of the candidate frequency points; the formula for calculating the exponential moving average is: ; in, Let k be the importance of the k-th candidate frequency point within the i-th adapter in the t-th training round. The wavelet sparse coefficients of the candidate frequency points, For the classification loss, β represents the importance of the previous round, and β is the smoothing coefficient.
3. The dermoscopic image classification method according to claim 1, characterized in that, The progressive pruning includes: Every preset training round, the candidate frequency points within the same adapter are sorted from highest to lowest importance, and candidate frequency points with lower importance are deleted, so that the number of frequency points gradually decreases from the first number to the second number according to a preset decreasing schedule; the decreasing schedule is as follows: ; in, Let k be the number of frequency points retained in the t-th pruning round, k be the second number, and nK be the first number. The frequency pruning cycle ends.
4. The dermoscopic image classification method according to claim 1, characterized in that, The allocation of different initial sampling amounts for candidate frequency points to different sub-bands includes: The initial sampling amount of the low-frequency sub-band is greater than that of the mid-to-high-frequency sub-band, and the initial sampling amount of the mid-frequency sub-band in the mid-to-high-frequency sub-band is greater than that of the highest frequency sub-band.
5. The dermoscopic image classification method according to claim 1, characterized in that, The classification loss is a weighted focus loss, where the weights are inversely correlated with the class frequency, and a focus factor is introduced into the weighted focus loss; the formula for calculating the weighted focus loss is: ; in, Let the weight of the j-th category be , γ is the predicted probability of the j-th category, and γ is the focusing factor.
6. The dermoscopic image classification method according to claim 1, characterized in that, The candidate weight matrix is located in at least one of the feature projection layers before the attention query projection layer, key projection layer, value projection layer, output projection layer, feedforward network layer, point convolutional layer, or classification head of the visual base model, and the visual base model is a visual Transformer model or a ConvNeXt model.
7. The dermoscopic image classification method according to claim 1, characterized in that, After acquiring the dermoscopic image set, the training set, validation set, and test set are divided according to patient identification or lesion identification so that multiple images of the same lesion are in the same dataset. Before the training phase and before the inference phase, the dermoscopic images are preprocessed, and the preprocessing includes at least one of hair artifact suppression, scale artifact suppression, bubble artifact suppression, color constancy, and lesion region cropping.
8. The dermoscopic image classification method according to claim 1, characterized in that, The step of merging the retained spatial domain incremental weights with the frozen weights to obtain the deployment model includes: The product of the scaling factor corresponding to the retained adapter, the learnable gating parameter, and the spatial domain incremental weight is added to the corresponding frozen weight and stored together; or, The coordinates and values of the sparse coefficients of the visual base model and the adapter are saved respectively; the preset threshold is a configurable threshold determined based on the final value distribution of the gating parameters.
9. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the dermoscopic image classification method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the dermoscopic image classification method as described in any one of claims 1 to 8.
