Eyelid tumor classification method and system

By optimizing the similarity matrix of ocular tumor features through block processing and partial cosine adjustment, the accuracy problem of ocular tumor classification under small sample conditions is solved, and a more efficient ocular tumor classification effect is achieved.

CN121545208AActive Publication Date: 2026-02-17TIANJIN EYE HOSPITAL
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202610043819.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-14
Publication Date
2026-02-17
Estimated Expiration
2046-01-14

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately classify ocular tumors under small sample conditions, particularly by neglecting the similarity value of skeletal features and the extraction of multi-scale information, resulting in insufficient classification accuracy.

Method used

By processing the backbone and dense feature maps in blocks, a primary and dense similarity matrix is ​​constructed. The dense feature similarity matrix is ​​optimized using a partial cosine adjustment formula. Combined with attention-guided pyramids and dynamic feature enhancement grids, the feature representation and similarity measurement are improved.

Benefits of technology

It significantly improves the accuracy and robustness of ocular tumor classification, especially performing well in few-shot learning scenarios, and enhances the model's generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121545208A_ABST
    Figure CN121545208A_ABST
Patent Text Reader

Abstract

The invention provides an eyelid tumor classification method and system, and relates to the technical field of medical image analysis. Constructing a main similarity matrix; constructing a dense feature similarity matrix; calculating a cosine angle between corresponding row vectors of the main similarity matrix and the dense feature similarity matrix by taking a row as a unit, defining a partial cosine adjustment formula according to the cosine angle so as to perform overall fine adjustment on each element in each row vector of the dense feature similarity matrix, and adjusting each element by taking a row as a unit; obtaining an adjusted dense feature similarity matrix; and according to the adjusted dense feature similarity matrix, calculating the similarity of each category feature of the query set and the support set to obtain a classification result, outputting the probability that the eyelid tumor belongs to different categories through a Softmax function, and judging the query set image as the category with the maximum probability. The accuracy and reliability of benign and malignant eye tumor classification under the small sample condition are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image analysis, and more specifically, to a method and system for classifying eyelid tumors. Background Technology

[0002] In the field of medical imaging, early diagnosis of ocular tumors is crucial for improving cure and survival rates. Ocular tumors often present as fundus abnormalities, with subtle early symptoms, posing a challenge to diagnosing them. Therefore, ocular tumor classification techniques based on computer vision and deep learning have been widely researched and applied. By utilizing medical imaging data and advanced algorithms, doctors can effectively assist in classifying ocular tumors as benign or malignant. In recent years, with the rapid development of deep learning, techniques such as convolutional neural networks (CNNs) and transfer learning have demonstrated remarkable effectiveness in medical image analysis. Specifically, in the detection of ocular tumors, many studies have applied CNNs to image classification tasks to distinguish between benign and malignant tumors. However, due to the scarcity and complexity of tumor samples, traditional deep learning methods do not perform ideally in few-shot learning (FSL) scenarios. The challenge of few-shot learning lies in the fact that only a limited number of samples are typically available for training, placing higher demands on the model's generalization ability and accuracy. To address these issues, few-shot learning (FSL) technology emerged, enabling machine learning models to maintain good learning capabilities even with very few labeled samples. FSL compensates for data scarcity by transferring existing knowledge to new tasks. Therefore, accurately classifying ocular tumors under limited sample conditions has become a key challenge in medical image analysis.

[0003] In the field of medical image analysis, especially in the task of classifying eyelid tumors, few-shot learning faces numerous challenges. Traditional deep learning models heavily rely on large-scale labeled data, but medical image annotation requires the participation of professional doctors, which is costly and time-consuming, resulting in a scarcity of labeled data. This directly causes traditional models to perform poorly in data-scarce scenarios, making it difficult to accurately classify eyelid tumors.

[0004] In the process of developing this invention, the applicant discovered that existing similarity-based learning methods have serious flaws. Due to the scarcity of samples and large intra-class differences, images of the same category are prone to shifting in the metric space. Existing methods often rely solely on the similarity matrix formed by dense features to represent the relationship between the support set and the query set, completely ignoring the important factor that backbone features can also represent similarity relationships. For example, a common practice is to extract features using backbone networks such as ResNet, and then further extract dense features and construct a similarity matrix using pyramid convolution, but this only uses backbone features to further standardize the dense features without truly exploring the similarity value of backbone features. This results in an inability to comprehensively and accurately characterize the similarity relationships between images, greatly affecting classification accuracy. Existing methods also have significant shortcomings in dense feature extraction. Traditional methods based on fully convolutional networks (FCNs) have feature representation capabilities limited by a fixed receptive field, making it difficult to effectively capture multi-scale information and failing to meet the high requirements for feature extraction due to the morphological diversity of eyelid tumors. Pyramid-based methods, while fusing features at different resolutions through multi-scale pooling operations, often involve simple splicing or summation, failing to fully utilize the interactive information between features. Furthermore, when processing medical images, they generally ignore the dynamic relationship between local details and global context, resulting in insufficient discriminative power in feature representation and difficulty in accurately extracting key features from eyelid tumor images.

