Model training method, polyp detection method, corresponding device, medium and equipment

Through joint learning of feature extraction network, polyp detection branch and contrast learning branch, the problems of high false detection rate and weak generalization ability of polyp detection model in colonoscopy are solved, and accurate polyp detection in complex intestinal environments and different application scenarios are achieved.

CN114863124BActive Publication Date: 2025-07-29XIAOHE MEDICAL EQUIP (HAINAN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210583592.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-25
Publication Date
2025-07-29
Estimated Expiration
2042-05-25

AI Technical Summary

Technical Problem

The existing polyp detection model based on deep learning has problems with high false detection rate and weak generalization ability in colonoscopy, especially in complex intestinal environments, different collection equipment, and patients in different regions, which perform poorly.

Method used

A multi-task joint learning method using feature extraction network, polyp detection branch and contrast learning branch is adopted. Through joint optimization of detection loss and contrast loss, the model's discrimination ability of positive and negative samples is enhanced, and the model's robustness and generalization performance are improved.

Benefits of technology

The accuracy and robustness of the polyp detection model in different scenarios can be improved, and the location of polyp targets in the image can be more accurately detected, the virtual detection rate is reduced, and the ability to distinguish suspected targets with similar polyps is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863124B_ABST
    Figure CN114863124B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a model training method, a polyp detection method, a corresponding device, a medium and a device. The training method includes: obtaining a polyp detection model; inputting training images into the polyp detection model, and obtaining multiple feature maps of different scales through a feature extraction network; through a polyp detection branch, detecting the positions of polyp targets in the training images according to the multiple feature maps, and calculating a detection loss; through a contrastive learning branch, extracting positive sample features and negative sample features from the multiple feature maps, and calculating a contrastive loss according to the distance between the positive sample features and the positive sample target features and the distance between the negative sample features and the negative sample target features; obtaining a combined loss according to the detection loss and the contrastive loss, and updating the polyp detection branch and the contrastive learning branch according to the combined loss. The model obtained in this way can have good discrimination ability for suspected targets similar in shape to polyps, and can accurately obtain the positions of polyp targets in the image for different application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technologies, and in particular, to a model training method, a polyp detection method, a corresponding device, a medium, and a device. Background Art

[0002] Colonoscopy can be used for colon screening and polyp detection. For polyp detection, currently, mainly endoscopic specialists discover polyps from endoscopic images by the naked eye. In related technologies, a polyp detection model based on deep learning can also be used to detect polyp targets in endoscopic images.

[0003] The polyp detection model based on deep learning can achieve good performance in a single scenario. However, during colonoscopy, the existing models have the following problems: First, the intestinal environment is complex, and there are a large number of suspected targets similar in shape to polyps (such as feces, mucosal elevations, etc.), while the frequency of polyp targets appearing during the entire colonoscopy process is low, resulting in a high false detection rate of the existing models, which will cause unnecessary interference to the normal examination and diagnosis of doctors; Second, due to different acquisition devices, there are differences in image imaging resolution, and there are also large differences in the polyp distribution of patients in different regions, resulting in weak generalization ability of the existing models and a high missed detection rate in new application scenarios. Summary of the Invention

[0004] This Summary of the Invention section is provided to introduce concepts in a brief form, which will be described in detail in the subsequent Detailed Implementation section. This Summary of the Invention section is not intended to identify the key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.

[0005] In a first aspect, the present disclosure provides a model training method, including:

[0006] Obtain a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrast learning branch;

[0007] Input a training image into the polyp detection model, and through the feature extraction network, extract features from the training image to obtain multiple feature maps of different scales;

[0008] Through the polyp detection branch, detect the positions of polyp targets in the training image according to the multiple feature maps, and calculate a detection loss according to the detection results;

[0009] Through the contrast learning branch, extract positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps, and calculate a contrast loss according to the distance between the positive sample features and positive sample target features, and the distance between the negative sample features and negative sample target features.

[0010] Obtain a joint loss based on the detection loss and the contrast loss, and update the polyp detection branch and the contrast learning branch according to the joint loss.

[0011] In a second aspect, the present disclosure provides a polyp detection method, including:

[0012] Obtain an image to be detected;

[0013] Input the image to be detected into a target polyp detection model to obtain the position of polyp targets in the image to be detected; wherein, the target polyp detection model is obtained by training a polyp detection model according to the method in the first aspect, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

[0014] In a third aspect, the present disclosure provides a model training device, including:

[0015] A model acquisition module, configured to acquire a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrast learning branch;

[0016] A feature extraction module, configured to input a training image into the polyp detection model, and extract features from the training image through the feature extraction network to obtain multiple feature maps of different scales;

[0017] A polyp detection module, configured to detect the position of polyp targets in the training image according to the multiple feature maps through the polyp detection branch, and calculate a detection loss according to the detection result;

[0018] A contrast learning module, configured to extract positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps through the contrast learning branch, and calculate a contrast loss according to the distance between the positive sample features and positive sample target features and the distance between the negative sample features and negative sample target features;

[0019] A joint learning module, configured to obtain a joint loss based on the detection loss and the contrast loss, and update the polyp detection branch and the contrast learning branch according to the joint loss.

[0020] In a fourth aspect, the present disclosure provides a polyp detection device, including:

[0021] An image acquisition module, configured to acquire an image to be detected;

[0022] A polyp detection module, configured to input the image to be detected into a target polyp detection model to obtain the position of polyp targets in the image to be detected; wherein, the target polyp detection model is obtained by training a polyp detection model based on the method described in the first aspect, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

[0023] In a fifth aspect, the present disclosure provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processing device, the steps of the method described in the first aspect or the second aspect are implemented.

[0024] In a sixth aspect, the present disclosure provides an electronic device, including:

[0025] A storage device, on which a computer program is stored;

[0026] A processing device, configured to execute the computer program in the storage device to implement the steps of the method described in the first aspect or the second aspect.

[0027] In the above solution, through the multi-task joint learning of the polyp detection branch and the contrast learning branch, the generalization performance of the polyp detection model can be improved. Specifically, based on the detection loss of the polyp detection branch and the contrast loss of the contrast learning branch, the parameters of the polyp detection branch are updated, which is beneficial to enhancing the robustness of the polyp detection branch in the face of different scenarios and improving the discrimination ability for positive and negative samples. When facing different application scenarios such as different acquisition devices and patients in different regions, accurate discrimination of positive and negative samples can be achieved, so as to more accurately obtain the position of polyp targets in the image.

[0028] Other features and advantages of the present disclosure will be described in detail in the subsequent specific implementation part. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Combined with the drawings and referring to the following specific implementation manners, the above and other features, advantages and aspects of the embodiments of the present disclosure will become more obvious. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the original components and elements are not necessarily drawn to scale. In the drawings:

[0030] Figure 1 The flowchart of the model training method provided by an exemplary embodiment is shown;

[0031] Figure 2 The schematic diagram of the polyp detection model in an exemplary embodiment is shown;

[0032] Figure 3 The flowchart of the specific implementation manner of step S104 in an exemplary embodiment is shown;

[0033] Figure 4 Shows another schematic diagram of a polyp detection model in an exemplary embodiment;

[0034] Figure 5 Shows a flowchart of a polyp detection method provided by an exemplary embodiment;

[0035] Figure 6 Shows a block diagram of a model training device provided by an exemplary embodiment;

[0036] Figure 7 Shows a block diagram of a polyp detection device provided by an exemplary embodiment;

[0037] Figure 8 Shows a block diagram of an electronic device provided by an exemplary embodiment. Detailed implementation manners

[0038] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0039] It should be understood that the various steps recorded in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0040] The term "including" and its variations used herein are open-ended, that is, "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0041] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependent relationships.

