Cell image sample enhancement method, device, equipment and medium

By constructing and processing a cell image data set, using the diffusion model for denoising sampling and fusion processing, an image enhancement data set is generated, which solves the problem of insufficient number of rare category nuclei in cell images, improves the recognition and classification performance of the model, and accurately Reflects the spatial distribution of cell nuclei.

CN117765531BActive Publication Date: 2024-09-13SHENZHEN RES INST OF BIG DATA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410046362.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-11
Publication Date
2024-09-13
Estimated Expiration
2044-01-11

AI Technical Summary

Technical Problem

When processing cell images, the existing technology is difficult to effectively solve the problem of insufficient number of rare cell nuclei, resulting in a decline in the model's recognition and classification performance of rare cell types, and the inability to accurately reflect the spatial distribution of cell nuclei in real situations.

Method used

By obtaining a cell image data set, a minority class nuclear structure image is constructed, and the diffusion model is used to perform iterative denoising sampling and extended fusion processing to generate a majority class nuclear structure image and target instance image, forming an image enhancement data set to improve the model's accuracy of rare classes. Number of nuclei and classification accuracy.

Benefits of technology

It effectively increases the number of rare category nuclei, improves the imbalance problem of nucleus categories, improves the model's accuracy in segmenting and classifying nuclei instances, and reflects the spatial distribution of nuclei in real situations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117765531B
    Figure CN117765531B
Patent Text Reader

Abstract

The present invention provides a cell image sample enhancement method, device, equipment and medium, including: obtaining a cell image data set, wherein any cell image in the cell image data set is annotated and divided into instance images and category images; based on the instance images and category images corresponding to any cell image, a number of minority class nuclear structure images of different categories are constructed; the nuclear structure images are iteratively denoised and sampled respectively to obtain a number of target minority class nuclear structure images; each target minority class nuclear structure image is expanded and fused respectively to obtain a plurality of majority class nuclear structure images; based on each majority class nuclear structure image, a number of target instance images and target category images are generated; based on any target instance image and target category image, an image enhancement data set is generated. The present invention realizes increasing the number of rare class cell nuclei, improving the problem of cell nucleus category imbalance, and reflecting the spatial distribution of different categories of nuclei in real conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method, device, equipment and medium for enhancing a cell image sample. Background Art

[0002] In histopathology image datasets, the occurrence of different cell types naturally varies significantly. Certain cell types may be more common in certain tissues or specific pathological conditions, while other cell types may be relatively rare. Researchers may prioritize collecting samples that are more easily accessible or more reflective of the disease, which may lead to overrepresentation of some cell types and underrepresentation of other cell types. This will cause deep learning models to pay more attention to cell nucleus types with higher numbers and ignore types with lower numbers, thereby reducing the recognition and classification performance of rare cell types.

[0003] At present, existing technologies that attempt to solve the class imbalance problem in natural images usually include data augmentation and sample synthesis methods. Data augmentation methods enhance input data by performing various image transformations (such as rotation, scaling, translation, etc.) on existing data. Image synthesis methods use image synthesis technology to mix different images or their labels to generate new synthetic samples.

[0004] However, although these methods can increase the number of rare category nuclei and improve the problem of cell nucleus category imbalance to a certain extent, they may not reflect the spatial distribution of nuclei of different categories in reality, causing the model to still be affected by category imbalance. Summary of the invention

[0005] The present invention provides a cell image sample enhancement method, device, equipment and medium, aiming to solve the technical problem of reducing the number of rare category cell nuclei and improving the imbalance of cell nucleus categories.

[0006] The present invention provides a cell image sample enhancement method, comprising:

[0007] Acquire a cell image dataset, wherein any cell image in the cell image dataset is annotated and divided into an instance image and a category image;

[0008] Based on the instance image and category image corresponding to any cell image, several minority nuclear structure images of different categories are constructed;

[0009] Using a pre-built diffusion model, iteratively denoising and sampling the nuclear structure images are performed to obtain a plurality of target minority class nuclear structure images;

[0010] Performing expansion and fusion processing on each of the target minority class nuclear structure images respectively to obtain multiple majority class nuclear structure images;

[0011] Based on the majority class nuclear structure images, generating a plurality of target instance images and target category images;

[0012] Based on any of the target instance images and target category images, an image enhancement dataset is generated.

[0013] According to a cell image sample enhancement method provided by the present invention, the expansion and fusion processing is performed on each of the target minority nuclear structure images to obtain multiple majority nuclear structure images, including:

[0014] For any of the target minority class nuclear structure images:

[0015] Based on the target minority class nuclear structure image, generating target region image information;

[0016] Iteratively adding noise to the target area image information to obtain a noise image for each iteration;

[0017] Performing denoising sampling on the noise image to obtain a denoised image;

[0018] Fusing the denoised image with the corresponding noisy image to obtain a fused image;

[0019] The fused image is subjected to denoising sampling to fuse the denoised sampled image with the corresponding noise image to obtain a new fused image, and the above steps are repeated until the majority of the nuclear structure images are obtained.

[0020] According to a cell image sample enhancement method provided by the present invention, the image enhancement data set is generated based on any of the target instance images and target category images, comprising:

[0021] Generate a pathological image based on any one of the target instance images and the target category image associated therewith;

