A Diabetic Foot Image Classification System and Method Based on Few-Sample Learning

The diabetic foot image classification system, which learns from few samples, uses data augmentation and feature extraction modules to generate an expanded dataset. Combined with an attention mechanism, it solves the problems of scarce labeled data and insufficient capture of lesion features, thereby improving classification accuracy and generalization ability and adapting to the dynamic changes of lesions.

CN120635547BActive Publication Date: 2025-12-02BEIJING SHIJITAN HOSPITAL CAPITAL MEDICAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510715661.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-12-02
Estimated Expiration
2045-05-30

AI Technical Summary

Technical Problem

Existing technologies for classifying diabetic foot images suffer from problems such as scarce labeled data, insufficient ability to capture lesion features, poor adaptability to background noise interference and dynamic changes, resulting in low classification accuracy. In particular, they are unable to meet the clinical needs of early lesion screening and disease stage segmentation in small sample scenarios.

Method used

A diabetic foot image classification system based on few-shot learning is adopted. An expanded dataset is generated through a data augmentation module. The global semantic and local detail features are extracted using the ResNet-101 backbone network. Combined with dual-pool channel attention and enhanced spatial attention mechanisms, the category prototype is dynamically adjusted to achieve accurate focusing and classification of lesion areas.

Benefits of technology

It improves classification accuracy under small sample conditions, solves the problem of scarce labeled data, enhances the ability to capture multi-scale features, suppresses background noise interference, and improves the generalization ability to new categories and early lesions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635547B_ABST
    Figure CN120635547B_ABST
Patent Text Reader

Abstract

This invention provides a diabetic foot image classification system and method based on few-shot learning. The system includes: a data augmentation module for weighted fusion of training images and similar images of diabetic foot images to generate an expanded dataset; a feature extraction module for ResNet-101 backbone network feature extraction processing on the expanded dataset generated by the data augmentation module to generate a feature tensor containing global semantics and local details; an attention enhancement module for dual-pool channel attention and enhanced spatial attention processing on the feature tensor generated by the feature extraction module to generate an attention-enhanced feature map focusing on the lesion region; and a classification module for dynamic prototype aggregation processing of the attention-enhanced feature map generated by the attention enhancement module to classify the diabetic foot images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing, and more particularly to a diabetic foot image classification system and method based on few-shot learning. Background Technology

[0002] In the clinical diagnosis of diabetic foot, medical image classification is an important tool for assessing the severity of lesions. With the development of deep learning technology, image recognition-based classification models have shown certain application potential in the diagnosis of diabetic foot, but they face a significant challenge in practical applications due to the scarcity of labeled data. Diabetic foot lesions are characterized by large individual differences and subtle early features. Obtaining a large number of high-quality labeled images requires significant clinical resources. Traditional deep learning models, due to their reliance on large-scale labeled data, are prone to overfitting in small sample scenarios, leading to a significant decrease in classification accuracy.

[0003] Currently, existing diabetic foot image classification schemes mainly suffer from the following technical bottlenecks: First, traditional data augmentation methods (such as rotation and cropping) can only change the geometric properties of the image and are difficult to preserve the semantic features of the lesion area, resulting in insufficient effectiveness of augmented data; Second, conventional feature extraction networks lack the ability to capture multi-scale features of diabetic foot lesions, especially in taking into account both the global lesion distribution and local subtle features (such as ulcer edge texture); Third, existing attention mechanisms have limited ability to focus on lesion areas in complex backgrounds and are easily affected by noise from skin texture, shooting environment, etc.; Fourth, classification models based on static prototypes cannot adapt to the dynamic changes of diabetic foot lesions and have weak generalization ability for new categories or early lesions.

[0004] The aforementioned technical issues result in low classification accuracy of existing systems for diabetic foot lesions under small sample conditions, making it particularly difficult to meet the clinical needs of early lesion screening and disease stage segmentation. Improving the model's feature representation and classification capabilities for diabetic foot images with limited labeled data has become a pressing technical challenge in this field. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a diabetic foot image classification system and method based on few-shot learning, so as to at least partially solve the above problems.

[0006] According to a first aspect of the present invention, a diabetic foot image classification system based on few-shot learning is provided, comprising:

[0007] The data augmentation module is used to perform weighted fusion of training images and similar images on diabetic foot images to generate an expanded dataset;

[0008] The feature extraction module is used to perform ResNet-101 backbone network feature extraction processing on the augmented dataset generated by the data augmentation module, generating a feature tensor that includes global semantics and local details.

[0009] The attention enhancement module is used to perform dual-pool channel attention and enhanced spatial attention processing on the feature tensors generated by the feature extraction module to generate attention-enhanced feature maps that focus on the lesion region.

[0010] The classification module performs dynamic prototype aggregation processing on the attention-enhanced feature maps generated by the attention-enhancing module to classify diabetic foot images.

[0011] Optionally, when the data augmentation module performs weighted fusion of training images and similar images on diabetic foot images to generate an expanded dataset, it performs the following steps:

[0012] Training images and similar images are sampled from diabetic foot images. The training images and similar images are then weighted and fused to generate deformed images. Based on this, an expanded dataset is generated, which includes deformed images and diabetic foot images.

[0013] Optionally, when the data augmentation module samples training images and similar images from diabetic foot images, performs weighted fusion on the training images and similar images to generate deformed images and accordingly generates an augmented dataset, which includes deformed images and diabetic foot images, the following steps are performed:

[0014] Identify the base class images for diabetic foot images and construct a few-shot learning paradigm based on the base class images;

[0015] Based on the few-shot learning paradigm, diabetic foot images are sampled to obtain training images;

[0016] Nearest neighbor retrieval is performed in the feature space based on training images to determine lesion features and generate similar images accordingly.

[0017] The training images and similar images are linearly superimposed with weights to generate deformed images, and the augmented dataset is generated accordingly.

[0018] Optionally, when the data augmentation module performs a weighted linear superposition of training images and similar images to generate deformed images and thereby generates an augmented dataset, it performs the following steps:

[0019] Weighted pixel-level fusion is performed on the training image and similar images to generate a preliminary fused image;

[0020] The generated primary fused image is subjected to lesion region masking weighting to generate a deformed image;

[0021] Lesion semantic annotations were performed on deformed images and diabetic foot images to generate an expanded dataset.

[0022] Optionally, when the feature extraction module performs ResNet-101 backbone network feature extraction processing on the augmented dataset generated by the data augmentation module to generate a feature tensor containing both global semantics and local details, the following steps are performed:

[0023] Based on the ResNet-101 backbone network, feature extraction is performed on the augmented dataset to obtain three-dimensional feature vectors. Where H / W is the feature map size and C is the number of channels;

[0024] The 3D feature vector is decomposed into multiple local descriptors, each corresponding to a fine-grained feature of an image patch, to generate a feature tensor that includes both global semantics and local details.

[0025] Optionally, when the feature extraction module decomposes the three-dimensional feature vector into multiple local descriptors, each local descriptor corresponding to fine-grained features of an image patch, to generate a feature tensor that includes global semantics and local details, the following steps are performed:

[0026] Convolutional operations are performed on 3D feature vectors using convolutional kernels with different receptive fields to generate multi-scale feature mapping sets.

[0027] The feature map at each scale is divided into grids of different sizes, and max pooling or average pooling operations are performed on the features within each grid to generate spatial pyramid features.

[0028] The spatial pyramid features are segmented into sliding windows of fixed size, and the features within each window are compressed into vectors of fixed dimensions through a fully connected layer to generate multiple local descriptors.

[0029] Calculate the semantic self-attention weights among all local descriptors to generate semantic association features;

[0030] Global average pooling and max pooling are performed on the semantic association features to obtain global semantic features;

[0031] The global semantic features are upsampled to generate a feature tensor that includes both global semantics and local details.

[0032] Optionally, when the attention enhancement module performs dual-pool channel attention and enhanced spatial attention processing on the feature tensor generated by the feature extraction module to generate an attention-enhanced feature map focusing on the lesion region, it performs the following steps:

[0033] Adaptive feature reweighting results are generated based on the feature tensors generated by the feature extraction module;

[0034] A channel attention map is generated based on the adaptive feature reweighting result;

[0035] An attention-enhanced feature map focusing on the lesion region is generated based on the channel attention map.

[0036] Optionally, when the attention enhancement module generates an adaptive feature reweighting result based on the feature tensor generated by the feature extraction module, it performs the following steps:

[0037] The feature tensors generated by the feature extraction module are simultaneously subjected to cross-channel autocorrelation calculation and local feature entropy evaluation to obtain a set of channel autocorrelation matrices and a vector of channel entropy values.

[0038] The channel autocorrelation matrix group and the channel entropy vector are concatenated and then processed by attention gating to generate the channel weight vector;

[0039] The feature tensor is scaled using the channel weight vector, and the adaptive feature reweighting result is obtained accordingly.

[0040] Optionally, when the attention enhancement module generates a channel attention map based on the adaptive feature reweighting result, it performs the following steps:

[0041] The adaptive feature reweighting result is processed through independent linear layers to obtain a dual-path output vector;

[0042] The dual-path output vectors are summed element-wise and normalized using the Sigmoid function to generate key feature channel weights. Irrelevant feature channels, including those corresponding to the background, are suppressed, and a channel attention map is generated accordingly.

[0043] Optionally, when the attention enhancement module generates an attention enhancement feature map focusing on the lesion region based on the channel attention map, the channel attention map is mapped to the cross-channel interaction space and the local correlation metric space to calculate the local feature similarity matrix and evaluate the correlation of the lesion region accordingly, and locate the focus label of the diabetic foot lesion region to generate the attention enhancement feature map focusing on the lesion region.

[0044] Optionally, when classifying diabetic foot images, the classification module performs dynamic prototype aggregation processing on the attention-enhanced feature maps generated by the attention-enhancing module, and performs the following steps:

[0045] Measure support features and query features from attention-enhanced feature maps;

[0046] Based on the extracted metric support features and query features, an enhanced perceptual mask is generated;

[0047] Dynamic category prototypes are generated based on enhanced perception masks.

[0048] Dynamic category prototypes are fused to determine the classification of diabetic foot images.

[0049] Optionally, when the classification module extracts metric support features and query features from the attention-enhanced feature map, it performs the following steps:

[0050] Based on the constructed support feature extractor, the attention-enhanced feature map is used to measure support feature extraction.

[0051] Based on the constructed query feature extractor, query features are extracted from the attention-enhanced feature map;

[0052] The extracted metric support features and query features are embedded with prior knowledge features of diabetic foot lesions to generate medical prior-guided metric support features and query features.