[0005] Therefore, how to accurately and efficiently determine the type (benign or malignant) of ocular tumors has become an urgent technical problem to be solved. Summary of the Invention

[0006] This invention aims to solve at least one of the technical problems existing in the prior art or related technologies, and discloses a method and system for classifying eyelid tumors, which greatly improves the accuracy and reliability of classifying benign and malignant eye tumors under small sample conditions, and effectively solves the problems faced by existing methods such as feature complexity, similarity calculation and inter-class differences.

[0007] The first aspect of the present invention discloses a method for classifying eyelid tumors, comprising: feature map segmentation: segmenting the backbone feature maps of the support set and the query set into blocks to obtain multiple backbone feature image blocks of the same size; segmenting the dense feature maps of the support set and the query set into blocks to obtain multiple dense feature image blocks of the same size; wherein the support set and the query set include multiple eyelid tumor images.

[0008] Construct the main similarity matrix: Calculate the cosine similarity between the backbone feature image patches of the query set and the backbone feature image patches of the support set to construct the main similarity matrix with the query set as the row and the support set as the column;

[0009] Construct a dense feature similarity matrix: Calculate the cosine similarity between dense feature image patches in the query set and dense feature image patches in the support set to construct a dense feature similarity matrix with the query set as the rows and the support set as the columns;

[0010] Dense feature similarity matrix adjustment: Calculate the cosine angle between the corresponding row vectors of the main similarity matrix and the dense feature similarity matrix on a row-by-row basis. Define the partial cosine adjustment formula based on the cosine angle to fine-tune each element in each row vector of the dense feature similarity matrix as a whole. After adjusting each element on a row-by-row basis, the adjusted dense feature similarity matrix is ​​obtained.

[0011] Classification decision: Based on the adjusted dense feature similarity matrix, the similarity of each category feature between the query set and the support set is calculated to obtain the classification result. The probability of eyelid tumors belonging to different categories is output through the Softmax function, and the query set image is determined to be the category with the highest probability.

[0012] According to the eyelid tumor classification method disclosed in this invention, preferably, the step of adjusting the dense feature similarity matrix specifically includes:

[0013] Let each row of the primary similarity matrix be α, and each row of the dense feature similarity matrix be β;

[0014] The cosine angle θ between the two row vectors α and β is calculated using the following formula:

[0015] θ= ;

[0016] Based on the cosine angle θ, a partial cosine adjustment formula is defined to fine-tune the row vectors of the dense feature similarity matrix. The elements of the adjusted row vectors are:

[0017]

[0018] in, This represents the j-th element in each row of the adjusted dense feature similarity matrix. Let represent the j-th element in each row of the unadjusted dense feature similarity matrix, γ be an adjustable parameter, and sgn() be the sign function. When α·β>0, sgn(α·β)=1; when x=0, sgn(α·β)=0; when α·β<0, sgn(α·β)=−1.

[0019] In this technical solution, the core principle of the partial cosine adjustment formula lies in the fact that when the angle θ between the row vectors of the primary similarity matrix and the dense feature similarity matrix is ​​small, cos(θ) approaches 1, and (1−cos(θ)) approaches 0. At this point, the adjustment amplitude of the corresponding row vector elements of the dense feature similarity matrix is ​​small because the similarity between the two is already high. Conversely, when the angle is large, cos(θ) is small, and (1−cos(θ)) is large, resulting in a correspondingly larger adjustment amplitude. γ is used to flexibly control the overall adjustment intensity. By multiplying by γ, the adjustment degree can be flexibly adjusted according to different application scenarios and data characteristics to ensure good optimization results under various conditions. Simultaneously, sgn(α·β) is used to clarify the direction of adjustment, making the adjusted row vectors of the dense feature similarity matrix more aligned with the primary similarity matrix in direction, thereby effectively reducing the angle between them and significantly improving the accuracy of feature similarity measurement.

[0020] According to the eyelid tumor classification method disclosed in this invention, preferably, before the feature map segmentation step, the method further includes: skeletal feature extraction: extracting skeletal features of eyelid tumor images from the support set and query set based on a convolutional neural network; dense feature enhancement: inputting the skeletal features into a dense feature extractor to enhance the skeletal features and obtain dense features.

[0021] According to the eyelid tumor classification method disclosed in this invention, preferably, the dense feature enhancement step specifically includes:

[0022] The backbone features are processed through the AGP (Attention-Guided Pyramid) module: the input feature map is divided into multiple sub-feature maps of different scales; attention weights are calculated for each sub-feature map of each scale; each sub-feature map of each scale is multiplied with the corresponding attention weight map to highlight important feature regions; and then the weighted sub-feature maps of different scales are fused to form a dense feature map.

[0023] Alternatively, the backbone features can be processed using the DFEG (Dynamic Feature Enhancement Grid) module: the input feature map is divided into multiple grid regions, each representing a local part of the image; for each grid region, a local convolutional neural network module is used for processing, which performs weighted fusion or feature transformation on the features of the grid region based on the similarity and difference of features of adjacent grid regions; the features of each grid region after dynamic adjustment are recombined to form a dense feature map.