[0022] Based on the cell image data set, extracting pixel values ​​corresponding to the target cell nucleus;

[0023] Generate a target cell image set based on the pixel value corresponding to the target cell nucleus and the mask area of ​​each of the pathological images, wherein the mask area is extracted based on the target nucleus example in the target instance image;

[0024] The image enhancement dataset is constructed based on the target cell image set, each of the target instance images and each of the target category images.

[0025] According to a cell image sample enhancement method provided by the present invention, a plurality of minority nuclear structure images of different categories are constructed based on the instance image and the category image corresponding to any cell image, including:

[0026] Determine the number of samples of each type of cells based on the instance image and the category image corresponding to the cell image;

[0027] Based on the sample quantity of each type of cells, filter out the cell information corresponding to the sample quantity in the instance image and the category image being higher than a preset quantity threshold;

[0028] Based on the filtered instance image and category image, the minority class nuclear structure image is constructed.

[0029] According to a cell image sample enhancement method provided by the present invention, the minority class nuclear structure image is constructed based on the filtered instance image and category image, comprising:

[0030] Based on the instance information and category of each cell nucleus in the filtered instance image and category image, construct a binary mask image of each cell nucleus, wherein a foreground pixel in the binary mask image represents whether the foreground pixel is a cell nucleus of the target category;

[0031] Based on the instance information of any one of the cell nuclei, a horizontal center line and a vertical center line are calculated;

[0032] Based on the distance between any pixel point in the example image and the horizontal center line and the distance between any pixel point and the vertical center line, a horizontal distance transformation map and a vertical distance transformation map are constructed;

[0033] Based on the binary mask image, the horizontal distance transform image and the vertical distance transform image, the minority class core structure image is formed, wherein the channels of the minority class core structure image are the same as those of the instance image and the category image.

[0034] According to a cell image sample enhancement method provided by the present invention, after generating an image enhancement dataset based on any of the target instance images and target category images, the method further comprises:

[0035] Based on the cell image dataset and the image enhancement dataset, forming a training sample set;

[0036] Randomly select a number of target images from the training sample set;

[0037] Dividing any of the target images into a plurality of sub-regions of the same size;

[0038] Selecting multiple images from the training sample set, and dividing each image into image blocks having the same size as the sub-region;

[0039] Randomly placing each of the image blocks into a sub-region in any of the target images to obtain a mixed domain sample set;

[0040] Based on the training sample set and the mixed domain sample set, the model to be trained is iteratively trained to obtain a target segmentation classification model.

[0041] According to a cell image sample enhancement method provided by the present invention, the decoder in the model to be trained includes a pixel-level binary mapping decoder, a distance mapping decoder, a category decoder and a pixel-level domain decoder;

[0042] The pixel-level domain decoder is used to identify the domain label of each pixel in the training sample, and the domain label is used to indicate whether the pixel belongs to the pixel of the cell image dataset;

[0043] The iterative training of the model to be trained based on the training sample set and the mixed domain sample set to obtain a target segmentation classification model includes:

[0044] For any training sample in the training sample set and the mixed domain sample set:

[0045] Input any of the training samples into the model to be trained to obtain a pixel-level segmentation result, a distance mapping result, a category recognition result, and a pixel-level domain recognition result output by the model to be trained;

[0046] Determining a total model loss value based on the pixel-level segmentation result, the distance mapping result, the category recognition result, and the pixel-level domain recognition result;

[0047] Based on the total loss value of the model, the model parameters of the model to be trained are optimized to obtain the target segmentation classification model.

[0048] The present invention also provides a cell image sample enhancement device, comprising:

[0049] An acquisition module, used for acquiring a cell image dataset, wherein any cell image in the cell image dataset is annotated and divided into an instance image and a category image;

[0050] A construction module, used for constructing a number of minority nuclear structure images of different categories based on the instance image and the category image corresponding to any cell image;

[0051] A denoising sampling module is used to perform iterative denoising sampling on the nuclear structure image using a pre-built diffusion model to obtain a plurality of target minority class nuclear structure images;

[0052] A fusion module is used to perform expansion and fusion processing on each of the target minority class nuclear structure images to obtain multiple majority class nuclear structure images;

[0053] A first generating module, used for generating a plurality of target instance images and target category images based on the majority class nuclear structure images;

[0054] The second generating module is used to generate an image enhancement data set based on any one of the target instance images and the target category images.

[0055] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the cell image sample enhancement methods described above is implemented.

[0056] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the cell image sample enhancement method described in any one of the above is implemented.

[0057] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the cell image sample enhancement methods described above.

[0058] The cell image sample enhancement method, device, equipment and medium provided by the present invention first construct a number of rare category minority nuclear structure images based on the instance image and category image corresponding to any cell image, and the nuclear structure image can reflect the spatial distribution of different categories of nuclei under real conditions. Then, using the pre-constructed diffusion model, the nuclear structure images are iteratively denoised and sampled to obtain a number of target minority nuclear structure images; each of the target minority nuclear structure images is expanded and fused to obtain a plurality of majority nuclear structure images, thereby increasing the number of rare category cell nuclei, improving the problem of cell nucleus category imbalance, and reflecting the spatial distribution of different categories of nuclei under real conditions. Based on each of the majority nuclear structure images, a number of target instance images and target category images are generated; based on any of the target instance images and target category images, an image enhancement data set is generated. Therefore, based on the image enhancement data set, the accuracy of subsequent models for cell nucleus instance segmentation and classification can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0060] Figure 1 It is a schematic diagram of the process of the cell image sample enhancement method provided by the present invention;