[0042] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly specified in the context, it should be understood as "one or more".

[0043] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only and are not used to limit the scope of these messages or information.

[0044] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to users and the authorization of users should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0045] For example, when responding to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, an application program, a server, or a storage medium that executes the operations of the technical solutions of the present disclosure according to the prompt message.

[0046] As an optional but non-limiting implementation manner, the manner of sending a prompt message to the user in response to receiving an active request from the user can be, for example, in the form of a pop-up window, and the prompt message can be presented in text in the pop-up window. In addition, the pop-up window can also carry selection controls for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0047] It can be understood that the above process of notifying and obtaining user authorization is only illustrative and does not limit the implementation manners of the present disclosure. Other manners that meet relevant laws and regulations can also be applied to the implementation manners of the present disclosure.

[0048] At the same time, it can be understood that the data involved in the present technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of corresponding laws, regulations and related provisions.

[0049] For the polyp detection model based on deep learning, with the booming development of deep learning in the field of computer vision, related technologies have tried to introduce leading algorithms in general object detection into the polyp detection task. These methods usually rely on pre-training on large-scale general vision datasets such as ImageNet, and then fine-tuning on some benchmark datasets composed of endoscopic images for the polyp detection task. Although these methods have achieved good performance on the benchmark datasets, the scale of these benchmark datasets is usually small, and the obtained polyp detection models have the risk of overfitting, resulting in poor generalization performance when the models are applied in the specific colonoscopy process. Moreover, in the real colonoscopy process, the intestinal environment is very complex, and suspected targets such as feces and mucosal elevations are likely to interfere with the polyp detection model. Factors such as different acquisition devices and the polyp distribution of patients in different regions also pose higher requirements on the generalization ability of the polyp detection model.

[0050] Accordingly, an embodiment of the present disclosure provides a model training method to improve the generalization ability of the polyp detection model in a complex intestinal environment. Figure 1 The flowchart of the model training method provided by an exemplary embodiment is shown. As Figure 1 shown, the method includes:

[0051] S101, obtain a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrast learning branch.

[0052] Figure 2 The schematic diagram of the polyp detection model in an exemplary embodiment is shown. Please refer to Figure 2 , the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrast learning branch. Among them, the feature extraction network is used to extract features from the input image and output multiple feature maps of different scales. Exemplarily, Figure 2 in, the feature extraction network includes a basic network and a Feature Pyramid Networks (FPN). First, the image is input into the basic network to extract features from bottom to top, and then the shallow feature maps to high-level feature maps extracted by the basic network are input into the FPN. The FPN fuses these feature maps through top-down and lateral connections, and finally outputs multiple feature maps of different scales. For example, feature maps downsampled by 16 times, 32 times, and 64 times respectively compared to the input image are output, which are P1, P2, and P3 respectively. Based on these multiple feature maps, a polyp detection branch and a contrast learning branch are respectively connected. The polyp detection branch is used to complete the polyp detection task, and the contrast learning branch is used to complete the contrast learning task of positive and negative sample features. Through the multi-task joint learning of the polyp detection branch and the contrast learning branch, the generalization performance of the polyp detection model is improved.