[0053] Optionally, when the classification module generates the enhanced-aware mask based on the extracted metric support features and query features, it performs the following steps:

[0054] The metric support features and query features are reshaped to calculate the association strength of each spatial location with the metric support features and query features;

[0055] Based on the correlation strength, a neighborhood index matrix of spatial location is constructed, and the neighborhood index matrix is ​​Gaussian smoothed to obtain a locally smoothed correlation matrix.

[0056] Activation mapping of lesion regions is performed on the local smooth correlation matrix to generate an enhanced perception mask.

[0057] Optionally, when the classification module generates a dynamic category prototype based on the enhanced perception mask, it performs the following steps:

[0058] Spatial dimension masking is performed on the enhanced perception mask to generate an initial category prototype;

[0059] Principal component analysis is used to reduce the dimensionality of the initial category prototype to construct the feature subspace of the dynamic category prototype.

[0060] In the feature subspace, the inter-class distance of the initial class prototype is maximized and the disease stage is dynamically adapted to generate a dynamic class prototype.

[0061] Optionally, when the classification module fuses dynamic category prototypes to determine the classification of diabetic foot images, it performs the following steps:

[0062] Calculate the feature covariance matrix between dynamic category prototypes;

[0063] Calculate the similarity between the dynamic category prototype and the query feature based on the feature covariance matrix;

[0064] Dynamic category prototypes are fused based on similarity to generate weighted category representations;

[0065] The classification decision boundary is constructed based on statistically weighted category representation to determine the classification of diabetic foot images.

[0066] According to a second aspect of the present invention, a method for classifying diabetic foot images based on few-shot learning is provided, comprising:

[0067] Weighted fusion of training images and similar images is performed on diabetic foot images to generate an expanded dataset;

[0068] The augmented dataset is processed by ResNet-101 backbone network feature extraction to generate a feature tensor containing both global semantics and local details.

[0069] The feature tensor is processed with dual-pool channel attention and enhanced spatial attention to generate an attention-enhanced feature map that focuses on the lesion region.

[0070] Dynamic prototype aggregation is performed on attention-enhanced feature maps to classify diabetic foot images.

[0071] The solutions in the embodiments of the present invention have the following beneficial technical effects:

[0072] ① Address the issues of scarce labeled data and overfitting to improve the effectiveness of small sample classification.

[0073] The data augmentation module generates an expanded dataset by weighted fusion of training images and similar images. Unlike traditional geometric transformations (rotation, cropping), this method samples similar images based on feature similarity and fuses them linearly. This preserves the semantic features of diabetic foot lesions and effectively expands the data distribution density in small sample scenarios, reducing the risk of model overfitting. For example, feature nearest neighbor retrieval ensures that the lesion features of similar images are highly consistent with those of the training images. The fused data increases the number of samples while maintaining the continuity of lesion semantics, enabling the model to learn stable lesion feature representations even with limited labeled data.

[0074] ② Enhance multi-scale feature capture capabilities, taking into account both global semantics and local details.

[0075] The feature extraction module employs the ResNet-101 backbone network, whose deep convolutional structure can extract global semantic features (such as the overall distribution of lesions). Combined with the network's hierarchical feature extraction mechanism, it can simultaneously capture the global distribution and subtle local features of diabetic foot lesions. Compared to conventional feature extraction networks, this approach avoids the overhead of designing additional complex multi-scale modules by leveraging the backbone network's inherent multi-scale expressive capabilities. Furthermore, the fusion of global and local features in the feature tensor provides a more comprehensive feature foundation for the subsequent attention mechanism.

[0076] ③ Improve the ability to focus on the lesion area and suppress background noise interference.

[0077] The attention enhancement module achieves precise focusing on lesion areas through hierarchical processing of dual-pool channel attention and enhanced spatial attention. Channel attention generates channel weights using global average pooling and max pooling, suppressing irrelevant channels such as skin texture and shooting environment, and enhancing lesion-related channels such as ulcers and pigmentation. Spatial attention further locates the lesion area; the combination of the two effectively filters complex background noise. For example, in diabetic foot images, this module can automatically weaken background interference such as socks and sheets, focusing attention on the lesion area of ​​the foot and improving the discriminative power of feature representation.

[0078] ④ Adapt to dynamic changes in lesions and enhance the generalization ability of new categories and early lesions.

[0079] The classification module uses dynamic prototype aggregation to generate category prototypes that update with each sample based on attention-enhanced feature maps, rather than static, fixed prototypes. This mechanism dynamically adjusts the prototype representation according to the lesion features of the input image, especially for early, subtle lesions or newly emerging lesion types, improving classification generalization ability through adaptive prototype updates. For example, when encountering an early ulcer of Wagner grade 1, the dynamic prototype can optimize the category representation by incorporating the features of that sample, improving the model's accuracy in identifying similar cases and solving the problem of insufficient generalization ability for new categories in traditional static prototype models. Attached Figure Description

[0080] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0081] Figure 1 This is a schematic diagram of a diabetic foot image classification system based on few-shot learning, according to an embodiment of this application.

[0082] Figure 2 This is a schematic diagram of a diabetic foot image classification method based on few-shot learning provided in this embodiment. Detailed Implementation

[0083] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and thoroughly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art should fall within the protection scope of the present invention.

[0084] It should be understood that the terms "first," "second," and "third," etc., in the claims, specification, and drawings of this disclosure are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "including" as used in the specification and claims of this disclosure indicate the presence of the described features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or sets thereof.

[0085] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this disclosure. As used in this disclosure and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this disclosure and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.

[0086] Figure 1 This is a schematic diagram of a diabetic foot image classification system based on few-shot learning, as an embodiment of this application. Figure 1 As shown, a diabetic foot image classification system based on few-shot learning includes:

[0087] The data augmentation module is used to perform weighted fusion of training images and similar images on diabetic foot images to generate an expanded dataset;

[0088] The feature extraction module is used to perform ResNet-101 backbone network feature extraction processing on the augmented dataset generated by the data augmentation module, generating a feature tensor that includes global semantics and local details.

[0089] The attention enhancement module is used to perform dual-pool channel attention and enhanced spatial attention processing on the feature tensors generated by the feature extraction module to generate attention-enhanced feature maps that focus on the lesion region.

[0090] The classification module performs dynamic prototype aggregation processing on the attention-enhanced feature maps generated by the attention-enhancing module to classify diabetic foot images.

[0091] Optionally, when the data augmentation module performs weighted fusion of training images and similar images on diabetic foot images to generate an expanded dataset, it performs the following steps:

[0092] Training images and similar images are sampled from diabetic foot images. The training images and similar images are then weighted and fused to generate deformed images. Based on this, an expanded dataset is generated, which includes deformed images and diabetic foot images.

[0093] Preferably, in a specific application scenario, the specific technical implementation for generating the dataset is as follows:

[0094] 1. Similar Image Sampling Mechanism (Feature Vector Driven Process)

[0095] For each image in the diabetic foot image database, geometric features (perimeter, area, roundness), color features (mean / variance of ulcer hue in HSV space), and texture features (edge ​​complexity extracted by the LBP operator) of the ulcer region are extracted to form a feature vector of dimension n=12.

[0096] By mapping the feature vectors of all images to Euclidean space, a feature index tree (such as a KD-Tree) is constructed to achieve fast nearest neighbor retrieval.

[0097] For training image I train The feature vectors retrieved by KD-Tree satisfy ‖f(I train )-f(I similar Similar image I of )‖2<τ·Std(f) similar (τ = 1.2 is the similarity threshold), and I is required to be similar. similar Background features (such as shooting angle, foot obstructions) and I train The difference exceeds the threshold δ=0.7, ensuring that the lesions are similar but the backgrounds are diverse.

[0098] 2. Weighted Fusion Transformation Mechanism (Feature Vector-Guided Fusion)

[0099] Using the feature vector f of the training image and similar images train ,f similar Calculate the feature difference vector Δf = f train -f similar By optimizing the TPS transformation parameters, ||f(T(I)| ... similar ))-f train Minimize ||2 to ensure that the features of similar images after geometric transformation are consistent with those of the training images.

[0100] Global fusion weights are generated based on the magnitude of the feature difference vector Δf. Simultaneously, pixel-wise weights are generated by combining the local saliency map M:

[0101] α(x,y)=M(x,y)·(0.7+0.3·α global )+(1-M(x,y))·0.2

[0102] Among them, the weight of the lesion region is dynamically adjusted according to the feature similarity (the more similar the features, the higher the weight of the training image).

[0103] Calculate deformed image I after fusion aug eigenvector f aug The requirement is to satisfy ||f aug -f train If ||2| < 0.5·||Δf||2, otherwise reselect a similar image or adjust the fusion parameters to ensure the consistency of features in the generated data.

[0104] In summary, traditional methods often result in randomly sampled similar images having different ulcer types than the training images (e.g., fusing blister images with ulcer images), leading to semantic confusion in the generated data. This approach, through feature vector nearest neighbor retrieval, ensures that the sampled I... similar with I train Both belong to the same ulcer type (difference in the "ulcer shape" dimension of the feature vector < 0.2). Traditional fusion lacks feature constraints, causing the fused ulcer color features to deviate from the clinical true value; this scheme dynamically adjusts the fusion weights through Δf, making I... aug Ulcer color characteristics (HSV hue dimension) and I train The deviation is less than 5%.

[0105] In addition, when there are only 30 labeled samples, about 40% of the 200 data generated by traditional augmentation are invalid samples (feature vectors differ from any labeled sample by more than 2 standard deviations). This solution controls the invalid sample rate to below 5% through a feature vector verification mechanism, thereby increasing the amount of effective data by 3.2 times and improving the classification accuracy from 60% to 85%.

[0106] Optionally, when the data augmentation module samples training images and similar images from diabetic foot images, performs weighted fusion on the training images and similar images to generate deformed images and accordingly generates an augmented dataset, which includes deformed images and diabetic foot images, the following steps are performed:

[0107] Identify the base class images for diabetic foot images and construct a few-shot learning paradigm based on the base class images;

[0108] Based on the few-shot learning paradigm, diabetic foot images are sampled to obtain training images;

[0109] Nearest neighbor retrieval is performed in the feature space based on training images to determine lesion features and generate similar images accordingly.

[0110] The training images and similar images are linearly superimposed with weights to generate deformed images, and the augmented dataset is generated accordingly.

[0111] In a specific implementation, the above steps are implemented as follows:

[0112] When selecting base class images and constructing the small sample paradigm, images with complete lesions, typical features, and covering multiple types are selected from the diabetic foot image database as base classes. An "N-way K-shot" data framework (e.g., 5 types of lesions, 5 labeled images for each type) that conforms to the clinical small sample diagnosis scenario is constructed to ensure enhanced clinical representativeness of the data.

[0113] In the feature space nearest neighbor retrieval mechanism, a vector containing 18-dimensional lesion features (6-dimensional geometric features + 6-dimensional color features + 6-dimensional texture features) is extracted for each image. The KD-Tree is used to retrieve similar images in the feature space that are less than 1.5 times the feature standard deviation of the training image. At the same time, the background difference is required to be greater than 0.6, so as to achieve the sample selection of "same lesion features but different background".

[0114] In the dynamic weighted linear fusion strategy, the global fusion weight is determined by the feature distance between the training image and similar images: the smaller the feature distance, the higher the weight of the training image (weight is inversely proportional to distance); the local fusion weight is combined with the lesion saliency map: the weight of the lesion area is dynamically adjusted with the global weight (up to 0.8 times the global weight + 0.2), while the background area is fixed with a low weight of 0.3 to ensure the preservation of lesion features and the suppression of background noise;

[0115] When the fused image needs to meet the feature distance constraint: the feature distance between the deformed image and the training image must be less than 0.6 times the feature distance between the training image and similar images to ensure the feature consistency of the generated data.

[0116] Preferably, in a specific application scenario, the above steps are implemented as follows:

[0117] 1. Base class image determination and few-sample paradigm construction

[0118] Base class selection criteria: Images meeting the following conditions were selected from the diabetic foot image database as the base class: lesion integrity: ulcer area occlusion rate <10%, verified by the proportion of mask area generated by the semantic segmentation model; feature typicality: conforming to the clinical Wagner classification criteria (e.g., Wagner grade 2 ulcers must have dermal layer exposure features); data diversity: covering at least 4 major lesion types (ulcer, callus, pigmentation, vascular lesions).

[0119] Small sample paradigm construction: A 5-way 5-shot framework (5 types of lesions, 5 labeled images for each type) is adopted to simulate the small sample scenario during initial clinical diagnosis, ensuring that the subsequent augmented data is consistent with the data distribution in the real diagnostic scenario.

[0120] 2. Nearest neighbor retrieval mechanism based on feature space (high-dimensional feature vector driven process)

[0121] Feature vector construction (d = 18 dimensions) includes: Geometric features (6 dimensions): ulcer area A, perimeter P, and roundness C = 4πA / P 2 Major axis length L, minor axis length W, eccentricity E; Color characteristics (6 dimensions): Hue mean μ of the ulcer region in HSV space. h Mean saturation μ s Mean brightness μ v and standard deviation σ h ,σ s ,σ v Texture features (6-dimensional): ulcer edge roughness R, directionality D, contrast C, and their standard deviation σ extracted by the LBP operator. R ,σ D ,σ C .

[0122] Feature space retrieval process:

[0123] For training image I train Extracting feature vectors

[0124] Construct a KD-Tree index in the feature space to retrieve queries that satisfy ||ff|| train The graph of ||2<τ·Std(f) (τ=1.5, Std(f) is the standard deviation of each dimension of the eigenvector);

[0125] The selected similar images must meet the requirement that the background difference BgDiff > 0.6 (calculated by the difference in HSV color distribution in the background region) to ensure that the lesions are similar but the backgrounds are different.

[0126] 3. Generation of deformed images with weighted linear superposition

[0127] Global weight Where f similar Feature vectors of similar images;

[0128] The local weight α(x,y) is determined by the lesion significance map M(x,y)∈[0,1] (generated by the segmentation model):

[0129] α(x,y)=M(x,y)·(0.8α global +0.2)+(1-M(x,y))·0.3

[0130] Where: 0.8α global +0.2 represents the weight of the lesion area (dynamically adjusted according to feature similarity), and $0.3 represents a fixed low weight for the background area.

[0131] Linear superposition formula: I aug (x,y)=α(x,y)·I train (x,y)+(1-α(x,y))·I similar (x,y)