[0024] According to the eyelid tumor classification method disclosed in this invention, preferably, the classification decision steps specifically include: EMD measurement: treating the adjusted dense feature similarity matrix as a probability distribution, calculating the bulldozer distance, and obtaining the classification result based on the nearest support set category of the query set; MEL measurement: constructing a transition graph based on the same matrix, calculating the Katz centrality, and obtaining the classification result; simultaneously performing EMD measurement and MEL measurement to evaluate the input features from multiple perspectives.

[0025] According to the eyelid tumor classification method disclosed in this invention, preferably, the step of constructing a primary similarity matrix specifically includes: for a skeletal feature image block corresponding to an image in the query set, traversing the skeletal feature image blocks in the support set, and calculating the cosine similarity between the query set image block and each support set image block; repeating the operation for each image block in the query set to construct a primary similarity matrix with the query set image blocks as rows and the support set image blocks as columns; the elements in the matrix represent the degree of similarity between the query set image blocks and the support set image blocks based on skeletal features.

[0026] In this technical solution, adaptive similarity calculation is employed, dynamically adjusting the similarity calculation between the support set and the query set by introducing cosine similarity. As an alternative, traditional similarity calculation methods such as Euclidean distance and Manhattan distance can be considered. While these methods lack the dynamic learning capability of this invention, they still have some applicability in scenarios with lower computational resource requirements. Alternatively, graph neural network (GNN) based methods can also be used, processing the relationship between the support set and the query set through graph structures to calculate their similarity. GNNs are highly capable of handling graph-structured data and adjacency relationships, making them suitable for handling complex data relationships.

[0027] According to the eyelid tumor classification method disclosed in this invention, preferably, the step of constructing a dense feature similarity matrix specifically includes: using an adaptive pooling method to ensure that the dense feature similarity matrix and the main similarity matrix are consistent in dimension, and then obtaining the dense feature similarity matrix according to the cosine similarity formula: for a dense feature image patch corresponding to an image in the query set, traversing the dense feature image patches in the support set, and calculating the cosine similarity between the query set image patch and each support set image patch; repeating the operation for each image patch in the query set to construct a dense feature similarity matrix with the query set image patches as rows and the support set image patches as columns; the elements in the matrix represent the degree of similarity between the query set image patches and the support set image patches based on dense features.

[0028] According to the eyelid tumor classification method disclosed in this invention, preferably, the dense feature extractor specifically includes: an AGP module, a DFEG module, or a Transformer module.

[0029] According to the eyelid tumor classification method disclosed in this invention, preferably, the convolutional neural network specifically includes: ResNet, Conv4, VGG, Inception, EfficientNet, or MobileNet.

[0030] A second aspect of the present invention discloses an eyelid tumor classification system, comprising: a memory for storing program instructions; and a processor for calling the program instructions stored in the memory to implement the eyelid tumor classification method as described in any of the above technical solutions.

[0031] The beneficial effects of this invention include at least the following: Existing technologies typically rely on a single feature extraction method (such as ResNet), making it difficult to simultaneously capture detailed information about global and local features. This invention, by introducing the Attention-Guided Pyramid (AGP) and Dynamic Feature Enhancement Grid (DFEG), achieves multi-scale feature partitioning and dynamic feature adjustment, significantly improving the discriminative power of feature representations and enabling more accurate capture of the complex features of eyelid tumor images. Existing technologies typically rely on only a single feature space in similarity matrix construction, making it difficult to comprehensively reflect the complex relationships between images. This invention, by constructing a primary similarity matrix and a dense feature similarity matrix, and combining a partial cosine angle adjustment strategy, achieves dual similarity synergistic optimization, significantly improving the accuracy of similarity measurement, especially performing excellently in few-shot learning scenarios. This invention innovatively treats each row of the primary similarity matrix and the dense feature similarity matrix as an independent feature similarity unit, and achieves refined adjustment of the dense feature similarity matrix by calculating the cosine angle row by row and applying a partial cosine adjustment strategy. This method not only optimizes feature similarity from multiple dimensions, but also enhances the robustness and generalization ability of the classification model, making it particularly suitable for eyelid tumor classification tasks in few-shot learning scenarios. Attached Figure Description

[0032] Figure 1 A flowchart illustrating an eyelid tumor classification method according to an embodiment of the present invention is shown.

[0033] Figure 2 A schematic block diagram of an eyelid tumor classification system according to an embodiment of the present invention is shown. Detailed Implementation

[0034] To better understand the above-described objects, features, and advantages of the present invention, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Many specific details are set forth in the following description to provide a thorough understanding of the invention; however, the invention may be practiced in other ways different from those described herein, and therefore, the invention is not limited to the specific embodiments disclosed below.

[0035] like Figure 1As shown, according to an embodiment of the present invention, a method for classifying eyelid tumors is disclosed. This method is based on an n-way k-shot classification framework and specifically includes the following steps:

[0036] Step S1, Bone Feature Extraction: Extract bone features of eyelid tumor images from the support set and query set based on a convolutional neural network;