[0061] Figure 2 It is a module schematic diagram of a cell image sample enhancement method provided by an embodiment of the present invention;

[0062] Figure 3 It is a flowchart of model training provided by an embodiment of the present invention;

[0063] Figure 4 It is a structural schematic diagram of the cell image sample enhancement device provided by the present invention;

[0064] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0065] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0066] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.

[0067] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when..." or "when...".

[0068] Figure 1 FIG. 1 is a flow chart of the cell image sample enhancement method provided by the present invention. Figure 1 As shown, the cell image sample enhancement method includes:

[0069] Step S11, obtaining a cell image dataset, wherein any cell image in the cell image dataset is annotated and divided into an instance image and a category image;

[0070] It should be noted that the cell image dataset includes several pre-collected pathological cell images. In cell nucleus segmentation and classification, the annotation result of a pathological cell image includes an instance image and a category image. In these two images, each foreground pixel is labeled with the serial number and category of the cell nucleus instance. For each foreground pixel in the instance image, the numerical value in the instance image indicates which cell nucleus instance the pixel belongs to. Adjacent pixels have the same instance identifier, while the identifiers between different cell nucleus instances are unique. Each pixel in the category image is assigned a label to indicate which category the pixel belongs to. In cell nucleus segmentation and classification, the category image is usually used to mark whether each pixel belongs to the background or foreground (cell nucleus), that is, binary classification. Usually, the background is represented by one label, and the foreground (cell nucleus) is represented by another label.

[0071] Step S12, constructing a plurality of minority nuclear structure images of different categories based on the instance image and the category image corresponding to any cell image;

[0072] Specifically, based on the number of samples of each type of cells in the instance image and the category image, the cell information corresponding to the number of samples in the instance image and the category image that is higher than a preset number threshold is filtered out. The preset number threshold can be set according to actual conditions and is not specifically limited here. In order to synthesize the layout of cell nuclei, a minority class nuclear structure image can be constructed based on the filtered instance image and category image to represent the spatial distribution of cell nucleus instances. It should be noted that the minority class nuclear structure image represents the nuclear structure image of the cell nucleus with a small number of samples. This nuclear structure image is a multi-channel image with the same size as the original image (instance image and category image). The minority class nuclear structure image includes a horizontal distance transformation map, a vertical distance transformation map, and N C binary mask images. Among them, N C Represents the number of categories, where the horizontal distance transformation map is formed based on the distance value between any pixel point of the image and the horizontal center line, and the vertical distance transformation map is formed based on the distance value between any pixel point of the image and the vertical center line. The horizontal center line and the vertical center line are determined based on the regional information of the cell nucleus of the image. The binary mask image indicates whether the foreground pixel is a cell nucleus of category C.

[0073] Step S13, using a pre-built diffusion model, iteratively denoising and sampling the nuclear structure images respectively to obtain a plurality of target minority class nuclear structure images;

[0074] It should be noted that the diffusion model can be understood as using a T-step forward process to add noise to a clean image, and using a T-step reverse process to continuously remove noise from a noisy image to restore a clean image. The forward process can be expressed as:

[0075]

[0076] in, represents the variance of the forward process, I represents the identity matrix, and N represents the normal distribution. The normal distribution is a probability distribution, also known as the Gaussian distribution. If the random variable X obeys a mathematical expectation of μ and a variance of σ 2 The normal distribution is denoted by N(μ, σ 2 ). Specifically, the forward process adds noise to the clean image to obtain a noisy image, and the calculation formula is:

[0077]

[0078] Among them, α t =1-β t α s It represents α when t = s t ; represents α1, α2, ..., α t The cumulative multiplication of .

[0079] In the reverse process, we start with a sample that conforms to the Gaussian noise distribution and iteratively denoise the image from T to 1. This denoising process is sampled from the conditional distribution and can be approximated by a neural network. So the distribution of this neural network conforms to Among them, f θ represents the model network, u θ Represents the mean of the output of the model network. To optimize this approximation, a variational lower bound loss is used to minimize the prediction The difference between the posterior and the forward process. The simplified loss function is expressed as:

[0080]

[0081] Where E represents the mathematical expectation, represents the expected value of the input y at time t and the noise ∈ at time t. ∈t can be understood as the noise added to the image. Specifically, refer to Figure 2 , Figure 2: is a schematic diagram of a module of a cell image sample enhancement method provided by an embodiment of the present invention. First, an unconditional diffusion model is trained for each minority class of cell nucleus instances. After a diffusion model of a minority class nuclear structure is trained, the nuclear structure image is iteratively denoised and sampled from the Tth step to obtain a number of target minority class nuclear structure images. For example, when it comes to the tth step, we use the following formula (3) for sampling:

[0082]

[0083] in, z represents a random noise image that belongs to the same distribution as the original cell image dataset; σ t Represents the variance at time t. Repeat this sampling step until a clean target minority class nuclear structure image is obtained.