[0132] The generated deformed image must satisfy ||f aug -f train ||2<0.6·||f train -f similar ‖2(f aug (If the image is a deformed image feature vector, then a similar image is selected; otherwise, a similar image is selected.)

[0133] This solution uses ||f train -f similar The strict screening method using 2 < 1.5·Std(f) ensures matching characteristics of similar lesions. Traditional fusion weights are independent of features, leading to ulcer color feature drift after fusion; this method uses α... global Dynamic adjustments are made to keep the tone shift within 5°, meeting the requirements for clinical image consistency.

[0134] Traditional methods, in 5-way 5-shot scenarios, suffer from low validity rates for the same lesion among the 100 generated data points due to imprecise feature matching. This proposed solution, through feature vector retrieval, significantly increases the proportion of valid data and dramatically improves classification accuracy. When the feature vector dimension d=18, the mismatch rate of KD-Tree retrieval is relatively low.

[0135] Traditional fixed-weight fusion results in a high deviation rate for the geometric features (such as area) of the ulcer region; this solution uses ||f|| aug -f train ||2<0.6·||f train -f similar The ‖2 constraint significantly reduces the area deviation rate and improves the edge roughness feature preservation rate. In the deformed images generated by this scheme, the pixel contrast of the punctate bleed feature is also improved, thus optimizing the model's recognition rate for this feature.

[0136] Traditional methods use a background fusion weight of α = 0.5, resulting in a large proportion of generated images containing significant background interference (such as sock texture). Our proposed solution fixes the background weight at 0.3 and combines it with saliency map filtering, significantly reducing the background interference rate and improving the model's efficiency in extracting features from lesion areas. The data generated by this solution shows a significant reduction in the model's accuracy standard deviation under different background conditions, demonstrating its strong background robustness.

[0137] Optionally, when the data augmentation module performs a weighted linear superposition of training images and similar images to generate deformed images and thereby generates an augmented dataset, it performs the following steps:

[0138] Weighted pixel-level fusion is performed on the training image and similar images to generate a preliminary fused image;

[0139] The generated primary fused image is subjected to lesion region masking weighting to generate a deformed image;

[0140] Lesion semantic annotations were performed on deformed images and diabetic foot images to generate an expanded dataset.

[0141] In summary, pixel-level weighted fusion involves linearly superimposing training and similar images pixel by pixel, with weight allocation following the principle of "preserving features from training images preferentially in lesion areas and introducing diversity from similar images in background areas." Specifically, the fusion weights are dynamically adjusted based on the significant differences in lesion areas within the images: the weight of training images is increased in lesion areas such as ulcers and pigmentation to preserve key diagnostic features; the weight of training images is decreased in areas such as normal skin on the foot and the background to introduce background variations from similar images, thereby expanding the data while avoiding distortion of lesion features.

[0142] During the lesion region masking and weighting process, a pre-generated lesion region mask (such as the ulcer region contour obtained through semantic segmentation) is used to perform secondary weighting optimization on the initial fused image. The core logic of masking and weighting is: based on the lesion boundary defined by the mask, differential weight adjustments are made to the lesion core area, edge area, and background area of ​​the fused image—the core area strengthens the features of the training image to maintain diagnostic information, the edge area balances the features of both to avoid boundary blurring, and the background area further suppresses non-lesion information, ultimately generating a deformed image with clear features and diverse background.

[0143] When implementing the semantic annotation mechanism for lesions, semantic annotation was performed on the generated deformed images and the original diabetic foot images based on clinical diagnostic criteria. The annotation process strictly followed a three-dimensional annotation system based on lesion type (ulcer, callus, etc.), severity (Wagner classification), and anatomical location (sole of foot, interdigital, etc.) to ensure that each sample in the augmented dataset has clear clinical semantic attributes, providing accurate label guidance for subsequent classification.

[0144] Optionally, when the feature extraction module performs ResNet-101 backbone network feature extraction processing on the augmented dataset generated by the data augmentation module to generate a feature tensor containing both global semantics and local details, the following steps are performed:

[0145] Based on the ResNet-101 backbone network, feature extraction is performed on the augmented dataset to obtain three-dimensional feature vectors. Where H / W is the feature map size and C is the number of channels;

[0146] The 3D feature vector is decomposed into multiple local descriptors, each corresponding to a fine-grained feature of an image patch, to generate a feature tensor that includes both global semantics and local details.

[0147] In summary, the ResNet-101 backbone network feature extraction mechanism leverages the hierarchical feature extraction capabilities of its deep convolutional networks to perform multi-scale feature extraction on the augmented diabetic foot images. This network mitigates the vanishing gradient problem in deep networks through residual connection structures, enabling the extraction of features at different levels of abstraction from the image: shallow convolutional layers capture local details such as ulcer edges and color, while deep convolutional layers integrate global semantic information (such as the overall distribution of lesions and anatomical relationships). The final output is a three-dimensional feature vector H×W×C, where H×W corresponds to the feature map space size, C is the number of channels, and each channel represents a semantic or texture feature.

[0148] Furthermore, during feature vector decomposition and local descriptor generation, the three-dimensional feature vector is decomposed into multiple local descriptors according to the spatial dimension. Each descriptor corresponds to the fine-grained features of a specific image patch in the original image. Specifically, the feature map is divided into multiple overlapping or non-overlapping sub-regions using a sliding window approach. Features within each sub-region are aggregated (e.g., average pooling, max pooling) to generate local descriptors. These descriptors can preserve subtle local features such as ulcer edges and bleeding points, and by combining multiple descriptors, a semantic representation of the global distribution of the lesion can be formed, ultimately generating a feature tensor that simultaneously contains global semantics and local details.

[0149] Optionally, when the feature extraction module decomposes the three-dimensional feature vector into multiple local descriptors, each local descriptor corresponding to fine-grained features of an image patch, to generate a feature tensor that includes global semantics and local details, the following steps are performed:

[0150] Convolutional operations are performed on 3D feature vectors using convolutional kernels with different receptive fields to generate multi-scale feature mapping sets.

[0151] The feature map at each scale is divided into grids of different sizes, and max pooling or average pooling operations are performed on the features within each grid to generate spatial pyramid features.

[0152] The spatial pyramid features are segmented into sliding windows of fixed size, and the features within each window are compressed into vectors of fixed dimensions through a fully connected layer to generate multiple local descriptors.

[0153] Calculate the semantic self-attention weights among all local descriptors to generate semantic association features;

[0154] Global average pooling and max pooling are performed on the semantic association features to obtain global semantic features;

[0155] The global semantic features are upsampled to generate a feature tensor that includes both global semantics and local details.

[0156] In summary, the multi-scale feature mapping generation mechanism employs convolutional kernels with different receptive fields to perform parallel convolutions on the three-dimensional feature vectors, capturing the multi-scale features of lesions in diabetic foot images. Small receptive field convolutional kernels (e.g., 3×3) focus on subtle local features such as ulcer edges and bleeding points, while large receptive field convolutional kernels (e.g., 7×7) capture global semantics such as the overall distribution and anatomical location of the lesions, forming a feature mapping set covering different spatial scales, ensuring simultaneous characterization of microulcers (diameter <3mm) and large infected areas.

[0157] In the spatial pyramid feature construction mechanism, feature maps at various scales can be divided into grids of different densities (e.g., 1×1, 2×2, 4×4), and pooling operations are performed on the features within each grid. High-density grids (e.g., 4×4) retain fine-grained information such as ulcer edge texture, while low-density grids (e.g., 1×1) integrate global semantics, forming a pyramid feature that contains multi-scale spatial information. This mechanism enables features to describe both the local edge morphology of the ulcer and its overall positional relationship within the foot.

[0158] In the generation of local descriptors and the enhancement of semantic association, sliding window feature segmentation is used: spatial pyramid features are overlapped and segmented with fixed-size windows (e.g., 16×16 pixels). Each window corresponds to a local region of the original image. The window features are compressed into fixed-dimensional vectors through fully connected layers to generate local descriptors, ensuring that each descriptor focuses on the fine-grained features of a specific image patch (e.g., the color and texture of a local part of an ulcer).

[0159] When calculating semantic self-attention weights, the semantic correlation between all local descriptors can be analyzed. Descriptors that are highly correlated with ulcer lesions (such as descriptors containing bleeding point features) can be given high weights, while the weights of descriptors in normal skin areas can be suppressed. This strengthens the semantic association of lesion features and avoids mutual interference between features of different lesion areas.

[0160] In the mechanism of global semantics and local details fusion, global pooling (average pooling + max pooling) is performed on semantically related features to extract global semantic features that can characterize the overall attributes of the lesion (such as ulcer type and severity). Then, the spatial location information of the global features and local descriptors is aligned through upsampling, and finally a feature tensor containing both global semantics and local details is generated, realizing the dual feature expression of "overall lesion diagnosis - local detail verification".

[0161] Therefore, for complex cases involving both microulcers and large areas of pigmentation, traditional methods often overwhelm microulcer features with global features due to a lack of multi-scale processing. This approach extracts microulcer edges through small receptive field convolution and locates pigmentation areas through large receptive field convolution, combined with spatial pyramid feature fusion, significantly improving classification accuracy for such cases. In this application, the low-density grid (e.g., 1×1) in the spatial pyramid features integrates overall foot anatomical information, and combined with the positional coordinates of sliding window segmentation, accurately encodes features of lesions in different locations such as between the toes and on the sole. This mechanism significantly improves the model's accuracy in distinguishing between "interdigital ulcers" and "plantar ulcers," significantly reducing classification errors caused by location misjudgment. Furthermore, when traditional local features are processed independently, the color and edge features of the ulcer area may be misclassified as irrelevant information. This approach strengthens the semantic association between the two through self-attention weight calculation (e.g., the feature combination of "red ulcer edge"), significantly improving feature discriminative power and significantly enhancing the accuracy in distinguishing between "hemorrhagic ulcers" and "non-hemorrhagic ulcers." Finally, the upsampling operation aligns global semantic features (such as "Wagner grade 2 ulcer") with local detail features (such as fibrin exudation at the base of the ulcer) in spatial dimensions, ensuring consistency between global diagnosis and local details. For example, when the global semantic judgment is "moderate ulcer," the local descriptor can verify whether there are detail features that match this grade, significantly reducing the false positive rate.

[0162] Optionally, when the attention enhancement module performs dual-pool channel attention and enhanced spatial attention processing on the feature tensor generated by the feature extraction module to generate an attention-enhanced feature map focusing on the lesion region, it performs the following steps:

[0163] Adaptive feature reweighting results are generated based on the feature tensors generated by the feature extraction module;

[0164] A channel attention map is generated based on the adaptive feature reweighting result;

[0165] An attention-enhanced feature map focusing on the lesion region is generated based on the channel attention map.

[0166] In summary, this application introduces an adaptive feature reweighting mechanism. For the feature tensor output by the feature extraction module, differentiated weight adjustments are implemented by analyzing the correlation between the features of each channel and diabetic foot lesions. Specifically, each channel of the feature tensor is first subjected to global average pooling and max pooling. The former captures the overall response intensity of the channel, while the latter highlights local peak features (such as the high-frequency response of ulcer edges). Then, the importance of the channels is measured by combining both methods. Channels related to lesions, such as ulcer color and edge texture, are given increased weight, while channels irrelevant to normal skin texture and background noise are given decreased weight. This strengthens the expression of lesion features and suppresses background interference.

[0167] This application also introduces a channel attention map generation mechanism, which further constructs a channel attention map based on adaptively reweighted features: by calculating the cross-channel correlation of each channel feature, it captures the co-activation patterns of lesion features (such as the high-frequency co-activation of the color channel and edge channel in the ulcer area). This mechanism prioritizes the activation of channel combinations highly correlated with diabetic foot lesions (such as ulcers and bleeding points), forming a channel weight distribution that focuses on lesion features, ensuring that lesion-related features are preserved in subsequent processing.

[0168] This application also introduces an attention enhancement mechanism that focuses on lesion regions. The channel attention map is weighted channel-by-channel with the original feature tensor to generate an attention-enhanced feature map. High-weighted channels in the channel attention map correspond to lesion features such as ulcers and bleeding; after weighting, the response intensity of these features is significantly increased. Low-weighted channels correspond to irrelevant information such as normal skin and background; their feature responses are suppressed. The final generated feature map effectively filters out interference from non-lesion regions, making the feature expression of lesion regions more prominent and providing more discriminative input for subsequent classification.

[0169] Therefore, classifying diabetic foot has the following technical advantages.

[0170] 1. Traditional attention techniques are insufficient in focusing on lesion areas in diabetic foot images with backgrounds such as socks and sheets, and are prone to misinterpreting background textures as lesion features. This solution significantly improves the feature response intensity of the ulcer area through dual-channel attention and enhanced spatial attention processing, while effectively suppressing the interference of background noise, making the expression of lesion features clearer in complex backgrounds.

[0171] 2. For early microulcers such as Wagner grade 1, traditional methods are prone to having their features overwhelmed by normal skin features due to insufficient sensitivity of the attention mechanism to subtle features. This approach enhances the activation of subtle features such as the edge and color of microulcers through adaptive reweighting and channel attention maps, which significantly improves the feature expression of early lesions and enhances the detection capability of subtle lesions.

[0172] 3. For complex lesions with both ulceration and pigmentation, traditional techniques are unable to effectively separate the features of different lesion types, leading to classification confusion. This approach uses channel attention mapping to differentially activate channels related to different lesions, which can clearly distinguish the features of ulcer areas and pigmentation areas, reduce mutual interference of features in complex lesions, and significantly improve the feature separation capability.

[0173] 4. Traditional attention mechanisms lack targeted focus on lesions in different anatomical locations of the foot (such as between the toes and on the sole). This approach enhances spatial attention processing and combines the weight distribution of the channel attention map to dynamically adjust the attention focus according to the anatomical location characteristics of the lesion. This improves the accuracy of the model in focusing on the features of lesions in different locations and reduces classification errors caused by misjudgment of location.

[0174] Optionally, when the attention enhancement module generates an adaptive feature reweighting result based on the feature tensor generated by the feature extraction module, it performs the following steps:

[0175] The feature tensors generated by the feature extraction module are simultaneously subjected to cross-channel autocorrelation calculation and local feature entropy evaluation to obtain a set of channel autocorrelation matrices and a vector of channel entropy values.

[0176] The channel autocorrelation matrix set and the channel entropy vector are concatenated and then processed by attention gating to generate the channel weight vector;

[0177] The feature tensor is scaled using the channel weight vector, and the adaptive feature reweighting result is obtained accordingly.

[0178] Specifically, in one application scenario, the above solution is implemented as follows:

[0179] This application introduces a cross-channel autocorrelation calculation and local feature entropy evaluation mechanism. For the feature tensor output by the feature extraction module, the autocorrelation matrix between features of each channel is calculated to capture the co-activation relationship of diabetic foot lesion features (e.g., the correlation between the ulcer color channel and the edge texture channel). By analyzing the correlation between channels, feature combinations highly associated with the lesion are identified, providing a basis for subsequent weight allocation. Local entropy values ​​are calculated for the features of each channel to quantify the uncertainty of the features—features in the lesion area (e.g., ulcer edges) have higher entropy values ​​due to their complex texture, while features in normal skin areas have lower entropy values. Entropy vectors are used to distinguish lesion-related channels from background channels, enhancing the sensitivity to lesion features.

[0180] This application introduces a channel weight vector generation mechanism, which concatenates cross-channel autocorrelation matrices with channel entropy vectors to form a comprehensive feature vector. An attention gating mechanism (such as the sigmoid activation function) filters redundant information, highlighting feature dimensions relevant to the lesion. This mechanism dynamically adjusts the importance weights of each channel based on inter-channel correlation and feature entropy values, suppressing background channels with low entropy and weak correlation, and activating lesion channels with high entropy and strong correlation. The gated feature vector is mapped to a channel weight vector, where each element corresponds to a channel of the feature tensor, and the weight reflects the channel's representational ability for diabetic foot lesions.

[0181] This application also introduces an adaptive feature reweighting mechanism, which uses channel weight vectors to scale the feature tensor channel by channel—increasing the feature response intensity of high-weight channels (such as ulcer color and edge texture channels) while suppressing the features of low-weight channels (such as normal skin and background channels), ultimately generating an adaptive feature reweighting result. This result enhances the co-expression of lesion features while reducing the interference of background noise, providing a more discriminative feature basis for subsequent attention enhancement.

[0182] Therefore, it is evident that the classification of diabetic foot has the following beneficial technical effects.

[0183] 1. Traditional techniques often lead to mutual inhibition of different lesion features when dealing with complex lesions that simultaneously contain ulcers and bleeding, because they do not utilize the correlation between channels. This approach strengthens the synergistic weighting of the ulcer color channel and the bleeding feature channel through cross-channel autocorrelation calculation, making the feature expression of complex lesions more complete and significantly reducing feature confusion.

[0184] 2. For subtle lesions such as Wagner grade 1 microulcers, traditional methods are prone to neglecting features due to the insensitivity of low-response features in the channel weight generation mechanism. This approach assigns higher weights to subtle lesion features with high entropy values ​​(such as the texture of pinpoint bleeding) by evaluating local feature entropy values, thereby improving the feature response intensity of subtle lesions and significantly enhancing detection capabilities.

[0185] 3. In images containing complex backgrounds such as bed sheet textures and sock patterns, traditional techniques struggle to distinguish between background channels and lesion channels. This solution uses both autocorrelation and entropy values ​​as indicators to accurately identify low-entropy background channels and suppress their weights, significantly reducing the interference of background noise on lesion features and improving feature purity.

[0186] 4. Traditional techniques use fixed weights or simple mapping, which cannot adapt to the differences in lesion characteristics of different cases. This scheme dynamically generates channel weights through an attention gating mechanism, which can adaptively adjust the weight allocation for different types of diabetic foot lesions (such as ulcers and pigmentation), making the feature reweighting results more in line with the diagnostic needs of specific cases and improving the adaptability of feature expression.

[0187] Optionally, when the attention enhancement module generates a channel attention map based on the adaptive feature reweighting result, it performs the following steps:

[0188] The adaptive feature reweighting result is processed through independent linear layers to obtain a dual-path output vector;

[0189] The dual-path output vectors are summed element-wise and normalized using the Sigmoid function to generate key feature channel weights. Irrelevant feature channels, including those corresponding to the background, are suppressed, and a channel attention map is generated accordingly.

[0190] In summary, this application introduces a dual-path linear layer feature transformation mechanism. The adaptively reweighted feature results are transformed through two independent linear layers to form a dual-path output vector. Each path uses a different weight matrix to map the input features: one path focuses on capturing global semantic features of diabetic foot lesions (such as the overall distribution of ulcers), while the other focuses on local detail features (such as ulcer edge texture). This dual-path design can extract features from different dimensions, ensuring comprehensive capture of lesion-related information.

[0191] Furthermore, this application introduces a feature fusion and normalization mechanism, which adds the dual-path output vectors element by element, fusing global semantics and local detail features to form a comprehensive feature vector containing multi-dimensional lesion information. The comprehensive feature vector is normalized using the Sigmoid function, mapping the values ​​to the [0,1] interval, so that each element corresponds to a channel weight of the feature tensor—a high value represents that the channel is highly correlated with the lesion, and a low value represents that the channel is associated with irrelevant information such as the background.

[0192] Finally, this application also introduces a channel attention map generation mechanism, which generates channel attention maps based on normalized weight vectors: high-weight channels (such as ulcer color and edge texture channels) are given strong activation, while low-weight channels (such as normal skin and background noise channels) are suppressed. This mechanism retains key feature channels related to the diagnosis of diabetic foot lesions and filters out irrelevant interference channels through weight selection, thereby generating a channel attention map that focuses on lesion features and provides accurate weight guidance for subsequent feature enhancement.

[0193] Therefore, the above solution brings the following beneficial technical effects in the classification of diabetic foot:

[0194] 1. Traditional techniques often fail to capture both global and local bleeding points in complex lesions with large-area ulcers, as a single linear layer cannot capture both global and local features, leading to the neglect of bleeding point features. This approach uses a dual-pathway mechanism to extract the global distribution of ulcers and the local details of bleeding points, making the feature expression of complex lesions more comprehensive and significantly reducing the omission of features.

[0195] 2. In images containing complex backgrounds such as medical equipment and bed sheets, traditional techniques struggle to accurately distinguish between background channels and lesion channels. This solution, through dual-path fusion and normalization, effectively identifies low-weight background channels and suppresses their responses, significantly reducing the interference of background noise on lesion features and improving feature purity.

[0196] 3. For subtle lesions such as Wagner grade 1 microulcers, traditional methods are prone to insufficient feature response due to the insensitivity of local details in the weight generation mechanism. The local detail path in this scheme is highly sensitive to features such as the edge of microulcers. By assigning weights to enhance its response intensity, the feature expression of subtle lesions is significantly improved.

[0197] 4. Traditional techniques use fixed weight generation methods, which cannot adapt to the characteristic differences of different lesion types. This solution dynamically integrates global and local features through dual paths, and can adaptively adjust the weight allocation for different lesion types such as ulcers and pigmentation, making the channel attention map more consistent with the feature distribution of specific lesions and improving the adaptability of feature selection.

[0198] Optionally, when the attention enhancement module generates an attention enhancement feature map focusing on the lesion region based on the channel attention map, the channel attention map is mapped to the cross-channel interaction space and the local correlation metric space to calculate the local feature similarity matrix and evaluate the correlation of the lesion region accordingly, and locate the focus label of the diabetic foot lesion region to generate the attention enhancement feature map focusing on the lesion region.

[0199] In summary, this application introduces a dual-channel spatial mapping mechanism, mapping channel attention maps to a cross-channel interaction space and a local correlation metric space, respectively. The cross-channel interaction space analyzes the synergistic relationships between channel features, capturing feature combinations of diabetic foot lesions (such as the co-activation patterns of ulcer color channels and edge texture channels), forming an inter-channel correlation matrix to identify feature combinations highly associated with the lesion. Based on the local correlation metric space, the feature similarity of each local region in the feature tensor is evaluated. By calculating a pixel-level feature distance matrix, regions with high feature similarity within the lesion area (such as texture consistency in the ulcer core area) are located, while simultaneously distinguishing feature differences between lesions and normal skin.

[0200] Furthermore, when assessing the correlation between lesion regions, a similarity matrix is ​​calculated based on local feature similarity. In the local correlation metric space, the feature similarity between each pixel and its neighboring pixels is calculated, generating a similarity matrix. Pixels within the lesion region exhibit high similarity due to high feature consistency (e.g., texture repetition at ulcer edges), while the boundary between normal skin and the lesion region exhibits low similarity due to significant feature differences. During the lesion correlation assessment, the channel correlation matrix and local similarity matrix in the cross-channel interaction space are combined to comprehensively evaluate the correlation between each region and diabetic foot lesions—regions with high channel correlation and high local feature similarity are identified as the core lesion region, while low-correlation regions are identified as background or normal skin.

[0201] Finally, a focus label generation and feature enhancement mechanism was introduced. When locating focus labels in the lesion area, based on the correlation assessment results, binary focus labels were generated—the core and edge areas of the lesion were marked as highly activated, while the background and normal skin were marked as low-activation. This label accurately locates the spatial position of diabetic foot lesions in the feature map and suppresses interference from irrelevant areas. When generating the attention-enhanced feature map, the focus labels were multiplied element-wise with the original feature tensor. The lesion features in highly activated areas were preserved and enhanced, while the background features in low-activation areas were suppressed. This ultimately generated an attention-enhanced feature map focusing on the lesion area, highlighting the feature expression of key diagnostic areas such as ulcers and bleeding points.

[0202] Therefore, its application in the classification of diabetic foot has achieved beneficial technical results:

[0203] 1. Traditional techniques often confuse different lesion areas when dealing with complex lesions that combine ulcers and pigmentation because they cannot simultaneously handle channel association and spatial distribution. This approach uses dual-channel spatial mapping to locate the spatial positions of ulcers (high color channel activation) and pigmentation (high texture channel activation) separately, which significantly improves the regional separation of complex lesions and reduces feature confusion.

[0204] 2. For the blurred boundary between ulcers and normal skin (such as the early infiltrative area of ​​Wagner grade 1 ulcers), traditional methods often lead to the neglect of boundary region features due to the lack of local feature similarity analysis. This approach enhances the feature differences of boundary pixels through a local similarity matrix, thereby improving the feature response intensity of the lesion boundary and significantly improving the boundary clarity, providing more accurate feature support for lesion grading.

[0205] 3. For small-scale lesions such as interdigital ulcers with small diameter, traditional techniques are prone to missed detection due to insufficient sensitivity to local features caused by the attention mechanism. This solution uses pixel-level similarity calculation in the local correlation metric space, which is sensitive to feature consistency within small-scale lesions and can effectively capture their local features, thus significantly improving the detection capability of small-scale lesions and significantly reducing missed detections.

[0206] 4. In images containing complex backgrounds such as medical equipment and bed sheets, traditional techniques struggle to distinguish the feature correlation between the background and the lesion. This solution filters background-related channels through cross-channel interactive space and suppresses the feature response of the background region by combining local correlation metric space, thereby significantly reducing the interference of background noise on lesion features and improving the purity of the feature map.

[0207] Optionally, when classifying diabetic foot images, the classification module performs dynamic prototype aggregation processing on the attention-enhanced feature maps generated by the attention-enhancing module, and performs the following steps:

[0208] Measure support features and query features from attention-enhanced feature maps;

[0209] Based on the extracted metric support features and query features, an enhanced perceptual mask is generated;

[0210] Dynamic category prototypes are generated based on enhanced perception masks.

[0211] Dynamic category prototypes are fused to determine the classification of diabetic foot images.

[0212] Optionally, when the classification module extracts metric support features and query features from the attention-enhanced feature map, it performs the following steps:

[0213] Based on the constructed support feature extractor, the attention-enhanced feature map is used to measure support feature extraction.

[0214] Based on the constructed query feature extractor, query features are extracted from the attention-enhanced feature map;

[0215] The extracted metric support features and query features are embedded with prior knowledge features of diabetic foot lesions to generate medical prior-guided metric support features and query features.

[0216] To address this, this application introduces a medically prior-guided feature extraction mechanism. Through independently constructed support feature extractors and query feature extractors, support features (representing known lesion categories) and query features (features of the current image to be diagnosed) are extracted from the attention-enhanced feature map for category prototype construction. The extraction process incorporates prior knowledge of diabetic foot lesions, such as the clinical Wagner classification standard and lesion anatomical location features (differences in plantar / interdigital ulcer morphology), to provide semantically guided filtering of features, strengthening key diagnostic features such as ulcer edges and bleeding points while suppressing irrelevant information such as normal skin texture. The prior knowledge of the lesion is transformed into a weight mask along the feature dimension; for example, channels conforming to Wagner grade 2 ulcer features are assigned high weights, while feature channels unrelated to diabetic foot (such as background color) are assigned low weights, making the extracted support and query features more aligned with clinical diagnostic needs.

[0217] Furthermore, this application introduces an enhanced perceptual mask generation mechanism. Based on medical prior knowledge-guided supporting features and query features, a feature similarity matrix is ​​calculated between the two to generate an enhanced perceptual mask. This mask measures the semantic correlation between the query features and each supporting feature, locating regions within the query features that are highly correlated with known lesion categories—high-similarity regions correspond to core lesion features (such as the matching of ulcer color and grading features), while low-similarity regions correspond to background or atypical features. The mask generation process incorporates prior lesion knowledge, prioritizing the activation of feature associations that conform to clinical diagnostic logic and suppressing abnormal feature matching.

[0218] This application introduces a dynamic category prototype generation mechanism that utilizes enhanced perceptual masks to weighted aggregate supporting features, generating dynamic category prototypes. Unlike traditional static prototypes, this prototype adaptively adjusts based on the pathological characteristics of the current query features: if the query features include early ulcer features, the prototype strengthens the feature expression of microulcers; if it includes infection features, it enhances the weight of related features such as purulent coating, making the prototype more closely resemble the feature distribution of the current case to be classified. The generation of dynamic prototypes is constrained by prior knowledge of diabetic foot lesions; for example, prototype features must conform to clinical rules such as the "co-existence of ulcer area color features and edge features," avoiding the generation of prototypes that do not conform to medical logic.

[0219] This application introduces a prototype fusion and classification mechanism. Similarity is calculated between dynamically generated prototypes of each category and query features, and the final classification result is determined through weighted fusion. The fusion process incorporates category associations from prior knowledge of the lesion (e.g., the feature overlap between Wagner grade 2 and 3 ulcers) and assigns differentiated weights to prototypes of similar categories, ultimately outputting a classification of diabetic foot lesions that conforms to clinical diagnostic logic (e.g., ulcer type, grade, and whether there is concurrent infection).

[0220] Therefore, the above-mentioned technical solution has the following technical advantages in the classification of diabetic foot:

[0221] 1. Traditional classification methods, due to the inability of static prototypes to capture subtle features of early lesions, are prone to misclassifying Wagner grade 1 ulcers as normal skin. This approach extracts early lesion features (such as ulcer edges less than 0.5 mm) guided by medical priors, and combines this with adaptive adjustment of dynamic prototypes, which significantly improves the classification accuracy of early lesions and reduces misclassification.

[0222] 2. For complex cases with both ulcers and vascular lesions, traditional techniques often lead to classification confusion because they cannot handle the medical correlation between features. This solution strengthens the feature correlation between "ulcer color and vascular texture" by enhancing perceptual masking and combines dynamic prototypes to aggregate complex features, which significantly improves the classification clarity of complex lesions and significantly reduces feature confusion.

[0223] 3. Images acquired by different hospital equipment have differences in illumination and resolution. Traditional techniques cannot adapt to feature shifts due to static prototypes, resulting in poor classification stability. The medical prior knowledge embedded in this solution (such as anatomical location of lesions and color medical standards) can filter out interference caused by equipment differences. Combined with the adaptive adjustment of feature shifts by dynamic prototypes, the classification robustness of cross-center data is significantly enhanced, and the consistency of classification results is improved.

[0224] 4. Traditional classification methods lack medical logic in prototype construction, making the results difficult to interpret. This approach introduces prior knowledge of lesions, ensuring that the features of the dynamic prototype conform to clinical diagnostic criteria (e.g., Wagner grade 3 ulcers must include dermal exposure features). The classification process can be traced back to specific medical feature associations, significantly improving the clinical interpretability of the classification results and making them more in line with doctors' diagnostic habits.

[0225] Optionally, when the classification module generates the enhanced-aware mask based on the extracted metric support features and query features, it performs the following steps:

[0226] The metric support features and query features are reshaped to calculate the association strength of each spatial location with the metric support features and query features;

[0227] Based on the correlation strength, a neighborhood index matrix of spatial location is constructed, and the neighborhood index matrix is ​​Gaussian smoothed to obtain a locally smoothed correlation matrix.

[0228] Activation mapping of lesion regions is performed on the local smooth correlation matrix to generate an enhanced perception mask.

[0229] In summary, this application introduces a feature association strength calculation mechanism to spatially reshape the metric support features (representing known lesion categories) and query features (features of the image to be classified) extracted from the attention-enhanced feature map, enabling the association strength of both to be calculated positionally in the feature space. Specifically, after converting the support features and query features into vector form, the feature matching degree at each spatial location is calculated using cosine similarity or Euclidean distance—high association strength corresponds to the core lesion region (e.g., the match between ulcer color and known ulcer features), while low association strength corresponds to the background or non-lesion region. This process captures the spatial correspondence between query features and support features, providing a basis for lesion region localization.

[0230] Furthermore, during the construction and smoothing of the neighborhood index matrix, a neighborhood index matrix is ​​constructed for each pixel based on the correlation strength of its spatial location, representing the feature correlation between the pixel and the surrounding area. Pixels within the lesion area exhibit high correlation values ​​in their neighborhood index matrices due to high feature consistency (e.g., similar textures at ulcer edges); conversely, the boundary between the lesion and normal skin exhibits low correlation values ​​due to significant feature differences.

[0231] In this application, Gaussian smoothing is performed by applying a Gaussian kernel function to the neighborhood index matrix, thereby reducing noise interference and enhancing the continuity of regional features. The smoothed matrix generates a locally smoothed correlation matrix, making the boundaries of the lesion region clearer and avoiding localization errors caused by minor fluctuations in features.

[0232] Furthermore, in generating activation maps and masks for lesion regions, this application uses a local smooth correlation matrix to generate activation maps for lesion regions through threshold segmentation or activation function mapping—highly correlated regions (the core area of ​​the lesion) are marked as highly activated, and lowly correlated regions (background or normal skin) are marked as low activated. After binarizing the activation maps, an enhanced perceptual mask is generated. This mask accurately locates lesion regions in the query features that are highly correlated with supporting features, suppresses irrelevant background interference, and provides spatial weight guidance for dynamic prototype generation.

[0233] Therefore, the following technical advantages are available when classifying diabetic foot:

[0234] 1. Traditional classification methods lack spatial correlation analysis and cannot distinguish the locational differences between "interdigital ulcers" and "plantar ulcers," often leading to classification errors. This scheme calculates the correlation strength of each location, which can accurately locate the anatomical position of the lesion on the foot, significantly improving the accuracy of location differentiation and reducing classification errors caused by location misjudgment.

[0235] 2. For the blurred boundary between ulcers and normal skin (such as the infiltrated area of ​​Wagner grade 1 ulcers), traditional techniques are prone to pixel noise interference in boundary localization due to the lack of neighborhood smoothing. This solution enhances the feature continuity of the boundary area through Gaussian smoothing, which significantly improves the clarity of the ulcer edge and provides more accurate spatial feature support for lesion grading.

[0236] 3. In images containing complex backgrounds such as bed sheet textures and sock patterns, traditional techniques struggle to distinguish the spatial relationship between the background and the lesion. This solution, through a neighborhood index matrix and Gaussian smoothing, effectively suppresses the correlation strength of the background region, making the lesion region stand out from the complex background. The interference of background noise is significantly reduced, and the accuracy of lesion segmentation is improved.

[0237] 4. Traditional activation mapping mechanisms are simple (such as global threshold segmentation) and cannot distinguish the feature differences between the core and peripheral areas of an ulcer. This scheme generates activation maps based on correlation strength, which can hierarchically activate different regions—high activation in the core area, medium activation in the peripheral area, and low activation in the background. This makes the hierarchical feature expression of the lesion area clearer, provides richer spatial dimension information for classification, and improves the accuracy of classification.

[0238] Optionally, when the classification module generates a dynamic category prototype based on the enhanced perception mask, it performs the following steps:

[0239] Spatial dimension masking is performed on the enhanced perception mask to generate an initial category prototype;

[0240] Principal component analysis is used to reduce the dimensionality of the initial category prototype to construct the feature subspace of the dynamic category prototype.

[0241] In the feature subspace, the inter-class distance of the initial class prototype is maximized and the disease stage is dynamically adapted to generate a dynamic class prototype.

[0242] In summary, this application expands the spatial dimension of the enhanced perception mask during spatial dimension mask expansion and initial prototype construction, mapping the two-dimensional spatial mask to the feature dimension to generate an initial category prototype. Specifically, based on the features of the high-activation region (the core area of ​​the lesion) in the mask, the spatial and channel features of the lesion region are integrated through weighted aggregation—features of the high-activation region (such as ulcer color and edge texture) are preferentially aggregated, while features of the low-activation region (background) are suppressed, forming a preliminary category prototype that ensures the prototype contains the most diagnostically valuable lesion features.

[0243] Furthermore, during principal component analysis (PCA) dimensionality reduction and feature subspace construction, PCA is performed on the initial class prototypes to identify the main directions of variation in features and construct a feature subspace for the dynamic class prototypes. This subspace retains the feature dimensions most relevant to diabetic foot lesions (such as ulcer shape and bleeding point texture) while eliminating noisy or redundant dimensions (such as irrelevant background color), making the prototype features more focused on key diagnostic information. During dimensionality reduction, principal components that explain most feature variations are retained, ensuring that the prototype can still fully express the lesion features in the low-dimensional space.

[0244] When maximizing inter-class distance and dynamically adapting to lesion stages, the prototype distribution in the feature subspace is optimized to maximize the distance between prototypes of different lesion categories (e.g., Wagner grade 1 and 2 ulcers), enhancing the distinguishability between categories. By adjusting the feature weights of the prototypes, the feature differences of different lesion stages (e.g., ulcer depth, extent of tissue damage) are highlighted to avoid category confusion. Based on the lesion characteristics of the query features, the feature subspace and inter-class distance of the prototypes are dynamically adjusted—for early lesions (e.g., Wagner grade 1), the prototypes strengthen the expression of subtle features (e.g., pinpoint bleeding); for late lesions (e.g., Wagner grade 4), the prototypes highlight large-area ulcers and infection features, enabling the prototypes to adapt to the feature distribution of different lesion stages and improving classification flexibility.

[0245] Therefore, the following technical advantages are available in the classification of diabetic foot:

[0246] 1. Traditional classification methods often misclassify grade 1 and grade 2 ulcers because static prototypes cannot capture the characteristic differences between Wagner grades. This scheme enhances the characteristic differences of lesions at different stages (such as ulcer depth and edge morphology) by maximizing inter-class distance and dynamic adaptation, which significantly improves the accuracy of lesion stage differentiation and significantly reduces classification errors.

[0247] 2. When there are few labeled samples, the static prototypes of traditional techniques are easily affected by sample bias and have poor classification stability. This scheme retains key lesion features through PCA dimensionality reduction and dynamically optimizes the prototype distribution, so that the prototype can still accurately express the lesion category in small sample scenarios, significantly enhances the generalization ability, and improves the reliability of the classification results.

[0248] 3. For complex cases involving ulcers and neuropathy, traditional prototype techniques cannot separate different lesion features. This approach prioritizes the aggregation of core features of each lesion through spatial masking and optimizes the distribution of different types of prototypes in the feature subspace, enabling each feature of the complex lesion to be accurately expressed, significantly reducing feature confusion, and significantly improving classification clarity.

[0249] 4. Traditional prototype construction does not filter noise features, making it susceptible to interference from factors such as shooting angle and equipment differences. This solution uses PCA to reduce noise dimensions that are irrelevant to lesions and combines dynamic adaptation to suppress feature shifts caused by equipment differences, which significantly improves the purity of prototype features, enhances anti-interference ability, and improves the classification stability of cross-center data.

[0250] Optionally, when the classification module fuses dynamic category prototypes to determine the classification of diabetic foot images, it performs the following steps:

[0251] Calculate the feature covariance matrix between dynamic category prototypes;

[0252] Calculate the similarity between the dynamic category prototype and the query feature based on the feature covariance matrix;

[0253] Dynamic category prototypes are fused based on similarity to generate weighted category representations;

[0254] The classification decision boundary is constructed based on statistically weighted category representation to determine the classification of diabetic foot images.

[0255] In summary, this application introduces a feature covariance matrix calculation mechanism to perform feature space analysis on dynamic category prototypes and calculate the feature covariance matrix between each prototype. This matrix captures the statistical dependencies between features of different lesion categories (such as Wagner classification)—high covariance indicates shared similar features between categories (such as ulcer edge texture), while low covariance indicates significant differences in category features (such as tissue damage patterns between deep and superficial ulcers). Through covariance analysis, the feature correlation between categories is quantified, providing a statistical basis for subsequent similarity calculations.

[0256] In this application, similarity calculation and dynamic weight allocation are performed based on the feature covariance matrix to calculate the similarity between each dynamic category prototype and the query feature. Unlike traditional Euclidean distance or cosine similarity, this calculation considers the feature correlation between categories—by performing a whitening transformation on the feature space through the covariance matrix, the similarity measure focuses more on the unique features between categories rather than shared features. For example, when distinguishing between Wagner grade 2 and grade 3 ulcers, the similarity calculation strengthens the weight of specific features such as "whether there is bone exposure" and weakens the influence of common features such as "redness and swelling at the ulcer edge," thereby improving the category discrimination ability.

[0257] In this application, during dynamic prototype fusion and weighted category representation, dynamic category prototypes are weighted and fused based on similarity calculation results to generate a comprehensive weighted category representation. Prototypes with high similarity (such as Wagner level 2 prototypes matching the query features) have dominant weights in the fusion, while the weights of prototypes with low similarity (such as Wagner level 4 prototypes) are suppressed. This process dynamically integrates information from multiple prototypes, enabling the final representation to retain both the main category features of the query features and supplementary information from adjacent categories (such as features of transition from early to late lesions), forming a more comprehensive expression of lesion features.

[0258] In constructing and classifying decision boundaries, this application uses a weighted category representation to build statistical decision boundaries and determines classification thresholds by analyzing the probability density function of feature distributions. The construction of the decision boundaries considers the feature covariance and similarity distribution between categories, making the boundaries closer to the natural separation between actual lesion categories—for example, in the feature transition region between Wagner grade 2 and 3 ulcers, the decision boundaries are flexibly divided according to the gradual change in clinical features, avoiding classification errors caused by hard thresholds. Finally, query features are assigned to the most matching diabetic foot lesion category based on their position within the decision boundaries.

[0259] Therefore, the following technical advantages are available in the classification of diabetic foot.

[0260] 1. Traditional classification methods, due to their fixed decision boundaries, often fail to distinguish the transitional stages between Wagner grade 2 and grade 3 ulcers, leading to grade jumps. This scheme, through the construction of flexible decision boundaries, can accurately divide adjacent lesion stages according to the gradual change of characteristics, significantly improving the accuracy of stage differentiation and significantly reducing grading errors.

[0261] 2. For complex cases with both ulcers and infections, traditional techniques cannot integrate different lesion features because they process the prototypes independently. This approach, through dynamic prototype fusion, can effectively combine ulcer morphology and infection features (such as the extent of redness and swelling, and the amount of exudation), making the feature expression of complex lesions more comprehensive and significantly improving the completeness of classification.

[0262] 3. When labeled samples are limited, traditional static prototypes are prone to overfitting. This approach is based on statistical modeling of feature covariance, which can uncover the essential relationships between categories from a small number of samples. This allows the classifier to maintain high stability in small sample scenarios, significantly enhances generalization ability, and reduces classification fluctuations caused by insufficient samples.

[0263] 4. Traditional classification decision boundaries are disconnected from clinical diagnostic criteria. This solution constructs decision boundaries that conform to the progressive nature of lesions through statistical probability density functions, making the classification results closer to clinical reality. For example, in the process of early ulcers developing into deep ulcers, the classification results can reflect the progressive nature of the lesions, significantly improving the consistency with doctors' diagnostic logic and enhancing the diagnostic reference value.

[0264] To facilitate understanding of the above content of this application, the following examples are provided for specific illustration:

[0265] Taking the classification process of a Wagner grade 2 diabetic foot ulcer as an example:

[0266] I. Data Augmentation Module: Building High-Quality Training Datasets

[0267] Base class image selection and few-sample paradigm construction

[0268] Typical Wagner grade 2 ulcer images were selected from the image library as the base class (features: dermal exposure, redness and swelling at the ulcer edge, no bone exposure). A 5-way 5-shot few-shot learning framework was constructed (5 types of lesions, 5 labeled images for each type) to simulate the few-shot scenario during initial clinical diagnosis.

[0269] Similar image sampling and weighted fusion

[0270] For a certain training image (a mid-foot ulcer, approximately 10 mm in area) 2 Extract its geometric features (area A=10, perimeter P=12), color features (HSV hue of ulcer area H=15, S=0.8, V=0.6), and texture features (edge ​​roughness R=0.7) to form an 18-dimensional feature vector F=[10,12,...0.7].

[0271] Three similar images were retrieved in the feature space using KD-Tree, and the Euclidean distances between their feature vectors and F were 0.5, 0.6, and 0.7, respectively (the distances are less than the threshold of 1.5 × feature standard deviation).

[0272] Lesion saliency map (mask example): A binary mask M generated by the segmentation model, with the same size as the image, where the pixel value of the ulcer region is 1 and the background is 0. For example, the mask for a 5×5 region is: 0 0 1 0 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0

[0278] Dynamic weighted fusion: For each pixel (x,y), if M(x,y)=1 (ulcer region), then the fusion weight α=0.8; otherwise, α=0.3, and the deformed image I_{aug}(x,y)=α·I_train(x,y)+(1-α)·I_similar(x,y) is generated.

[0279] II. Feature Extraction Module: Multi-scale Feature Fusion

[0280] ResNet-101 backbone network feature extraction

[0281] The shallow layer captures pixel-level textures of the ulcer edges, while the deep layer integrates the overall morphology of the ulcer.

[0282] After the input image is processed by ResNet-101, the output is a three-dimensional feature vector H×W×C=32×32×2048, where a local region of the feature map of a certain channel is as follows: [[0.2 0.5 0.7] [0.3 0.8 0.6] [0.1 0.7 0.9]]

[0286] Spatial pyramid feature and local descriptor generation

[0287] Example of multi-scale feature mapping: In the feature map generated by the 3×3 convolution kernel, the feature value of capturing punctate bleeding at the edge of the ulcer in a certain 3×3 region is [0.9, 0.8, 0.7]; in the feature map generated by the 7×7 convolution kernel, the feature value of integrating the ulcer location in the corresponding region is [0.6, 0.7, 0.5].

[0288] Spatial pyramid feature (4×4 grid example): The feature map is divided into a 4×4 grid, and max pooling is performed in each grid. The pooling result of a certain grid is 0.8 (which means that the edge features of the region are significant).

[0289] Local descriptor generation: The feature map is segmented by a 16×16 sliding window. The features within a certain window are compressed into a 128-dimensional vector D = [0.3, 0.5, ... 0.7] by a fully connected layer, which corresponds to the color and texture features of a certain local area at the edge of the ulcer.

[0290] Example of semantic self-attention weight matrix: Calculate the attention matrix A between descriptors, where A[i,j] = 0.9 indicates that the i-th descriptor (red edge) is highly correlated with the j-th descriptor (rough texture), thus strengthening their association.

[0291] III. Attention Enhancement Module: Focusing on the Characteristics of the Lesion Area

[0292] Adaptive feature reweighting

[0293] Example of cross-channel autocorrelation matrix: Calculate the autocorrelation matrix R between color channel C1 and edge channel C2:

[0294] R = [[1.0 0.8]] [0.8 1.0]]