[0053] Among them, the polyp detection branch is used to detect the position of the polyp target according to the multiple feature maps of different scales output by the feature extraction network, and obtain the detection result, that is, the target box representing the position of the polyp target. In the training stage, the polyp detection branch also calculates the detection loss of the polyp detection branch according to the position of the detected polyp target and the polyp target annotation of the input image.

[0054] Among them, the contrast learning branch is used to store the positive sample target features and negative sample target features, and sample the positive sample features corresponding to the polyp target and the negative sample features corresponding to the non-polyp target from the multiple feature maps of different scales output by the feature extraction network. According to the distance between each sampled positive sample feature and the positive sample target feature, and the distance between each sampled negative sample feature and the negative sample target feature, the contrast loss of the contrast learning branch is calculated.

[0055] S102. Input the training image into the polyp detection model, and extract features from the training image through the feature extraction network to obtain multiple feature maps of different scales.

[0056] Prior to this, first obtain a training set, which includes multiple training images. In an exemplary embodiment, to ensure data diversity, the training set is obtained by extracting frames from endoscopic videos collected from hospitals, and the collected endoscopic videos come from different collection devices. The frame extraction frame rate of the video is 5 FPS. Blurry images are filtered out, and then labeled by internists.

[0057] It should be noted that in general object detection tasks, the target appears at a relatively high frequency in the image. However, in real endoscopic videos, the polyp target appears at a relatively low frequency, and the intestinal environment is complex, with a large number of suspected targets similar in shape to polyps (such as feces, mucosal elevations, etc.). If only images containing polyp targets are used for training, it will make it difficult for the model to judge suspected targets, thereby significantly increasing the false detection rate. To reduce the false detection rate during colonoscopy, a large number of images without polyp targets are added to the training set.

[0058] Optionally, to further increase data diversity, at least one of the following data augmentations is performed on each training image in the training set: random cropping, random vertical flipping, random horizontal flipping, and random color transformation. Finally, the image size is scaled to a preset size (such as 512×512).

[0059] S103. Through the polyp detection branch, detect the position of the polyp target in the input training image according to the multiple feature maps, and calculate the detection loss according to the detection result.

[0060] S104. Through the contrastive learning branch, extract the positive sample features corresponding to the polyp target and the negative sample features corresponding to the non-polyp target from the multiple feature maps, and calculate the contrastive loss according to the distance between the positive sample features and the positive sample target features, and the distance between the negative sample features and the negative sample target features.

[0061] S105. Obtain the combined loss according to the detection loss and the contrastive loss, and update the polyp detection branch and the contrastive learning branch according to the combined loss.

[0062] Specifically, calculate the weighted sum of the detection loss and the contrastive loss as the combined loss of the polyp detection model, and update the polyp detection branch and the contrastive learning branch according to the combined loss.

[0063] In the contrast learning branch, it is first necessary to generate positive sample target features representing the feature information of positive samples and negative sample target features representing the feature information of negative samples. The positive sample target features and negative sample target features are randomly generated initially, but they are learnable and will perform contrast learning based on the positive sample features and negative sample features of the input images. When updating the contrast learning branch during each training iteration, it is the positive sample target features and negative sample target features in the contrast learning branch that are updated. Therefore, as the polyp detection model is trained, the positive sample target features and negative sample target features will be adaptively updated according to the joint loss.

[0064] During the training process, the positive sample target features will approach the positive sample features, and the negative sample target features will approach the negative sample features. Therefore, the distance between the learned positive sample target features and negative sample target features will continuously increase.

[0065] Based on the detection loss of the polyp detection branch and the contrast loss of the contrast learning branch, the parameters of the polyp detection branch are updated, which is beneficial to enhancing the robustness of the polyp detection branch in the polyp detection model when facing different scenarios, improving the discrimination ability for positive and negative samples, and accurately discriminating positive and negative samples in the face of different application scenarios such as different acquisition devices and patients in different regions, so as to more accurately obtain the position of the polyp target in the image.

[0066] To obtain positive and negative sample features for contrast learning, the contrast learning branch performs sample feature sampling on the three-layer feature maps output by the feature extraction network. Figure 3 The flowchart showing the specific implementation manner of the above step S104 in an exemplary embodiment is shown. Please refer to Figure 3 , step S104 includes:

[0067] S201, according to the polyp target annotation of the training image, determine the label of each pixel position in each feature map.

[0068] Since each feature map is obtained by extracting features from the input training image, there is a mapping relationship between the pixel positions on the feature map and the pixel positions on the training image. According to the polyp target annotation of the training image, it can be determined whether each pixel position on each feature map corresponds to a polyp target. Here, the polyp target annotation is the target box that frames the polyp target. Then, according to whether each pixel position on each feature map corresponds to a polyp target, determine the label y i , y i ∈ {0, 1}, where 0 represents a positive sample and 1 represents a negative sample. Specifically, determine the label of the pixel positions corresponding to the polyp target in each feature map as positive samples, and determine the label of the pixel positions corresponding to non-polyp targets in each feature map as negative samples.