[0084] Step S14, performing expansion and fusion processing on each of the target minority class nuclear structure images to obtain multiple majority class nuclear structure images;

[0085] Specifically, based on the target minority class nuclear structure image, the target region image information is generated, and then in order to integrate the known region information in the generation process, the target region image information is iteratively denoised to obtain a noise image after each iterative denoising, and the noise image is denoised and sampled to obtain a denoised image. Further, the denoised image and the corresponding noise image are fused to obtain a fused image, and then the fused image is denoised and sampled to obtain a new denoised image, and the current new denoised image and the corresponding noise image are fused to obtain a new fused image, and the above steps are repeated until a synthesized majority class nuclear structure image is obtained.

[0086] Step S15, generating a plurality of target instance images and target category images based on the majority class nuclear structure images;

[0087] Specifically, each majority class nuclear structure image is segmented to obtain a target instance image and a target category image of each cell nucleus, for example, by using a watershed algorithm for segmentation.

[0088] Step S16: Generate an image enhancement dataset based on any of the target instance images and target category images.

[0089] Specifically, based on any target instance image and target category image, a corresponding pathological image is generated. Since the image generated by the diffusion model is different from the real pathological image in color distribution, in this embodiment, a known region image x of the pathological image is pre-set. known , x knownFirst, initialize it to a zero image, randomly crop the pixel values ​​corresponding to the cell nucleus of a minority category from the cell image dataset, and fill these pixel values ​​into the image x known The mask region is randomly selected from each nuclear instance in the instance image. The conditions generated by are sampled to obtain the corresponding target cell image set, so as to construct the image enhancement dataset based on the target cell image set, the target instance image associated with any cell image in the target cell image set, and the target category image, so that the image is similar to the image in the real cell dataset in terms of vision and label.

[0090] The embodiment of the present invention first constructs several rare category minority nuclear structure images based on the instance image and category image corresponding to any cell image, and the nuclear structure image can reflect the spatial distribution of different categories of nuclei under real conditions. Then, the pre-constructed diffusion model is used to iteratively denoise and sample the nuclear structure images to obtain several target minority nuclear structure images; each of the target minority nuclear structure images is expanded and fused to obtain multiple majority nuclear structure images, thereby increasing the number of rare category cell nuclei, improving the problem of cell nucleus category imbalance, and reflecting the spatial distribution of different categories of nuclei under real conditions. Based on each of the majority nuclear structure images, several target instance images and target category images are generated; based on any of the target instance images and target category images, an image enhancement data set is generated. Therefore, based on the image enhancement data set, the accuracy of subsequent models for cell nucleus instance segmentation and classification can be improved.

[0091] In one embodiment of the present invention, each of the target minority class nuclear structure images is expanded and fused to obtain a plurality of majority class nuclear structure images, including:

[0092] For any of the target minority class nuclear structure images: based on the target minority class nuclear structure image, generate target area image information; perform iterative denoising processing on the target area image information to obtain a noise image for each iteration; perform denoising sampling on the noise image to obtain a denoised image; fuse the denoised image and the corresponding noise image to obtain a fused image; perform denoising sampling on the fused image to fuse the denoised sampled image and the corresponding noise image to obtain a new fused image, and repeat the above steps until the majority class nuclear structure image is obtained.

[0093] It should be noted that, as shown in the following formula (4), the multi-category core structure is defined as:

[0094]

[0095] The target minority class core structure image is taken as a known region, as shown in the following formula (5), and the target minority class core structure image is re-expressed as:

[0096]

[0097] Among them, N C represents the number of categories, h r Represents the horizontal distance transformation map, v r Represents the vertical distance transformation map, c r represents the binary mask image of category r, 0 represents the all-zero matrix, W and H represent the width and height of the image respectively, c r It needs to be placed under the channel of the corresponding category of the multi-category core structure. C +2 means the number of categories +2, 2 means the number of channels of a horizontal distance transform map and a vertical distance transform map; concat is the abbreviation of "concatenation", which is an operation that means concatenating multiple matrices on a certain axis; R w×h×(Nc+2) Represents a real matrix with width W and height H...

[0098] Specifically, based on the target minority class nuclear structure image, the target region image information is generated, and then in order to integrate the known region information into the generation process, the target region image information is iteratively denoised to obtain a noise image after each iterative denoising. The denoising process is shown in the following formula (6):

[0099]

[0100] Further, the noise image is denoised and sampled to obtain a denoised image, and the current denoised image and the corresponding noise image are fused to obtain a fused image, wherein the fusion process is shown in the following formula (7):

[0101]

[0102] Then the fused image Substitute into the above formula (3) to perform denoising sampling and calculate the denoised sampled image Then the denoised sampled image and noisy image Fusion is performed to obtain a new fused image Then the fused image Substitute into formula (3) to perform denoising sampling and calculate the denoised sampling image Repeat the above steps until the synthesized majority-nuclear structure image is obtained.

[0103] The embodiment of the present invention integrates the information of known regions in the process of synthesizing the majority-class nuclear structure image, thereby generating multiple different types of nuclear structures, thereby ensuring that the diversity of samples is increased while including the minority-class nuclear structure.

[0104] In one embodiment of the present invention, generating an image enhancement dataset based on any of the target instance images and target category images includes:

[0105] Based on any of the target instance images and the target category images associated therewith, a pathological image is generated; based on the cell image dataset, pixel values ​​corresponding to the target cell nucleus are extracted; based on the pixel values ​​corresponding to the target cell nucleus and the mask area of ​​each of the pathological images, a target cell image set is generated, wherein the mask area is extracted based on the target nucleus example in the target instance image; based on the target cell image set, each of the target instance images and each of the target category images, the image enhancement dataset is constructed.

[0106] Specifically, a conditional diffusion model is established to generate histological images based on conditional graphs, where the semantic condition is defined as:

[0107]

[0108] Among them, c 0 represents the binary mask image of the background, and e is the contour image of the cell nucleus instance. The corresponding conditions can be obtained by the target instance image and the target category image associated with it, and then the noise image x is converted into T Iterate denoising until x0 is obtained. In each iteration, the following formula (9) is used for calculation:

[0109]

[0110] where s is the guidance strength, which controls the degree of guidance from the semantic condition. represents an all-zero vector, which is used to represent the estimated noise in the unconditional case.

[0111] In addition, in order to alleviate the problem that the image generated by the traditional diffusion model is different from the real pathological image in color distribution, a known area of ​​the pathological image is pre-set, and the generation method of the known area of ​​the pathological image is basically the same as the generation method of the above formula (5) to obtain an initialization image. Based on the cell image dataset, the pixel values ​​corresponding to a minority category of target cell nuclei are randomly cropped; further, these pixel values ​​are filled into the mask area of ​​the initialization image, and the mask area is extracted based on the target nucleus example in the target instance image. The generated conditions are sampled to obtain the corresponding generated target cell image set; thereby, based on the target cell image set, each of the target instance images and each of the target category images, the image enhancement dataset is constructed. For example, the image enhancement dataset is expressed as:

[0112]

[0113] Among them, D sm represents the target cell image set, Target instance image and target category image representing a cell nucleus.

[0114] In one embodiment of the present invention, based on the instance image and the category image corresponding to any cell image, a plurality of minority nuclear structure images of different categories are constructed, including:

[0115] Based on the instance images and category images corresponding to the cell images, the sample quantity of each type of cells is determined; based on the sample quantity of each type of cells, the cell information corresponding to the sample quantity in the instance images and the category images that is higher than a preset quantity threshold is filtered out; based on the filtered instance images and category images, the minority class nuclear structure image is constructed.

[0116] Specifically, based on the instance image and the category image, the number of samples of each type of cell is determined, and then based on the number of samples of each type of cell, the cell information corresponding to the number of samples in the instance image and the category image that is higher than a preset number threshold is filtered out, that is, all other types of cell nucleus instances with a large number are deleted. For example, the image includes categories a, b and c, the number of samples in category a is 100, the number of samples in category b is 5, and the number of samples in category c is 150. At this time, the cell nucleus instances of categories a and c are filtered out.

[0117] Furthermore, based on the filtered instance image and category image, the minority class nuclear structure image is constructed. It should be noted that in order to synthesize the layout of the cell nucleus, the instance image and the category image are re-expressed as a nuclear structure image used to represent the spatial distribution of the cell nucleus instance. This nuclear structure image is a multi-channel image with the same size as the original image (instance image and category image). In this embodiment, the nuclear structure image includes a horizontal distance transformation image, a vertical distance transformation image and N C binary mask images, where N C Indicates the number of categories. For each cell nucleus instance, the distance value from each pixel in the image to the horizontal center line or the vertical center line is calculated, and then the distance value is normalized to obtain the horizontal distance transformation map and the vertical distance transformation map. Any binary mask image indicates whether the foreground pixel is a cell nucleus of category C, and the generated nuclear structure indicates the position and shape of the cell nucleus.

[0118] The embodiment of the present invention filters out other types of cell nucleus instances with a large number of samples, and then generates a nuclear structure image for representing the spatial distribution of cell nucleus instances based on the instance map and category map of the minority class. It can perform data enhancement on the nuclear structure image based on the spatial distribution of nuclei of different categories in real situations, thereby increasing the number of rare category cell nuclei and improving the problem of cell nucleus category imbalance.

[0119] In one embodiment of the present invention, constructing the minority class nuclear structure image based on the filtered instance image and the category image includes:

[0120] Based on the instance information and category of each cell nucleus in the filtered instance image and category image, a binary mask image of each cell nucleus is constructed, wherein the foreground pixel in the binary mask image represents whether the foreground pixel is a cell nucleus of the target category; based on the instance information of any cell nucleus, a horizontal center line and a vertical center line are calculated; based on the distance between any pixel point in the instance image and the horizontal center line and the distance between any pixel point and the vertical center line, a horizontal distance transformation map and a vertical distance transformation map are constructed; based on the binary mask image, the horizontal distance transformation map and the vertical distance transformation map, the minority class nucleus structure image is formed, wherein the channel of the minority class nucleus structure image is the same as that of the instance image and the category image.

[0121] Specifically, based on the filtered instance image and category image, the instance information and category of each cell nucleus in the image are determined, and then based on any pixel point in the category image and the category of each cell nucleus, a binary mask image of each cell nucleus is constructed. For example, when the cell nucleus is a target category r, the foreground pixel point in the binary mask image represents whether the foreground pixel is a cell nucleus of the target category r, and if so, the foreground pixel point is 1, otherwise it is 0.