[0037] Step S2, Dense Feature Enhancement: The backbone features are input into the dense feature extractor to enhance the backbone features and obtain dense features;

[0038] Step S3, Feature map segmentation: The backbone feature maps of the support set and the query set are segmented into blocks to obtain multiple backbone feature image blocks of the same size. The dense feature maps of the support set and the query set are also segmented into blocks to obtain multiple dense feature image blocks of the same size. The support set and the query set include multiple eyelid tumor images.

[0039] Step S4, construct the main similarity matrix: calculate the cosine similarity between the backbone feature image patches of the query set and the backbone feature image patches of the support set, so as to construct the main similarity matrix with the query set as the row and the support set as the column;

[0040] Step S5, construct a dense feature similarity matrix: calculate the cosine similarity between dense feature image patches of the query set and dense feature image patches of the support set to construct a dense feature similarity matrix with the query set as the row and the support set as the column.

[0041] Step S6, Dense Feature Similarity Matrix Adjustment: Calculate the cosine angle between the corresponding row vectors of the main similarity matrix and the dense feature similarity matrix on a row-by-row basis. Define a partial cosine adjustment formula based on the cosine angle to fine-tune each element in each row vector of the dense feature similarity matrix. After adjusting each element on a row-by-row basis, the adjusted dense feature similarity matrix is ​​obtained.

[0042] Step S7, Classification Decision: Based on the adjusted dense feature similarity matrix, the similarity of each category feature between the query set and the support set is calculated to obtain the classification result. The probability of eyelid tumors belonging to different categories is output through the Softmax function, and the query set image is determined as the category with the highest probability.

[0043] According to the above embodiments, preferably, the step of adjusting the dense feature similarity matrix specifically includes:

[0044] Let each row of the primary similarity matrix be α, and each row of the dense feature similarity matrix be β;

[0045] The cosine angle θ between the two row vectors α and β is calculated using the following formula:

[0046] θ= ;

[0047] Based on the cosine angle θ, a partial cosine adjustment formula is defined to fine-tune the row vectors of the dense feature similarity matrix. The elements of the adjusted row vectors are:

[0048]

[0049] in, This represents the j-th element in each row of the adjusted dense feature similarity matrix. Let represent the j-th element in each row of the unadjusted dense feature similarity matrix, γ be an adjustable parameter, and sgn() be the sign function. When α·β>0, sgn(α·β)=1; when x=0, sgn(α·β)=0; when α·β<0, sgn(α·β)=−1.

[0050] According to yet another embodiment of the present invention, a specific implementation process and working principle of the eyelid tumor classification method provided in the above embodiments are also disclosed:

[0051] Data Preparation Phase: A wide range of eyelid tumor image data were collected from various medical institutions, covering a rich variety of tumor types and stages of development. Subsequently, senior ophthalmologists meticulously annotated key information in the images according to internationally recognized medical annotation standards, such as the specific type of tumor, its location in the image, and its boundary contours. After annotation, a series of preprocessing operations were performed on the original images, uniformly adjusting them to a specific size (512×512 pixels) and normalizing pixel values ​​to the [0,1] range. Simultaneously, data augmentation techniques such as random rotation (±15 degrees), horizontal flipping, and vertical flipping were used to expand the dataset size.

[0052] Feature Extraction Stage: High-performance pre-trained networks ResNet and Conv4, renowned in deep learning, are selected to efficiently extract features from the input tumor image. Taking ResNet as an example, the image undergoes processing through multiple convolutional layers, pooling layers, and activation functions. In the convolutional layers, kernels of different sizes extract local features; pooling layers reduce feature dimensionality through downsampling; and activation functions enhance the model's non-linear expressive power, ultimately outputting a feature map with strong representational capabilities. The extracted features then enter a specially designed dense feature extractor, namely Attention-Guided Pyramid (AGP) and Dynamic Feature Enhanced Grid (DFEG), for further feature enhancement. The AGP layer (AGP module) guides the pyramid structure with an attention mechanism, significantly highlighting important feature regions; the DFEG layer (DFEG module) constructs a dynamic feature enhancement grid, fully considering the feature information of adjacent regions, thus accurately distinguishing features between the support set and the query set.

[0053] Dual Similarity Coordination and Optimization: A primary similarity matrix and a dense feature similarity matrix are calculated separately. The primary similarity matrix is ​​constructed using image patches as the basic unit, calculating the similarity of each image patch to all image patches in other images using cosine similarity, thus reflecting the similarity relationships of backbone features. The dense feature similarity matrix is ​​constructed based on the dense feature vectors of image patches processed by AGP and DFEG layers. Crucially, this invention employs a unique fine-tuning strategy based on the partial cosine angle to optimize the dense feature similarity matrix. Factors such as feature directionality and importance are comprehensively considered. Based on the backbone feature similarity information contained in the primary similarity matrix, the partial cosine angle is calculated for each feature vector pair corresponding to each element in the dense feature similarity matrix, and the values ​​in the dense feature similarity matrix are finely adjusted based on the difference between the partial cosine angle and the original cosine angle. This process achieves a precise balance between the roles of backbone features and dense features in the classification process, greatly improving the accuracy of feature similarity measurement.