[0069] S202. Sample a plurality of positive sample features corresponding to positive samples and a plurality of negative sample features corresponding to negative samples from the plurality of feature maps according to the labels at each pixel position in each feature map.

[0070] Normally, the number of negative samples in the plurality of feature maps is much larger than the number of positive samples. To prevent the training process from being dominated by negative samples, during the sampling process, the number of negative sample features is determined according to the number of positive sample features.

[0071] First, sample all positive sample features corresponding to positive samples from the positions of positive samples in the plurality of feature maps according to the labels at each pixel position. Among them, one sample feature can be sampled at each pixel position. Exemplarily, the size of feature map P1 is 32×32×512, and a 1×1×512 sample feature can be sampled from one pixel position on feature map P1, and finally N p positive sample features are obtained. Then randomly sample k*N p negative sample features corresponding to negative samples from the plurality of feature maps, where k is a preset coefficient. For example, if k = 3, then finally 3N p negative sample features are obtained. In this way, when the number of sampled positive sample features is small, the number of sampled negative sample features also decreases accordingly, and when the number of sampled positive sample features is large, the number of sampled negative sample features also increases accordingly.

[0072] Among them, the value of k should not be too large. For example, the value of k can be within [1, 5].

[0073] S203. Calculate the contrastive loss according to the distance between each positive sample feature and the positive sample target feature, and the distance between each negative sample feature and the negative sample target feature.

[0074] It should be noted that in the above solution, the positive and negative sample features come from the corresponding pixel positions on the feature maps of different scales output by the feature extraction network, ensuring that the positive and negative sample features contain multi-scale information.

[0075] Optionally, in the above steps, perform L2 normalization processing on each positive sample feature, each negative sample feature, the positive sample target feature, and the negative sample target feature. Calculate the intra-class loss according to the distance between each normalized positive sample feature and the positive sample target feature, and the distance between each normalized negative sample feature and the negative sample target feature. Calculate the inter-class loss according to the distance between each normalized positive sample feature and the negative sample target feature, and the distance between each normalized negative sample feature and the positive sample target feature. Then calculate the contrastive loss according to the intra-class loss and the inter-class loss. Therefore, the contrastive loss is composed of the intra-class loss and the inter-class loss.

[0076] In the above calculation, the distance between two features can be measured by cosine similarity.

[0077] Based on the above embodiments, the intra-class loss, inter-class loss, and contrast loss can be calculated using the following formulas:

[0078]

[0079]

[0080] L con = L pos + L neg ;

[0081] where L pos is the intra-class loss, L neg is the inter-class loss, L con is the contrast loss, cos() represents calculating the cosine similarity, represents calculating the cosine similarity between x1 and x2, max() represents taking the maximum value, max(z1,z2) represents taking the larger value of z1 and z2, N p is the number of sampled positive sample features, N n is the number of sampled negative sample features, p1 is the positive sample target feature, p0 is the negative sample target feature, is the i-th normalized positive sample feature, is the i-th normalized negative sample feature.

[0082] From the above process, it can be seen that the positive and negative sample features are obtained by extracting the corresponding features at the corresponding positions on the multi-scale feature maps according to the labels of the pixel positions, making full use of the multi-scale information of the polyp target, which is beneficial to improving the adaptability of the polyp detection branch in the polyp detection model to polyp targets of different scales.

[0083] Optionally, in order to further improve the discrimination ability of the model between real polyp targets and suspected targets and further reduce false detections, Figure 4 shows another schematic diagram of the polyp detection model in an exemplary embodiment. Figure 4 In, the polyp detection model further includes an image classification branch. Based on the top-level feature map output by the feature extraction network, an image classification branch is connected. This image classification branch is used to complete the global image binary classification task for identifying whether there is a polyp target in the image.

[0084] Specifically, the image classification branch is used to obtain the top-level feature map among the multiple feature maps of different scales output by the feature extraction network, classify whether there is a polyp target in the input image based on the global image features in the top-level feature map, and calculate the classification loss of the image classification branch.

[0085] Specifically, the image classification branch includes an average pooling layer and a fully connected layer. In the image classification branch, the top-layer feature map is input into the average pooling layer, and the top-layer feature map is globally average pooled through the average pooling layer to obtain a one-dimensional feature vector. Subsequently, the one-dimensional feature vector is input into the fully connected layer, and the classification prediction value p is output through the fully connected layer. The label y of the input image is obtained, and the classification prediction value p and the label y are substituted into the classification loss function for calculation to obtain the classification loss.

[0086] Among them, the classification loss function can adopt the following function:

[0087] L cls = -y log(p) - (1 - y)log(1 - p);

[0088] Among them, y ∈ {0, 1}. If the input image contains a polyp target, the label y is 1, otherwise the label y is 0.

[0089] Therefore, in step S105, the joint loss is obtained according to the detection loss, the contrast loss, and the classification loss, and the polyp detection branch, the contrast learning branch, and the image classification branch are updated according to the joint loss.

[0090] Specifically, the joint loss is:

[0091] L total = λ0L det + λ1L con + λ2L cls ;