[0122] Furthermore, for any instance information of the cell nucleus: based on the instance information, a horizontal center line and a vertical center line are calculated. For example, based on the instance information of the cell nucleus, the shape and position of the cell nucleus are determined, and according to the shape and position of the cell nucleus, a feature matrix frame of the cell nucleus is extracted, and then the horizontal center line and vertical center line corresponding to the feature matrix frame are calculated.

[0123] Furthermore, the distance between any pixel point in the instance image and the horizontal center line is calculated respectively, and the distance between any pixel point and the horizontal center line is normalized to obtain a horizontal distance transformation map; and the distance between any pixel point in the instance image and the vertical center line is calculated, and the distance between any pixel point and the vertical center line is normalized to obtain a vertical distance transformation map; further, based on the binary mask image, the horizontal distance transformation map and the vertical distance transformation map, the minority class core structure image is formed, wherein the channel of the minority class core structure image is the same as that of the instance image and the category image.

[0124] For example, the minority class nuclear structure image can be represented as Among them, r represents the category, h r Represents the horizontal distance transformation map, v r Represents the vertical distance transformation map, c r Represents the binary mask image of category r, W and H represent the width and height of the image respectively.

[0125] The embodiment of the present invention generates a nuclear structure image based on the instance map and category map of the minority class. The nuclear structure image can show the spatial distribution of nuclei of different categories in real situations, thereby increasing the number of rare category cell nuclei and improving the problem of cell nucleus category imbalance.

[0126] In one embodiment of the present invention, after generating an image enhancement dataset based on any of the target instance images and target category images, the method further includes:

[0127] Based on the cell image data set and the image enhancement data set, a training sample set is formed; a number of target images are randomly selected from the training sample set; any of the target images is divided into a plurality of sub-regions of the same size; a plurality of images are selected from the training sample set, and each image is divided into image blocks of the same size as the sub-region; each image block is randomly placed in a sub-region in any of the target images to obtain a mixed domain sample set; based on the training sample set and the mixed domain sample set, a model to be trained is iteratively trained to obtain a target segmentation classification model.

[0128] Specifically, based on the cell image dataset and the image enhancement dataset, a training sample set is formed, so as to train a target segmentation classification model using the training sample set. Optionally, in this embodiment, in order to narrow the gap between the real and synthetic domains, a mixed domain sample is constructed using the training sample set for training. For more details: Figure 3 , Figure 3 This is a flow chart of model training provided by an embodiment of the present invention. A number of target images can be directly randomly selected from the training sample set, or a random number can be generated each time any training sample in the training sample set is input. When the random number is not less than a preset threshold, the model is directly trained using the training sample. When the random number is less than the preset threshold, the training sample is used as the target image, and any of the target images is divided into a plurality of sub-regions of the same size, and a plurality of images are selected from the training sample set, and each image is divided to obtain an image block of the same size as the sub-region, so that each of the image blocks is randomly placed in a sub-region in any of the target images to obtain a mixed domain sample set.

[0129] For example, the input image is divided into four sub-regions of equal size, located at the upper left, lower left, upper right, and lower right of the image. Then, multiple images are randomly selected from the training sample set, and a region with the lower region as the original region is randomly cropped from each image. Figure 4 The image block is one-tenth the size of the original image and is randomly placed in one of the four sub-regions of the input image. The final sample is the mixed domain sample, and its corresponding instance and category label also use the same transformation.

[0130] Further, based on the training sample set and the mixed domain sample set, the model to be trained is iteratively trained to obtain a target segmentation classification model. In order to learn fine-grained features from the domain prediction task, the decoder in the model to be trained includes a pixel-level binary map decoder, a distance map decoder, a category decoder and a pixel-level domain decoder. Among them, the pixel-level domain decoder is used to identify the domain label of each pixel in the training sample, and the domain label is used to characterize whether the pixel belongs to the pixel of the cell image dataset. If it belongs to the pixel of the cell image dataset, its domain label is 1, otherwise, its domain label is 0. The pixel-level domain decoder consists of four layers, each of which includes a 3×3 convolution layer and a Leaky ReLU function. The input of the pixel-level domain decoder is a potential feature map of size obtained from the feature extractor, which is upsampled to the size of the ground truth after passing through the pixel-level domain decoder. The pixel-level binary map decoder is responsible for predicting whether each pixel is part of the target object. It generates a binary mask in which the pixels of the target object are marked as 1 and the background pixels are marked as 0. Such a prediction can be used for pixel-level segmentation, that is, assigning each pixel in the image to the target category or background. The distance map decoder predicts the distance from each pixel to the nearest object. Typically, the distance value is negative for pixels inside the object and positive for pixels outside the object. This distance map prediction helps capture the fine structure of the object boundary, allowing the model to better understand the shape and contour of the object. The category decoder is used to predict multiple possible categories in the image at each pixel location. Each pixel is assigned a probability distribution of one or more category labels. This prediction is applicable to situations where there are multiple different categories in the scene, allowing the model to process information from multiple semantic categories simultaneously.

