Uterine cavity lesion image classification method based on weighted prototype network
By introducing weighted prototype networks and adaptive data enhancement technology in the uterine lesion image classification task, the problems of data scarcity, imbalance and poor image quality are solved, and the accuracy and robustness of classification are significantly improved.
Patent Information
- Application Number
- CN202411640530.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-28
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN119540631A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision and deep learning technology, and specifically to a uterine cavity lesion image classification method based on a weighted prototype network (WPN), aiming to improve the accuracy and robustness of uterine cavity lesion image classification by optimizing prototype representation and dynamically adjusting data enhancement. Background Art
[0002] Deep learning technology is increasingly being used in the medical field. In the field of gynecology, it can realize the automated analysis of images of uterine lesions, greatly reducing the workload of doctors and improving diagnostic efficiency. However, the recognition and classification of images of uterine lesions also face multiple severe challenges, including but not limited to the high difficulty of data collection caused by the scarcity of some rare lesion cases, the significant imbalance within the data set, and the image quality varies due to various factors (such as acquisition equipment, environmental conditions, etc.). These problems directly restrict the generalization ability and practical application effect of the classification model. At present, although a variety of classification methods have been proposed and applied in this field, they have obvious limitations in dealing with the above challenges.
[0003] In view of this, the present invention innovatively proposes a weighted prototype network method, which shows significant superiority and breakthrough in solving the key problems in the classification of uterine lesion images. This method introduces the concept of category weights, assigns reasonable weights to samples of different categories, and especially increases the weights of minority or difficult-to-classify categories, so that the model can pay more attention to these categories during the training process, thereby improving the model's ability to recognize rare lesions. In addition, the prototype network itself, with its concise and efficient prototype representation mechanism, helps to capture the essential characteristics between categories, further enhancing the classification performance of the model. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and propose a method for classifying uterine lesion images based on a weighted prototype network, which is intended to be achieved by the following methods: constructing a weighted prototype network, optimizing the prototype representation in a weighted manner, and improving the classification accuracy. Designing an adaptive data enhancement strategy, dynamically adjusting the enhancement parameters according to model feedback, and enhancing the generalization ability of the model.
[0005] The technical solution adopted by the present invention is: a method for classifying uterine cavity lesion images based on a weighted prototype network, comprising the following steps:
[0006] Step 1: Collect uterine cavity lesion image data;
[0007] Step 2: Classify the uterine lesion image set and align the resolution and field of view of the images;
[0008] Step 3: Establish a uterine cavity lesion image dataset;
[0009] Step 4: Adopt adaptive data enhancement method to increase the amount of training data of images in the minority category;
[0010] Step 5: Train the weighted prototype network WPN;
[0011] Step 6: Input the test image into the trained WPN network model and calculate the distance between the features of the input image and each type of prototype;
[0012] Step 7: Output the category of the uterine cavity lesion image according to the distance.
[0013] Furthermore, in step 1, image data of uterine cavity pathological tissue within the field of view is collected from the hysteroscopic surgery video.
[0014] Furthermore, in step 2, the uterine cavity lesion image is classified according to the lesion type, and the effective lesion tissue area is intercepted from the image to perform resolution and field of view alignment.
[0015] Furthermore, in step 3, a uterine cavity lesion image dataset is established for the classified lesion images and category labels.
[0016] Furthermore, in step 4, the uterine lesion image dataset is adaptively enhanced, and the image rotation angle range, scaling ratio, and cropping method are dynamically adjusted for the few-sample category data to increase the number of samples; a loss function L is defined on the validation set V V , used to evaluate the effects of different data enhancement strategies A and their parameters θ. Find the optimal data enhancement strategy and its parameters θ through heuristic search * , so that Minimum. Where S is the training set. After each training cycle, the impact of the current enhancement strategy on the model performance is evaluated, and the selection mechanism is adjusted according to the evaluation structure.
[0017] Furthermore, the implementation of the weighted prototype network WPN in step 5 includes the following steps:
[0018] Step (1): The weighted prototype network WPN uses the CNN Resnet50 deep learning network as the embedding function f φ , maps the input uterine cavity image x to the feature vector Z=f in the high-dimensional feature space φ (x).
[0019] Step (2): For each category c, add the prototype weight W ci , weight W ci According to the inverse frequency of the sample category as the weight, Where N is a normalization constant (the inverse of the total number of samples of all categories), count(c) is the number of samples of category c, and ε is a small positive number used to avoid division by zero errors and ensure smooth calculations even in categories with no samples.
[0020] Step (3): For each category c, calculate the weighted prototype P c ′,P c ′ is the mean of the feature vector of the samples of category c. The weighted prototype calculation formula is:
[0021]
[0022] Among them, S c is the sample set of c. The loss function expression is:
[0023]
[0024] Where N is the total number of samples, C is the total number of categories, and y ci It is the indicator function of whether sample i belongs to the category. If yes, it is 1, otherwise it is 0. dist(.,.) is the distance function.
[0025] Step (4): For any input uterine cavity image First, by embedding the function f φ Extract the feature vector z, and then calculate z and each weighted prototype P c ′, use the softmax function to calculate the probability of belonging to each category, and select the category with the largest probability as the classification result. Classification probability calculation:
[0026]
[0027] Furthermore, in step 7, the prototype distance of each category is calculated according to the test image to obtain the category of the uterine cavity lesion image.
[0028] Beneficial effects: The present invention introduces a weighting mechanism, which can more accurately represent the prototype of each category (i.e., the center or representative sample of the category). This weighting method takes into account the importance and diversity of samples, making classification decisions more accurate. Compared with traditional methods such as prototype networks or support vector machines, weighted prototype networks can better handle complex and unbalanced data sets, thereby improving classification accuracy. By combining prototype learning and data enhancement technology, this method can reduce dependence on a large amount of labeled data to a certain extent. Prototype learning can extract effective category information from a small amount of labeled data, while data enhancement can further expand the diversity of training samples. This combination enables the model to achieve better classification results even when the labeled data is limited. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a training flow chart of the uterine cavity lesion image classification method based on the weighted prototype network.
[0030] Figure 2 It is the structure diagram of weighted prototype network WPN. DETAILED DESCRIPTION
[0031] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0032] like Figure 1 As shown, the uterine cavity lesion image classification method based on weighted prototype network of the present invention comprises the following steps:
[0033] Step 1: Collect uterine cavity lesion image data;
[0034] Step 2: Classify the uterine lesion image set and align the resolution and field of view of the images;
[0035] Step 3: Establish a uterine cavity lesion image dataset;
[0036] Step 4: Adopt the adaptive data augmentation method to increase the amount of training data for the few-sample category images; adaptive data augmentation rotates, scales, crops, flips, etc. the images. Define a loss function L on the validation set V V , used to evaluate the effects of different data enhancement strategies A and their parameters θ. Find the optimal data enhancement strategy and its parameters θ through heuristic search * , so that Minimum. Where S is the training set. After each training cycle, the impact of the current enhancement strategy on the model performance is evaluated, and the selection mechanism is adjusted according to the evaluation structure.
[0037] Step 5: Train the weighted prototype network WPN;
[0038] like Figure 2 As shown in the figure, the implementation of the weighted prototype network WPN includes the following steps:
[0039] Step (1): The weighted prototype network WPN uses the CNN Resnet50 deep learning network as the embedding function f φ , maps the input uterine cavity image x to the feature vector Z=f in the high-dimensional feature space φ (x).
[0040] Step (2): For each category c, add the prototype weight W ci , weight W ci According to the inverse frequency of the sample category as the weight, Among them, N is a normalization constant (the inverse of the total number of samples of all categories),
[0041] count(c) is the number of examples in class c, and ε is a small positive number used to avoid division by zero errors and ensure smooth calculations even in classes with no examples.
[0042] Step (3): For each category c, calculate the weighted prototype P c ′,P c ′ is the mean of the feature vector of the samples of category c. The weighted prototype calculation formula is:
[0043]
[0044] Among them, S c is the sample set of c. The loss function expression is:
[0045]
[0046] Where N is the total number of samples, C is the total number of categories, and y ci It is the indicator function of whether sample i belongs to the category. If yes, it is 1, otherwise it is 0. dist(.,.) is the distance function.
[0047] Step (4): For any input uterine cavity image First, by embedding the function f φ Extract the feature vector z, and then calculate z and each weighted prototype P c ′, use the softmax function to calculate the probability of belonging to each category, and select the category with the largest probability as the classification result. Classification probability calculation:
[0048]
[0049] Step 6: Input the test image into the trained WPN network model and calculate the distance between the features of the input image and each type of prototype;
[0050] Step 7: Output the category of the uterine cavity lesion image according to the distance.
[0051] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A method for classifying uterine cavity lesion images based on a weighted prototype network, characterized in that: The following steps are involved: Step 1: Collect uterine cavity lesion image data; Step 2: Classify the uterine lesion image set and align the resolution and field of view of the images; Step 3: Establish a uterine cavity lesion image dataset; Step 4: Adopt adaptive data enhancement method to increase the amount of training data of images in the minority category; Step 5: Train the weighted prototype network WPN; Step 6: Input the test image into the trained WPN network model and calculate the distance between the features of the input image and each type of prototype; Step 7: Output the category of the uterine cavity lesion image according to the distance.
2. The method for classifying uterine cavity lesions images based on a weighted prototype network according to claim 1, characterized in that: In the step 1, image data containing uterine cavity pathological tissue within the field of view is collected from the hysteroscopic surgery video.
3. The method for classifying uterine cavity lesions images based on a weighted prototype network according to claim 2, characterized in that: In step 2, the uterine cavity lesion image is classified according to the lesion type, and the effective lesion tissue area is intercepted from the image to perform resolution and field of view alignment.
4. The method for classifying uterine cavity lesion images based on weighted prototype network according to claim 3, characterized in that: In step 3, a uterine cavity lesion image dataset is established based on the classified lesion images and category labels.
5. The method for classifying uterine cavity lesion images based on weighted prototype network according to claim 4, characterized in that: In step 4, the uterine cavity lesion image dataset is adaptively enhanced, and the image rotation angle range, scaling ratio, and cropping method are dynamically adjusted for the few-sample category data to increase the number of samples.
6. The method for classifying uterine cavity lesion images based on weighted prototype network according to claim 5, characterized in that: In step 4, a loss function L is defined on the validation set V V , used to evaluate the effects of different data enhancement strategies A and their parameters θ; find the optimal data enhancement strategy and its parameters θ through heuristic search * , so that α * =argm θ inL V (A(S,θ)) is minimized; where S is the training set; after each training cycle, the impact of the current enhancement strategy on the model performance is evaluated, and the selection mechanism is adjusted according to the evaluation structure.
7. The method for classifying uterine cavity lesion images based on weighted prototype network according to claim 6, characterized in that: The implementation of the weighted prototype network WPN in step 5 includes the following steps: Step (1): The weighted prototype network WPN uses the CNN Resnet50 deep learning network as the embedding function f φ , maps the input uterine cavity image x to the feature vector Z=f in the high-dimensional feature space φ (x); Step (2): For each category c, add the prototype weight W ci , weight W ci According to the inverse frequency of the sample category as the weight, Where N is a normalization constant, count(c) is the number of samples in category c, and ε is a small positive number used to avoid division by zero errors and ensure smooth calculations even in categories with no samples. Step (3): For each category c, calculate the weighted prototype P c ′,P c ′ is the mean of the feature vector of the sample of category c; the weighted prototype calculation formula is: Among them, S c is the sample set of c; the loss function expression is: Where N is the total number of samples, C is the total number of categories, and y ci is the indicator function of whether sample i belongs to the category, if yes, it is 1, if not, it is 0; dist(.,.) is the distance function; Step (4): For any input uterine cavity image First, by embedding the function f φ Extract the feature vector z, and then calculate z and each weighted prototype P c ′, use the softmax function to calculate the probability of belonging to each category, and select the category with the largest probability as the classification result; classification probability calculation:
8. The method for classifying uterine cavity lesion images based on weighted prototype network according to claim 7, characterized in that: In step 7, the prototype distance of each category is calculated according to the test image to obtain the category of the uterine cavity lesion image.
Citation Information
Patent Citations
Uterine cavity lesion image classification method based on granularity perception and structural modeling
CN117765338A
Agricultural pest image data enhancement method and system based on MTS multi-network model
CN118628924A
Cited By
Abnormal lesion area detection method of endoscope image
CN120747032A