[0296] This indicates that the features of the two channels are highly correlated.

[0297] Example of a local entropy vector: The entropy value of a 5×5 region is calculated as E=[0.9,0.8,0.7,0.6,0.5]. The entropy value of the ulcer region is high (0.9), and the entropy value of normal skin is low (0.5).

[0298] Example of channel weight vector: After concatenating R and E, a weight vector W = [0.9, 0.8, 0.3, 0.2] is generated through gating. The first two dimensions are the weights of the lesion channel, and the last two dimensions are the weights of the background channel.

[0299] Channel attention map generation

[0300] Example of dual-path output vector: global path output G = [0.7, 0.6, 0.5], local path output L = [0.9, 0.8, 0.7], after addition and sigmoid normalization, the channel attention map A = [0.8, 0.7, 0.6] is obtained, with high weights activating lesion-related channels.

[0301] Feature enhancement of the focused lesion area

[0302] Example of a local feature similarity matrix: Calculate the pixel similarity matrix S within a 5×5 region: [[1.0 0.9 0.8 0.7 0.6] [0.9 1.0 0.9 0.8 0.7] [0.8 0.9 1.0 0.9 0.8] [0.7 0.8 0.9 1.0 0.9] [0.6 0.7 0.8 0.9 1.0]]

[0308] The core area of ​​the ulcer has high pixel similarity (large values ​​near the diagonal).