[0131] In order to narrow the gap between the two domains of real images and synthetic images, the embodiment of the present invention selects image samples from the training sample set to construct a mixed domain sample set, so that the training model can fully learn to utilize these synthetic data, thereby improving the model performance of nuclear segmentation and classification tasks.

[0132] In one embodiment of the present invention, the iterative training of the model to be trained based on the training sample set and the mixed domain sample set to obtain the target segmentation classification model includes:

[0133] For any training sample in the training sample set and the mixed domain sample set: input any training sample into the model to be trained to obtain the pixel-level segmentation result, distance mapping result, category recognition result and pixel-level domain recognition result output by the model to be trained; determine the total model loss value based on the pixel-level segmentation result, the distance mapping result, the category recognition result and the pixel-level domain recognition result; based on the total model loss value, optimize the model parameters of the model to be trained to obtain the target segmentation classification model.

[0134] Specifically, for any training sample in the training sample set and the mixed domain sample set: obtain the pixel-level segmentation result, distance mapping result, category recognition result, and pixel-level domain recognition result output by the model to be trained, and then calculate the corresponding loss values ​​based on the pixel-level segmentation result, distance mapping result, category recognition result, and pixel-level domain recognition result, for example, using the cross entropy loss function to calculate the loss value. Then, based on each loss value, determine the total loss value of the model, and the total loss value of the model is calculated as shown in the following formula (10):

[0135]

[0136] Among them, L represents the total loss value of the model, L HV Indicates the loss value corresponding to the pixel-level segmentation result, L BC Indicates the loss value corresponding to the distance mapping result, L MC Indicates the loss value corresponding to the category recognition result, L DISC represents the loss value corresponding to the pixel-level domain recognition result, δ is L DISC The weight of is, for example, set to 0.1. Further, based on the total loss value of the model, the model parameters of the model to be trained are optimized to obtain the target segmentation classification model.

[0137] The embodiments of the present invention identify the pixel-level segmentation results, distance mapping results, category recognition results and pixel-level domain recognition results of training samples through a pixel-level binary mapping decoder, a distance mapping decoder, a category decoder and a pixel-level domain decoder, so that the model can learn fine-grained features from domain prediction tasks, improve model performance, and thus enhance the accuracy of the model in improving core segmentation and classification tasks.

[0138] The cell image sample enhancing device provided by the present invention is described below. The cell image sample enhancing device described below and the cell image sample enhancing method described above can be referred to each other.

[0139] Figure 4 is a schematic diagram of the structure of the cell image sample enhancement device provided by the present invention, such as Figure 4As shown, a cell image sample enhancement device according to an embodiment of the present invention comprises:

[0140] An acquisition module 21 is used to acquire a cell image dataset, wherein any cell image in the cell image dataset is annotated and divided into an instance image and a category image;

[0141] A construction module 22, used for constructing a plurality of minority nuclear structure images of different categories based on the instance image and the category image corresponding to any cell image;

[0142] A denoising sampling module 23 is used to perform iterative denoising sampling on the nuclear structure image using a pre-built diffusion model to obtain a plurality of target minority class nuclear structure images;

[0143] A fusion module 24 is used to perform expansion and fusion processing on each of the target minority class nuclear structure images to obtain multiple majority class nuclear structure images;

[0144] A first generating module 25, for generating a plurality of target instance images and target category images based on the plurality of class nuclear structure images;

[0145] The second generating module 26 is used to generate an image enhancement dataset based on any of the target instance images and target category images.

[0146] It should be noted here that the above-mentioned device provided in the embodiment of the present invention can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.

[0147] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a memory 320, a communications interface 330 and a communications bus 340, wherein the processor 310, the memory 320 and the communications interface 330 communicate with each other through the communications bus 340. The processor 310 may call the logic instructions in the memory 320 to execute the cell image sample enhancement method.

[0148] In addition, the logic instructions in the above-mentioned memory 320 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0149] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the cell image sample enhancement method provided by the above methods.

[0150] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the cell image sample enhancement method provided by the above-mentioned methods.

[0151] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0153] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cell image sample enhancement method, characterized in that: include: Acquire a cell image dataset, wherein any cell image in the cell image dataset is annotated and divided into an instance image and a category image; Based on the instance image and category image corresponding to any cell image, several minority nuclear structure images of different categories are constructed; Using a pre-built diffusion model, iteratively denoising and sampling the nuclear structure images are performed to obtain a plurality of target minority class nuclear structure images; Performing expansion and fusion processing on each of the target minority class nuclear structure images respectively to obtain multiple majority class nuclear structure images; Based on the majority class nuclear structure images, generating a plurality of target instance images and target category images; Based on any of the target instance images and target category images, generate an image enhancement dataset; The step of generating an image enhancement dataset based on any one of the target instance images and the target category images comprises: Generate a pathological image based on any one of the target instance images and the target category image associated therewith; Based on the cell image data set, extracting pixel values ​​corresponding to the target cell nucleus; Generate a target cell image set based on the pixel value corresponding to the target cell nucleus and the mask area of ​​each of the pathological images, wherein the mask area is extracted based on the target nucleus example in the target instance image; Based on the target cell image set, each of the target instance images and each of the target category images, construct the image enhancement dataset; Based on the instance image and the category image corresponding to any cell image, a plurality of minority nuclear structure images of different categories are constructed, including: Determine the number of samples of each type of cells based on the instance image and the category image corresponding to the cell image; Based on the sample quantity of each type of cells, filter out the cell information corresponding to the sample quantity in the instance image and the category image being higher than a preset quantity threshold; Based on the filtered instance image and category image, the minority class nuclear structure image is constructed.

