Gastroscope image automatic labeling method, device, equipment, medium and product
Through the unsupervised learning method, the feature extraction network and iteratively optimized image segmentation model are used to realize automatic labeling of gastroscopic images, solving the problem of difficulty and cost of obtaining manual labeling data in the prior art, and improving the labeling efficiency and quality.
Patent Information
- Application Number
- CN202411763148.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, deep learning methods for gastroscopic image lesions relies on manual annotated training data, resulting in high difficulty and cost of obtaining labeled data, affecting the deep learning effect.
Unsupervised learning method is adopted to extract and pixel cluster the unlabeled gastroscopy images through feature extraction network to obtain the lesion area mask image set, and a training data set is generated through polygon fitting and labeling, and the image segmentation model is iteratively optimized to realize automatic labeling of gastroscopy images.
Automatic labeling of gastroscopic images is realized, which reduces dependence on manual labeling, improves the efficiency and quality of labeling data acquisition, and reduces costs.
Smart Images

Figure CN119785073A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer-aided medical technology, and in particular relates to a method, device, equipment, medium and product for automatic annotation of gastroscopic images. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] At present, all deep learning methods for lesion recognition in gastroscopic images are supervised learning methods, that is, deep learning is performed based on manually annotated training data. In the medical field, the annotated data needs to be completed by professional physicians, which increases the difficulty and cost of obtaining annotated data and affects the effect of deep learning. Although gastroscopic image data is relatively easy to obtain, there is a lack of high-quality gastroscopic image annotated data, especially pixel-level annotation. Summary of the invention
[0004] In order to overcome the above-mentioned deficiencies of the prior art, the present invention provides a method, device, equipment, medium and product for automatic annotation of gastroscope images. Automatic annotation of gastroscope images is achieved based on unsupervised learning.
[0005] To achieve the above object, a first aspect of the present invention provides a method for automatically annotating gastroscopic images, comprising the following steps:
[0006] Obtaining a set of unlabeled gastroscopic images;
[0007] Based on the feature extraction network, feature extraction and pixel clustering are performed on some unlabeled gastroscopic image sets to obtain the mask image set of the lesion area;
[0008] Perform polygon fitting and annotation based on the mask image set of the lesion area to obtain a training data set of the lesion area;
[0009] Based on the training data set of the lesion area, the initial image segmentation model is trained; the remaining unlabeled gastroscopy images are used as input, image segmentation is performed based on the initial image segmentation model, and the mask image set of the lesion area is updated;
[0010] The polygon fitting and labeling, as well as the optimization of the image segmentation model are iteratively performed to obtain the image segmentation model to be deployed, wherein the image segmentation model to be deployed is used to identify and label the lesion area of the gastroscopy image during the examination process.
[0011] A second aspect of the present invention provides a gastroscope image automatic annotation device, comprising:
[0012] The unlabeled image acquisition module is configured to: acquire an unlabeled gastroscopic image set;
[0013] The lesion area recognition module is configured to: perform feature extraction and pixel clustering on a portion of the unlabeled gastroscopic image set based on a feature extraction network to obtain a lesion area mask image set;
[0014] The training data acquisition module is configured to: perform polygon fitting and annotation based on the lesion area mask image set to obtain a training data set of the lesion area;
[0015] The training data updating module is configured to: train the initial image segmentation model based on the training data set of the lesion area; take the remaining unlabeled gastroscopy images as input, perform image segmentation based on the initial image segmentation model, and update the mask image set of the lesion area;
[0016] The segmentation model iterative optimization module is configured to iteratively perform polygon fitting and labeling, and optimize the image segmentation model to obtain the image segmentation model to be deployed, and the image segmentation model to be deployed is used to identify and label the lesion area of the gastroscopic image during the examination.
[0017] A third aspect of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method described.
[0018] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the method described when executed by a processor.
[0019] A fifth aspect of the present invention provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the method described is implemented.
[0020] One or more of the above technical solutions use an unsupervised learning method based on deep learning. Based on unlabeled data, through feature extraction and pixel clustering, a mask image for image segmentation is obtained. Then, based on the image segmentation model, fully automated image annotation can be achieved, effectively reducing the required manual annotation. And wherein, feature extraction and pixel clustering are performed iteratively multiple times, and the feature extraction network is continuously optimized in this process, thereby improving the feature extraction accuracy of the feature extraction network for gastroscopic images; in the process of building the image segmentation model, the fitting annotation module and the adjustment segmentation module are iterated multiple times to achieve continuous optimization of the image segmentation model, that is, the feature extraction network and the image segmentation model are both iteratively optimized, so that the feature extraction network and the image segmentation model are both suitable for the processing of gastroscopic images, thereby achieving unsupervised gastroscopic image target recognition and annotation. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0022] Figure 1 This is an overall flow chart of the method for automatic annotation of gastroscopic images in an embodiment of the present invention;
[0023] Figure 2 The present invention is a flowchart of a method for generating and updating a lesion area mask image set in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.
[0025] In the description of the embodiments of the present application, the term “including” and similar terms should be understood as open inclusion, that is, “including but not limited to.” The term “based on” should be understood as “based at least in part on.”
[0026] like Figure 1-Figure 2 As shown, this embodiment provides a method for automatic annotation of gastroscopic images, comprising:
[0027] Step 1: Obtain a set of unlabeled gastroscopic images;
[0028] Step 2: Based on the feature extraction network, feature extraction and pixel clustering are performed on some unlabeled gastroscopy image sets to obtain the mask image set of the lesion area;
[0029] Step 3: Perform polygon fitting and annotation based on the mask image set of the lesion area to obtain a training data set of the lesion area;
[0030] Step 4: Based on the training data set of the lesion area, train the initial image segmentation model; use the remaining unlabeled gastroscopy images as input, perform image segmentation based on the initial image segmentation model, and update the mask image set of the lesion area;
[0031] Step 5: Repeat steps 3-4 to obtain the image segmentation model to be deployed, where the image segmentation model to be deployed is used to identify and mark the lesion area of the gastroscopy image during the examination.
[0032] In step 1, obtaining an unlabeled gastroscopic image set specifically includes:
[0033] Step 1.1: Get the original gastroscopic image collected during gastroscopy. Since there are text annotations around the original gastroscopic image, if they are not removed, they will interfere with the subsequent feature extraction and lesion identification, so interference removal is required. The specific interference removal process is as shown in steps 1.2-1.3.
[0034] Step 1.2: Perform text detection and positioning on the original gastroscopic image to obtain text area location information. Specifically, the detection and positioning of the text area position can adopt the OCR optical character recognition algorithm; or the pre-trained EAST detection algorithm can be used to achieve text area positioning through a fully convolutional neural network and non-maximum suppression. Since the text annotations in gastroscopic images are usually white and the background is black, in this embodiment, the background is removed by filling the white pixels in the text area with black. The specific process is as shown in step 1.3.
[0035] Step 1.3: Fill the white pixels in the text area with black; detect the proportion of black pixels in the original gastroscopic image. If the proportion of black pixels exceeds a set threshold (e.g., 0.8), discard the corresponding original gastroscopic image to obtain an unlabeled gastroscopic image set.
[0036] By filling all the pixels in the rectangular frame with a black text background color with black, the interference information in the original gastroscopy image can be removed. By detecting the proportion of black pixels, the size of the object to be detected is guaranteed, thereby meeting the clarity requirements and providing a guarantee for the accuracy of subsequent model training.
[0037] After the step 1 obtains the unlabeled gastroscopic image set, the unlabeled gastroscopic image set is also subjected to image preprocessing, wherein the image preprocessing includes adjusting the image resolution and performing sample expansion on the unlabeled gastroscopic image data set. The sample expansion specifically includes performing one or more operations of geometric transformation, random cropping, and random horizontal flipping transformation on the unlabeled gastroscopic images, and the untransformed and transformed gastroscopic images constitute the sample data set. It can be understood that the adjustment of the image resolution is to adapt to the subsequent feature extraction network, for example, the resolution of the unlabeled gastroscopic image is compressed from 1080*1080 to 320*320. Sample expansion is performed to make up for the problem of poor generalization ability of the model caused by the small number of training samples, wherein the cropping factor of random cropping can be set to (0.5, 1), and the flip probability of random horizontal flipping can be set to 0.5.
[0038] The step 2 specifically includes:
[0039] Step 2.1: Based on the initial feature extraction network, feature extraction and pixel clustering are performed on the unlabeled gastroscopy images to obtain the initial lesion area mask image set.
[0040] Step 2.2: Based on the initial lesion area mask image set, the initial feature extraction network is optimized to obtain the optimized feature extraction network; based on the optimized feature extraction network, feature extraction and pixel clustering are performed on the unlabeled gastroscopy images again to obtain a new segmentation mask image set; repeat this step to obtain the final lesion area mask image set.
[0041] In step 2.1, the initial feature extraction network uses a feature pyramid network to obtain a feature representation, also known as a feature map. The feature pyramid network downsamples the features multiple times to obtain multiple layers of high-level semantic features, and then upsamples. In some embodiments, ResNet18 pre-trained on ImageNet is used as the network backbone.
[0042] The feature extraction of the unlabeled gastroscopic image set specifically includes: (1) extracting features from the gastroscopic images after geometric transformation through a feature extraction network to obtain a feature representation Z1 of the gastroscopic images; (2) extracting features from the gastroscopic images without geometric transformation through a feature extraction network to obtain a feature representation Z2 of the gastroscopic images; (3) performing the same geometric transformation on the feature representation Z2 of the gastroscopic images as that on the gastroscopic images after geometric transformation to obtain a feature representation Z3 of the gastroscopic images. By utilizing the geometric equivariance, more feature data of the unlabeled gastroscopic images can be obtained by geometrically transforming the feature representation, which further expands the feature data on the basis of expanding the samples, and helps to improve the subsequent segmentation accuracy.
[0043] The pixel clustering specifically includes: clustering the image according to the feature representation of the gastroscopic image to obtain a segmentation mask image. Specifically, using the k-means algorithm to calculate the cluster center of the feature representation Z1 of the gastroscopic image, obtaining the cluster center C1 and the cluster label Y1 of each pixel; using the k-means algorithm to calculate the cluster center of the feature representation Z3 of the gastroscopic image, obtaining the cluster center C3 and the cluster label Y3 of each pixel; and generating multiple segmentation mask images of the gastroscopic image through the obtained label of each pixel.
[0044] Based on the optimized feature extraction network, feature extraction and pixel clustering are performed again on the unlabeled gastroscopy images, so that the feature extraction network has enough samples to improve the accuracy and robustness of the model.
[0045] The loss function used by the feature extraction network is: based on the feature representation Z1 and the feature representation Z3, the distance loss function is calculated, and the two distance loss functions are summed to obtain the first loss function, which is used to measure the effect of the clustering of gastroscopic image pixels that have undergone geometric transformation and those that have not undergone geometric transformation in the early stage, that is, the clustering effect of the constraint feature itself; based on the feature representation Z1, the cross distance loss function is calculated with the cluster center and label of the feature representation Z3, and based on the feature representation Z3, the cross distance loss function is calculated with the cluster center and label of the feature representation Z1, and the two distance loss functions are summed to obtain the second loss function, which is used to measure the consistency of the clustering of gastroscopic images that have undergone geometric transformation and those that have not undergone geometric transformation in the early stage. The larger the second loss function, the greater the difference between the two clustering results, that is, the difference between the clustering of the constrained feature vector transformation and that of the untransformed. The total loss function is calculated based on the first loss function and the second loss function, and the feature extraction network is optimized with the minimum of the total loss function as the goal, and an iteration termination condition is set, and the iteration termination condition is that the total loss function is minimized or the set number of iterations is reached, for example, the number of iterations is set to 10 times.
[0046] Specifically, the optimizer used in training is the ADAM optimizer, and the loss function adopts a distance-based loss function. The formula of the distance-based loss function is:
[0047]
[0048] The first loss function L1 and the second loss function L2 are:
[0049]
[0050] Here, k is the count of cluster centers and i is the count of pixels in the feature representation (feature map).
[0051] Since clustering is performed, the cluster center C and the label Y are corresponding, the above formula can be simplified to obtain the distance-based loss function formula:
[0052]
[0053] Wherein, Z is Z1, Z2 or Z3, C is C1, C2 or C3, C k represents the kth cluster center, and d represents the cosine distance.
[0054] The first loss function L1 and the second loss function L2 are:
[0055] L1=∑ i (L(Z1[i],C1)+L(Z3[i],C3));
[0056] L2=∑ i(L(Z1[i],C3)+L(Z3[i],C1));
[0057] Where i represents the i-th pixel, d(Z1(i),C1 k ) represents the distance between the i-th pixel of feature representation Z1 and the k-th cluster center of multiple cluster centers in C1, d(Z3(i),C3 k ) represents the distance between the i-th pixel of feature representation Z3 and the k-th cluster center of multiple cluster centers in C3, d(Z1(i),C3 k ) represents the distance between the i-th pixel of feature representation Z1 and the k-th cluster center of multiple cluster centers in C3, d(Z3(i),C1 k ) represents the distance between the i-th pixel of feature representation Z3 and the k-th cluster center of multiple cluster centers in C1.
[0058] The total loss function is the sum of the first loss function and the second loss function: L 总 =L1+L2.
[0059] The idea of cross-validation was introduced into the construction of the loss function. For the clustering results obtained from the images that had undergone geometric transformation and those that had not undergone geometric transformation, the loss functions that constrained the clustering effects of each image were used respectively. In addition, for each clustering result, the cluster centers obtained from another clustering result were cross-adopted to construct a cross-distance loss function. The two loss functions were combined and used together to optimize the feature network model, which improved the recognition performance of the feature extraction network for the specific object of gastroscopic images. In addition, the feature extraction network was trained using segmentation mask images, and the feature extraction unit and pixel clustering unit were alternately iterated to improve the recognition accuracy of the mask image in the lesion area.
[0060] In some embodiments, after obtaining the optimized feature extraction network, part of the gastroscopic images are used for feature extraction and clustering operations to obtain a set of mask images of the lesion area, and the remaining unlabeled gastroscopic images are used for training the image segmentation model in the subsequent step 4.
[0061] In the step 3, the mask area boundary of the lesion area mask image is fitted to obtain a polygonal boundary. Specifically, the segmentation mask image is edge detected using a Laplace operator and a Gaussian low-pass filter is used to eliminate noise to obtain a filtered image; the filtered image is binarized to obtain edge information of the segmentation mask image; and the edge information of the segmentation mask image is fitted using an iterative endpoint fitting algorithm to obtain a polygonal boundary.
[0062] A standard annotation format is generated according to the polygon boundary to obtain annotation data. Specifically, the basic information of the gastroscope image is annotated, and the polygon boundary is formed into a group of corresponding x and y coordinates in adjacent order for every two numbers to obtain the annotation data; wherein the basic information of the gastroscope image includes the image sequence number, the image file name, the image width, and the image height.
[0063] After obtaining the training data set of the lesion area, manual adjustments are also performed. A professional physician makes a small amount of manual adjustments to the automatically generated polygon annotations to obtain the adjusted annotations. Specifically, the annotation data is input into the general annotation software to obtain the visual annotations. The professional physician drags the visual annotations, adds or deletes annotation vertices, and obtains the adjusted annotation data.
[0064] In step 4, after obtaining the manually adjusted lesion area training data set, the adjusted lesion area training data set is also enhanced, specifically including: horizontally flipping, affine transformation, perspective transformation, image blurring, image sharpening and adding Gaussian noise to the annotated data and its gastroscopic image to obtain an enhanced training set image.
[0065] The initial image segmentation model is built based on the DeeplabV3+ model, which consists of a spatial pyramid pooling module and a codec structure. In the encoder of the codec structure, parallel dilated convolution operations are used for the feature layer compressed four times, dilated convolutions with different dilation degrees are used for feature extraction, and merge and convolution compression feature operations are performed; the optimizer used for image segmentation model training is the ADAM optimizer; the image segmentation model training loss function is set to the Dice loss function. The Dice loss function is:
[0066]
[0067] Among them, |X∩Y| represents the intersection between X and Y, and |X| and |Y| represent the number of elements of X and Y respectively.
[0068] Based on the training data set of the lesion area, the initial image segmentation model is trained; the unlabeled gastroscopic images are used as input, and image segmentation is performed based on the initial image segmentation model; based on the new lesion area mask image, the lesion area mask image set is updated. Specifically, all unlabeled gastroscopic images are shuffled according to the image name and divided into 10 equal parts; each iteration inputs 1 part of the image data into the image segmentation model for prediction to obtain a new lesion area mask image.
[0069] In step 5, the final image segmentation model is obtained by multiple iterations of fitting the annotation module and adjusting the segmentation module. Specifically, the iterative process includes: fitting the new lesion area mask image obtained by the adjustment segmentation module through the fitting annotation module to obtain new polygon annotation data; adjusting the new polygon annotation data through the adjustment segmentation module to obtain new adjusted annotation data, and retraining the image segmentation model according to the new adjusted annotation data.
[0070] In step 6, the final image segmentation model is deployed in the automatic annotation system, and the automatic annotation system is provided with an input interface and an output interface. The unlabeled gastroscopic image entering the input interface is predicted to obtain the lesion area through the deployed image segmentation model, and the lesion area is visualized and output on the gastroscopic image through the output interface.
[0071] Based on the above method, one or more embodiments of the present invention further provide a gastroscope image automatic annotation device, comprising:
[0072] The unlabeled image acquisition module is configured to: acquire an unlabeled gastroscopic image set;
[0073] The lesion region recognition module is configured to: perform feature extraction and pixel clustering on the unlabeled gastroscopic image set based on the feature extraction network to obtain a lesion region mask image set;
[0074] The training data acquisition module is configured to: perform polygon fitting and annotation based on the lesion area mask image set to obtain a training data set of the lesion area;
[0075] The training data updating module is configured to: train an initial image segmentation model based on a training data set of the lesion area; take the unlabeled gastroscopy image as input, perform image segmentation based on the initial image segmentation model, and update the mask image set of the lesion area;
[0076] The segmentation model iterative optimization module is configured to iteratively perform polygon fitting and labeling, and optimize the image segmentation model to obtain the image segmentation model to be deployed, and the image segmentation model to be deployed is used to identify and label the lesion area of the gastroscopic image during the examination.
[0077] One or more embodiments of the present invention further provide an electronic device that can be used to implement the gastroscope image automatic annotation method in the above embodiments. The electronic device includes one or more processors, one or more memories coupled to the processors, and a communication module coupled to the processors.
[0078] The memory may include one or more non-volatile memories and one or more volatile memories. Examples of non-volatile memories include, but are not limited to, at least one of the following: read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, hard disk, compact disc (CD), digital video disc (DVD) or other magnetic storage and / or optical storage. Examples of volatile memories include, but are not limited to, at least one of the following: random access memory (RAM), or other volatile memories that do not last during the power outage duration. The computer program may be stored in the ROM. When the processor executes the computer program, the above-mentioned gastroscopic image automatic annotation method is implemented.
[0079] In some embodiments, the program may be tangibly contained in a computer-readable medium, which may be included in a device (such as in a memory) or other storage device accessible by the device. The program may be loaded from the computer-readable medium to the RAM for execution. The computer-readable medium may include any type of tangible non-volatile memory, such as ROM, EPROM, flash memory, hard disk, and the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned gastroscopic image automatic annotation method.
[0080] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a server or terminal, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a server or terminal or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (such as a floppy disk, a hard disk and a tape, etc.), an optical medium (such as a digital video disk (digital video disk, DVD), etc.), or a semiconductor medium (such as a solid-state hard disk, etc.).
[0081] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the application. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0082] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for automatic annotation of gastroscopic images, characterized in that: The following steps are involved: Obtaining a set of unlabeled gastroscopic images; Based on the feature extraction network, feature extraction and pixel clustering are performed on some unlabeled gastroscopic image sets to obtain the mask image set of the lesion area; Perform polygon fitting and annotation based on the mask image set of the lesion area to obtain a training data set of the lesion area; Based on the training data set of the lesion area, train the initial image segmentation model; The remaining unlabeled gastroscopic images are used as input, image segmentation is performed based on the initial image segmentation model, and the mask image set of the lesion area is updated; The polygon fitting and labeling, as well as the optimization of the image segmentation model are iteratively performed to obtain the image segmentation model to be deployed, wherein the image segmentation model to be deployed is used to identify and label the lesion area of the gastroscopy image during the examination process.
2. The method for automatic annotation of gastroscopic images according to claim 1, characterized in that: Obtaining unlabeled gastroscopy image sets includes: Acquire original gastroscopic images collected during gastroscopy; Positioning the text area in the original gastroscopic image; Fill the white pixels in the text area with black; The proportion of black pixels in the original gastroscopic image is detected. If the proportion of black pixels exceeds the set threshold, the corresponding original gastroscopic image is discarded to obtain an unlabeled gastroscopic image set.
3. The method for automatic annotation of gastroscopic images according to claim 1, characterized in that: The final lesion area mask image set is obtained by iteratively optimizing the feature extraction network, including: Based on the initial feature extraction network, feature extraction and pixel clustering are performed on the unlabeled gastroscopic images to obtain the initial lesion area mask image set; Based on the initial lesion area mask image set, the initial feature extraction network is optimized to obtain the optimized feature extraction network; based on the optimized feature extraction network, feature extraction and pixel clustering are performed on the unlabeled gastroscopy images again to obtain a new segmentation mask image set; this step is repeated to obtain the final lesion area mask image set.
4. The method for automatic annotation of gastroscopic images according to claim 3, characterized in that: Performing geometric transformation on the unlabeled gastroscopic image to obtain a feature representation Z1; performing feature extraction on the remaining unlabeled gastroscopic image through an initial feature extraction network to obtain a feature representation Z2; Performing the same geometric transformation on the feature representation Z2 as that on the gastroscopic image after the geometric transformation, to obtain the feature representation Z3; The loss function calculation method used by the feature extraction network is: Calculate the distance loss function based on the feature representation Z1 and the feature representation Z3, and sum the two distance loss functions to obtain the first loss function; Based on the feature representation Z1, the cross distance loss function is calculated with the cluster center and label of the feature representation Z3; at the same time, based on the feature representation Z3, the cross distance loss function is calculated with the cluster center and label of the feature representation Z1, and the two cross distance loss functions are summed to obtain the second loss function; The total loss function is obtained by summing the first loss function and the second loss function.
5. The method for automatic annotation of gastroscopic images according to claim 1, characterized in that: When training the initial image segmentation model, part of the training data is used as input each time to obtain a new lesion area mask image.
6. The method for automatic annotation of gastroscopic images according to claim 1, characterized in that: Polygon fitting based on the lesion area mask image set includes: Use the Laplacian operator to detect the edge of the segmentation mask image and perform binarization processing; The edge information of the segmentation mask image is fitted using an iterative endpoint fitting algorithm to obtain the polygonal boundary.
7. A gastroscope image automatic annotation device, characterized in that: include: The unlabeled image acquisition module is configured to: acquire an unlabeled gastroscopic image set; The lesion area recognition module is configured to: perform feature extraction and pixel clustering on a portion of the unlabeled gastroscopic image set based on a feature extraction network to obtain a lesion area mask image set; The training data acquisition module is configured to: perform polygon fitting and annotation based on the lesion area mask image set to obtain a training data set of the lesion area; The training data updating module is configured to: train an initial image segmentation model based on a training data set of the lesion area; The remaining unlabeled gastroscopic images are used as input, image segmentation is performed based on the initial image segmentation model, and the mask image set of the lesion area is updated; The segmentation model iterative optimization module is configured to iteratively perform polygon fitting and labeling, and optimize the image segmentation model to obtain the image segmentation model to be deployed, and the image segmentation model to be deployed is used to identify and label the lesion area of the gastroscopic image during the examination.
8. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory stores computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.