[0092] Among them, L total is the joint loss, L det is the detection loss of the polyp detection branch, L con is the contrast loss of the contrast learning branch, L cls is the classification loss of the image classification branch, and λ0, λ1, and λ2 are respectively the weight coefficients of the losses of the three branches, which are used to maintain the stable progress of training. In one example, λ0, λ1, and λ2 are all set to 1.0.

[0093] Through the multi-task joint learning of the polyp detection branch, the contrast learning branch, and the image classification branch, the generalization performance of the polyp detection model can be further improved.

[0094] It should be noted that the image classification branch and the contrast learning branch are only used in the training stage to improve the generalization performance of the polyp detection model. In the actual detection stage, these two branches can be completely discarded without increasing the weight parameters and inference time consumption of the polyp detection model.

[0095] After the training is completed, a final polyp detection model is obtained, and a target polyp detection model is obtained according to the feature extraction network and the polyp detection branch in the final polyp detection model. Therefore, the target polyp detection model includes a feature extraction network and a polyp detection branch. Among them, the polyp detection branch of the target polyp detection model is trained based on detection loss, contrast loss, and classification loss. Therefore, the polyp detection branch has good discrimination ability for suspected targets similar in shape to polyps, and can accurately obtain the position of polyp targets in the image in the face of different application scenarios such as different acquisition devices and patients from different regions.

[0096] Therefore, the present disclosure provides a polyp detection method for detecting the position of polyp targets in an image. Figure 5 The flowchart of the polyp detection method provided by an exemplary embodiment is shown. Please refer to Figure 5 This method includes:

[0097] S301, obtain the image to be detected.

[0098] S302, input the image to be detected into the target polyp detection model to obtain the position of the polyp target in the image to be detected. Among them, the target polyp detection model is obtained based on the model training method provided above in the present disclosure.

[0099] The target polyp detection model includes a feature extraction network and a polyp detection branch. Among them, the image to be detected is input into the feature extraction network after preprocessing. The preprocessing includes but is not limited to scaling the image to be detected to a preset size, such as 512×512. The feature extraction network is used to extract features from the input image to be detected and output multiple feature maps of different scales. The polyp detection branch is used to detect the position of the polyp target in the image to be detected according to the multiple feature maps of different scales output by the extraction feature network, obtain the detection result, and output a target box representing the position of the polyp target in the image to be detected.

[0100] Since the polyp detection branch of the target polyp detection model is trained based on detection loss, contrast loss, and classification loss, the polyp detection branch has good discrimination ability for suspected targets similar in shape to polyps, and can accurately output a target box representing the position of the polyp target in the image to be detected in the face of different application scenarios such as different acquisition devices and patients from different regions.

[0101] Figure 6 The block diagram of the model training device provided by an exemplary embodiment is shown. Please refer to Figure 6 This model training device 400 includes:

[0102] A model acquisition module 401, configured to acquire a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrast learning branch;

[0103] A feature extraction module 402, configured to input a training image into the polyp detection model, and extract features from the training image through the feature extraction network to obtain multiple feature maps of different scales;

[0104] A polyp detection module 403, configured to detect the position of polyp targets in the training image according to the multiple feature maps through the polyp detection branch, and calculate a detection loss according to the detection result;

[0105] A contrast learning module 404, configured to extract positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps through the contrast learning branch, and calculate a contrast loss according to the distance between the positive sample features and positive sample target features and the distance between the negative sample features and negative sample target features;

[0106] A joint learning module 405, configured to obtain a joint loss according to the detection loss and the contrast loss, and update the polyp detection branch and the contrast learning branch according to the joint loss.

[0107] Optionally, the polyp detection model further includes an image classification branch, and the apparatus 400 further includes:

[0108] An image classification module, configured to classify whether the training image contains polyp targets according to the top-level feature map among the multiple feature maps through the image classification branch, and calculate a classification loss according to the classification result.

[0109] Wherein, the joint learning module 405 is configured to obtain a joint loss according to the detection loss, the contrast loss, and the classification loss, and update the polyp detection branch, the contrast learning branch, and the image classification branch according to the joint loss.

[0110] Optionally, the contrast learning module 404 includes:

[0111] A label determination module, configured to determine the label of each pixel position in each feature map according to the polyp target annotation of the training image; wherein, the label of the pixel position corresponding to the polyp target in the feature map is a positive sample, and the label of the pixel position corresponding to the non-polyp target is a negative sample;

[0112] A feature sampling module, configured to sample multiple positive sample features corresponding to positive samples and multiple negative sample features corresponding to negative samples from the multiple feature maps according to the label of each pixel position in each feature map.

[0113] Optionally, the feature sampling module is used for:

[0114] Sampling all positive sample features corresponding to positive samples and k*N negative sample features corresponding to randomly sampled negative samples from the multiple feature maps according to the labels at each pixel position in each of the feature maps; where, p N p is the number of positive sample features sampled, and k is a preset coefficient.

[0115] Optionally, the contrastive learning module 404 is used for:

[0116] Performing L2 normalization on each positive sample feature, each negative sample feature, the positive sample target feature, and the negative sample target feature;

[0117] Calculating the intra-class loss according to the distance between each normalized positive sample feature and the positive sample target feature, and the distance between each normalized negative sample feature and the negative sample target feature;