2. The cell image sample enhancement method according to claim 1, characterized in that: The step of performing expansion and fusion processing on each of the target minority class nuclear structure images to obtain a plurality of majority class nuclear structure images includes: For any of the target minority class nuclear structure images: Based on the target minority class nuclear structure image, generating target region image information; Iteratively adding noise to the target area image information to obtain a noise image for each iteration; Performing denoising sampling on the noise image to obtain a denoised image; Fusing the denoised image with the corresponding noisy image to obtain a fused image; The fused image is subjected to denoising sampling to fuse the denoised sampled image with the corresponding noise image to obtain a new fused image, and the above steps are repeated until the majority of the nuclear structure images are obtained.

3. The cell image sample enhancement method according to claim 1, characterized in that: The constructing the minority class core structure image based on the filtered instance image and the category image includes: Based on the instance information and category of each cell nucleus in the filtered instance image and category image, construct a binary mask image of each cell nucleus, wherein a foreground pixel in the binary mask image represents whether the foreground pixel is a cell nucleus of the target category; Based on the instance information of any one of the cell nuclei, a horizontal center line and a vertical center line are calculated; Based on the distance between any pixel point in the example image and the horizontal center line and the distance between any pixel point and the vertical center line, a horizontal distance transformation map and a vertical distance transformation map are constructed; Based on the binary mask image, the horizontal distance transform image and the vertical distance transform image, the minority class core structure image is formed, wherein the channels of the minority class core structure image are the same as those of the instance image and the category image.

4. The cell image sample enhancement method according to claim 1, characterized in that: After generating the image enhancement dataset based on any of the target instance images and the target category images, the method further includes: Based on the cell image dataset and the image enhancement dataset, forming a training sample set; Randomly select a number of target images from the training sample set; Dividing any of the target images into a plurality of sub-regions of the same size; Selecting multiple images from the training sample set, and dividing each image into image blocks having the same size as the sub-region; Randomly placing each of the image blocks into a sub-region in any of the target images to obtain a mixed domain sample set; Based on the training sample set and the mixed domain sample set, the model to be trained is iteratively trained to obtain a target segmentation classification model.

5. The cell image sample enhancement method according to claim 4, characterized in that: The decoder in the model to be trained includes a pixel-level binary map decoder, a distance map decoder, a category decoder and a pixel-level domain decoder; The pixel-level domain decoder is used to identify the domain label of each pixel in the training sample, and the domain label is used to indicate whether the pixel belongs to the pixel of the cell image dataset; The iterative training of the model to be trained based on the training sample set and the mixed domain sample set to obtain a target segmentation classification model includes: For any training sample in the training sample set and the mixed domain sample set: Input any of the training samples into the model to be trained to obtain a pixel-level segmentation result, a distance mapping result, a category recognition result, and a pixel-level domain recognition result output by the model to be trained; Determining a total model loss value based on the pixel-level segmentation result, the distance mapping result, the category recognition result, and the pixel-level domain recognition result; Based on the total loss value of the model, the model parameters of the model to be trained are optimized to obtain the target segmentation classification model.

6. A cell image sample enhancement device, characterized in that: include: An acquisition module, used for acquiring a cell image dataset, wherein any cell image in the cell image dataset is annotated and divided into an instance image and a category image; A construction module, used for constructing a number of minority nuclear structure images of different categories based on the instance image and the category image corresponding to any cell image; A denoising sampling module is used to perform iterative denoising sampling on the nuclear structure image using a pre-built diffusion model to obtain a plurality of target minority class nuclear structure images; A fusion module is used to perform expansion and fusion processing on each of the target minority class nuclear structure images to obtain multiple majority class nuclear structure images; A first generating module, used for generating a plurality of target instance images and target category images based on the majority class nuclear structure images; A second generating module, used for generating an image enhancement dataset based on any one of the target instance images and the target category images; The step of generating an image enhancement dataset based on any one of the target instance images and the target category images comprises: Generate a pathological image based on any one of the target instance images and the target category image associated therewith; Based on the cell image data set, extracting pixel values ​​corresponding to the target cell nucleus; Generate a target cell image set based on the pixel value corresponding to the target cell nucleus and the mask area of ​​each of the pathological images, wherein the mask area is extracted based on the target nucleus example in the target instance image; Based on the target cell image set, each of the target instance images and each of the target category images, construct the image enhancement dataset; Based on the instance image and the category image corresponding to any cell image, a plurality of minority nuclear structure images of different categories are constructed, including: Determine the number of samples of each type of cells based on the instance image and the category image corresponding to the cell image; Based on the sample quantity of each type of cells, filter out the cell information corresponding to the sample quantity in the instance image and the category image being higher than a preset quantity threshold; Based on the filtered instance image and category image, the minority class nuclear structure image is constructed.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the cell image sample enhancement method according to any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cell image sample enhancement method according to any one of claims 1 to 5 is implemented.