Training method, image segmentation method and device
By combining color deconvolution, clustering algorithms, and SVM, the problem of misjudgment caused by complex backgrounds in the segmentation of hematoxylin and eosin stained images was solved, achieving high-precision image segmentation and reducing hardware and labor costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-04-07
AI Technical Summary
When performing image segmentation on tissue sections stained with hematoxylin and eosin, existing technologies often misjudge complex cytoplasmic patterns in the background as foreground, leading to inaccurate segmentation results. Furthermore, deep learning methods require high hardware and labor costs.
A method combining color deconvolution, clustering algorithm, and support vector machine (SVM) is adopted. The target image is obtained through color deconvolution operation, the pixel clustering algorithm is used to automatically divide the pixel clusters, and the SVM model is trained based on the category label to perform pixel classification.
It reduces the manual labeling and hardware costs of pixel category labels, improves the accuracy of image segmentation, and achieves accurate pixel classification and segmentation results.
Smart Images

Figure CN121811397A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to a training method, an image segmentation method, and an apparatus. Background Technology
[0002] The purpose of image segmentation for hematoxylin and eosin (H&E) images is to separate the foreground image, i.e., the cell nucleus image, from stained tissue sections. However, the background of H&E cell images not only contains blood clots and granular impurities but also more complex cytoplasmic patterns. These complex cytoplasmic patterns often interfere with the H&E image segmentation process and are easily misidentified as foreground, leading to inaccurate segmentation results. Summary of the Invention
[0003] This disclosure provides a training method, an image segmentation method, and an apparatus to at least partially address one of the technical problems in related technologies. The technical solution of this disclosure is as follows: According to a first aspect of the present disclosure, a training method is provided, comprising: acquiring a cell color image, and performing a color deconvolution operation on the cell color image to obtain a target image; employing a clustering algorithm to perform pixel clustering on the target image to obtain pixel category labels; and training a pixel classification model based on the category labels to obtain a target classification model; wherein the target classification model is used to classify pixels in the cell color image or the target image.
[0004] According to a second aspect of the present disclosure, an image segmentation method is provided, comprising: acquiring a target classification model, the target classification model being trained according to the training method of the first invention; using the target classification model to perform pixel classification on an image to be processed to obtain a pixel category for any pixel; the image to be processed being a cell color image or a target image corresponding to the cell color image, the target image being an image obtained by performing a color deconvolution operation on the cell color image; and performing image segmentation on the cell color image based on the pixel category.
[0005] According to a third aspect of the present disclosure, a training apparatus is provided, comprising: an acquisition module for acquiring a cell color image and performing a color deconvolution operation on the cell color image to obtain a target image; a clustering module for performing pixel clustering on the target image using a clustering algorithm to obtain pixel category labels; and a training module for training a pixel classification model based on the category labels to obtain a target classification model; wherein the target classification model is used to perform pixel classification on the cell color image or the target image.
[0006] According to a fourth aspect of the present disclosure, an image segmentation apparatus is provided, comprising: an acquisition module for acquiring a target classification model, the target classification model being trained according to the training method of the first invention; a classification module for using the target classification model to perform pixel classification on an image to be processed to obtain a pixel category for any pixel; the image to be processed being a cell color image or a target image corresponding to the cell color image, the target image being an image obtained by performing a color deconvolution operation on the cell color image; and a segmentation module for performing image segmentation on the cell color image based on the pixel category.
[0007] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement a training method as described in the first aspect of the present disclosure or an image segmentation method as described in the second aspect.
[0008] According to a sixth aspect of the present disclosure, a computer-readable storage medium is provided, which stores computer-executable instructions that, when executed by a processor, are used to implement a training method as described in the first aspect of the present disclosure or an image segmentation method as described in the second aspect.
[0009] According to a seventh aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a training method as described in the first aspect of the present disclosure or an image segmentation method as described in the second aspect.
[0010] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects: acquiring a cell color image and performing a color deconvolution operation on the cell color image to obtain a target image; using a clustering algorithm to cluster pixels in the target image to obtain pixel category labels; training a pixel classification model based on the category labels to obtain a target classification model; wherein, the target classification model is used to classify pixels in a cell color image or a target image. Specifically, the clustering algorithm can mine the inherent correlation and differences between pixels based on the similarity of pixels in features such as color and texture, automatically dividing pixels into different clusters, thereby reasonably determining the pixel category labels; furthermore, obtaining pixel category labels through pixel clustering using a combination of color deconvolution, clustering algorithms, and SVM is an unsupervised training method, which not only reduces the manual annotation cost of pixel category labels but also improves segmentation accuracy; furthermore, training the target classification model based on category labels allows the model to fully learn the characteristic patterns of pixels in different categories, thereby achieving accurate determination of the pixel category when using the target classification model to classify pixels in a cell color image or a target image. It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0011] The above and / or additional aspects and advantages of this disclosure will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, in which: Figure 1 This is a schematic flowchart of a training method provided in an embodiment of the present disclosure; Figure 2 A flowchart illustrating another training method provided in an embodiment of this disclosure; Figure 3 A flowchart illustrating another training method provided in an embodiment of this disclosure; Figure 4 This is a schematic flowchart of an image segmentation method provided in an embodiment of the present disclosure; Figure 5 This is a schematic flowchart of another image segmentation method provided in an embodiment of the present disclosure; Figure 6 This is a schematic flowchart of a training device provided in an embodiment of the present disclosure; Figure 7 This is a schematic diagram of the structure of an image segmentation apparatus provided in an embodiment of the present disclosure; Figure 8 This is a block diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0012] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0013] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0014] It should be noted that the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solution disclosed herein are all carried out with the consent of the user, and all comply with the provisions of relevant laws and regulations, and do not violate public order and good morals.
[0015] In related technologies, color deconvolution is an algorithm that can improve the segmentation effect of H&E cell images. When the H&E cell image is a red-green-blue (RGB) image, its principle is essentially that a 3×3 matrix with standardized values transforms the three basis vectors (R, G, B) in the color space corresponding to each pixel in the color image, so that these three-dimensional vectors are transformed by the new basis vectors (R, G, B). , , In the direction of the new component, the pattern of the original nuclear region (the hematoxylin-stained area, appearing blue-purple) is reflected in the new B channel, i.e. The background (e.g., eosin-stained areas in the cytoplasm) only reacts in the new R channels ( ) or the new G channel ( Even patterns of impurities like blood clots are almost never reflected on the surface. This facilitates subsequent segmentation of the cell nucleus, filtering out many patterns except for the hematoxylin-stained areas.
[0016] However, although color deconvolution brings convenience to the subsequent segmentation of cell nuclei images, it still cannot fully guarantee the perfect separation of cell nuclei from other background parts. The resulting cell nuclei layer still contains cytoplasm, and false positives can still be found in the resulting positive selection area, resulting in inaccurate final segmentation results.
[0017] In addition, related technologies have proposed a method that combines color deconvolution, deep learning, and clustering algorithms for image segmentation. However, this method requires graphics cards and manually labeled data, resulting in high hardware and labor costs.
[0018] To address the aforementioned problems, this disclosure proposes a training method, an image segmentation method, and an apparatus. The training method, image segmentation method, and apparatus of embodiments of this disclosure are described below with reference to the accompanying drawings.
[0019] It should be noted that the training method in this embodiment is executed by a training device, and the image segmentation method in this embodiment is executed by an image segmentation device. The training device and the image segmentation device can be implemented by software and / or hardware and can be configured in an electronic device.
[0020] Figure 1 This is a flowchart illustrating a training method provided in the first embodiment of this disclosure.
[0021] like Figure 1 As shown, the training method includes the following steps: Step 101: Obtain the cell color image and perform a color deconvolution operation on the cell color image to obtain the target image.
[0022] The cell color image can refer to the H&E cell color image, which is a three-channel image. The H&E cell color image can refer to the original H&E cell image or the H&E cell image after image preprocessing. For example, the H&E cell color image is an RGB image.
[0023] Similar to the cell color image, the target image obtained by performing color deconvolution on the cell color image is also a three-channel color image.
[0024] Step 102: Use a clustering algorithm to cluster pixels in the target image to obtain the category labels of the pixels.
[0025] Clustering algorithms are used to analyze the pixel features of each pixel in the target image. Based on the pixel features, pixels with similar features are grouped into the same category, and multiple clusters are automatically divided, such as cell nucleus clusters and cytoplasm clusters, so as to assign a category label to each pixel.
[0026] Among them, the clustering algorithm can refer to the K-means clustering algorithm; before performing pixel clustering, the number of clusters can be preset according to the pixel category.
[0027] In an alternative embodiment, such as Figure 2 As shown, step 102 includes the following steps: Step 1021: For any pixel in the target image, determine the three-dimensional coordinates corresponding to the pixel based on the pixel value.
[0028] The target image is a three-channel image. For any pixel, the pixel value in the first channel can be used as the horizontal axis (X-axis) coordinate, the pixel value in the second channel can be used as the vertical axis (Y-axis) coordinate, and the pixel value in the third channel can be used as the vertical axis (Z-axis) coordinate to obtain the three-dimensional coordinates corresponding to the pixel value.
[0029] Step 1022: Based on the clustering algorithm, the three-dimensional coordinates corresponding to the pixels in the target image are clustered to obtain multiple clusters, and each cluster corresponds to a clustering category.
[0030] This involves clustering the three-dimensional coordinates of pixels in the target image according to a pre-set number of clusters, resulting in multiple clusters. The cluster categories can include cell nuclei, cytoplasm, blood clots, background, etc.
[0031] This can be achieved by manually labeling the cluster categories corresponding to each cluster, or by calculating the similarity between the three-dimensional coordinates of the clusters and the three-dimensional coordinates of known categories, and then determining the cluster category corresponding to the clusters based on the similarity calculation results.
[0032] In an optional embodiment, step 1022 includes the following steps: performing standardization and / or normalization processing on the three-dimensional coordinates corresponding to any pixel to obtain the processed three-dimensional coordinates; and clustering the processed three-dimensional coordinates according to a clustering algorithm to obtain multiple clusters.
[0033] To improve clustering accuracy and reduce computation, the three-dimensional coordinates of each pixel can be standardized and / or normalized before clustering.
[0034] Standardizing and / or normalizing the three-dimensional coordinates of pixels can eliminate the influence of differences in pixel value ranges across different channels, prevent a single dimension from dominating the clustering results, and thus improve clustering accuracy.
[0035] Step 1023: Determine the category label of the pixel corresponding to the three-dimensional coordinate in the cluster based on the cluster category corresponding to the cluster.
[0036] In this cluster, the category labels corresponding to the three-dimensional coordinates are the same in each cluster; for any cluster, the cluster category corresponding to the cluster is used as the category label of the pixels corresponding to each three-dimensional coordinate in the cluster.
[0037] For example, if the cluster category corresponding to the cluster can include categories such as cell nucleus, cytoplasm, blood clot, and background, the category label of the pixel can include cell nucleus, cytoplasm, blood clot, and background.
[0038] The color features of pixels in the target image are quantized into spatial coordinates, which facilitates clustering algorithm processing and improves clustering efficiency. The clustering algorithm automatically divides the image into clusters and determines the category label of the pixels according to the cluster category, which reduces the cost of manual annotation of training data and the required hardware cost.
[0039] Step 103: Based on the category labels, train the pixel classification model to obtain the target classification model; wherein, the target classification model is used to classify the pixels of the cell color map or the target image.
[0040] In the case where the target classification model is used to classify cell color images into pixels, the cell color image can be input into the pixel classification model to obtain the predicted category output by the pixel classification model for any pixel in the cell color image; the pixel classification model is trained based on the difference between the predicted category and the category label corresponding to any pixel.
[0041] In the case where the target classification model is used to classify the pixels of a target image, the target image can be input into the pixel classification model to obtain the predicted category output by the pixel classification model for any pixel in the target image; the pixel classification model is trained based on the difference between the predicted category and the category label corresponding to any pixel.
[0042] The pixel classification model is trained based on the difference between the predicted category and the category label corresponding to any pixel, including: calculating the difference loss based on the predicted category and the category label corresponding to any pixel; and training the pixel classification model based on the difference loss.
[0043] In some embodiments, the difference loss between the predicted class and the class label corresponding to a pixel can be determined based on the cross-entropy loss function or the weighted cross-entropy loss function.
[0044] In one optional embodiment, the pixel classification model is a Support Vector Machine (SVM) model. The SVM model can be trained using either a hard-margin mechanism or a soft-margin mechanism.
[0045] In an alternative embodiment, such as Figure 3 As shown, step 103 includes the following steps: Step 1031: Construct the objective function of the support vector machine model based on the normal vector of the hyperplane to be solved; where the hyperplane corresponds to a bias term.
[0046] The hyperplane is composed of the normal vector. and bias terms Composition, normal vector w Bias term used to determine the orientation of the hyperplane b The hyperplane is used to adjust its position to prevent it from getting too close to a certain class of samples. The objective function is constructed to find the optimal hyperplane, that is, to maximize the classification margin of the hyperplane, so as to improve the generalization ability of the SVM model.
[0047] As an example, when training an SVM model based on a soft-margin mechanism, step 1031 includes the following steps: determining a first function based on the normal vector of the hyperplane; determining the relaxation variable and its value based on the relaxation variable corresponding to any pixel to be solved, and determining a second function based on the relaxation variable and its value and a set penalty parameter; and constructing a target function based on the first function and the second function.
[0048] The objective function is formulated as follows:
[0049] in, Let be the objective function. It is the normal vector. It is the first function; For the first The relaxation variable corresponding to each pixel For penalty parameters, This is the second function.
[0050] As another example, when training an SVM model based on a hard-margin mechanism, the objective function is formulated as follows:
[0051] in, Let be the objective function. It is the normal vector.
[0052] Step 1032: Determine the constraints based on the feature vector, class label, normal vector, and bias term of any pixel.
[0053] Among them, the constraints are used to ensure that pixel samples are correctly classified or to control errors. That is, the constraints are used to define the rules of "classification correctness" and limit the optimization boundary of the hyperplane through the constraints.
[0054] As an example, when training an SVM model based on a soft-margin mechanism, step 1032 includes the following steps: determining a first value corresponding to a pixel based on the feature vector, normal vector, and bias term corresponding to any pixel, the first value being used to determine the predicted class corresponding to the pixel; for any pixel, determining a second value based on the first value and class label corresponding to the pixel, and determining a third value based on the slack variable and set value corresponding to the pixel; and determining constraints based on the second and third values.
[0055] The formulas for the constraints are as follows: ,
[0056] in, For the first The pixel features corresponding to each pixel. Indicates the first The first value corresponding to each pixel is an intermediate result of the classification prediction, which needs to be converted into the final predicted category through a sign function. For the first The category label corresponding to each pixel For the first The relaxation variable corresponding to each pixel The second value, This is the third value. It should be noted that the core of the soft margin constraint is to tolerate a small number of samples being misclassified or falling within the margin.
[0057] As another example, when training an SVM model based on a hard-margin mechanism, the constraint formula is as follows:
[0058] The meanings of the parameters in this formula can be found in the relevant descriptions in the aforementioned formulas, and will not be repeated here. It should be noted that the core of the hard-margin constraint is that no sample is allowed to be misclassified, and all samples must fall outside the margin boundaries.
[0059] Step 1033: Based on the constraints, optimize the objective function and obtain the target classification model based on the optimization results.
[0060] Among these methods, the objective function can be optimized (minimized) under constraints to find the optimal solution. and By determining the hyperplane, a target classification model that can accurately classify pixel features is obtained.
[0061] In the case of training an SVM model based on a soft margin mechanism, minimizing the objective function can maximize the hyperplane margin while balancing the classification error.
[0062] In this embodiment, a cell color image is acquired, and a color deconvolution operation is performed on the cell color image to obtain a target image. A clustering algorithm is used to cluster pixels in the target image to obtain pixel category labels. Based on the category labels, a pixel classification model is trained to obtain a target classification model. The target classification model is used to classify pixels in either the cell color image or the target image. The pixel clustering method, which combines color deconvolution, clustering algorithms, and SVM to obtain pixel category labels, is an unsupervised training method. Unsupervised training methods have low hardware requirements and can be started without expensive graphics cards. Therefore, this application not only reduces the manual labeling cost of pixel category labels but also significantly saves hardware costs. Furthermore, the clustering algorithm can uncover the inherent correlations and differences between pixels based on their similarity in features such as color and texture, automatically dividing pixels into different clusters to accurately determine pixel category labels. Further, training the model based on these category labels can improve the model's classification accuracy.
[0063] This disclosure proposes an image segmentation method. Figure 4 This is a schematic flowchart of an image segmentation method provided in the second embodiment of this disclosure.
[0064] like Figure 4 As shown, the image segmentation method may include the following steps: Step 401: Obtain the target classification model.
[0065] The target classification model is a classification model trained according to the training method in the first embodiment.
[0066] The target classification model can be an SVM model, which can be used to classify pixels in cell color images or to classify pixels in target images of cell color images.
[0067] Step 402: Use a target classification model to classify the pixels of the image to be processed to obtain the pixel category of any pixel; the image to be processed is a cell color image or the target image corresponding to the cell color image, and the target image is the image obtained by performing a color deconvolution operation on the cell color image.
[0068] In the case where the target classification model is used to classify pixels in a cell color image and the image to be processed is a cell color image, the image to be processed can be directly input into the target classification model to obtain the pixel category of any pixel output by the target classification model.
[0069] In the case where the target classification model is used to classify the target image corresponding to the cell color image, and the image to be processed is a cell color image, a color deconvolution operation can be performed on the image to be processed first to obtain the corresponding target image. Then, the target image is input into the target classification model to obtain the pixel category of any pixel output by the target classification model.
[0070] Step 403: Perform image segmentation on the cell color map based on pixel category.
[0071] This allows for the extraction or labeling of pixels belonging to the same pixel category. For example, cell nucleus pixels can be uniformly labeled with one color, while background pixels can be uniformly labeled with another color, thereby achieving image segmentation.
[0072] In an alternative embodiment, such as Figure 5 As shown, step 403 includes the following steps: Step 4031: Obtain a mask image, wherein the size of the mask image is the same as that of the cell color image, and the pixel value of the pixels in the mask image is a set value.
[0073] The masking image can be a single-channel image, and the pixel value of each pixel in the masking image is a set value. For example, the set value can be 0, in which case the masking image is a black image; or the set value can be 200, in which case the masking image is a white image.
[0074] Step 4032: For any pixel category, perform category mapping based on the pixel category to obtain the corresponding mapping value.
[0075] Specifically, the mapping value corresponding to each pixel category can be determined based on the preset mapping relationship between pixel category and mapping value; it should be noted that the mapping value corresponding to different pixel categories is different.
[0076] For example, the mapping value corresponding to the cell nucleus category can be 1, the mapping value corresponding to the cytoplasm category can be 2, the mapping value corresponding to the blood clot category can be 3, and the mapping value corresponding to the background category can be 0.
[0077] Step 4033: For any pixel position in the mask image, update the set value at the pixel position according to the mapping value corresponding to the pixel category at the corresponding pixel position in the cell color image, and obtain the updated mask image.
[0078] Specifically, for any pixel location in the mask image, the set value at that pixel location in the mask image can be updated to the mapping value corresponding to the pixel category at the corresponding pixel location in the cell color image.
[0079] For example, for the j-th pixel position in the mask image, assuming the mapping value corresponding to the pixel category at the corresponding pixel position in the cell color image is A, the setting value at the j-th pixel position in the mask image is updated to A. Here, the value of j ranges from [1, J], and J represents the total number of pixels in the mask image.
[0080] Step 4034: Based on the updated mask image, perform image segmentation on the cell color image.
[0081] In the updated mask image, the pixel values of the images are different. The cell color image can be segmented based on the mask region composed of pixels with the same pixel value in the updated mask image.
[0082] For example, if a user wants to save the cell nucleus, they can extract the corresponding masked region from the masked image based on the mapping value corresponding to the cell nucleus, and perform image segmentation on the cell color image based on the masked region to obtain the corresponding cell nucleus image.
[0083] It should be noted that the training process of the target classification model can refer to the relevant description in the foregoing embodiments. This disclosure does not limit this process and will not elaborate further.
[0084] In this embodiment, a target classification model is obtained, which is trained according to the method in the first embodiment. Using the target classification model, pixel classification is performed on the image to be processed to obtain the pixel category of any pixel. The image to be processed is a cell color image or a target image corresponding to a cell color image, where the target image is obtained by performing a color deconvolution operation on the cell color image. Based on the pixel category, image segmentation is performed on the cell color image. The target classification model trained based on category labels fully learns the characteristic patterns of pixels of different categories. Therefore, when using the target classification model to classify pixels in a cell color image or target image, it can accurately determine the category to which a pixel belongs, thereby improving image segmentation accuracy.
[0085] To implement the above embodiments, this disclosure also proposes a training device.
[0086] Figure 6 This is a schematic diagram of the structure of a training device provided in the third embodiment of this disclosure.
[0087] like Figure 6 As shown, the training device 600 includes: an acquisition module 601, a clustering module 602, and a training module 603.
[0088] The acquisition module 601 is used to acquire a cell color image and perform a color deconvolution operation on the cell color image to obtain a target image; the clustering module 602 is used to perform pixel clustering on the target image using a clustering algorithm to obtain the category labels of the pixels; the training module 603 is used to train a pixel classification model based on the category labels to obtain a target classification model; wherein, the target classification model is used to perform pixel classification on the cell color image or the target image.
[0089] As one possible implementation of this disclosure, the pixel classification model is a support vector machine model. The training module 603 is specifically used for: constructing the objective function of the support vector machine model based on the normal vector of the hyperplane to be solved; wherein the hyperplane corresponds to a bias term; determining the constraints based on the feature vector, class label, normal vector and bias term of any pixel; optimizing the objective function based on the constraints; and obtaining the target classification model based on the optimization result.
[0090] As one possible implementation of this disclosure, the training module 603 is specifically used to: determine a first function based on the normal vector of the hyperplane; determine the relaxation variable and its value based on the relaxation variable corresponding to any pixel to be solved, and determine a second function based on the relaxation variable and its value and a set penalty parameter; and construct a target function based on the first function and the second function.
[0091] As one possible implementation of this disclosure, the training module 603 is specifically used to: determine a first value corresponding to a pixel based on the feature vector, normal vector, and bias term corresponding to any pixel, wherein the first value is used to determine the predicted category corresponding to the pixel; for any pixel, determine a second value based on the first value and category label corresponding to the pixel, and determine a third value based on the slack variable and set value corresponding to the pixel; and determine constraint conditions based on the second value and the third value.
[0092] As one possible implementation of this disclosure, the clustering module 602 is specifically used for: determining the three-dimensional coordinates corresponding to any pixel in the target image based on the pixel value; clustering the three-dimensional coordinates corresponding to the pixels in the target image according to the clustering algorithm to obtain multiple clusters, each cluster corresponding to a cluster category; and determining the category label of the pixel corresponding to the three-dimensional coordinates in the cluster according to the cluster category.
[0093] As one possible implementation of this disclosure, the clustering module 602 is specifically used to: perform standardization and / or normalization processing on the three-dimensional coordinates corresponding to any pixel to obtain the processed three-dimensional coordinates; and cluster the processed three-dimensional coordinates according to the clustering algorithm to obtain multiple clusters.
[0094] It should be noted that the foregoing explanation of the training method embodiments also applies to the training device of this embodiment, and will not be repeated here.
[0095] In this embodiment, a cell color image is acquired, and a color deconvolution operation is performed on the cell color image to obtain a target image. A clustering algorithm is used to cluster pixels in the target image to obtain pixel category labels. Based on the category labels, a pixel classification model is trained to obtain a target classification model. The target classification model is used to classify pixels in either the cell color image or the target image. The pixel clustering method, which combines color deconvolution, clustering algorithms, and SVM to obtain pixel category labels, is an unsupervised training method. Unsupervised training methods have low hardware requirements and can be started without expensive graphics cards. Therefore, this application not only reduces the manual labeling cost of pixel category labels but also significantly saves hardware costs. Furthermore, the clustering algorithm can uncover the inherent correlations and differences between pixels based on their similarity in features such as color and texture, automatically dividing pixels into different clusters to accurately determine pixel category labels. Further, training the model based on these category labels can improve the model's classification accuracy.
[0096] To achieve the above embodiments, this disclosure also proposes an image segmentation apparatus.
[0097] Figure 7This is a schematic diagram of the structure of a training device provided in the fourth embodiment of this disclosure.
[0098] like Figure 7 As shown, the training device 700 includes: an acquisition module 701, a classification module 702, and a segmentation module 703.
[0099] The acquisition module 701 is used to acquire a target classification model, which is trained according to the aforementioned training method; the classification module 702 is used to classify the pixels of the image to be processed using the target classification model to obtain the pixel category of any pixel; the image to be processed is a cell color image or a target image corresponding to the cell color image, and the target image is an image obtained by performing a color deconvolution operation on the cell color image; the segmentation module 703 is used to segment the cell color image based on the pixel category.
[0100] As one possible implementation of this disclosure, the segmentation module 703 is specifically used for: acquiring a mask image, wherein the size of the mask image is the same as that of the cell color image, and the pixel values of the pixels in the mask image are set values; for any pixel category, performing category mapping according to the pixel category to obtain the corresponding mapping value; for any pixel position in the mask image, updating the set value at the pixel position according to the mapping value corresponding to the pixel category at the corresponding pixel position in the cell color image to obtain an updated mask image; and performing image segmentation on the cell color image based on the updated mask image.
[0101] It should be noted that the foregoing explanation of the image segmentation method embodiment also applies to the image segmentation apparatus of this embodiment, and will not be repeated here.
[0102] In this embodiment, a target classification model is obtained, which is trained according to the method in the first embodiment. Using the target classification model, pixel classification is performed on the image to be processed to obtain the pixel category of any pixel. The image to be processed is a cell color image or a target image corresponding to a cell color image. The target image is an image obtained by performing a color deconvolution operation on the cell color image. Based on the pixel category, image segmentation is performed on the cell color image. On the one hand, clustering algorithms can discover the inherent correlation and differences between pixels based on the similarity of pixels in features such as color and texture, automatically dividing pixels into different clusters, thereby reasonably determining the pixel category label. On the other hand, training the target classification model based on the category label enables the model to fully learn the characteristic patterns of pixels of different categories, thus achieving accurate determination of the pixel category when using the target classification model to classify pixels in the cell color image or target image, thereby improving image segmentation accuracy.
[0103] Figure 8This is a schematic diagram of the structure of an electronic device provided according to a fifth embodiment of the present disclosure. The electronic device 800 in this embodiment is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0104] like Figure 8 As shown, the above-mentioned electronic device 800 includes: The memory 801 and the processor 802 are connected by a bus 803, which connects the different components (including the memory 801 and the processor 802). The memory 801 stores a computer program, which implements the training method or image segmentation method of the present disclosure when the processor 802 executes the program.
[0105] Bus 803 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0106] Electronic device 800 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by electronic device 800, including volatile and non-volatile media, removable and non-removable media.
[0107] Memory 801 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 804 and / or cache memory 805. Electronic device 800 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 806 may be used to read and write non-removable, non-volatile magnetic media (… Figure 8 Not shown; usually referred to as a "hard drive"). Although Figure 8As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 803 via one or more data media interfaces. Memory 801 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this disclosure.
[0108] A program / utility 808 having a set (at least one) of program modules 807 may be stored, for example, in memory 801. Such program modules 807 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 807 typically perform the functions and / or methods described in the embodiments of this disclosure.
[0109] Electronic device 800 can also communicate with one or more external devices 809 (e.g., keyboard, pointing device, display 811, etc.), and with one or more devices that enable a user to interact with the electronic device 800, and / or with any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through input / output (I / O) interface 812. Furthermore, electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 813. Figure 8 As shown, network adapter 813 communicates with other modules of electronic device 800 via bus 803. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0110] The processor 802 executes various functional applications and data processing by running programs stored in the memory 801.
[0111] It should be noted that the implementation process and technical principles of the electronic device in this embodiment are explained in the foregoing description of the training method or image segmentation method of the present disclosure embodiments, and will not be repeated here.
[0112] To implement the above embodiments, this disclosure also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments. The computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.
[0113] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.
[0114] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0115] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A training method, characterized in that, Includes the following steps: Obtain a cell color image, and perform a color deconvolution operation on the cell color image to obtain the target image; A clustering algorithm is used to cluster pixels in the target image to obtain the category labels of the pixels; Based on the category labels, a pixel classification model is trained to obtain a target classification model; wherein, the target classification model is used to classify pixels of the cell color map or the target image.
2. The method according to claim 1, characterized in that, The pixel classification model is a support vector machine model. The step of training the pixel classification model based on the category labels to obtain the target classification model includes: Based on the normal vector of the hyperplane to be solved, the objective function of the support vector machine model is constructed; wherein, the hyperplane corresponds to a bias term; The constraints are determined based on the feature vector of any pixel, the category label, the normal vector, and the bias term. Based on the constraints, the objective function is optimized and solved, and the target classification model is obtained based on the optimization results.
3. The method according to claim 2, characterized in that, The step of constructing the objective function of the support vector machine model based on the normal vector and bias term of the hyperplane includes: Determine the first function based on the normal vector of the hyperplane; Based on the relaxation variable corresponding to any pixel to be solved, determine the relaxation variable and its value, and based on the relaxation variable and its value and the set penalty parameter, determine the second function; The target function is constructed based on the first function and the second function.
4. The method according to claim 3, characterized in that, The step of determining the constraint conditions based on the feature vector of any pixel, the category label, the normal vector, and the bias term includes: Based on the feature vector, the normal vector and the bias term corresponding to any pixel, a first value corresponding to the pixel is determined, wherein the first value is used to determine the predicted category corresponding to the pixel; For any given pixel, a second value is determined based on the first value and category label corresponding to the pixel, and a third value is determined based on the relaxation variable and set value corresponding to the pixel; The constraint conditions are determined based on the second and third values.
5. The method according to claim 1, characterized in that, The clustering algorithm is used to cluster pixels in the target image to obtain pixel category labels, including: For any pixel in the target image, determine the three-dimensional coordinates corresponding to the pixel based on the pixel value; Based on the clustering algorithm, the three-dimensional coordinates corresponding to the pixels in the target image are clustered to obtain multiple clusters, and each cluster corresponds to a clustering category; Based on the cluster category corresponding to the cluster, determine the category label of the pixel corresponding to the three-dimensional coordinate in the cluster.
6. The method according to claim 5, characterized in that, The clustering algorithm is used to cluster the three-dimensional coordinates corresponding to pixels in the target image to obtain multiple clusters, including: The three-dimensional coordinates corresponding to any pixel are standardized and / or normalized to obtain the processed three-dimensional coordinates. Based on the clustering algorithm, the processed three-dimensional coordinates are clustered to obtain the multiple clusters.
7. An image segmentation method, characterized in that, Includes the following steps: Obtain a target classification model, wherein the target classification model is trained by the method according to any one of claims 1-6; Using the target classification model, the image to be processed is classified pixel by pixel to obtain the pixel category of any pixel; The image to be processed is a cell color image or a target image corresponding to the cell color image, wherein the target image is an image obtained by performing a color deconvolution operation on the cell color image; Based on the pixel category, the cell color image is segmented.
8. The method according to claim 7, characterized in that, The step of segmenting the cell color image based on the pixel category includes: Obtain a mask image, wherein the size of the mask image is the same as that of the cell color image, and the pixel value of the pixels in the mask image is a set value; For any pixel category, perform category mapping based on the pixel category to obtain the corresponding mapping value; For any pixel location in the mask image, the set value at the pixel location is updated according to the mapping value corresponding to the pixel category at the corresponding pixel location in the cell color image, to obtain the updated mask image; Based on the updated masked image, the cell color image is segmented.
9. A training device, characterized in that, include: The acquisition module is used to acquire cell color images and perform color deconvolution operations on the cell color images to obtain a target image; The clustering module is used to perform pixel clustering on the target image using a clustering algorithm to obtain the category labels of the pixels; The training module is used to train the pixel classification model based on the category labels to obtain a target classification model; wherein the target classification model is used to classify the cell color image or the target image into pixels.
10. An image segmentation apparatus, characterized in that, include: An acquisition module is used to acquire a target classification model, wherein the target classification model is trained by the method according to any one of claims 1-6; The classification module is used to classify the pixels of the image to be processed using the target classification model to obtain the pixel category of any pixel; The image to be processed is a cell color image or a target image corresponding to the cell color image, wherein the target image is an image obtained by performing a color deconvolution operation on the cell color image; The segmentation module is used to segment the cell color image based on the pixel category.