[0118] Calculating the inter-class loss according to the distance between each normalized positive sample feature and the negative sample target feature, and the distance between each normalized negative sample feature and the positive sample target feature;

[0119] Calculating the contrastive loss according to the intra-class loss and the inter-class loss.

[0120] Optionally, the intra-class loss, the inter-class loss, and the contrastive loss are calculated by the following formulas:

[0121]

[0122]

[0123] L con = L pos + L neg ;

[0124] where, L pos is the intra-class loss, L neg is the inter-class loss, L con is the contrastive loss, cos() represents calculating the cosine similarity, max() represents taking the maximum value, N p is the number of positive sample features sampled, N n is the number of negative sample features sampled, p1 is the positive sample target feature, p0 is the negative sample target feature, is the i-th normalized positive sample feature, is the i-th normalized negative sample feature.

[0125] Optionally, the collaborative learning module 405 is configured to:

[0126] Update the polyp detection branch, and the positive sample target feature and the negative sample target feature in the contrastive learning branch according to the collaborative loss.

[0127] Figure 7 The block diagram of a polyp detection device provided by an exemplary embodiment is shown. Please refer to Figure 7 The polyp detection device 500 includes:

[0128] An image acquisition module 501, configured to acquire an image to be detected;

[0129] A polyp detection module 502, configured to input the image to be detected into a target polyp detection model to obtain the position of the polyp target in the image to be detected; wherein, the target polyp detection model is obtained by training a polyp detection model based on the model training method of the present disclosure, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

[0130] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.

[0131] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processing device, the model training method or the polyp detection method of the present disclosure is implemented.

[0132] In an exemplary embodiment, an electronic device is provided, including:

[0133] A storage device, on which a computer program is stored;

[0134] A processing device, configured to execute the computer program in the storage device to implement the model training method or the polyp detection method of the present disclosure.

[0135] Next, refer to Figure 8 , which shows a schematic structural diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. The electronic device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is only an example, and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.

[0136] As Figure 8As shown, the electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may perform various appropriate actions and processes according to a program stored in the read-only memory (ROM) 602 or a program loaded from the storage device 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0137] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 8 an electronic device 600 with various devices is shown, it should be understood that it is not required to implement or include all the shown devices. Instead, more or fewer devices may be implemented or included.

[0138] Specifically, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are executed.

[0139] It should be noted that the computer-readable medium described above in this disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. And in this disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0140] The above computer-readable medium can be included in the above electronic device; it can also exist separately without being assembled into the electronic device.

[0141] The above computer-readable medium stores one or more programs, which, when executed by the electronic device, cause the electronic device to: obtain a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrastive learning branch; input a training image into the polyp detection model, and through the feature extraction network, extract features from the training image to obtain multiple feature maps of different scales; through the polyp detection branch, detect the positions of polyp targets in the training image according to the multiple feature maps, and calculate a detection loss according to the detection results; through the contrastive learning branch, extract positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps, and calculate a contrastive loss according to the distances between the positive sample features and positive sample target features, and the distances between the negative sample features and negative sample target features; obtain a combined loss according to the detection loss and the contrastive loss, and update the polyp detection branch and the contrastive learning branch according to the combined loss.

[0142] Alternatively, the above computer-readable medium stores one or more programs, which, when executed by the electronic device, cause the electronic device to: obtain an image to be detected; input the image to be detected into a target polyp detection model to obtain the positions of polyp targets in the image to be detected; where the target polyp detection model is obtained by training a polyp detection model based on the model training method of the present disclosure, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

[0143] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., connected through the Internet using an Internet service provider).

[0144] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.

[0145] The modules described in the embodiments of the present disclosure can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation on the module itself in some cases. For example, the model acquisition module can also be described as "the module for acquiring a polyp detection model".

[0146] The functions described above herein can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and so on.

[0147] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0148] According to one or more embodiments of the present disclosure, Example 1 provides a model training method, including:

[0149] Obtain a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrastive learning branch;

[0150] Input the training image into the polyp detection model, and through the feature extraction network, extract features from the training image to obtain multiple feature maps of different scales;

[0151] Through the polyp detection branch, detect the position of the polyp target in the training image according to the multiple feature maps, and calculate the detection loss according to the detection result;

[0152] Through the contrastive learning branch, extract positive sample features corresponding to the polyp target and negative sample features corresponding to non-polyp targets from the multiple feature maps, and calculate the contrastive loss according to the distance between the positive sample features and the positive sample target features, and the distance between the negative sample features and the negative sample target features;

[0153] Obtain a combined loss according to the detection loss and the contrastive loss, and update the polyp detection branch and the contrastive learning branch according to the combined loss.

[0154] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1. The polyp detection model further includes an image classification branch. After extracting features from the training image through the feature extraction network to obtain multiple feature maps of different scales, the method further includes:

[0155] Through the image classification branch, classify whether the training image contains a polyp target according to the top-level feature map among the multiple feature maps, and calculate the classification loss according to the classification result;

[0156] The obtaining the combined loss according to the detection loss and the contrastive loss, and updating the polyp detection branch and the contrastive learning branch according to the combined loss includes:

[0157] Obtain a combined loss according to the detection loss, the contrastive loss, and the classification loss, and update the polyp detection branch, the contrastive learning branch, and the image classification branch according to the combined loss.

[0158] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1 or 2. The extracting the positive sample features corresponding to the polyp target and the negative sample features corresponding to non-polyp targets from the multiple feature maps includes:

[0159] Determine the label of each pixel position in each of the feature maps according to the polyp target annotation of the training images; wherein, the label of the pixel position corresponding to the polyp target in the feature map is a positive sample, and the label of the pixel position corresponding to the non-polyp target is a negative sample;

[0160] Sample a plurality of positive sample features corresponding to positive samples and a plurality of negative sample features corresponding to negative samples from the plurality of feature maps according to the labels of each pixel position in each of the feature maps.

[0161] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 3, and the sampling of a plurality of positive sample features corresponding to positive samples and a plurality of negative sample features corresponding to negative samples from the plurality of feature maps according to the labels of each pixel position in each of the feature maps includes:

[0162] Sample all positive sample features corresponding to positive samples from the plurality of feature maps according to the labels of each pixel position in each of the feature maps, and randomly sample k*N p negative sample features corresponding to negative samples; wherein, N p is the number of sampled positive sample features, and k is a preset coefficient.

[0163] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 3, and the calculation of the contrast loss according to the distance between the positive sample feature and the positive sample target feature, and the distance between the negative sample feature and the negative sample target feature includes:

[0164] Perform L2 normalization on each positive sample feature, each negative sample feature, the positive sample target feature, and the negative sample target feature;

[0165] Calculate the intra-class loss according to the distance between each normalized positive sample feature and the positive sample target feature, and the distance between each normalized negative sample feature and the negative sample target feature;

[0166] Calculate the inter-class loss according to the distance between each normalized positive sample feature and the negative sample target feature, and the distance between each normalized negative sample feature and the positive sample target feature;

[0167] Calculate the contrast loss according to the intra-class loss and the inter-class loss.

[0168] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, and the intra-class loss, the inter-class loss, and the contrast loss are calculated by the following formulas:

[0169]

[0170]

[0171] L con = L pos + L neg ;

[0172] Wherein, L pos is the intra-class loss, L neg is the inter-class loss, L con is the contrastive loss, cos() represents calculating the cosine similarity, max() represents taking the maximum value, N p is the number of sampled positive sample features, N n is the number of sampled negative sample features, p1 is the positive sample target feature, p0 is the negative sample target feature, is the i-th normalized positive sample feature, is the i-th normalized negative sample feature.

[0173] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, updating the polyp detection branch and the contrastive learning branch according to the joint loss, including:

[0174] Updating the polyp detection branch according to the joint loss, and the positive sample target feature and the negative sample target feature in the contrastive learning branch.

[0175] According to one or more embodiments of the present disclosure, Example 8 provides a polyp detection method, including:

[0176] Obtaining an image to be detected;

[0177] Inputting the image to be detected into a target polyp detection model to obtain the position of the polyp target in the image to be detected; wherein, the target polyp detection model is obtained by training a polyp detection model according to the method of any one of Examples 1-7, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

[0178] According to one or more embodiments of the present disclosure, Example 9 provides a model training device, including:

[0179] A model acquisition module, configured to acquire a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrastive learning branch;

[0180] A feature extraction module, configured to input a training image into the polyp detection model, and extract features from the training image through the feature extraction network to obtain multiple feature maps of different scales;

[0181] A polyp detection module, configured to detect the position of polyp targets in the training image according to the multiple feature maps through the polyp detection branch, and calculate a detection loss according to the detection result;

[0182] A contrastive learning module, configured to extract positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps through the contrastive learning branch, and calculate a contrastive loss according to the distance between the positive sample features and the positive sample target features, and the distance between the negative sample features and the negative sample target features;

[0183] A joint learning module, configured to obtain a joint loss according to the detection loss and the contrastive loss, and update the polyp detection branch and the contrastive learning branch according to the joint loss.

[0184] According to one or more embodiments of the present disclosure, Example 10 provides a polyp detection device, including:

[0185] An image acquisition module, configured to acquire an image to be detected;

[0186] A polyp detection module, configured to input the image to be detected into a target polyp detection model to obtain the position of polyp targets in the image to be detected; wherein, the target polyp detection model is obtained by training a polyp detection model according to the method of any one of Examples 1-7, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

[0187] According to one or more embodiments of the present disclosure, Example 11 provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processing device, the method of any one of Examples 1-8 is implemented.

[0188] According to one or more embodiments of the present disclosure, Example 12 provides an electronic device, including:

[0189] A storage device, on which a computer program is stored;

[0190] A processing device, configured to execute the computer program in the storage device to implement the method of any one of Examples 1-8.

[0191] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.

[0192] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the foregoing description, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features that are described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.

[0193] Although the subject matter has been described in language specific to structural features and / or methodological acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.

Claims

1. A model training method, characterized in that, Including: Obtain a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrast learning branch; Input a training image into the polyp detection model, and through the feature extraction network, extract features from the training image to obtain multiple feature maps of different scales; Through the polyp detection branch, detect the position of polyp targets in the training image according to the multiple feature maps, and calculate a detection loss according to the detection results; Through the contrast learning branch, extract positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps, and calculate a contrast loss according to the distance between the positive sample features and positive sample target features, and the distance between the negative sample features and negative sample target features; Obtain a combined loss according to the detection loss and the contrast loss, and update the polyp detection branch and the contrast learning branch according to the combined loss.