[0054] Classification Decision Stage: Based on efficient query methods such as EMD (Earth Mover's Distance) and MEL (Matching Equilibrium Learning), an end-to-end classification metric is adopted. EMD measures similarity by calculating the minimum cost between two feature distributions. In this invention, it compares the distributions of query set features with the distributions of each category feature in the support set, providing a distance value reflecting similarity. MEL is a method based on constructing a transition matrix using a bidirectional random walk of dense features and utilizing Katz centrality to determine category similarity. MEL mines category similarity from the perspective of feature structure and interrelationships, using the transition matrix and Katz centrality. These query methods work in parallel, evaluating input features from multiple perspectives. The system inputs the feature information, after dual similarity coordination and optimization, into the classification decision module. Through a pre-trained weight allocation mechanism, each query result is assigned a corresponding weight. These results are comprehensively analyzed and fused. Finally, the Softmax function outputs the probability of eyelid tumors belonging to different categories, classifying the image as the category with the highest probability, thus achieving accurate classification of benign and malignant eyelid tumors.

[0055] According to the above embodiments, the support set refers to a small number of labeled samples provided to the model in few-shot learning tasks to support classification or inference. Specifically, the support set contains a certain number of samples with known labels, used to guide the model in classification or regression inference within the query set. The key role of the support set is to provide the model with a reference when samples are scarce, helping the model learn enough knowledge from limited labeled data to effectively infer the category of unknown samples in the query set. The support set is usually used in conjunction with the query set in a training process. Through 2-way 1-shot or similar few-shot learning frameworks, each sample in the support set provides the model with prior knowledge of the category. The samples in the support set do not need to be uniformly distributed across the entire dataset, but rather should represent typical features of different categories. In specific tasks, such as the classification of benign and malignant eyelid tumors, the support set samples will include images of different types of tumors, through which the model can learn the potential features that distinguish benign and malignant tumors.

[0056] Similarly, each sample in the support set will have preliminary features extracted using a pre-trained model such as a deep convolutional neural network (ResNet or Conv4). These pre-trained models have been trained on large-scale datasets, thus effectively capturing low- and mid-level features in the input image, such as edges and textures. However, these preliminary features only represent the basic structure and visual information of the image and cannot fully reflect the high-level relationships and feature distributions between samples. To further enhance feature representation and improve the model's generalization ability in scenarios with few-shot learning, the preliminary extracted features will be passed to a specially designed dense feature extractor. The dense feature extractor further processes the preliminary features through a more complex network structure to capture fine-grained differences and high-level semantic information between samples. Through this process, the sample features in the support set will be more accurately represented, effectively reflecting the distinguishing information between different categories. This multi-stage feature extraction method ensures both the quality of the extracted features and that the support set samples provide more accurate and highly discriminative feature vectors when calculating similarity with the query set samples. This lays a solid foundation for subsequent similarity calculations and category predictions, thereby improving classification performance and overall model performance in few-shot learning tasks.

[0057] A query set is a set of samples used for classification prediction in few-shot learning tasks. The query set helps the model determine the category of a tumor by comparing it with the support set and calculating similarity. In this case, the query set is used to determine the benign or malignant nature of eyelid tumors. Each sample in the query set is an image of a tumor to be classified. The goal is to infer the category of the query set sample—whether it is benign or malignant—by comparing its similarity with samples in the support set. The query set plays a crucial role because it contains the test samples that need to be classified, and the classification labels of these samples are usually unknown during model training. Therefore, the classification of samples in the query set requires inference based on known samples in the support set.

[0058] In this invention, the role of the query set is mainly reflected in the following aspects:

[0059] Determining the benign or malignant nature of tumors: Each tumor image in the query set represents a sample to be classified. By comparing the query set samples with tumor images of known categories in the support set, the features of the query set samples help the model identify their benign or malignant nature. The query set samples may come from different patients, and their features may vary to some extent, but through high-quality feature extraction and accurate similarity calculation, the model can accurately classify tumors.

[0060] Similarity Calculation: Calculating the similarity between the query set and support set samples is the core of the classification process. Features of the query set samples are matched with features of the support set samples, and the relationship between the query samples and support set samples is determined through similarity calculation. The query set samples obtain their predicted category through this process. To improve the accuracy of this process, each sample in the query set undergoes deep feature extraction to ensure that its unique features are fully represented when compared with support set samples.

[0061] Applications of Few-Shot Learning: Classification tasks involving eyelid tumors often face the problem of scarce samples, especially for certain types of tumors. The operation of the query set and support set within a few-shot learning framework is particularly important. By comparing the query set with a limited number of samples in the support set, the model learns the category information from the support set, enabling it to accurately classify the query set samples. This few-shot learning approach is particularly suitable for the medical field, especially in the early screening of eyelid tumors, where it can significantly improve classification efficiency and accuracy.

[0062] According to another embodiment of the present invention, the implementation principle of the dense feature extractor of the above embodiments is also disclosed: to ensure that the output of the dense feature representation layer has a uniform spatial dimension, this scheme adopts a multi-module parallel feature extraction architecture. The existing PyramidFCN architecture, through its inherent multi-scale pooling structure, naturally satisfies the spatial consistency requirement, providing a basic global feature representation for the system. Based on this, the present invention innovatively introduces two new modules in parallel: the Attention-Guided Pyramid (AGP) enhances the feature response of key tumor regions through a spatial attention mechanism, and the Dynamic Feature Enhancement Grid (DFEG) models the spatial correlation of local features through adaptive grid topology modeling.

[0063] AGP Attention-Guided Pyramid Structure: In the dense feature representation layer, a dense feature transformation T is used to ensure the consistency of the spatial dimensions of the output feature maps from different backbone networks, facilitating the subsequent refinement and alignment of the similarity matrix. Simultaneously, an Attention-Guided Pyramid (AGP) layer is introduced, which enhances the discriminative power of the feature representation while maintaining spatial consistency. Specifically, the AGP layer utilizes an attention mechanism to guide the pyramid structure. It first divides the input feature map into multiple sub-feature maps of different scales, for example, through pooling operations of different sizes. Attention weights are calculated for each scale of sub-feature map. Specifically, a small convolutional neural network takes the sub-feature map as input and outputs an attention weight map of the same size as the sub-feature map. Each element in this weight map represents the importance of the feature at the corresponding location. Each scale of sub-feature map is multiplied by its corresponding attention weight map to highlight important feature regions. Then, the weighted sub-feature maps of different scales are fused, for example, through a concatenation operation, to obtain the feature map output by the AGP layer, thereby enhancing the discriminative power of the feature representation.

[0064] DFEG Dynamic Feature Enhancement Grid: This module works by constructing a dynamic feature enhancement grid. It first divides the input feature map into multiple grid regions, each representing a local part of the image. For each grid region, a local convolutional neural network module is used for processing. This module fully considers the feature information of adjacent grid regions and dynamically adjusts the feature representation of its own grid region. Specifically, the module performs weighted fusion or feature transformation on the features of its own grid region based on the similarity and differences in features between adjacent grid regions. For example, if adjacent grid regions have similar texture features, weighted fusion is used to enhance the expression of these texture features; if adjacent grid regions have significant differences in features, feature transformation is performed to better highlight the unique features of the current grid region. The dynamically adjusted features of each grid region are then recombined to form the feature map output by the DFEG layer. This approach further improves the expressive power of the features, and by strictly adhering to the principle of spatial dimensional consistency during processing, it ensures the compatibility of the output feature map with other modules, providing a more discriminative and consistent feature foundation for subsequent similarity-based classification tasks.

[0065] According to another embodiment of the present invention, the implementation principle of the partial cosine adjusted dense similarity matrix of the above embodiments is also disclosed:

[0066] The specific process of constructing the principal similarity matrix includes the following steps: For eyelid tumor images, firstly, basic features are extracted using convolutional neural networks. Then, the images in the query set and support set are processed, dividing each image into fixed-size (512*512 pixels) image blocks. Taking the feature vector of an image block corresponding to a specific image in the query set as an example, the feature vectors corresponding to image blocks in the support set are traversed, and the similarity between the query set image block and each support set image block is calculated using the cosine similarity formula. This process is repeated for each image block in the query set to construct a principal similarity matrix with query set image blocks as rows and support set image blocks as columns. The elements in the matrix clearly present the degree of similarity between query set image blocks and support set image blocks based on backbone features, laying the foundation for subsequent partial cosine adjustment.

[0067] The specific process of constructing the dense feature similarity matrix includes: utilizing advanced dense feature extractors (e.g., AGP and DFEG) such as deep convolutional modules with attention mechanisms to perform deeper processing on the image patches of the query set and support set, obtaining their corresponding dense feature vectors. Then, following the computational logic used in constructing the main similarity matrix, the similarity between the image patches of the query set and support set is calculated based on these newly obtained dense feature vectors, thereby constructing the dense feature similarity matrix. Adaptive pooling is used to ensure dimensional consistency with the main feature similarity matrix.

[0068] F out =AdaptivePool(F in ,h,w)⊕Conv 1×1 (F in )

[0069] Among them, F out Represents the output feature map, AdaptivePool(F) in (h,w) represents the input feature map F processed by adaptive pooling. in Adjusted to target space dimension h×w, Conv 1×1 (F in ) indicates that a 1×1 convolution is applied to adjust the input feature map F. in The channel dimension is represented by ⊕, where ⊕ denotes element-wise addition. This transformation ensures that the spatial dimension of the output feature map remains consistent.

[0070] After performing the above adaptive pooling process, the dense feature similarity matrix is ​​obtained according to the cosine similarity formula.

[0071] The partial cosine angle adjustment (optimization) process includes: To optimize the dense feature similarity matrix so that it can more accurately reflect the complex intrinsic relationships between features in eyelid tumor images, this invention designs a fine-tuning mechanism based on the primary similarity matrix. This mechanism operates on a row-by-row basis, calculating the cosine angle between the corresponding row vectors of the primary similarity matrix and the dense feature similarity matrix, and adjusting the row vectors of the dense feature similarity matrix using the parameter γ, thereby reducing the angle difference between the two. The specific process is as follows:

[0072] Let each row of the primary similarity matrix be α, and each row of the dense feature similarity matrix be β;

[0073] The cosine angle θ between the two row vectors α and β is calculated using the following formula:

[0074] θ= ;

[0075] Based on the cosine angle θ, a partial cosine adjustment formula is defined to fine-tune the row vectors of the dense feature similarity matrix. The elements of the adjusted row vectors are:

[0076]

[0077] in, This represents the j-th element in each row of the adjusted dense feature similarity matrix. Let represent the j-th element in each row of the unadjusted dense feature similarity matrix. γ is an adjustable parameter; in a series of experiments on eyelid tumor image classification, the classification model achieved relatively ideal performance when γ = 0.2. sgn() is the sign function: sgn(α·β) = 1 when α·β > 0; sgn(α·β) = 0 when x = 0; and sgn(α·β) = −1 when α·β < 0. The core principle of the partial cosine adjustment formula is that when the angle θ between the row vectors of the primary similarity matrix and the dense feature similarity matrix is ​​small, cos(θ) approaches 1, and (1−cos(θ)) approaches 0. In this case, the adjustment amplitude of the corresponding row vector elements of the dense feature similarity matrix is ​​small because the similarity between the two is already high. Conversely, when the angle is large, cos(θ) is small, and (1−cos(θ)) is large, resulting in a correspondingly larger adjustment amplitude. γ is used to flexibly control the intensity of the overall adjustment. By multiplying by γ, the degree of adjustment can be flexibly adjusted according to different application scenarios and data characteristics to ensure good optimization results in various situations. At the same time, sgn(α·β) is used to clarify the direction of adjustment, so that the row vectors of the adjusted dense feature similarity matrix are more aligned with the main similarity matrix in terms of direction, thereby effectively reducing the angle between the two and significantly improving the accuracy of feature similarity measurement.

[0078] In this embodiment, each row of the primary similarity matrix and each row of the dense feature similarity matrix are treated as an independent "patch," i.e., a feature similarity unit. This innovative design allows for finer-grained optimization of feature similarity, significantly improving classification performance. Each row of the primary similarity matrix represents the similarity distribution between the query image and the support images in the primary feature space, while each row of the dense feature similarity matrix reflects the similarity distribution between the query image and the support images in the dense feature space. By treating each row as a "patch," the similarity relationship between the two can be analyzed and adjusted row by row, ensuring that the dense feature similarity matrix can more accurately capture the complex relationships between images. During the adjustment process, the cosine angle between each row of the primary similarity matrix and the corresponding row of the dense feature similarity matrix is ​​first calculated to measure the difference in direction between the two. Based on this angle, a partial cosine angle adjustment strategy is further introduced to finely adjust each row of the dense feature similarity matrix. This adjustment not only considers the consistency between primary and dense features but also flexibly controls the optimization intensity by introducing adjustment parameters, thereby achieving the best classification results in different scenarios.

[0079] like Figure 2 As shown, according to another embodiment of the present invention, an eyelid tumor classification system 200 is also disclosed, including: a memory 201 for storing program instructions; and a processor 202 for calling the program instructions stored in the memory to implement the eyelid tumor classification method as described above.

[0080] In summary, this invention designs a dual similarity collaborative optimization mechanism: by introducing a primary similarity matrix (main similarity matrix) and a dense feature similarity matrix, this invention can more comprehensively explore the complex relationships between the query set and the support set images. The primary similarity matrix captures global feature similarity, while the dense feature similarity matrix focuses on the fine-grained associations of local features; the combination of the two significantly improves classification accuracy. This invention also proposes a partial cosine angle adjustment mechanism: by calculating the cosine angle between the primary similarity matrix and the dense feature similarity matrix, an adjustment strategy based on the partial cosine angle is proposed. This strategy can dynamically adjust the row vectors of the dense feature similarity matrix to better align them with the primary similarity matrix in direction, thereby reducing the difference between the two and improving the accuracy of feature similarity measurement.

[0081] All or part of the steps in the various methods of the above embodiments can be implemented by a program controlling the relevant hardware. The program can be stored in a readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other readable medium that can be used to carry or store data.

[0082] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method of classifying eyelid tumors, comprising: The method comprises the following steps: Feature map blocking: the backbone feature maps of the support set and the query set are blocked respectively to obtain a plurality of backbone feature image blocks of the same size, and the dense feature maps of the support set and the query set are blocked respectively to obtain a plurality of dense feature image blocks of the same size, wherein the support set and the query set comprise a plurality of eyelid tumor images; Constructing a main similarity matrix: the cosine similarity between the backbone feature image blocks of the query set and the backbone feature image blocks of the support set is calculated to construct a main similarity matrix with the query set as rows and the support set as columns; Constructing a dense feature similarity matrix: the cosine similarity between the dense feature image blocks of the query set and the dense feature image blocks of the support set is calculated to construct a dense feature similarity matrix with the query set as rows and the support set as columns; Adjusting the dense feature similarity matrix: the cosine angle between the corresponding row vectors of the main similarity matrix and the dense feature similarity matrix is calculated in units of rows, and a partial cosine adjustment formula is defined based on the cosine angle to finely adjust each element in each row vector of the dense feature similarity matrix, and after adjusting each element in units of rows, an adjusted dense feature similarity matrix is obtained; Classification decision: the similarity of each category feature of the query set and the support set is calculated based on the adjusted dense feature similarity matrix to obtain a classification result, and the probability of eyelid tumors belonging to different categories is output through a Softmax function, and the query set image is determined as the category with the maximum probability.

2. The eyelid tumor classification method of claim 1, wherein, The step of adjusting the dense feature similarity matrix specifically comprises: Let each row of the main similarity matrix be α, and each row of the dense feature similarity matrix be β; The cosine angle θ between the two row vectors α and β is calculated, and the calculation formula is: θ = 0 ; Based on the cosine angle θ, a partial cosine adjustment formula is defined to finely adjust the row vector of the dense feature similarity matrix, and each element in the adjusted row vector is: wherein, denotes the jth element in each row of the adjusted dense feature similarity matrix, denotes the jth element in each row of the unadjusted dense feature similarity matrix, γ is an adjustable parameter, and sgn() is a sign function, sgn(α·β)=1 when α·β>0; sgn(α·β)=0 when x=0; sgn(α·β)=−1 when α·β<0.

3. The eyelid tumor classification method of claim 1, wherein, Before the step of feature map blocking, the method further comprises the following steps: Backbone feature extraction: the backbone features of the eyelid tumor images in the support set and the query set are extracted based on a convolutional neural network; Dense feature enhancement: the backbone features are input into a dense feature extractor to enhance the features of the backbone features and obtain dense features.

4. The eyelid tumor classification method of claim 3, wherein, The step of dense feature enhancement specifically comprises: Processing the backbone features through an AGP module: dividing the input feature map into a plurality of sub-feature maps of different scales; calculating attention weights for each scale of sub-feature map; multiplying each scale of sub-feature map with the corresponding attention weight map to highlight important feature regions, and then fusing the weighted sub-feature maps of different scales to form a dense feature map; Alternatively, the backbone features can be processed through the DFEG module: the input feature map is divided into multiple grid regions, each representing a local part of the image; for each grid region, a local convolutional neural network module is used for processing, and the local convolutional neural network module performs weighted fusion or feature transformation on the features of the grid region based on the similarity and difference of the features of adjacent grid regions; the features of each grid region after dynamic adjustment are recombined to form a dense feature map.

5. The eyelid tumor classification method of claim 1, wherein, The classification decision steps specifically include: EMD metric: Treat the adjusted dense feature similarity matrix as a probability distribution, calculate the bulldozer distance, and obtain the classification result based on the nearest support set category of the query set; MEL metric: Construct a transition graph based on the same matrix, calculate Katz centrality, and obtain classification results; Simultaneously execute the EMD metric and the MEL metric to evaluate the input features from multiple perspectives.

6. The eyelid tumor classification method of claim 1, wherein, The steps for constructing the main similarity matrix specifically include: For a backbone feature image block corresponding to an image in the query set, traverse the backbone feature image blocks in the support set and calculate the cosine similarity between the query set image block and each support set image block. Repeat the operation for each image patch in the query set to construct a main similarity matrix with query set image patches as rows and support set image patches as columns; the elements in the matrix represent the degree of similarity between query set image patches and support set image patches based on backbone features.

7. The eyelid tumor classification method of claim 1, wherein, The step of constructing the dense feature similarity matrix specifically includes: An adaptive pooling method is used to maintain the dimensionality consistency between the dense feature similarity matrix and the main similarity matrix, and then the dense feature similarity matrix is ​​obtained according to the cosine similarity formula: For a dense feature image patch corresponding to an image in the query set, traverse the dense feature image patches in the support set and calculate the cosine similarity between the query set image patch and each support set image patch. Repeat the operation for each image patch in the query set to construct a dense feature similarity matrix with query set image patches as rows and support set image patches as columns; the elements in the matrix represent the degree of similarity between query set image patches and support set image patches based on dense features.

8. The eyelid tumor classification method of claim 3, wherein, The dense feature extractor specifically includes: an AGP module, a DFEG module, or a Transformer module.

9. The eyelid tumor classification method of claim 3, wherein, The convolutional neural networks specifically include: ResNet, Conv4, VGG, Inception, EfficientNet, or MobileNet.

10. An eyelid tumor classification system, comprising: include: Memory, used to store program instructions; A processor is configured to invoke the program instructions stored in the memory to implement the eyelid tumor classification method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Near infrared spectrum qualitative discrimination method and system

    CN120877026A

  • Small sample target detection method for robot intelligent operation

    CN121053637A

  • Field pest image identification method and device under small sample condition

    CN121214105A

  • Control method for information processor, information processor, and program

    JP2024174681A

  • Systems and Methods Using Weighted-Ensemble Supervised-Learning for Automatic Detection of Ophthalmic Disease from Images

    US20240185138A1