[0309] Focusing on the label (mask example): After Gaussian smoothing, a binary mask L is generated by setting a threshold of 0.8, with the ulcer core area set to 1 and the background area set to 0. [[0 0 1 0 0] [0 1 1 1 0] [1 1 1 1 1] [0 1 1 1 0] [0 0 1 0 0]]

[0315] IV. Classification Module: Dynamic Prototype Aggregation and Classification Decision

[0316] Medical Prior-Guided Feature Extraction

[0317] Example of supporting features: Given the supporting features of Wagner grade 2 ulcers, S = [0.8 (exposed dermis), 0.7 (red and swollen edges), 0.2 (normal skin)], the weights after embedding priors are [0.9, 0.8, 0.1].

[0318] Augmented perception mask generation

[0319] Example of association strength matrix: Calculate the association strength matrix C between the query feature and the supporting features. The value of a certain 3×3 region is: [[0.9 0.8 0.7] [0.8 0.9 0.8] [0.7 0.8 0.9]]

[0323] The ulcer area shows a high degree of correlation.

[0324] Example of a neighborhood index matrix: Construct a 3×3 neighborhood matrix N, where the association index between the center pixel and its neighbors is: [[0.8 0.9 0.8] [0.9 1.0 0.9] [0.8 0.9 0.8]]