2. The method according to claim 1, characterized in that, The polyp detection model further includes an image classification branch. After extracting features from the training image through the feature extraction network to obtain multiple feature maps of different scales, the method further includes: Through the image classification branch, classify whether there are polyp targets in the training image according to the top-level feature map among the multiple feature maps, and calculate a classification loss according to the classification results; The obtaining a combined loss according to the detection loss and the contrast loss, and updating the polyp detection branch and the contrast learning branch according to the combined loss includes: Obtain a combined loss according to the detection loss, the contrast loss, and the classification loss, and update the polyp detection branch, the contrast learning branch, and the image classification branch according to the combined loss.

3. The method according to claim 1 or 2, characterized in that: The extracting positive sample features corresponding to polyp targets and negative sample features corresponding to non-polyp targets from the multiple feature maps includes: Determine the label of each pixel position in each feature map according to the polyp target annotation of the training image; where the label of the pixel position corresponding to the polyp target in the feature map is a positive sample, and the label of the pixel position corresponding to the non-polyp target is a negative sample; According to the label of each pixel position in each feature map, sample multiple positive sample features corresponding to positive samples and multiple negative sample features corresponding to negative samples from the multiple feature maps.

4. The method according to claim 3, characterized in that The sampling multiple positive sample features corresponding to positive samples and multiple negative sample features corresponding to negative samples from the multiple feature maps according to the label of each pixel position in each feature map includes: Sample all positive sample features corresponding to positive samples and k * N negative sample features corresponding to randomly sampled negative samples from the multiple feature maps according to the labels at each pixel position in each of the feature maps; where N p is the number of sampled positive sample features, and k is a preset coefficient. p ​ 5. The method according to claim 3, characterized in that: The calculating a contrast loss according to the distance between the positive sample features and positive sample target features, and the distance between the negative sample features and negative sample target features includes: Perform L2 normalization on each positive sample feature, each negative sample feature, positive sample target feature, and negative sample target feature; Calculate an intra-class loss according to the distance between each normalized positive sample feature and positive sample target feature, and the distance between each normalized negative sample feature and negative sample target feature; Calculate the between-class loss based on the distances between each positive sample feature and the negative sample target feature after normalization, and the distances between each negative sample feature and the positive sample target feature after normalization. Calculate the contrastive loss based on the within-class loss and the between-class loss.

6. The method according to claim 5, wherein The within-class loss, the between-class loss, and the contrastive loss are calculated by the following formulas: L con =L pos +L neg ; Among them, L pos is the intra-class loss, L neg is the inter-class loss, L con is the contrastive loss, cos() represents calculating the cosine similarity, max() represents taking the maximum value, N p is the number of sampled positive sample features, N n is the number of sampled negative sample features, p1 is the positive sample target feature, p0 is the negative sample target feature, is the i-th normalized positive sample feature, is the i-th normalized negative sample feature.

7. The method according to claim 1, characterized in that, Updating the polyp detection branch and the contrastive learning branch according to the joint loss includes: Updating the polyp detection branch according to the joint loss, and the positive sample target feature and the negative sample target feature in the contrastive learning branch.

8. A polyp detection method, characterized in that, Including: Obtain the image to be detected; Input the image to be detected into the target polyp detection model to obtain the position of the polyp target in the image to be detected; wherein, the target polyp detection model is obtained by training the polyp detection model based on the method according to any one of claims 1-7, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

9. A model training device, characterized in that: Including: A model acquisition module, configured to acquire a polyp detection model, where the polyp detection model includes a feature extraction network, a polyp detection branch, and a contrastive learning branch; A feature extraction module, configured to input a training image into the polyp detection model, and extract features from the training image through the feature extraction network to obtain multiple feature maps of different scales; A polyp detection module, configured to detect the position of the polyp target in the training image according to the multiple feature maps through the polyp detection branch, and calculate a detection loss according to the detection result; A contrastive learning module, configured to extract a positive sample feature corresponding to the polyp target and a negative sample feature corresponding to the non-polyp target from the multiple feature maps through the contrastive learning branch, and calculate a contrastive loss according to the distance between the positive sample feature and the positive sample target feature, and the distance between the negative sample feature and the negative sample target feature; A joint learning module, configured to obtain a joint loss according to the detection loss and the contrastive loss, and update the polyp detection branch and the contrastive learning branch according to the joint loss.

10. A polyp detection device, characterized in that, Including: An image acquisition module, configured to acquire an image to be detected; A polyp detection module, configured to input the image to be detected into the target polyp detection model to obtain the position of the polyp target in the image to be detected; wherein, the target polyp detection model is obtained by training the polyp detection model based on the method according to any one of claims 1-7, and the target polyp detection model includes a feature extraction network and a polyp detection branch.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processing device, it implements the steps of the method according to any one of claims 1-8.

12. An electronic device, characterized in that, Including: A storage device, on which a computer program is stored; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Training method and device, fingerprint identification method and device, and electronic equipment

    CN112613341A