Image segmentation method and device and image segmentation model training method and device
By generating pseudo-label information and pixel-level contrast learning training, it solves the time-consuming problem of diffuse lesion image annotation, achieves efficient image segmentation model training, reduces manpower and time costs, and is suitable for diffuse lesion data analysis .
Patent Information
- Application Number
- CN202410453022.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-08-30
AI Technical Summary
Existing image segmentation models are time-consuming and labor- and time-consuming when processing diffuse lesion images, and are not suitable for diffuse lesion data analysis.
By obtaining label information of a large number of lesion image samples and a very small number of representative samples, pseudo label information is generated, and pixel-level contrast learning training is performed to obtain an image segmentation model suitable for diffuse lesions, reducing manual annotation workload and time consumption.
On the premise of ensuring the accuracy of image segmentation, it significantly reduces the labor and time costs of labeling, improves the efficiency of image segmentation model training, and is suitable for diffuse lesion data analysis scenarios.
Smart Images

Figure CN118570461A
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a method and device for image segmentation and image segmentation model training. Background Art
[0002] Plant phenotyping plays a vital role in the process of smart breeding. It is responsible for providing reliable phenotypic statistical results for the breeding process. With the rapid development of computer technology and artificial intelligence (AI) technology, crop phenotyping based on AI has become a hot topic in current research. In particular, computer vision analysis technology is widely used in various types of phenotypic statistical analysis. It can greatly simplify the process of phenotypic collection, reduce labor costs, and reduce analysis time. For example, based on the captured images, wheat ears and corn cobs can be counted, germination rates can be calculated, pests and diseases can be analyzed, and plant weeds can be segmented.
[0003] Phenotypic analysis of lesions is an important part of phenotypic analysis of pests and diseases. Segmenting the lesion area in plant lesion images based on image segmentation models is a key technology for phenotypic analysis of lesions. At present, there are two main training schemes for image segmentation models: one is supervised training based on a large number of labeled lesion image data, but for diffuse lesion image data, due to the wide coverage of lesions, the manpower and time required to label diffuse lesions are very huge. For example, it takes many days to label tens of thousands of images with diffuse lesions, which is not feasible in practical applications. The other is a semi-supervised scheme based on small batches of data, which usually requires labeling about 1 / 10 of the data volume. In practical applications, thousands of lesion images also need to be labeled. This is more suitable for the analysis of focal (several local areas) lesions, but the workload of labeling thousands of diffuse lesion images is still very huge. Moreover, different lesions are very different, and when analyzing other types of lesions, the lesion images need to be re-labeled.
[0004] In practical applications, there are many types of lesion phenotypes, especially for the segmentation of diffuse lesion images. Compared with conventional lesion segmentation, the workload of diffuse lesion data annotation is very huge, which will result in very huge manpower and time costs. The current image segmentation scheme is not suitable for diffuse lesion data analysis. Summary of the invention
[0005] The present application provides a method and device for image segmentation and image segmentation model training, which are used to solve the problem that the current image segmentation solution is time-consuming to annotate lesion images and is not suitable for diffuse lesion data analysis.
[0006] In a first aspect, the present application provides an image segmentation model training method, comprising:
[0007] Obtain lesion image samples and label information of representative samples;
[0008] Based on the label information of the representative sample, generating pseudo label information of the lesion image sample;
[0009] Based on the lesion image samples and the pseudo-label information of the lesion image samples, pixel-level contrast learning training is performed on the image segmentation model to obtain a trained image segmentation model.
[0010] In a second aspect, the present application provides an image segmentation model training method, comprising:
[0011] Obtain image samples of diffuse lesions and label information of representative samples;
[0012] Based on the label information of the representative sample, generating pseudo label information of the image sample of the diffuse lesion;
[0013] Based on the image samples and the pseudo-label information of the image samples, pixel-level contrast learning training is performed on the image segmentation model to obtain an image segmentation model suitable for diffuse lesions.
[0014] In a third aspect, the present application provides an image segmentation method, comprising:
[0015] In response to an image segmentation request, acquiring image data of a diffuse lesion to be segmented;
[0016] Inputting the image data of the diffuse lesions into an image segmentation model for image segmentation to obtain a segmentation result of the image data of the diffuse lesions, wherein the image segmentation model is trained in the following manner: acquiring image samples of diffuse lesions and label information of representative samples, generating pseudo label information of the image samples based on the label information of the representative samples, and performing pixel-level contrast learning training on the image segmentation model based on the image samples and the pseudo label information of the image samples to obtain an image segmentation model suitable for diffuse lesions;
[0017] The segmentation result of the image data of the diffuse lesion is output.
[0018] In a fourth aspect, the present application provides a server, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the server executes a method provided in any of the preceding aspects.
[0019] In a fifth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method provided in any of the foregoing aspects is implemented.
[0020] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method provided in any of the aforementioned aspects.
[0021] The method and device for image segmentation and image segmentation model training provided by the present application automatically generate pseudo-label information of the lesion image samples based on the label information of the very small number of representative samples by acquiring a large number of lesion image samples and label information of a very small number (tens or even single digits) of representative samples, without which the workload of manual labeling can be greatly reduced, thereby greatly reducing the manpower and time consumption of data labeling; further, based on the lesion image samples and the pseudo-label information of the lesion image samples, the image segmentation model is trained by pixel-level comparative learning to obtain a trained image segmentation model, and the influence of erroneous information in the pseudo-label information can be suppressed through pixel-level comparative learning. On the premise of ensuring the accuracy of model image segmentation, the manpower and time cost of labeling is greatly reduced, and the efficiency of image segmentation model training is improved, which is suitable for diffuse lesion data analysis scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0023] Figure 1 Examples of diffuse lesion images provided for this application;
[0024] Figure 2 A schematic diagram of an exemplary system architecture applicable to the present application;
[0025] Figure 3 A flowchart of a method for training an image segmentation model provided for an exemplary embodiment of the present application;
[0026] Figure 4 A schematic diagram of a lesion boundary box in semi-automatic annotation provided by an exemplary embodiment of the present application;
[0027] Figure 5 A flowchart of pixel-level contrastive learning loss calculation provided for an exemplary embodiment of the present application;
[0028] Figure 6 A flowchart of an image segmentation method is provided for an exemplary embodiment of the present application;
[0029] Figure 7The overall framework diagram of diffuse lesion image segmentation provided by an exemplary embodiment of the present application;
[0030] Figure 8 A flow chart of an image segmentation model training method applicable to diffuse lesions provided in an exemplary embodiment of the present application;
[0031] Fig. 9 A flowchart of a diffuse lesion image segmentation method is provided for an exemplary embodiment of the present application;
[0032] Fig.10 A schematic diagram of the structure of a server provided in an embodiment of the present application.
[0033] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0034] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0035] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0036] First, the terms involved in this application are explained:
[0037] Deep learning: Deep learning is the process of learning the inherent laws and representation levels of sample data. The information obtained in the learning process is very helpful for interpreting data such as text, images and sounds. Its ultimate goal is to enable machines to have analytical learning capabilities like humans and to recognize data such as text, images and sounds. Deep learning is a complex machine learning algorithm that has achieved results in speech and image recognition that far exceed previous related technologies.
[0038] Image segmentation: Image segmentation is the technology and process of dividing an image into several specific regions with unique properties and proposing targets of interest. It is a key step from image processing to image analysis. Existing image segmentation methods are mainly divided into the following categories: threshold-based segmentation methods, region-based segmentation methods, edge-based segmentation methods, and segmentation methods based on specific theories. From a mathematical point of view, image segmentation is the process of dividing a digital image into non-overlapping regions. The image segmentation process is also a labeling process, that is, pixels belonging to the same region are assigned the same number.
[0039] Contrastive learning: Contrastive learning is a special unsupervised learning method that aims to learn data representation by maximizing the similarity between related samples and minimizing the similarity between unrelated samples. Positive and negative samples are usually generated using a high degree of freedom, customized rule. It has a wide range of applications in model pre-training.
[0040] Visual question answering task: Given an input image and a question, determine the answer to the question from the visual information of the input image.
[0041] Image description task: Generate description text for an input image.
[0042] Visual entailment task: predict the semantic relevance of an input image and text, i.e., entailment, neutral, or contradiction.
[0043] Referential expression and comprehension task: locate the image area in the input image corresponding to the input text based on the input text.
[0044] Image generation task: Generate an image based on the input description text.
[0045] Text-based sentiment classification task: predict the sentiment classification information of the input text.
[0046] Text summarization task: Generate summary information of the input text.
[0047] Multimodal tasks: refers to downstream tasks whose input and output data involve multiple modal data such as images and text, such as visual question answering tasks, image description tasks, visual implication tasks, referential expression and understanding tasks, image generation tasks, etc.
[0048] Multimodal pre-trained model: refers to a pre-trained model whose input and output data involve multiple modal data such as images and text. After fine-tuning and training, it can be applied to multimodal task processing.
[0049] Pre-trained language model: A pre-trained model obtained by pre-training a large-scale language model (LLM).
[0050] A large model refers to a deep learning model with large-scale model parameters, usually containing hundreds of millions, tens of billions, or even hundreds of billions of model parameters. A large model can also be called a foundation model / foundation model (FM). It is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks and has good generalization capabilities, such as large-scale language models (LLMs) and multi-modal pre-training models.
[0051] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
[0052] Figure 1 An example of a diffuse lesion image provided for this application is Figure 1 Three images of leaves with diffuse lesions are shown in Figure 1 In the image shown, there is more than one lesion on the leaf, and the lesions are diffuse, numerous, and cover a wide range. The workload of accurately marking the contour position of each lesion on the diffuse lesion image is very huge, requiring huge manpower and time costs.
[0053] The present application provides an image segmentation model training method, which automatically generates pseudo-label information of the lesion image samples based on the label information of the very small number of representative samples by obtaining a large number of lesion image samples and label information of a very small number of representative samples (tens or even single digits are sufficient), without the need for manual labeling, thereby greatly reducing the labor and time consumption of data labeling. Furthermore, based on the lesion image samples and the pseudo-label information of the lesion image samples, the image segmentation model is trained by pixel-level comparative learning to obtain a trained image segmentation model. The influence of erroneous information in the pseudo-label information can be suppressed through pixel-level comparative learning, which can greatly reduce the workload of labeling while ensuring the accuracy of model image segmentation.
[0054] Among them, the image segmentation model can be any deep learning model for image segmentation or image semantic segmentation, preferably an image segmentation model and a semantic segmentation model used for lesion phenotyping analysis, such as the Deeplab series of image semantic segmentation network models (such as DeeplabV3), image segmentation or semantic segmentation models based on U-type networks (UNet), image segmentation or semantic segmentation models based on fully convolutional networks (Fully Convolutional Networks, FCN for short), etc., which are not specifically limited in this embodiment.
[0055] The scheme of this embodiment can train an image segmentation model suitable for phenotypic analysis of various lesions through very small amounts of data annotation, and is particularly suitable for phenotypic analysis of diffuse lesions. It only requires annotating a few or a dozen representative samples (which can be flexibly adjusted by the user as needed), which can greatly reduce the amount of annotation of diffuse lesion image data and ensure the accuracy of the image segmentation model.
[0056] The present application also provides an image segmentation method, which performs image segmentation processing on the lesion image based on a trained image segmentation model to obtain the position information of the lesion in the lesion image.
[0057] Figure 2 FIG. 1 is a schematic diagram of an exemplary system architecture applicable to the present application. Figure 2 As shown, the system architecture includes a server and a terminal device. There is a communication link between the server and the terminal device, which can realize the communication connection between the server and the terminal device.
[0058] The server is a device with computing power deployed in the cloud or locally, such as a cloud cluster. The server stores an image segmentation model. The server is responsible for generating pseudo-label information of a large number of lesion image samples based on the label information of a very small number of representative samples, and performing pixel-level comparative learning training on the image segmentation model based on the lesion image samples and the pseudo-label information of the lesion image samples to obtain a trained image segmentation model. In addition, the server can also provide image segmentation processing for lesion image data based on the image segmentation model suitable for the trained image segmentation, and has segmented the location area of the lesion in the lesion image data.
[0059] The end-side device may be an electronic device running the lesion phenotype analysis system, and specifically may be a hardware device with network communication function, computing function and information display function, including but not limited to smart phones, tablet computers, desktop computers, local servers, cloud servers, etc. When the user needs to segment the lesion area from a given lesion image, the user sends the lesion image to be segmented to the server through the end-side device.
[0060] The server receives the lesion image sent by the end-side device, and uses the trained image segmentation model to perform image segmentation on the lesion image to obtain the segmentation result of the lesion image. The segmentation result of the lesion image includes the location information of the lesion in the lesion image. The server returns the segmentation result of the lesion image to the end-side device. The end-side device receives the segmentation result of the lesion image returned by the server, and outputs the segmentation result of the lesion image to the user.
[0061] It should be noted that the image segmentation model stored in the server of the above system architecture is a trained image segmentation model, and the training of the image segmentation model can be completed by the same server. The server is also responsible for obtaining lesion image samples and label information of representative samples; based on the label information of representative samples, pseudo label information of lesion image samples is generated; based on the lesion image samples and pseudo label information of lesion image samples, pixel-level comparative learning training is performed on the image segmentation model to obtain a trained image segmentation model.
[0062] Another system architecture includes a server of the lesion phenotype analysis system (referred to as the first server), and a second server responsible for training the image segmentation model. The second server is responsible for obtaining lesion image samples and label information of representative samples; based on the label information of representative samples, pseudo label information of lesion image samples is generated; based on the lesion image samples and the pseudo label information of lesion image samples, the image segmentation model is trained by pixel-level comparative learning to obtain a trained image segmentation model. The trained image segmentation model is deployed on the first server of the lesion phenotype analysis system. The first server is responsible for receiving the lesion image sent by the end-side device, performing image segmentation on the lesion image using the trained image segmentation model to obtain the segmentation result of the lesion image, and returning the segmentation result of the lesion image to the end-side device.
[0063] Optionally, the second server runs the trained image segmentation model and provides the first server with an application programming interface (Application Program Interface, API) of the image segmentation model. The first server sends a call request to the API of the image segmentation model to the second server through the API of the image segmentation model, and the call request includes the lesion image to be processed. In response to the API of the image segmentation model being called, the second server performs image segmentation on the lesion image through the image segmentation model to obtain a segmentation result of the lesion image, and returns the segmentation result of the lesion image to the first server. Furthermore, the first server returns the segmentation result of the lesion image to the end-side device.
[0064] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0065] Figure 3 A flowchart of a method for training an image segmentation model provided by an exemplary embodiment of the present application. The execution subject of this embodiment is Figure 2 The server in the system architecture shown or the second server in another system architecture. Figure 3 As shown, the specific steps of this method are as follows:
[0066] Step S301: Obtain lesion image samples and label information of representative samples.
[0067] The disease spot image samples may be images of the parts of the plant with disease spots collected by image acquisition devices such as cameras, such as images of leaves, roots, stems, etc. with disease spots. Representative samples refer to a very small number of representative disease spot images selected from a large amount of disease spot image data, which can cover most data types. Each representative sample can represent a type of disease spot image, or an individual disease spot image that is different from most disease spot images.
[0068] In practical applications, according to the image segmentation tasks / scenes to which the image segmentation model will be applied, lesion image samples and representative samples suitable for specific image segmentation tasks / scenes are obtained. The lesion image samples and representative samples can be image samples of various types of lesions, and the types of lesions contained in the lesion image samples are not specifically limited here. For example, if an image segmentation model suitable for a specific lesion type is to be trained and used to segment lesions of a specific lesion type, lesion image samples (including image samples of lesions of the corresponding lesion type) and representative samples of the corresponding lesion type can be obtained.
[0069] Exemplarily, the trained image segmentation model will be applied to the image segmentation task of diffuse lesions to obtain lesion image samples and representative samples containing diffuse lesions.
[0070] The label information of the representative sample refers to the result of labeling the location information of the lesion in the representative sample, that is, the image segmentation result of the pre-labeled representative sample. Exemplarily, the label information can be a mask image corresponding to the representative sample, which is a mask image of the same size as the representative sample (lesion image), including at least one lesion area and background area (non-lesion area) in the representative sample. The pixels in different lesion areas can be marked with different category labels (mask values), and the category labels (mask values) corresponding to different lesions are different. The background area refers to the non-lesion area in the representative sample. The pixels in the background area can be marked with a mask value that is different from any category label (mask value). For example, the background area can be marked as 0, and other different lesion categories correspond to different category labels (all non-0).
[0071] In addition, the label information of the representative samples may also be represented and stored in other ways besides the mask image. Specifically, any method for representing the image segmentation result may be used, which is not specifically limited in this embodiment.
[0072] In an optional implementation of this step, a large number (usually thousands, tens of thousands or even more) of lesion image samples are obtained, and a very small number (several or dozens) of representative samples and label information of the representative samples are obtained. The very small number of representative samples can be manually screened and specified by relevant technical personnel. The label information of the representative samples can be obtained by manually marking the position information of the lesions in the very small number of representative samples.
[0073] In another optional implementation of this step, a large number (usually thousands, tens of thousands or even more) of lesion image samples are obtained; a small number (several or more than ten) of representative samples are automatically screened out from the lesion image samples according to the configured screening rules, and the number of representative samples is much smaller than the total number of lesion image samples. Furthermore, the positions of the lesions in the representative samples are marked to obtain label information of the representative samples.
[0074] Among them, the screening rules for selecting a small number of representative samples from a large number of lesion image samples can be configured and adjusted according to the needs of the actual application scenario, and are not specifically limited here.
[0075] For example, according to the configured screening rules, representative samples are screened out from the lesion image samples, which can be implemented in the following manner:
[0076] Acquire feature vectors of lesion image samples; cluster the lesion image samples according to the feature vectors of the lesion image samples to obtain multiple clusters; and select, from each cluster, the lesion image sample with the smallest distance to the cluster center and the lesion image sample with the largest distance to the cluster center as representative samples.
[0077] The feature vector of the lesion image sample can be obtained by extracting features from the lesion image sample using an image feature extraction model. The image feature extraction model can be a deep residual network (Residual Network, referred to as ResNet) or a convolutional neural network (Convolutional Neural Network, referred to as CNN). In addition, the feature vector of the lesion image sample can also be obtained by extracting features from the lesion image sample using a commonly used image feature extraction method, such as a method based on scale-invariant feature transform (SIFT), etc. This embodiment is not specifically limited here.
[0078] Furthermore, after obtaining the feature vector of the lesion image sample, a clustering algorithm is used to cluster the lesion image sample according to the feature vector of the lesion image sample to obtain multiple clusters. The clustering algorithm may be a K-means clustering algorithm (K-means clustering algorithm for short), a hierarchical clustering Agglomerative Clustering, a density-based spatial clustering of applications with noise (DBSCAN for short), etc., which is not specifically limited in this embodiment.
[0079] Exemplarily, a K-means clustering algorithm can be used to cluster the lesion image samples into K clusters according to their feature vectors, where each cluster contains multiple lesion image samples, and K is the number of clusters obtained by clustering. The value of K can be configured according to the needs of the actual application scenario. For example, K can be 3, 5, 7, etc., and no specific limitation is made here.
[0080] Optionally, after obtaining the feature vector of the lesion image sample, the feature vector of the lesion image sample can also be subjected to dimensionality reduction processing, and the lesion image sample is clustered based on the feature vector after dimensionality reduction processing, which can improve the clustering speed. The dimensionality reduction processing can adopt the principal component analysis (Principal Component Analysis, referred to as PCA) method or other commonly used feature vector dimensionality reduction processing methods, which are not specifically limited here.
[0081] Furthermore, after obtaining multiple clusters through clustering, for each cluster, based on the cluster center, the distance between the feature vector of each lesion image sample in the cluster and the cluster center is calculated, and the lesion image sample with the smallest distance between the feature vector and the cluster center is selected as a representative sample of the cluster; and the lesion image sample with the largest distance between the feature vector and the cluster center is selected as a free representative sample in the cluster. 2 representative samples are selected from each cluster to obtain 2K representative samples. For example, K is 5, 5 clusters are determined by clustering, and 2 representative samples are selected from each cluster to obtain 10 representative samples.
[0082] Optionally, when selecting representative samples from a cluster, one or more lesion image samples whose feature vectors are at a small distance from the cluster center may be selected from the cluster as representative samples of the cluster, and one or more free lesion image samples whose feature vectors are at a large distance from the cluster center may be selected from the cluster as representative samples of the cluster. The number of free samples in different clusters may be different, the number of representative samples selected from each cluster may be different, and the number and / or upper limit of the number of representative samples selected from each cluster may be configured and adjusted according to the needs of the actual application scenario, and are not specifically limited here.
[0083] In an optional embodiment, when marking the location of the lesion in the representative sample, a semi-automatic marking system can be used to manually select the approximate area of a single lesion in the representative sample. When the front end uses a rectangular frame to select the area where the lesion is located, it will trigger the server to call the image segmentation model in the background, segment the location of the lesion according to the area of the rectangular frame, and return the segmentation result to the front end. The labeler can further edit and modify the segmentation result to finally determine the precise location of the lesion. Furthermore, the location information of each single lesion in the representative sample is combined to obtain the label information of the representative sample.
[0084] Specifically, the representative sample is output through the annotation interface. The annotation interface is a front-end interactive interface provided by the semi-automatic annotation system for selecting the approximate area of a single lesion. The representative sample is displayed through the annotation interface, and the relevant technicians are supported to use a rectangular frame to select the area where the lesion is located on the representative sample.
[0085] In response to the box selection operation on any lesion in the representative sample, the position information of the bounding box corresponding to any lesion in the representative sample is determined. The bounding box refers to a rectangular box (such as Figure 4 The rectangular box shown in ).
[0086] Furthermore, according to the position information of the bounding box corresponding to any lesion in the representative sample, the image of the region within the bounding box is segmented to obtain the position information of the lesion within the bounding box (such as Figure 4 When performing image segmentation on the regional image within the bounding box, a pre-trained image segmentation model can be used to predict the edge contour of the lesion within the given bounding box, and the annotator can further edit and modify it, which can improve the efficiency of annotation.
[0087] Optionally, after obtaining the position information of the lesion within the bounding box, the position information of the lesion within the bounding box can also be output through the annotation interface. For example, the outline of the lesion is displayed on the representative sample displayed on the annotation interface (such as Figure 4 It also supports the annotator to further edit and modify the outline of the lesion and finally determine the precise location information of the lesion.
[0088] In addition, if the image segmentation model fails to predict the location information of the lesion within the bounding box, the labeler can manually outline the edge contour of the lesion to obtain the precise location information of the lesion.
[0089] Furthermore, according to the position information of each lesion in the representative sample, a mask image of the lesion in the representative sample is generated as label information of the representative sample.
[0090] In another optional embodiment, the positions of the lesions in the representative samples may be marked by manual marking to obtain label information of the representative samples.
[0091] Step S302: Generate pseudo label information of the lesion image sample based on the label information of the representative sample.
[0092] After obtaining the label information of a small number of representative samples, the label information of a large number of lesion image samples is automatically generated based on the label information of a small number of representative samples. Since these label information are automatically generated and are not accurate labels that have been manually annotated, they are called pseudo-label information here.
[0093] In this step, the representative samples and the label information of the representative samples are used as segmentation examples, the segmentation examples and the lesion image samples are input into the general segmentation model, and the lesion image samples are segmented according to the segmentation examples by the general segmentation model to obtain the pseudo label information of the lesion image samples.
[0094] Among them, the general segmentation model can be a general visual model (Segment Everything In Context, abbreviated as SegGPT) that uses visual prompts to complete any segmentation task, or SAM (Segment Anything Model, segmentation model), etc., which is not specifically limited in this embodiment.
[0095] Exemplarily, taking the general segmentation model SegGPT as an example, the representative sample and the label information of the representative sample are used as visual prompts and input into the general segmentation model together with the lesion image sample to be segmented. The lesions in the lesion image sample are segmented based on the visual prompts by the general segmentation model, and the mask image of the lesion image sample is obtained as the pseudo-label information of the lesion image sample.
[0096] Among them, the pseudo-label information of the lesion image sample is used to indicate the location information of the lesion in the lesion image sample. The pseudo-label information is similar to the label information of the representative sample, and can be a mask image corresponding to the lesion image sample, which is a mask image with the same size as the lesion image sample, including at least one lesion area and background area (non-lesion area) in the lesion image sample. The pixels in different lesion areas can be marked with different category labels (mask values), and the category labels (mask values) corresponding to different lesions are different. The background area refers to the non-lesion area in the lesion image sample, and the pixels in the background area can be marked with mask values that are different from any category label (mask value). For example, the background area can be marked as 0, and other different lesion categories correspond to different category labels (all non-0).
[0097] In addition, the pseudo-label information of the lesion image sample may also be represented and stored in other ways besides the mask image. Specifically, any method for representing the image segmentation result may be used, which is not specifically limited in this embodiment.
[0098] Step S303: Based on the lesion image samples and the pseudo-label information of the lesion image samples, the image segmentation model is trained by pixel-level contrast learning to obtain a trained image segmentation model.
[0099] After obtaining pseudo-label information of a large number of lesion image samples, in this step, pixel-level contrast learning training is performed on the image segmentation model based on the lesion image samples and the pseudo-label information of the lesion image samples, and the influence of the erroneous information in the pseudo-label information is suppressed by pixel-level contrast learning to obtain a trained image segmentation model. Since there is some erroneous information in the pseudo-label, the erroneous information will have a negative impact on the model optimization. In order to effectively solve this problem, pixel-level contrast learning is introduced in this embodiment to suppress the influence of the erroneous information in the pseudo-label, which can improve the training effect of the image segmentation model and improve the accuracy of image segmentation.
[0100] Among them, the image segmentation model can be any deep learning model for image segmentation or image semantic segmentation, preferably an image segmentation model and a semantic segmentation model used for lesion phenotyping analysis, such as the Deeplab series of image semantic segmentation network models (such as DeeplabV3), image segmentation or semantic segmentation models based on U-type networks (UNet), image segmentation or semantic segmentation models based on fully convolutional networks (Fully Convolutional Networks, FCN for short), etc., which are not specifically limited in this embodiment.
[0101] The image segmentation model may generally include a feature extraction module and a decoding module. The feature extraction module is used to extract the features of the image to be segmented to obtain a feature map. The decoding module is used to decode the feature map to obtain an image segmentation result.
[0102] In this step, the lesion image sample is input into the image segmentation model, and the feature map of the lesion image sample is extracted by the feature extraction module of the image segmentation model. The segmentation result of the lesion image sample can be obtained after the feature map is decoded by the decoding module.
[0103] Furthermore, based on the feature map of the lesion image sample and the pseudo-label information, a pixel-level contrastive learning loss is calculated. The pixel-level contrastive learning loss is used to increase the similarity between the pixel feature and the aggregated feature of the lesion containing the pixel, and to reduce the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel, so as to suppress the influence of the erroneous information in the pseudo-label information on the image segmentation ability of the model.
[0104] Furthermore, according to the pixel-level contrast learning loss, the parameters of the image segmentation model are optimized to obtain an image segmentation model suitable for diffuse lesions.
[0105] In addition, in this step, the feature map is decoded by the decoding module to obtain the segmentation prediction results of the lesion image samples. According to the segmentation prediction results of the lesion image samples and the pseudo-label information (i.e., the annotation results), the image segmentation task loss is calculated. According to the pixel-level contrast learning loss and the image segmentation task loss, the parameters of the image segmentation model are optimized to obtain an image segmentation model suitable for diffuse lesions.
[0106] Among them, the image segmentation task loss can be a Dice loss function (English: Dice Loss, also known as Dice loss function, dice loss function), which is based on the Dice coefficient between the segmentation prediction result of the lesion image sample and the pseudo-label information (i.e., the annotation result). The definition of the Dice loss function is based on the inverse of the Dice coefficient. When the Dice coefficient is larger, the Dice loss function value is smaller, indicating that the similarity between the segmentation prediction result and the annotation result is higher, and the performance of the model is better. Conversely, when the Dice coefficient is smaller, the Dice loss function value is larger, indicating that the similarity between the segmentation prediction result and the annotation result is lower, and the performance of the model is worse.
[0107] Optionally, the image segmentation task loss can also be a cross entropy loss (CE) or a focus loss (FL) calculated based on the segmentation prediction result of the lesion image sample and the pseudo-label information (i.e., the annotation result), or other similar loss functions in the image segmentation scenario, which are not specifically limited here.
[0108] In this embodiment, the fine-tuning strategy used for pixel-level contrast learning training of the image segmentation model, including which optimization algorithm, loss function and test evaluation indicator to use, and how to adjust hyperparameters such as learning rate and batch size, can be designed, configured and adjusted by relevant technical personnel according to the needs of the actual application scenario, and this embodiment is not specifically limited here.
[0109] The method of this embodiment obtains a large number of lesion image samples and label information of a very small number (tens or even single digits) of representative samples, and automatically generates pseudo-label information of the lesion image samples based on the label information of the very small number of representative samples, which can greatly reduce the workload of manual labeling, thereby greatly reducing the manpower and time consumption of data labeling; further, based on the lesion image samples and the pseudo-label information of the lesion image samples, the image segmentation model is trained by pixel-level comparative learning to obtain a trained image segmentation model, and the influence of erroneous information in the pseudo-label information can be suppressed through pixel-level comparative learning. Under the premise of ensuring the accuracy of model image segmentation, the manpower and time cost of labeling is greatly reduced, and the efficiency of image segmentation model training is improved, which can be applicable to diffuse lesion data analysis scenarios.
[0110] Figure 5 A flowchart of pixel-level contrastive learning loss calculation provided by an exemplary embodiment of the present application. Figure 5 As shown, in an optional embodiment, in the aforementioned step S303, in the process of performing pixel-level contrastive learning training on the image segmentation model based on the lesion image sample and the pseudo-label information of the lesion image sample, the pixel-level contrastive learning loss is calculated according to the feature map of the lesion image sample and the pseudo-label information. The specific implementation steps are as follows:
[0111] Step S501: Determine the coverage area of each lesion in the lesion image sample according to the pseudo-label information of the lesion image sample.
[0112] The pseudo label information of the lesion image sample includes the position information of the lesion in the lesion image sample. In this step, the coverage area of each lesion in the lesion image sample is determined according to the pseudo label information of the lesion image sample.
[0113] Step S502: for any lesion in the lesion image sample, according to the coverage area of the lesion and the feature map of the lesion image sample, the features of the pixels falling into the lesion are aggregated to obtain the aggregated features of the lesion.
[0114] In this embodiment, for any lesion in the lesion image sample, the pixel points falling into any lesion (i.e., falling into the coverage area of the lesion) can be determined according to the coverage area of the lesion. According to the feature map of the lesion image sample, the pixel features falling into the same lesion are aggregated as the aggregated features of the lesion. In this way, the aggregated features of each lesion in the lesion image sample can be obtained.
[0115] In addition, for the background area (non-lesion area) in the lesion image sample, the pixel features falling into the background area can be aggregated to serve as the aggregated features of the background area.
[0116] Exemplarily, according to the feature map of the lesion image sample, the pixel features falling into the same lesion are averaged as the aggregate feature of the lesion; according to the feature map of the lesion image sample, the pixel features falling into the background area are averaged as the aggregate feature of the background area. Optionally, according to the feature map of the lesion image sample, a pooling operation can be performed on the features in the lesion-covered area and the background area in the lesion image sample to obtain the aggregate feature of each lesion and the aggregate feature of the background area.
[0117] Step S503: Calculate the pixel-level contrastive learning loss based on the feature map of the lesion image sample and the aggregated features of each lesion in the lesion image sample. The pixel-level contrastive learning loss is used to increase the similarity between the pixel feature and the aggregated features of the lesion containing the pixel, and reduce the similarity between the pixel feature and the aggregated features of the lesion not containing the pixel.
[0118] After obtaining the aggregate features of each lesion or background area in the lesion image sample, the different lesions and background areas in the lesion image sample are respectively regarded as different categories. By calculating the similarity between the features of each pixel in the lesion image sample and the aggregate features of the category to which the pixel belongs (for pixels in the lesion, the category to which the pixel belongs is the lesion in which the pixel falls), and the similarity between the features of the pixel and the aggregate features of the category to which the pixel does not belong (for pixels in the lesion, the category to which the pixel does not belong includes the lesion and background area that the pixel does not fall), and according to the similarity between the features of each pixel in the lesion image sample and the aggregate features of the category to which the pixel belongs, and the similarity between the features of the pixel and the aggregate features of the category to which the pixel does not belong, the pixel-level contrastive learning loss is calculated.
[0119] For example, according to the feature map of the lesion image sample and the aggregated features of each lesion in the lesion image sample, the following formula (1) can be used to calculate the pixel-level contrastive learning loss:
[0120]
[0121] Where x represents any lesion image sample. C represents the number of categories, which is the number of lesions in the lesion image sample x plus 1. c represents any category, which can refer to any lesion or background area. c (x) represents the set of pixels belonging to category c in the lesion image sample x, i represents any pixel belonging to category c in the lesion image sample x, i∈G c (x). f represents the feature extraction module of the image segmentation model, and f(x) represents the feature map of the lesion image sample x. i (x) represents the feature of any pixel i belonging to category c. c (x) represents the aggregated features belonging to category c, sim(f i (x),m c (x)) represents the feature f of any pixel i belonging to category c i (x) is similar to the aggregated features of category c. sim(f i (x),m k (x)) represents the feature f of any pixel i belonging to category c i (x) Aggregate features m with other categories k (k≠c) k τ is a configuration hyperparameter, which can be configured and adjusted according to the actual application scenario, for example, τ = 0.1, which is not specifically limited here.
[0122] The similarity between any pixel feature and any category of aggregated features can be obtained by calculating the cosine similarity between the pixel feature and the aggregated features of any category, or by calculating the Euclidean distance, Manhattan distance, etc. between the pixel feature and the aggregated features of any category, which is not specifically limited in this embodiment.
[0123] By minimizing the pixel-level contrastive learning loss expressed by formula (1), the similarity between the pixel features in the numerator and the aggregate features of the category to which the pixel belongs (for pixels in the lesion, the category to which the pixel belongs is the lesion in which the pixel falls) can be maximized, and the similarity between the pixel features in the denominator and the aggregate features of the category to which the pixel does not belong (for pixels in the lesion, the category to which the pixel does not belong includes the lesion and background area that the pixel does not fall into) can be minimized.
[0124] For example, according to the feature map of the lesion image sample and the aggregated features of each lesion in the lesion image sample, the following formula (2) can be used to calculate the pixel-level contrastive learning loss:
[0125]
[0126] Among them, the meaning of each symbol in formula (2) is the same as that of the same symbol in formula (1). For details, please refer to the above-mentioned relevant instructions, which will not be repeated here. By minimizing the pixel-level contrast learning loss represented by formula (2), it is also possible to maximize the similarity between the pixel features in the numerator and the aggregate features of the category to which the pixel belongs (for pixels in the lesion, the category to which the pixel belongs is the lesion in which the pixel falls), and minimize the similarity between the pixel features in the denominator and the aggregate features of the category to which the pixel does not belong (for pixels in the lesion, the category to which the pixel does not belong includes the lesion and background area that the pixel does not fall).
[0127] In an optional embodiment, when calculating the contrastive learning loss at the pixel level, some pixels (referred to as sampling points) may be randomly sampled in the coverage area of each lesion to participate in the calculation of the contrastive learning loss at the pixel level. Specifically, based on the similarity between the features of the sampling point and the aggregated features of the lesion containing the sampling point (i.e., the lesion in which the sampling point falls), and the similarity between the features of the sampling point and the aggregated features of the lesion not containing the sampling point (i.e., the lesion not falling into the sampling point); and based on the similarity between the features of the sampling point and the aggregated features of the lesion containing the sampling point (i.e., the lesion in which the sampling point falls), and the similarity between the features of the sampling point and the aggregated features of the lesion not containing the sampling point (i.e., the lesion not falling into the sampling point), the above formula (1) or (2) is used to calculate the contrastive learning loss at the pixel level.
[0128] In addition, the pixel-level contrastive learning loss function can also be configured and adjusted by relevant technical personnel according to actual application scenarios and experience. By minimizing the pixel-level contrastive learning loss function, the goal of increasing the similarity between the pixel feature and the aggregated feature of the lesion containing the pixel and reducing the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel can be achieved. This embodiment does not specifically limit the specific design of the pixel-level contrastive learning loss function.
[0129] The method of this embodiment calculates the similarity between each pixel feature in the lesion image sample and the aggregated feature of the lesion containing the pixel (that is, the lesion in which the pixel falls), and the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel (that is, the lesion not falling), based on the feature map of the lesion image sample and the aggregated feature of each lesion in the lesion image sample, and calculates the pixel-level contrastive learning loss based on the similarity between each pixel feature in the lesion image sample and the aggregated feature of the lesion containing the pixel (that is, the lesion in which the pixel falls), and the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel (that is, the lesion not falling). The pixel-level contrastive learning loss is used to increase the similarity between the pixel feature and the aggregated feature of the lesion containing the pixel, and reduce the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel, which can better suppress the impact of erroneous information in the pseudo-label information on the image segmentation ability of the model and improve the training effect of the image segmentation model.
[0130] Figure 6 A flowchart of an image segmentation method is provided for an exemplary embodiment of the present application. Figure 6 As shown, the steps of image segmentation of the lesion image based on the trained image segmentation model are as follows:
[0131] Step S601: receiving a diseased spot image sent by a terminal-side device.
[0132] The diseased spot image is an image to be segmented given by the user and the diseased spot area in the image needs to be segmented. When the user needs to segment the image, the diseased spot image to be segmented is sent to the end-side device. The end-side device sends the diseased spot image to be segmented to the server. The server receives the diseased spot image to be segmented sent by the end-side device.
[0133] Exemplarily, when a user needs to perform image segmentation, the user sends an image segmentation request to the end-side device, and the image segmentation request includes the lesion image to be segmented. The end-side device sends an image segmentation request to the server, and the image segmentation request includes the lesion image to be segmented. In response to receiving the image segmentation request sent by the end-side device, the server extracts the lesion image to be segmented from the image segmentation request.
[0134] Step S602: input the lesion image into the image segmentation model, extract the feature map of the lesion image through the feature extraction module of the image segmentation model, decode the feature map of the lesion image through the decoding module of the image segmentation model, and obtain the segmentation result of the lesion image, which includes the location information of the lesion in the lesion image.
[0135] After obtaining the lesion image to be segmented, the lesion image is input into the image segmentation model, the feature map of the lesion image is extracted by the image segmentation model, and the feature map is decoded to obtain the segmentation result of the lesion image. The segmentation result of the lesion image includes the position information of the lesion in the lesion image, which can be a mask image of the lesion position in the lesion image.
[0136] The image segmentation model used in this embodiment is obtained by training using the method of any of the aforementioned embodiments, and the specific training process will not be described in detail here.
[0137] Step S603: Return the segmentation result of the lesion image to the terminal device.
[0138] After obtaining the segmentation result of the lesion image, the server returns the segmentation result of the lesion image to the terminal device. Further, the terminal device can output the segmentation result of the lesion image for the user to view and use.
[0139] In addition, the server can output the segmentation result of the lesion image to the specified device according to the pre-configured output method; or, output the segmentation result of the lesion image through the front-end visual interactive interface. The output method of the segmentation result of the lesion image is not specifically limited here.
[0140] In an optional embodiment, after obtaining the segmentation result of the lesion image, the server may output the segmentation result of the lesion image through the front-end interface for the user to view and use. Specifically, after obtaining the segmentation result of the lesion image, the server may output the lesion image through the front-end interface, and mark the location of the lesion in the lesion image according to the segmentation result of the lesion image, including but not limited to: outlining the edge contour of the lesion and highlighting the lesion area.
[0141] The method of this embodiment applies the image segmentation model obtained by training in the above-mentioned embodiment to the segmentation of the lesion position in the lesion image, which can not only greatly shorten the time consumption of data labeling and improve the efficiency of image segmentation, but also ensure the accuracy of image segmentation.
[0142] The image segmentation model training and image segmentation solutions of the present application can be applied to task scenarios of diffuse lesion image data. Figure 7 The overall framework diagram of diffuse lesion image segmentation provided by an exemplary embodiment of the present application. Figure 7As shown, when applied to the task scenario of diffuse lesion image data, a data set containing a large number of diffuse lesion image data is obtained, and a very small number of representative samples are screened out from it by an unsupervised clustering method, and the representative images of a very small number of diffuse lesions are annotated (manually or semi-automatically), and the label information of the very small number of representative images is obtained. Further, based on the label information of a very small number of representative images, the pseudo-label information of a large number of diffuse lesion image samples is predicted by a general segmentation model. Further, based on the pseudo-label information of the diffuse lesion image samples, the image segmentation model is trained by pixel-level contrast learning, and the influence of erroneous information in the pseudo-label is suppressed by introducing pixel-level contrast learning to obtain a trained image segmentation model. The trained image segmentation model can be applied to image segmentation of new diffuse lesion images to obtain segmentation results of new diffuse lesion images.
[0143] Figure 8 A flowchart of a training method for an image segmentation model for diffuse lesions provided in an exemplary embodiment of the present application. Figure 8 As shown, the specific steps of this method are as follows:
[0144] Step S801: Obtain image samples of diffuse lesions and label information of representative samples.
[0145] The diffuse lesion image samples may be images of parts of plants with diffuse lesions collected by image acquisition devices such as cameras, such as images of leaves, roots, stems, etc. with diffuse lesions. Representative samples refer to a very small number of representative lesion images selected from a large number of diffuse lesion image data, which can cover most data types. Each representative sample can represent a class of diffuse lesion images, or an individual lesion image that is different from most diffuse lesion images.
[0146] The label information of the representative sample refers to the result of labeling the location information of the lesion in the representative sample, that is, the image segmentation result of the pre-labeled representative sample. Exemplarily, the label information can be a mask image corresponding to the representative sample, which is a mask image of the same size as the representative sample (lesion image), including multiple lesion areas and background areas (non-lesion areas) in the representative sample. The pixels in different lesion areas can be marked with different category labels (mask values), and the category labels (mask values) corresponding to different lesions are different. The background area refers to the non-lesion area in the representative sample. The pixels in the background area can be marked with a mask value that is different from any category label (mask value). For example, the background area can be marked as 0, and other different lesion categories correspond to different category labels (all non-0).
[0147] In addition, the label information of the representative samples may also be represented and stored in other ways besides the mask image. Specifically, any method for representing the image segmentation result may be used, which is not specifically limited in this embodiment.
[0148] In an optional implementation of this step, a large number of (usually thousands, tens of thousands or even more) image samples of diffuse lesions are obtained, and a very small number (a few or a dozen) of representative samples and label information of the representative samples are obtained. The very small number of representative samples can be manually screened and specified by relevant technical personnel. The label information of the representative samples can be obtained by manually marking the position information of the lesions in the very small number of representative samples.
[0149] In another optional implementation of this step, a large number of (usually thousands, tens of thousands or even more) image samples of diffuse lesions are obtained; a small number (several or more) of representative samples are automatically screened out from the large number of image samples of diffuse lesions according to the configured screening rules, and the number of representative samples is much smaller than the total number of image samples of diffuse lesions. Furthermore, the positions of the lesions in the representative samples are marked to obtain label information of the representative samples.
[0150] The implementation principle and technical effect of selecting a small number of representative samples from a large number of image samples of diffuse lesions and labeling a small number of representative samples refer to the relevant contents of the aforementioned step S301 and will not be repeated here.
[0151] Step S802: Generate pseudo label information of the image sample of the diffuse lesion based on the label information of the representative sample.
[0152] The specific implementation principle and technical effect of this step can be found in the relevant content of the aforementioned step S302, which will not be repeated here.
[0153] Step S803: Based on the image samples and the pseudo-label information of the image samples, pixel-level contrast learning training is performed on the image segmentation model to obtain an image segmentation model suitable for diffuse lesions.
[0154] The specific implementation principle and technical effect of this step can be found in the relevant content of the aforementioned step S303, which will not be repeated here.
[0155] In this embodiment, the image segmentation model training scheme of the previous embodiment is applied to the task scenario of diffuse lesion image segmentation. Based on the diffuse lesion image data, an image segmentation model suitable for diffuse lesion images is trained. The specific implementation principles and technical effects are shown in the previous embodiment and will not be repeated here.
[0156] The method of this embodiment, by acquiring a large number of image samples of diffuse lesions and label information of a very small number (tens or even single digits) of representative samples, automatically generates pseudo-label information of lesion image samples based on the label information of the very small number of representative samples, which can greatly reduce the workload of diffuse lesion image annotation, thereby greatly reducing the manpower and time consumption of data annotation; further, based on the image samples of diffuse lesions and the pseudo-label information of the image samples, the image segmentation model is trained by pixel-level comparative learning to obtain a trained image segmentation model, and the influence of erroneous information in the pseudo-label information can be suppressed through pixel-level comparative learning, thereby ensuring the accuracy of model image segmentation. Under the premise of ensuring the accuracy of model image segmentation, the method of this embodiment greatly reduces the manpower and time cost of diffuse lesion image annotation and improves the efficiency of model training in the diffuse lesion image segmentation scenario.
[0157] Fig. 9 A flowchart of a diffuse lesion image segmentation method is provided for an exemplary embodiment of the present application. Fig. 9 As shown, the steps of performing image segmentation on the image data of diffuse lesions based on the trained image segmentation model suitable for diffuse lesions are as follows:
[0158] Step S901: In response to an image segmentation request, image data of diffuse lesions to be segmented are acquired.
[0159] The image data of diffuse lesions is an image to be segmented given by a user and needs to segment multiple diffuse lesion areas in the image. When the user needs to perform image segmentation, the user sends an image segmentation request to the end-side device, and the image segmentation request includes the image data of the diffuse lesions to be segmented. The end-side device sends an image segmentation request to the server, and the image segmentation request includes the image data of the diffuse lesions to be segmented. In response to receiving the image segmentation request sent by the end-side device, the server extracts the image data of the diffuse lesions to be segmented from the image segmentation request.
[0160] Step S902: inputting the image data of the diffuse lesions into the image segmentation model for image segmentation to obtain the segmentation result of the image data of the diffuse lesions, wherein the image segmentation model is trained in the following manner: obtaining image samples of the diffuse lesions and label information of representative samples, generating pseudo-label information of the image samples based on the label information of the representative samples, performing pixel-level comparative learning training on the image segmentation model based on the image samples and the pseudo-label information of the image samples, and obtaining an image segmentation model suitable for diffuse lesions.
[0161] After the image data of the diffuse lesions to be segmented is obtained, the image data of the diffuse lesions is input into the image segmentation model, the feature map of the image data of the diffuse lesions is extracted by the image segmentation model, and the feature map is decoded to obtain the segmentation result of the image data of the diffuse lesions. The segmentation result of the image data of the diffuse lesions includes the position information of each lesion in the image data, and specifically can be a mask image of the lesion position in the image data of the diffuse lesions.
[0162] The image segmentation model used in this embodiment is an image segmentation model suitable for diffuse lesion image segmentation scenarios obtained by training using the method of any of the above embodiments, by obtaining a large number of image samples of diffuse lesions and label information of a very small number of representative samples, generating pseudo label information of a large number of image samples of diffuse lesions based on the label information of a very small number of representative samples, and performing pixel-level comparative learning training on the image segmentation model based on the image samples of diffuse lesions and the pseudo label information of the image samples, to obtain an image segmentation model suitable for diffuse lesions. The specific implementation principle and technical effects are referred to in the above embodiments, which will not be repeated here.
[0163] Step S903: output the segmentation result of the image data of the diffuse lesion.
[0164] After obtaining the segmentation result of the image data of the diffuse lesion, the server returns the segmentation result of the image data of the diffuse lesion to the end-side device. Further, the end-side device can output the segmentation result of the image data of the diffuse lesion for the user to view and use.
[0165] In addition, the server can output the segmentation results of the image data of the diffuse lesions to the designated device according to a pre-configured output method; or, output the segmentation results of the image data of the diffuse lesions through a front-end visual interactive interface. The output method of the segmentation results of the image data of the diffuse lesions is not specifically limited here.
[0166] In an optional embodiment, after obtaining the segmentation result of the image data of the diffuse lesions, the server may output the segmentation result of the image data of the diffuse lesions through the front-end interface for the user to view and use. Specifically, after obtaining the segmentation result of the image data of the diffuse lesions, the server may output the image data of the diffuse lesions through the front-end interface, and mark the location of the lesions in the image data of the diffuse lesions according to the segmentation result of the image data of the diffuse lesions, including but not limited to: outlining the edge contour of each lesion and highlighting each lesion area.
[0167] The method of this embodiment applies the image segmentation model suitable for diffuse lesions obtained by training in the above-mentioned embodiment to the segmentation of the lesion position of the image data of diffuse lesions, which can not only greatly shorten the time consumption of diffuse lesion image data labeling and improve the efficiency of image segmentation, but also ensure the accuracy of image segmentation of the image data of diffuse lesions.
[0168] Fig.10 A schematic diagram of the structure of a server provided in an embodiment of the present application. Fig.10 As shown, the server includes: a memory 1001 and a processor 1002. The memory 1001 is used to store computer-executable instructions and can be configured to store various other data to support operations on the server. The processor 1002 is connected to the memory 1001 in communication and is used to execute the computer-executable instructions stored in the memory 1001 to implement the technical solution provided by any of the above method embodiments. The specific functions and technical effects that can be achieved are similar and will not be repeated here.
[0169] Optional, such as Fig.10 As shown, the server also includes: a firewall 1003, a load balancer 1004, a communication component 1005, a power supply component 1006 and other components. Fig.10 Only some components are shown schematically, which does not mean that the server only includes Fig.10 Components shown. Fig.10 In the description, the server is only taken as a cloud server deployed in the cloud as an example for exemplary description. The server can also be deployed locally, and this embodiment is not specifically limited here.
[0170] An embodiment of the present application also provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the method of any of the aforementioned embodiments is implemented. The specific functions and technical effects that can be achieved are not repeated here.
[0171] The present application also provides a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor. The computer program is stored in a readable storage medium, and at least one processor of the server can read the computer program from the readable storage medium. At least one processor executes the computer program so that the server executes the technical solution provided by any of the above method embodiments. The specific functions and technical effects that can be achieved are not repeated here.
[0172] The embodiment of the present application provides a chip, including: a processing module and a communication interface, the processing module can execute the technical solution of the server in the aforementioned method embodiment. Optionally, the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module enables the processing module to execute the technical solution provided by any of the aforementioned method embodiments.
[0173] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0174] It should be understood that the above processor can be a central processing unit (CPU), a graphics processing unit (GPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in at least one processor.
[0175] The memory may include high-speed random access memory (RAM), and may also include non-volatile storage, such as at least one disk storage, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0176] The above storage may be an object storage service (OSS).
[0177] The above-mentioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0178] The above-mentioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as a mobile hotspot (WiFi), a second-generation mobile communication system (2G), a third-generation mobile communication system (3G), a fourth-generation mobile communication system (4G) / Long Term Evolution (LongTerm Evolution, referred to as LTE), a fifth-generation mobile communication system (5G) and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (Near Field Communication, referred to as NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (Radio Frequency Identification, referred to as RFID) technology, infrared technology, ultra-wideband (Ultra Wide Band, referred to as UWB) technology, Bluetooth technology and other technologies.
[0179] The power supply assembly provides power to various components of the device where the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply assembly is located.
[0180] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0181] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in a dedicated integrated circuit. Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0182] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0183] The order of the above-mentioned embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. In addition, in some of the processes described in the above-mentioned embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed or executed in parallel in the order in which they appear in this article, and are only used to distinguish between different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or less operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit "first" and "second" to different types. The meaning of "multiple" is more than two, unless otherwise clearly and specifically limited.
[0184] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0185] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0186] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for training an image segmentation model, characterized in that: include: Obtain lesion image samples and label information of representative samples; Based on the label information of the representative sample, generating pseudo label information of the lesion image sample; Based on the lesion image samples and the pseudo-label information of the lesion image samples, pixel-level contrast learning training is performed on the image segmentation model to obtain a trained image segmentation model.
2. The method according to claim 1, characterized in that Get label information for representative samples, including: Screening out representative samples from the lesion image samples, wherein the number of the representative samples is much smaller than the total number of the lesion image samples; The positions of the lesions in the representative sample are marked to obtain label information of the representative sample.
3. The method according to claim 2, characterized in that The step of selecting representative samples from the lesion image samples comprises: Obtaining a feature vector of the lesion image sample; Clustering the lesion image samples according to the feature vectors of the lesion image samples to obtain a plurality of clusters; Select the diseased spot image sample with the smallest distance to the cluster center and the diseased spot image sample with the largest distance to the cluster center from each cluster as representative samples.
4. The method according to claim 2, characterized in that: The step of marking the position of the lesion in the representative sample to obtain label information of the representative sample includes: Outputting the representative sample through a labeling interface; In response to a box selection operation on any lesion in the representative sample, determining position information of a bounding box corresponding to any lesion in the representative sample; According to the position information of the bounding box corresponding to any lesion in the representative sample, performing image segmentation on the regional image within the bounding box to obtain the position information of the lesion within the bounding box; According to the position information of each lesion in the representative sample, a mask image of the lesion in the representative sample is generated as label information of the representative sample.
5. The method according to claim 1, characterized in that The generating the pseudo label information of the lesion image sample based on the label information of the representative sample comprises: The representative sample and the label information of the representative sample are used as segmentation examples, the segmentation examples and the lesion image samples are input into a universal segmentation model, and the lesion image samples are segmented according to the segmentation examples by the universal segmentation model to obtain pseudo label information of the lesion image samples.
6. The method according to claim 1, characterized in that The step of performing pixel-level contrast learning training on the image segmentation model based on the lesion image sample and the pseudo-label information of the lesion image sample to obtain the trained image segmentation model includes: Inputting the lesion image sample into the image segmentation model, extracting a feature map of the lesion image sample through a feature extraction module of the image segmentation model, wherein the feature map is used for decoding to obtain a segmentation result of the lesion image sample; Calculating a pixel-level contrastive learning loss according to the feature map and pseudo-label information of the lesion image sample, wherein the pixel-level contrastive learning loss is used to increase the similarity between the pixel feature and the aggregated feature of the lesion containing the pixel, and to reduce the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel; According to the pixel-level contrast learning loss, the parameters of the image segmentation model are optimized to obtain a trained image segmentation model.
7. The method according to claim 6, characterized in that The pseudo label information is used to indicate the location information of the lesion in the lesion image sample, and the pixel-level contrastive learning loss is calculated according to the feature map and pseudo label information of the lesion image sample, including: Determining the coverage area of each lesion in the lesion image sample according to the pseudo-label information of the lesion image sample; For any lesion in the lesion image sample, according to the coverage area of the lesion and the feature map of the lesion image sample, the features of the pixels falling into the lesion are aggregated to obtain the aggregated features of the lesion; According to the feature map of the lesion image sample and the aggregated features of each lesion in the lesion image sample, a pixel-level contrastive learning loss is calculated, and the pixel-level contrastive learning loss is used to increase the similarity between the pixel feature and the aggregated features of the lesion containing the pixel, and reduce the similarity between the pixel feature and the aggregated features of the lesion not containing the pixel.
8. The method according to any one of claims 1 to 7, characterized in that Also includes: The diseased spot image sent by the receiving device; Inputting the lesion image into the image segmentation model, extracting a feature map of the lesion image through a feature extraction module of the image segmentation model, decoding the feature map of the lesion image through a decoding module of the image segmentation model, and obtaining a segmentation result of the lesion image, wherein the segmentation result includes location information of the lesion in the lesion image; The segmentation result of the lesion image is returned to the terminal device.
9. The method according to claim 8, characterized in that After obtaining the segmentation result of the lesion image, the method further includes: According to the segmentation result of the lesion image, the position of the lesion is marked in the lesion image.
10. A method for training an image segmentation model, characterized in that: include: Obtain image samples of diffuse lesions and label information of representative samples; Based on the label information of the representative sample, generating pseudo label information of the image sample of the diffuse lesion; Based on the image samples and the pseudo-label information of the image samples, pixel-level contrast learning training is performed on the image segmentation model to obtain an image segmentation model suitable for diffuse lesions.
11. The method according to claim 10, characterized in that The pixel-level contrast learning training is performed on the image segmentation model based on the image sample and the pseudo-label information of the image sample to obtain an image segmentation model suitable for diffuse lesions, including: Inputting the image sample into the image segmentation model, extracting a feature map of the image sample through a feature extraction module of the image segmentation model, wherein the feature map is used for decoding to obtain a segmentation result of the image sample; Calculating a pixel-level contrastive learning loss according to the feature map and pseudo-label information of the image sample, wherein the pixel-level contrastive learning loss is used to increase the similarity between the pixel feature and the aggregated feature of the lesion containing the pixel, and to reduce the similarity between the pixel feature and the aggregated feature of the lesion not containing the pixel; According to the pixel-level contrast learning loss, the parameters of the image segmentation model are optimized to obtain an image segmentation model suitable for diffuse lesions.
12. An image segmentation method, characterized in that: include: In response to an image segmentation request, acquiring image data of a diffuse lesion to be segmented; Inputting the image data of the diffuse lesions into an image segmentation model for image segmentation to obtain a segmentation result of the image data of the diffuse lesions, wherein the image segmentation model is trained in the following manner: acquiring image samples of diffuse lesions and label information of representative samples, generating pseudo label information of the image samples based on the label information of the representative samples, and performing pixel-level contrast learning training on the image segmentation model based on the image samples and the pseudo label information of the image samples to obtain an image segmentation model suitable for diffuse lesions; The segmentation result of the image data of the diffuse lesion is output.
13. A server, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the server to execute the method described in any one of claims 1-12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 12 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Semi-supervised image segmentation method based on uncertain false label correction
CN116206106A
Vitiligo lesion area segmentation method and device based on image editing and electronic equipment
CN116977323A
Cited By
Image instance segmentation training method and related equipment thereof
CN120411495A