[0328] After Gaussian smoothing, an activation map is generated, which is then converted into an enhanced perceptual mask.

[0329] A threshold (e.g., 0.8) is set for the smoothed correlation matrix. Regions above the threshold are marked as 1 (lesion activation), and regions below the threshold are marked as 0 (background suppression), generating an enhanced sensing mask L. For example, the mask shape for a 5×5 region is as follows: [[0 0 1 0 0] [0 1 1 1 0] [1 1 1 1 1] [0 1 1 1 0] [0 0 1 0 0]]

[0335] Dynamic category prototype generation

[0336] Example of initial prototype: A 10-dimensional initial prototype P = [0.7, 0.8, 0.6, 0.5, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4] is generated based on mask expansion. After dimensionality reduction by PCA, the first 3 principal components are retained to form a 3-dimensional feature subspace.

[0337] Prototype Fusion and Classification Decision

[0338] Example of a feature covariance matrix: Covariance matrix Σ of Wagner Level 2 and Level 3 prototypes:

[0339] Σ=[[1.0 0.5] [0.5 1.0]]

[0341] This indicates the correlation between two types of features.

[0342] Similarity calculation example: The query feature Q has a similarity of 0.9 with the Wagner Level 2 prototype and a similarity of 0.4 with the Level 3 prototype. After weighted fusion, the Wagner Level 2 weight accounts for 70%. The final classification result is:

[0343] "Wagner grade 2 diabetic foot ulcer with dermal exposure and peripheral redness and swelling, without bone exposure and deep infection."

[0344] Decision boundary visualization: In the 3D feature subspace, the peak of the probability density function of Wagner level 2 is located at coordinates (0.7, 0.8, 0.6), and the coordinates of the query feature Q (0.68, 0.79, 0.58) fall within 1.5 times the standard deviation of this peak, so it is determined to be Wagner level 2.

[0345] like Figure 2 As shown in the figure, an embodiment of this application provides a method for classifying diabetic foot images based on few-shot learning, comprising:

[0346] Weighted fusion of training images and similar images is performed on diabetic foot images to generate an expanded dataset;

[0347] The augmented dataset is processed by ResNet-101 backbone network feature extraction to generate a feature tensor containing both global semantics and local details.

[0348] The feature tensor is processed with dual-pool channel attention and enhanced spatial attention to generate an attention-enhanced feature map that focuses on the lesion region.

[0349] Dynamic prototype aggregation is performed on attention-enhanced feature maps to classify diabetic foot images.

[0350] The above Figure 2 For an exemplary description of each step, please refer to the above. Figure 1 Description of the embodiments.

[0351] The above embodiments are only used to illustrate the embodiments of the present invention and are not intended to limit the embodiments of the present invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present invention, and the patent protection scope of the embodiments of the present invention should be defined by the claims. The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions.

Claims

1. A diabetic foot image classification system based on few-shot learning, comprising: The data augmentation module is used to perform weighted fusion of training images and similar images on diabetic foot images to generate an expanded dataset; The feature extraction module is used to perform ResNet-101 backbone network feature extraction processing on the augmented dataset generated by the data augmentation module, generating feature tensors that include global semantics and local details; The attention enhancement module is used to perform dual-pool channel attention and enhanced spatial attention processing on the feature tensors generated by the feature extraction module to generate attention-enhanced feature maps that focus on the lesion region. The classification module is used to perform dynamic prototype aggregation processing on the attention-enhanced feature maps generated by the attention-enhancing module in order to classify diabetic foot images; Specifically, the classification module performs dynamic prototype aggregation processing on the attention-enhanced feature map generated by the attention-enhancing module to classify diabetic foot images, and executes the following steps: Measure support features and query features from attention-enhanced feature maps; Based on the extracted metric support features and query features, an enhanced perceptual mask is generated; Spatial dimension masking is performed on the enhanced perception mask to generate an initial category prototype; Principal component analysis is used to reduce the dimensionality of the initial category prototype to construct the feature subspace of the dynamic category prototype. In the feature subspace, the inter-class distance of the initial class prototype is maximized and the disease stage is dynamically adapted to generate a dynamic class prototype. Dynamic category prototypes are fused to determine the classification of diabetic foot images.

2. The diabetic foot image classification system based on few-shot learning according to claim 1, characterized in that, When the data augmentation module performs weighted fusion of training images and similar images of diabetic foot images to generate the expanded dataset, it performs the following steps: Training images and similar images are sampled from diabetic foot images. The training images and similar images are then weighted and fused to generate deformed images. Based on this, an expanded dataset is generated, which includes deformed images and diabetic foot images.

3. The diabetic foot image classification system based on few-shot learning according to claim 2, characterized in that, The data augmentation module samples training images and similar images from diabetic foot images, performs weighted fusion of the training images and similar images to generate deformed images, and generates an augmented dataset based on these deformed images and diabetic foot images, performing the following steps: Identify the base class images for diabetic foot images and construct a few-shot learning paradigm based on the base class images; Based on the few-shot learning paradigm, diabetic foot images are sampled to obtain training images; Nearest neighbor retrieval is performed in the feature space based on training images to determine lesion features and generate similar images accordingly. The training images and similar images are linearly superimposed with weights to generate deformed images, and the augmented dataset is generated accordingly.

4. The diabetic foot image classification system based on few-shot learning according to claim 1, characterized in that, When the data augmentation module performs a weighted linear superposition of training images and similar images to generate deformed images and accordingly generates the augmented dataset, it performs the following steps: Weighted pixel-level fusion is performed on the training image and similar images to generate a preliminary fused image; The generated primary fused image is subjected to lesion region masking weighting to generate a deformed image; Lesion semantic annotations were performed on deformed images and diabetic foot images to generate an expanded dataset.

5. The diabetic foot image classification system based on few-shot learning according to claim 1, characterized in that, When the feature extraction module performs ResNet-101 backbone network feature extraction processing on the augmented dataset generated by the data augmentation module to generate a feature tensor containing both global semantics and local details, the following steps are performed: Based on the ResNet-101 backbone network, feature extraction is performed on the augmented dataset to obtain three-dimensional feature vectors. ,in C is the feature map size, and C is the number of channels; The 3D feature vector is decomposed into multiple local descriptors, each corresponding to a fine-grained feature of an image patch, to generate a feature tensor that includes both global semantics and local details.

6. The diabetic foot image classification system based on few-shot learning according to claim 5, characterized in that, The feature extraction module decomposes the 3D feature vector into multiple local descriptors, each local descriptor corresponding to fine-grained features of an image patch. When generating a feature tensor that includes global semantics and local details, the following steps are performed: Convolutional operations are performed on 3D feature vectors using convolutional kernels with different receptive fields to generate multi-scale feature mapping sets. The feature map at each scale is divided into grids of different sizes, and max pooling or average pooling operations are performed on the features within each grid to generate spatial pyramid features. The spatial pyramid features are segmented into sliding windows of fixed size, and the features within each window are compressed into vectors of fixed dimensions through a fully connected layer to generate multiple local descriptors. Calculate the semantic self-attention weights among all local descriptors to generate semantic association features; Global average pooling and max pooling are performed on the semantic association features to obtain global semantic features; The global semantic features are upsampled to generate a feature tensor that includes both global semantics and local details.

7. The diabetic foot image classification system based on few-shot learning according to claim 1, characterized in that, When the attention enhancement module performs dual-pool channel attention and enhanced spatial attention processing on the feature tensor generated by the feature extraction module to generate an attention-enhanced feature map focusing on the lesion region, it executes the following steps: Adaptive feature reweighting results are generated based on the feature tensors generated by the feature extraction module; A channel attention map is generated based on the adaptive feature reweighting result; An attention-enhanced feature map focusing on the lesion region is generated based on the channel attention map.

8. The diabetic foot image classification system based on few-shot learning according to claim 7, characterized in that, When the attention enhancement module generates an adaptive feature reweighting result based on the feature tensor generated by the feature extraction module, it performs the following steps: The feature tensors generated by the feature extraction module are simultaneously subjected to cross-channel autocorrelation calculation and local feature entropy evaluation to obtain a set of channel autocorrelation matrices and a vector of channel entropy values. The channel autocorrelation matrix set and the channel entropy vector are concatenated and then processed by attention gating to generate the channel weight vector; The feature tensor is scaled using the channel weight vector, and the adaptive feature reweighting result is obtained accordingly.

9. The diabetic foot image classification system based on few-shot learning according to claim 7, characterized in that, When the attention enhancement module generates a channel attention map based on the adaptive feature reweighting result, it performs the following steps: The adaptive feature reweighting result is processed through independent linear layers to obtain a dual-path output vector; The dual-path output vectors are summed element-wise and normalized using the Sigmoid function to generate key feature channel weights. Irrelevant feature channels, including those corresponding to the background, are suppressed, and a channel attention map is generated accordingly.

10. The diabetic foot image classification system based on few-shot learning according to claim 7, characterized in that, When the attention enhancement module generates an attention enhancement feature map focusing on the lesion region based on the channel attention map, the channel attention map is mapped to the cross-channel interaction space and the local correlation metric space to calculate the local feature similarity matrix and evaluate the correlation of the lesion region accordingly, and locate the focus label of the diabetic foot lesion region to generate the attention enhancement feature map focusing on the lesion region.

Citation Information

Patent Citations

  • Small sample attention mechanism parallel twinning method for eye fundus image classification

    CN114494195A

  • Small sample image classification method based on local orthogonal feature attention fusion

    CN116109834A