Disclosure of Invention
The invention provides a cell edge segmentation method and a cell edge segmentation device based on adaptive morphology, which are used for solving the problems that in the prior art, the accurate segmentation of cell edges is difficult to ensure and the cell edge segmentation method is difficult to adapt to the segmentation task of CACs (computer aided systems) cells.
The invention provides a cell edge segmentation method based on adaptive morphology, which comprises the following steps:
determining a cell image to be segmented;
carrying out example segmentation on the cell image to be segmented by using a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented;
performing adaptive iterative corrosion processing on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented; wherein the convolution parameters in the adaptive iterative erosion processing process decrease as the difference between the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current erosion result decreases, and the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result;
and finely dividing the initial segmentation result based on the optimal corrosion result by using a watershed algorithm to obtain a final segmentation result of the cell image to be segmented.
According to the cell edge segmentation method based on the adaptive morphology, provided by the invention, the convolution parameters comprise convolution kernel size; the self-adaptive iterative corrosion processing is performed on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented, and the method specifically includes:
determining a plurality of decreasing-sized convolution kernel sizes beginning with an initial convolution kernel size;
carrying out iterative corrosion on the last corrosion processing result based on the sizes of the convolution kernels in sequence to obtain a current corrosion processing result; wherein each iterative erosion terminates when an iteration stop condition corresponding to the convolution kernel size is reached;
taking the current corrosion treatment result as the optimal corrosion result;
wherein, during the first etching, the initial segmentation result is etched based on the initial convolution kernel size; the iteration stop condition of any convolution kernel size is that the difference between the number of cells in the current corrosion processing result and the number of cells in the initial segmentation result is smaller than a preset difference threshold corresponding to any convolution kernel size, and the smaller the size of any convolution kernel is, the smaller the preset difference threshold corresponding to any convolution kernel size is.
According to the cell edge segmentation method based on the adaptive morphology, provided by the invention, the initial convolution kernel size is determined based on the following steps:
counting the area of each cell in the initial segmentation result based on the label information of the cell to which each pixel belongs in the initial segmentation result;
calculating an average area of each cell based on the area of each cell in the initial segmentation result;
determining the initial convolution kernel size based on the average area of the respective cells.
According to the cell edge segmentation method based on the adaptive morphology, provided by the invention, the initial segmentation result is finely segmented based on the optimal corrosion result by using a watershed algorithm to obtain a final segmentation result of the cell image to be segmented, and the method specifically comprises the following steps:
fine segmentation step: performing fine segmentation on the initial segmentation result by using a watershed algorithm based on the optimal corrosion result to obtain a current fine segmentation result;
a feedback regulation step: if the statistical characteristics of the cells in the initial segmentation result are not matched with the statistical characteristics of the cells in the current fine segmentation result, adjusting the size of the initial convolution kernel, performing adaptive iterative corrosion processing on the initial segmentation result again to obtain a new optimal corrosion result, and executing the fine segmentation step based on the new optimal corrosion result to obtain the current fine segmentation result;
and (3) circulating step: repeatedly executing the feedback adjustment step until the statistical characteristics of the cells in the initial segmentation result are matched with the statistical characteristics of the cells in the current fine segmentation result;
and a result determination step: and determining the current fine segmentation result as the final segmentation result.
According to the cell edge segmentation method based on the adaptive morphology provided by the invention, the adjusting of the initial convolution kernel size, the re-performing of the adaptive iterative erosion processing on the initial segmentation result to obtain a new optimal erosion result, and the executing of the fine segmentation step based on the new optimal erosion result specifically comprise:
performing sub-graph division on the cell image to be segmented to obtain a plurality of sub-graph regions of the cell image to be segmented;
obtaining the cell number of each sub-graph region corresponding to the initial segmentation result and the fine segmentation result;
if the cell number of any sub-graph region in the initial segmentation result is not matched with that of any sub-graph region in the fine segmentation result, adjusting the size of the initial convolution kernel, and performing self-adaptive iterative corrosion processing on the part corresponding to any sub-graph region in the initial segmentation result again to obtain a new optimal corrosion result;
and based on the new optimal corrosion result, performing fine segmentation on the part corresponding to any sub-graph region in the initial segmentation result again.
According to the cell edge segmentation method based on adaptive morphology provided by the invention, the adjusting of the initial convolution kernel size specifically comprises:
reducing the initial convolution kernel size based on a plurality of preset convolution kernel sizes.
According to the cell edge segmentation method based on the adaptive morphology, provided by the invention, the initial segmentation result is finely segmented based on the optimal corrosion result by using the watershed algorithm, and the method specifically comprises the following steps:
performing connected domain analysis on the optimal corrosion result to obtain a plurality of connected domains in the optimal corrosion result;
and performing fine segmentation on the initial segmentation result by using a watershed algorithm based on a plurality of connected domains in the optimal corrosion result.
According to the cell edge segmentation method based on the adaptive morphology, provided by the invention, the cell segmentation model is determined based on the following steps:
acquiring a training sample, and dividing the training sample into a training set and a test set; the training sample comprises a sample cell image, or comprises a sample cell image and mask labeling information of each cell in the sample cell image;
training a segmentation model based on the training set, performing staged performance test on the segmentation model by using the test set in the training process, and storing the segmentation model with the optimal performance test result as the cell segmentation model.
According to the cell edge segmentation method based on the adaptive morphology provided by the invention, the obtaining of the training sample specifically comprises the following steps:
obtaining a cell microscopic image;
if the number of channels of the cell microscopic image is larger than the preset number of channels corresponding to the input condition of the cell segmentation model, decomposing the cell microscopic image into a plurality of low-channel images;
performing image quality evaluation on the plurality of low-channel images to obtain quality evaluation scores of the plurality of low-channel images;
acquiring a plurality of low-channel images with highest quality evaluation scores based on the quality evaluation scores of the low-channel images;
combining the plurality of low-channel images with the highest quality assessment scores into the sample cell image; and the number of channels formed by combining the plurality of low-channel images with the highest quality evaluation scores is equal to the preset number of channels.
The invention also provides a cell edge segmentation device based on adaptive morphology, comprising:
the image determining unit is used for determining a cell image to be segmented;
the example segmentation unit is used for carrying out example segmentation on the cell image to be segmented by utilizing a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented;
the self-adaptive corrosion unit is used for carrying out self-adaptive iterative corrosion treatment on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented; wherein the convolution parameters in the adaptive iterative erosion processing process decrease as the difference between the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current erosion result decreases, and the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result;
and the fine segmentation unit is used for performing fine segmentation on the initial segmentation result based on the optimal corrosion result by using a watershed algorithm to obtain a final segmentation result of the cell image to be segmented.
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 the processor executes the program to implement the steps of the adaptive morphology-based cell edge segmentation method as described in any one of the above.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the adaptive morphology-based cell edge segmentation method as described in any of the above.
The present invention also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of the adaptive morphology based cell edge segmentation method as described in any one of the above.
The invention provides a cell edge segmentation method and a cell edge segmentation device based on adaptive morphology, which are characterized in that a cell image to be segmented is subjected to example segmentation by using a cell segmentation model to obtain an initial segmentation result, and then the initial segmentation result is subjected to adaptive iterative corrosion processing to obtain an optimal corrosion result, wherein convolution parameters in the adaptive iterative corrosion processing process are reduced along with the reduction of the difference between the statistical characteristics of cells in the initial segmentation result and the statistical characteristics of cells in the current corrosion result, so that the cells which are adhered and overlapped are separated to a greater extent, the morphology of the original cells is kept as much as possible, and then fine segmentation is carried out by using a watershed algorithm under the guidance of the optimal corrosion result, so that a smooth edge which is more accurate and conforms to the original morphology of the cells can be segmented, and the accuracy of cell edge segmentation is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a cell segmentation method according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step 110, determining a cell image to be segmented.
Specifically, a microscope image containing cells may be acquired as a cell image to be segmented. Wherein, the DAPI visual field image can be selected as the cell image to be segmented. Here, the cells included in the image to be segmented may be CACs cells in circulating tumor cells, or other cells that need to be subjected to precise edge segmentation, which is not specifically limited in the embodiment of the present invention.
And 120, carrying out example segmentation on the cell image to be segmented by using a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented.
Specifically, a cell segmentation model is trained in advance, and the cell segmentation model is an example segmentation model, such as a Mask-RCNN network. The cell segmentation model can adopt Resnet 50+ feature pyramid FPN as a feature extraction network, further adopts an ROI Align module to realize region-of-interest extraction of a small target, and finally synchronously realizes segmentation of a foreground and a background in the region-of-interest and classification of the foreground region through a multi-branch network. Since there are only cells in the foreground, the classification task is a binary one. In the training process of the cell segmentation model, the sample image and the mask binary image of each cell in the sample image are input into the cell segmentation model as metadata to be subjected to epiches training for multiple times, so that the trained cell segmentation model is obtained. And inputting the cell image to be segmented into the cell segmentation model for instance segmentation, so as to obtain an initial segmentation result of the cell image to be segmented. The initial segmentation result comprises each cell pixel point in the image to be segmented and the cell label to which each cell pixel point belongs.
Step 130, performing adaptive iterative corrosion processing on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented;
the convolution parameters in the adaptive iterative erosion processing process are reduced along with the reduction of the difference between the statistical characteristics of the cells in the initial segmentation result and the statistical characteristics of the cells in the current erosion result, and the statistical characteristics of the cells in the optimal erosion result are matched with the statistical characteristics of the cells in the initial segmentation result.
In particular, as shown in the left side of fig. 2, since there may be overlap between cells in the cell image to be segmented, a large amount of overlap is easily generated between cell boundaries in the initial segmentation result output by the cell segmentation model, and the cell edge segmentation is inaccurate. Therefore, the overlapped cell edges need to be finely divided, so as to obtain precise cell edges. To solve the problem of overlapping cells, part of the work is to perform a further segmentation operation on the initial segmentation result obtained by segmenting the example by using a watershed algorithm or the like. However, the edge segmentation effect of the above method is not good for the image to be segmented with crowded cells and serious cell overlapping. As shown in the middle of fig. 2, in the segmentation result obtained by finely segmenting the initial segmentation result by using the watershed algorithm, a large amount of overlap still exists between cell edges, and the cell edges are not smooth, in addition, part of cell pixel points are divided to the outside of all the cell edges, a large amount of information islands are generated, and when a downstream task is performed, the cell pixel points in the information islands have no way to distinguish the attribution thereof.
In contrast, before the initial segmentation result is finely segmented, the embodiment of the invention performs adaptive iterative corrosion processing on the binary image corresponding to the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result, so as to realize the separation of overlapped cells, thereby obtaining the optimal corrosion result corresponding to the cell image to be segmented. Here, the convolution parameters in the adaptive iterative erosion process decrease as the difference between the statistical characteristics of the cells in the initial segmentation result and the statistical characteristics of the cells in the current erosion result decreases. The statistical characteristics of the cells may include the total number of cells in the initial segmentation result or the current erosion result, and may also include the distribution of the cells in the initial segmentation result or the current erosion result, such as the number of cells in each sub-graph region.
Although the cell edge segmentation of the overlapping cells in the example segmentation process is not good enough, the number of cells or the cell distribution (i.e., the statistical characteristics) identified by the example segmentation is reliable, so that the difference between the statistical characteristics of the cells in the current erosion result and the statistical characteristics of the cells in the initial segmentation result can represent the difference between the segmentation condition and the actual condition of the overlapping cells in the current erosion result. Here, the larger the difference between the segmentation condition and the actual condition of the overlapping cells in the current erosion result is, the more significant erosion operation needs to be performed to separate the overlapping cells to a greater extent, and accordingly, the smaller the difference between the segmentation condition and the actual condition of the overlapping cells in the current erosion result is, which indicates that most of the overlapping cells have been separated, and only a small portion of overlapping cells with less significant overlapping portions are separated, so that a finer cell separation operation needs to be performed while the original morphology of the cells is maintained as much as possible to ensure the smoothness of the cell edges.
Specifically, in the etching process, convolution parameters used in the etching process, such as convolution kernel size and convolution step size, are adjusted according to the difference between the statistical characteristics of the cells in the current etching result and the statistical characteristics of the cells in the initial segmentation result. Wherein, the larger the difference between the statistical characteristics of the cells in the current erosion result and the statistical characteristics of the cells in the initial segmentation result is, the larger the convolution parameters can be used to perform the iterative erosion operation with quicker and more obvious effect, so as to separate most of the overlapped cells quickly. With the reduction of the difference between the statistical characteristics of the cells in the current corrosion result and the statistical characteristics of the cells in the initial segmentation result, the convolution parameters can be reduced to perform finer and smaller-amplitude iterative corrosion operation, and the original form of the cells is kept as much as possible on the basis of separating overlapped cells, so that the smoothness of the cell edges is ensured. And matching the statistical characteristics of the cells in the current corrosion result with the statistical characteristics of the cells in the initial segmentation result, namely, stopping iterative corrosion when the total number of the cells in the current corrosion result is the same as the total number of the cells in the initial segmentation result or the cell distribution in the current corrosion result is the same as the cell distribution in the initial segmentation result, and obtaining the optimal corrosion result. Wherein the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result.
Therefore, after the optimal corrosion result corresponding to the cell image to be segmented is obtained by performing the self-adaptive iterative corrosion treatment on the binary image corresponding to the initial segmentation result, the subsequent fine segmentation operation is performed, on one hand, the overlapped cells in the initial segmentation result can be segmented, and the adhered and overlapped cells are separated to a greater extent, so that the effect of the subsequent watershed algorithm is optimized, and the watershed algorithm is prevented from being invalid due to cell overlapping; on the other hand, the convolution parameters used in the self-adaptive iterative erosion process can be reduced along with the reduction of the difference between the statistical characteristics of the cells in the current erosion result and the statistical characteristics of the cells in the initial segmentation result, so that excessive erosion can be avoided, the form of the original cells can be kept as far as possible, and when the subsequent watershed algorithm is used for fine segmentation under the guidance of the optimal erosion result, smooth edges which are more in line with the original form of the cells can be segmented.
And 140, performing fine segmentation on the initial segmentation result by using a watershed algorithm based on the optimal corrosion result to obtain a final segmentation result of the cell image to be segmented.
Specifically, based on the optimal corrosion result, the initial segmentation result is finely segmented by using a watershed algorithm. The cell region identifier obtained from the optimal corrosion result can be used as a function parameter to be transmitted to the watershed algorithm, and when the watershed algorithm is used for fine segmentation, the cell region obtained from the optimal corrosion result can be used as an initial value to be subjected to fine segmentation, so that a final segmentation result of the cell image to be segmented is obtained. Since the adaptive iterative erosion operation separates the adhered and overlapped cells to a greater extent and preserves the morphology of the original cells as much as possible, under the guidance of the optimal erosion result obtained after the adaptive iterative erosion, the watershed algorithm can segment a smooth edge that is more accurate and better conforms to the original morphology of the cells, as shown on the right side of fig. 2.
According to the method provided by the embodiment of the invention, after the cell image to be segmented is subjected to instance segmentation by using the cell segmentation model to obtain an initial segmentation result, the initial segmentation result is subjected to adaptive iterative corrosion treatment to obtain an optimal corrosion result, wherein convolution parameters in the adaptive iterative corrosion treatment process are reduced along with the reduction of the difference between the statistical characteristics of the cells in the initial segmentation result and the statistical characteristics of the cells in the current corrosion result, the adhered and overlapped cells are separated to a greater extent, the form of the original cells is kept as much as possible, and then fine segmentation is carried out by using a watershed algorithm under the guidance of the optimal corrosion result, so that a smooth edge which is more accurate and more in line with the original form of the cells can be segmented, and the accuracy of cell edge segmentation is improved.
Based on the above embodiment, the convolution parameter includes a convolution kernel size;
fig. 3 is a schematic flow chart of the adaptive iterative etching method according to the embodiment of the present invention, and as shown in fig. 3, step 130 specifically includes:
step 131, determining a plurality of convolution kernel sizes with decreasing sizes, including the initial convolution kernel size;
step 132, performing iterative etching on the previous etching processing result on the basis of the sizes of the convolution kernels in sequence to obtain a current etching processing result; wherein each iterative erosion terminates when an iteration stop condition corresponding to the convolution kernel size is reached;
step 133, using the current corrosion processing result as the optimal corrosion result;
wherein, during the first etching, the initial segmentation result is etched based on the initial convolution kernel size; the iteration stop condition of any convolution kernel size is that the difference between the number of cells in the current corrosion processing result and the number of cells in the initial segmentation result is smaller than a preset difference threshold corresponding to any convolution kernel size, and the smaller the size of any convolution kernel is, the smaller the preset difference threshold corresponding to any convolution kernel size is.
Specifically, a plurality of convolution kernel sizes may be set, e.g., 7 × 7, 5 × 5, and 3 × 3, of which 7 × 7 is the initial convolution kernel size, with sizes starting at the initial convolution kernel size. The initial convolution kernel size can be determined based on the morphology of the cell in the cell image to be segmented, and the larger the cell is, the larger the initial convolution kernel size can be set.
And performing iterative etching on the last etching processing result in sequence based on the sizes of the convolution kernels to obtain a current etching processing result, wherein each iterative etching is terminated when an iteration stopping condition corresponding to the size of the convolution kernel is reached. Namely, according to the decreasing order of the sizes, the last corrosion processing result is subjected to iterative corrosion based on the current convolution kernel size, the iterative corrosion is terminated after the iteration stop condition of the current convolution kernel size is reached, and the next convolution kernel size is taken as the current convolution kernel size for further iterative corrosion. Taking the sizes of three convolution kernels of 7 × 7, 5 × 5 and 3 × 3 as an example, firstly, iterating and corroding the previous corrosion processing result based on the 7 × 7 convolution kernels until an iteration stop condition of the 7 × 7 convolution kernels is reached, wherein a corrosion object in the first corrosion is an initial segmentation result obtained by segmenting the example; then, based on the 5 × 5 convolution kernel, the last corrosion processing result is corroded in an iteration mode until an iteration stop condition of the 5 × 5 convolution kernel is achieved; and finally, based on the 3 × 3 convolution kernel, continuing to iteratively corrode the last corrosion processing result until reaching an iteration stop condition of the 3 × 3 convolution kernel. And when the iterative etching based on the size of the last convolution kernel is terminated, taking the obtained current etching processing result as the optimal etching result.
Here, the iteration stop condition of any convolution kernel size is that the difference between the number of cells in the current corrosion processing result and the number of cells in the initial segmentation result is smaller than a preset difference threshold corresponding to the convolution kernel size, and the smaller the convolution kernel size is, the smaller the preset difference threshold corresponding to the convolution kernel size is. In addition, the preset difference threshold corresponding to the size of the last convolution kernel may be set to 0, which indicates that the iteration needs to be stopped when the statistical features of the cells in the current erosion processing result match the statistical features of the cells in the initial segmentation result. For example, when iterative etching is performed based on a 7 × 7 convolution kernel, the iteration stop condition may be that the difference between the number of cells in the current etching processing result and the number of cells in the initial segmentation result is less than 10% of the number of cells in the initial segmentation result; when iterative etching is performed based on the 5 × 5 convolution kernel, the iteration stop condition may be that a difference between the number of cells in the current etching processing result and the number of cells in the initial segmentation result is less than 5% of the number of cells in the initial segmentation result; when iterative etching is performed based on the 3 × 3 convolution kernel, the iteration stop condition may be that the number of cells in the current etching processing result is equal to the number of cells in the initial segmentation result.
Based on any of the above embodiments, fig. 4 is a schematic flow chart of the method for determining an initial convolution kernel according to the embodiments of the present invention, and as shown in fig. 4, the size of the initial convolution kernel is determined based on the following steps:
step 410, counting the area of each cell in the initial segmentation result based on the label information of the cell to which each pixel belongs in the initial segmentation result;
step 420, calculating the average area of each cell based on the area of each cell in the initial segmentation result;
step 430, determining the initial convolution kernel size based on the average area of the cells.
Specifically, based on the label information of the cell to which each pixel belongs in the initial segmentation result, the number of pixels included in each cell in the initial segmentation result can be determined, so that the area of each cell is obtained through statistics. From the area of each cell, the average area of each cell was calculated. Based on the average area of each cell, the initial convolution kernel size can be determined. Wherein the larger the average area of each cell, the larger the initial convolution kernel size is determined. Because the initial convolution kernel size is positively correlated with the average area of each cell, the initial convolution kernel size adaptive to the size of each cell can be selected, excessive corrosion caused by selecting an excessively large initial convolution kernel size is avoided, and meanwhile, the initial convolution kernel size as large as possible can be selected while the corrosion effect is ensured, so that the efficiency of self-adaptive iterative corrosion is improved.
Based on any of the above embodiments, step 140 specifically includes:
fine segmentation step: performing fine segmentation on the initial segmentation result by using a watershed algorithm based on the optimal corrosion result to obtain a current fine segmentation result;
a feedback regulation step: if the statistical characteristics of the cells in the initial segmentation result are not matched with the statistical characteristics of the cells in the current fine segmentation result, adjusting the size of the initial convolution kernel, performing adaptive iterative corrosion processing on the initial segmentation result again to obtain a new optimal corrosion result, and executing the fine segmentation step based on the new optimal corrosion result to obtain the current fine segmentation result;
and (3) circulating step: repeatedly executing the feedback adjustment step until the statistical characteristics of the cells in the initial segmentation result are matched with the statistical characteristics of the cells in the current fine segmentation result;
and a result determination step: and determining the current fine segmentation result as the final segmentation result.
Specifically, as shown in fig. 5, after the adaptive iterative erosion operation is performed to obtain the optimal erosion result, the fine segmentation step is performed, and the initial segmentation result is finely segmented based on the optimal erosion result by using the watershed algorithm to obtain the current fine segmentation result. Subsequently, the statistical characteristics of the cells in the current fine segmentation result are acquired. Here, the statistical characteristics of the cells in the initial segmentation result may be used as an adjustment criterion, and whether the adaptive iterative erosion processing and the fine segmentation operation need to be performed again is determined according to a difference between the statistical characteristics of the cells in the initial segmentation result and the statistical characteristics of the cells in the current fine segmentation result, so as to further improve the accuracy of cell edge segmentation.
Specifically, if the statistical characteristics of the cells in the initial segmentation result do not match the statistical characteristics of the cells in the current fine segmentation result, for example, the total number of the cells in the initial segmentation result is different from the total number of the cells in the current fine segmentation result, or the cell distribution in the initial segmentation result is different from the cell distribution in the current fine segmentation result, it indicates that the fine segmentation result is inaccurate, and the optimal erosion result needs to be morphologically adjusted to perform the feedback adjustment step. The initial convolution kernel size in the adaptive iterative corrosion processing process can be adjusted, then the adaptive iterative corrosion processing is carried out again on the initial segmentation result based on the adjusted initial convolution kernel size to obtain a new optimal corrosion result, and the fine segmentation step is carried out based on the new optimal corrosion result to obtain the current fine segmentation result.
And if the statistical characteristics of the cells in the current fine segmentation result are not matched with the statistical characteristics of the cells in the initial segmentation result, executing a circulation step, repeatedly executing the feedback regulation step, continuously adjusting the size of the initial convolution kernel, and re-executing the self-adaptive iterative corrosion processing and the fine segmentation step until the statistical characteristics of the cells in the initial segmentation result are matched with the statistical characteristics of the cells in the current fine segmentation result. Then, the current fine segmentation result is determined as the final segmentation result.
Based on any of the above embodiments, fig. 6 is a schematic flow diagram of the feedback adjustment step provided in the embodiment of the present invention, and as shown in fig. 6, the adjusting the initial convolution kernel size, performing adaptive iterative erosion processing on the initial segmentation result again to obtain a new optimal erosion result, and executing the fine segmentation step based on the new optimal erosion result specifically includes:
step 610, performing subgraph division on the cell image to be segmented to obtain a plurality of subgraph areas of the cell image to be segmented;
step 620, obtaining the number of cells corresponding to each subgraph region in the initial segmentation result and the fine segmentation result;
step 630, if the number of cells corresponding to any sub-graph region in the initial segmentation result and the fine segmentation result is not matched, adjusting the size of the initial convolution kernel, and performing adaptive iterative corrosion processing again on the part corresponding to any sub-graph region in the initial segmentation result to obtain a new optimal corrosion result;
and 640, re-finely dividing the part corresponding to any sub-graph region in the initial division result based on the new optimal corrosion result.
Specifically, the cell image to be segmented may be sub-divided to obtain a plurality of sub-image regions of the cell image to be segmented. And then, acquiring the cell number of each subgraph region in the initial segmentation result and the fine segmentation result. Here, the initial segmentation result and the fine segmentation result both correspond to the cell image to be segmented, and therefore, after the cell image to be segmented is divided into a plurality of sub-image regions, a portion corresponding to each sub-image region in the initial segmentation result and the fine segmentation result may also be obtained, and the number of cells included in the portion corresponding to each sub-image region in the initial segmentation result and the fine segmentation result may also be obtained.
If the number of the cells corresponding to any sub-map region i in the initial segmentation result and the fine segmentation result is not matched, it is indicated that the fine segmentation aiming at the sub-map region i is inaccurate, and adjustment is needed. Therefore, the initial convolution kernel size in the adaptive iterative etching process is adjusted, the adaptive iterative etching processing is performed again on the part corresponding to the sub-graph region i in the initial segmentation result to obtain a new optimal etching result, and the part corresponding to the sub-graph region i in the initial segmentation result is finely segmented again on the basis of the new optimal etching result. After the cell image to be segmented is divided into a plurality of smaller sub-image regions, whether the fine segmentation of each sub-image region is accurate is judged, so that the partial sub-image regions with inaccurate fine segmentation are subjected to adaptive iterative erosion and fine segmentation again, the calculated amount of the adaptive iterative erosion and the fine segmentation is reduced, and the cell edge segmentation efficiency is improved.
Based on any of the above embodiments, the adjusting the initial convolution kernel size specifically includes:
reducing the initial convolution kernel size based on a plurality of preset convolution kernel sizes.
Specifically, when the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current fine segmentation result are not matched, or the number of the cells corresponding to any sub-map region in the initial segmentation result and the fine segmentation result is not matched, it is indicated that the fine segmentation is not accurate. The reason why the fine segmentation is inaccurate may be that excessive erosion occurs during the adaptive iterative erosion processing, so that the cell state in the optimal erosion result is different from the actual state of the cell in the cell image to be segmented, and the fine segmentation result is inaccurate. Therefore, in order to improve the accuracy of cell edge segmentation, the initial convolution kernel size in the adaptive iterative erosion processing process can be reduced, and iterative erosion is started from a smaller convolution kernel size to avoid excessive erosion. Here, a plurality of preset convolution kernel sizes may be preset, and then a convolution kernel size smaller than the current initial convolution kernel size may be selected therefrom as the adjusted initial convolution kernel size.
Based on any of the above embodiments, fig. 7 is a second flowchart of the fine segmentation method provided by the embodiment of the present invention, and as shown in fig. 7, the performing fine segmentation on the initial segmentation result based on the optimal erosion result by using a watershed algorithm specifically includes:
step 710, performing connected domain analysis on the optimal corrosion result to obtain a plurality of connected domains in the optimal corrosion result;
and 720, performing fine segmentation on the initial segmentation result by using a watershed algorithm based on a plurality of connected domains in the optimal corrosion result.
Specifically, in order to improve the accuracy of cell edge segmentation, the watershed algorithm may consider the regularity of the segmentation shape according to the morphological features of the cells, thereby improving the final performance of the segmentation. Here, the connected domain analysis may be performed on the optimal corrosion result by a connected domain segmentation method to obtain a plurality of connected domains, and an identifier is given to each independent connected domain of the optimal corrosion result. Wherein, the single independent connected domain corresponds to one cell obtained by the self-adaptive corrosion treatment.
And then, based on the morphological characteristics of the cells indicated by the plurality of connected domains in the optimal corrosion result, performing fine segmentation on the initial segmentation result by using a watershed algorithm. The identification of each independent connected domain in the optimal corrosion result can be used as a function parameter to be transmitted to a watershed segmentation algorithm for fine segmentation, and a corresponding cell segmentation result is obtained.
In any of the above embodiments, the cell segmentation model is determined based on the following steps:
acquiring a training sample, and dividing the training sample into a training set and a test set; the training sample comprises a sample cell image, or comprises a sample cell image and mask labeling information of each cell in the sample cell image;
training a segmentation model based on the training set, performing staged performance test on the segmentation model by using the test set in the training process, and storing the segmentation model with the optimal performance test result as the cell segmentation model.
Specifically, a large number of training samples need to be acquired first. The training sample may include a sample cell image, or may include both the sample cell image and mask labeling information for each cell in the sample cell image. Whether the mask marking information of each cell in the cell image of the sample is needed in the training sample or not can be determined according to whether the cell segmentation model is trained in a full-supervision mode or a semi-supervision mode. Here, a large number of cell microscopic images may be acquired as sample cell images for training the cell segmentation model. The mask marking information can be formed by a marking person with professional qualification through marking software. For example, open source software such as Labelme can be used to mark out a mask map of each cell in the sample cell image, where the mask map should be as accurate as possible in terms of the delineation of the cell nucleus edge.
After the training samples are obtained, the training samples can be cleaned and preprocessed, and some unqualified imaging data or incomplete labeling data can be removed. And then, according to the mask marking information, determining the position and the edge of each cell in the sample cell image to generate a mask binary image of the cell nucleus area, reasonably dividing a data set, and dividing the training sample into a training set and a testing set.
And then, training and optimizing the selected segmentation model by utilizing the training set and the test set. The segmentation model can adopt a Mask-RCNN network to segment the cells in an example, specifically can adopt Resnet 50+ feature pyramid FPN as a feature extraction network, adopts an ROI Align module to realize the extraction of the region of interest of the small target, and finally synchronously realizes the segmentation of the foreground and the background in the region of interest and the classification of the foreground region through a multi-branch network. In the training process of the segmentation model, a sample cell image in a training set, a mask binary image of each cell in the sample cell image, and the like may be input as metadata into the segmentation model, and the epochs may be trained a plurality of times (for example, 100 times).
In the training process, a staged performance test (which may adopt mAP) can be performed on the test set according to a certain program, and finally, an optimal model is reasonably selected and stored according to the performance expression result, and the segmentation model with the optimal performance is used as a cell segmentation model, so that the segmentation performance of the cell segmentation model is improved. Then, packaging and deploying the cell segmentation model into an application server or a workstation, and establishing a data inference flow; the data inference flow generally includes the data preprocessing and organizing processes, the model calling and inference, the model inference result output and storage, and the like. Where the best performing segmentation model should perform more than some threshold on the test set, e.g., more than 0.9 on mAP, more than 0.95 on Dice, etc. At the same time, the segmentation model with the best performance should have better generalization capability, for example, the performance difference between the test set and the training set is not more than 10%.
Based on any one of the above embodiments, the obtaining of the training sample specifically includes:
obtaining a cell microscopic image;
if the number of channels of the cell microscopic image is larger than the preset number of channels corresponding to the input condition of the cell segmentation model, decomposing the cell microscopic image into a plurality of low-channel images;
performing image quality evaluation on the plurality of low-channel images to obtain quality evaluation scores of the plurality of low-channel images;
acquiring a plurality of low-channel images with highest quality evaluation scores based on the quality evaluation scores of the low-channel images;
combining the plurality of low-channel images with the highest quality assessment scores into the sample cell image; and the number of channels formed by combining the plurality of low-channel images with the highest quality evaluation scores is equal to the preset number of channels.
Specifically, according to the network structure of the selected cell segmentation model, the number of channels of the input image required in the input condition is different, for example, most of the example segmentation networks currently require three-channel image input. However, the number of cell images is generally more than three, so that the cell images in multiple channels need to be decomposed into images in lower channels meeting the requirement of the input condition of the cell segmentation model, and the input data of the cell segmentation model is obtained.
Therefore, a cell microscopic image can be obtained, and then it is determined whether the number of channels of the cell microscopic image is greater than a preset number of channels (e.g., three channels) corresponding to the input condition of the cell segmentation model. And if the number of channels of the cell microscopic image is greater than the preset number of channels, decomposing the cell microscopic image into a plurality of low-channel images layer by layer. Wherein the low channel image may be a single channel image. Subsequently, the image quality evaluation is performed on the plurality of low-channel images to obtain quality evaluation scores of the plurality of low-channel images. Here, the image quality of the plurality of low-channel images may be evaluated by using an auto-focus evaluation algorithm, for example, by using a non-reference image sharpness evaluation function, such as an energy gradient function, a tengengdad gradient function, a Lapacian gradient function, and some statistical functions, such as an information entropy function and a Range function.
And obtaining a plurality of low-channel images with the highest quality evaluation scores according to the quality evaluation scores of the low-channel images, and combining the low-channel images with the highest quality evaluation scores to obtain a sample cell image with the channel number meeting the input condition of the cell segmentation model. The number of channels after the combination of the plurality of low-channel images with the highest quality evaluation scores is equal to the preset number of channels.
Based on any of the above embodiments, fig. 8 is a detailed schematic diagram of the cell edge segmentation method provided in the embodiment of the present invention, which may be used for accurate segmentation of a Circulating Tumor Cell (CTC), and may be applied to detection of CACs in the CTC cell, but a specific detection target may be determined according to an actual application scenario, and this is not limited in the embodiment of the present invention. As shown in fig. 8, the method includes:
step 810, obtaining an original training sample, wherein the original training sample comprises a cell microscopic image and mask labeling information of each cell in the cell microscopic image.
The DAPI visual field image can be selected as the cell microscopic image, and accurate detection and edge segmentation of the cell are achieved based on the cell microscopic image. The mask marking information is formed by a marking person with professional qualifications through marking software, for example, open source software such as Labelme can be adopted, the mask marking information at least comprises a mask image of each cell in the cell microscopic image, and the mask image is drawn as accurately as possible on the edge of the cell nucleus. And determining the area of the cell nucleus in the cell microscopic image according to the mask marking information, and extracting the area of the cell nucleus from the image to generate a mask binary image of the cell nucleus. After the original training sample is obtained, the original training sample can be cleaned and preprocessed, and some unqualified imaging data or incomplete labeling data are removed.
And step 820, determining the position and the edge of each cell in the cell microscopic image according to the mask marking information to generate a mask binary image of the cell nucleus area, and reasonably dividing the data set.
The purpose of this step is to organize the input data of the cell segmentation model. In order to improve the performance of the cell segmentation model, the image of the cell segmentation model is input into a quality-controlled image, and the image which is sent into the model for training and is actually segmented is image data with the optimal quality in one scanning. Here, the cell segmentation model generally requires three-channel image input, and the cell microscopic image generally has more than three channels, so that the best quality multi-channel image needs to be selected by means of automatic image quality evaluation to constitute the data input of the model. The automatic image evaluation mode may include a non-reference image sharpness evaluation function, such as an energy gradient function, a tengendard gradient function, a Lapacian gradient function, and some statistical functions, such as an information entropy and a Range function. On the other hand, the mask labeling information needs to be converted into cell coordinates or a mask binary image, and the data needs to be arranged into a metadata format suitable for further network training. In addition, in the process of collecting the sample, attention needs to be paid to the separation of the training set and the test set, and the test set and the actual sample distribution are consistent with the form as much as possible.
And 830, training and optimizing the cell segmentation model by using the sample cell image and the mask marking information thereof.
And training the cell segmentation model by using the sample cell image in the training set and the mask marking information thereof until a preset termination condition is reached so as to finish the training of the cell segmentation model. The cell segmentation network is an end-to-end instance segmentation network, can be a single-stage instance segmentation network or a multi-stage instance segmentation network, and is characterized in that each independent cell nucleus can be effectively segmented and given a respective identifier.
In addition, in the model training process, reasonable evaluation indexes can be established, the models are subjected to staged performance evaluation on the test set, and the models with the optimal performance are selected as the cell segmentation models which are put into use. Wherein, the model with the best performance refers to the model with the performance larger than some threshold value on the test set, such as the performance larger than 0.9 on mAP, the performance larger than 0.95 on Dice, etc. At the same time, the model should also have good generalization capability, for example, the performance difference between the test set and the training set should be no more than 10%.
And step 840, packaging and deploying the optimal model, and performing instance segmentation on the new cell image to be segmented.
Specifically, the optimal model is packaged and deployed in an application server or a workstation, and a data inference flow is established; the data inference flow generally includes the data preprocessing and organizing processes, the model calling and inference, the model inference result output and storage, and the like. And performing example segmentation on the cell image to be segmented through the trained cell segmentation model, so as to obtain an initial segmentation result of each cell in the visual field of the cell image to be segmented.
And 850, performing morphological post-processing on the initial segmentation result output by the cell segmentation model, and acquiring the corrosion result and the identification of each cell nucleus in the cell image to be segmented.
Firstly, the average area of the cells in the cell image to be segmented is counted according to the initial segmentation result, and the size of the initial convolution kernel of the adaptive iterative corrosion is set according to the average area of the cells. A plurality of decreasing convolution kernel sizes including the initial convolution kernel size are set, and iterative erosion is performed based on the plurality of convolution kernel sizes.
Taking two decreasing convolution kernel sizes of 5 × 5 and 3 × 3 as an example, a while loop is first set, and a first convolution kernel size (i.e., the initial convolution kernel size of 5 × 5) is used to perform iterative etching processing on a binary map of the initial segmentation result or a previous etching result (the etching object in the first round of etching is the binary map of the initial segmentation result, and the etching object in the second round and subsequent rounds of etching is the etching result obtained in the previous round of etching, i.e., the previous etching result). And stopping iteration and terminating the while loop when the difference between the number of connected domains in the current corrosion result counted after corrosion and the number of cells in the initial segmentation result is less than a threshold value (for example, 5% of the number of cells in the initial segmentation result) corresponding to the size of 5 x 5 convolution kernels.
And then setting another while loop, selecting the next convolution kernel size 3 x 3, performing iterative etching treatment on the previous etching result by using the convolution kernel size until the number of connected domains in the current etching result counted after etching is equal to the number of cells in the initial segmentation result, stopping iteration, and terminating the while loop to obtain the optimal etching result.
And after the self-adaptive iterative corrosion treatment is completed, performing connected domain analysis on the optimal corrosion result to obtain a plurality of connected domains, and endowing each independent connected domain with a unique identifier, thereby completing the identification of each cell in the optimal corrosion result.
And 860, based on the identification of each cell in the optimal corrosion result, performing further fine segmentation on each cell through a watershed algorithm to obtain a final segmentation result of the cell image to be segmented.
Here, the watershed algorithm may consider the regularity of the segmentation shape according to the morphological characteristics of the cells to improve the final performance of the segmentation, and thus transmit the identification of each cell in the optimal erosion result as a function parameter to the watershed segmentation algorithm to obtain a fine segmentation result. And after the fine segmentation, counting the number of cells of the fine segmentation result, if the counted number of cells is different from the number of cells in the initial segmentation result, performing morphological adjustment on the optimal corrosion result, and performing the watershed algorithm again until the number of cells in the fine segmentation result is consistent with the number of cells in the initial segmentation result. When the optimal corrosion result is morphologically adjusted, the size of an initial convolution kernel in the self-adaptive iterative corrosion process can be reduced, and then the self-adaptive iterative corrosion is repeatedly performed to obtain a new optimal corrosion result.
By the method, smooth edges which are more accurate and conform to the original form of the cells can be segmented, and the accuracy of cell edge segmentation is improved, so that the method is more suitable for edge-sensitive segmentation tasks such as CACs cell segmentation and the like.
The cell edge dividing device provided by the present invention is described below, and the cell edge dividing device described below and the cell edge dividing method described above may be referred to in correspondence with each other.
Based on any of the above embodiments, fig. 9 is a schematic structural diagram of a cell edge segmentation apparatus according to an embodiment of the present invention, as shown in fig. 9, the apparatus includes: an image determination unit 910, an example segmentation unit 920, an adaptive erosion unit 930, and a fine segmentation unit 940.
The image determining unit 910 is configured to determine an image of a cell to be segmented;
the example segmentation unit 920 is configured to perform example segmentation on the cell image to be segmented by using a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented;
the adaptive corrosion unit 930 is configured to perform adaptive iterative corrosion processing on the initial segmentation result based on statistical characteristics of cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented; wherein the convolution parameters in the adaptive iterative erosion processing process decrease as the difference between the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current erosion result decreases, and the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result;
the fine segmentation unit 940 is configured to perform fine segmentation on the initial segmentation result based on the optimal corrosion result by using a watershed algorithm, so as to obtain a final segmentation result of the cell image to be segmented.
According to the device provided by the embodiment of the invention, after the cell image to be segmented is subjected to instance segmentation by using the cell segmentation model to obtain the initial segmentation result, the initial segmentation result is subjected to adaptive iterative corrosion treatment to obtain the optimal corrosion result, wherein the convolution parameters in the adaptive iterative corrosion treatment process are reduced along with the reduction of the difference between the statistical characteristics of the cells in the initial segmentation result and the statistical characteristics of the cells in the current corrosion result, the adhered and overlapped cells are separated to a greater extent, the form of the original cells is kept as much as possible, and then fine segmentation is carried out by using a watershed algorithm under the guidance of the optimal corrosion result, so that a smooth edge which is more accurate and more in line with the original form of the cells can be segmented, and the accuracy of cell edge segmentation is improved.
Based on the above embodiment, the convolution parameter includes a convolution kernel size;
the adaptive corrosion unit 930 is specifically configured to:
determining a plurality of decreasing-sized convolution kernel sizes beginning with an initial convolution kernel size;
carrying out iterative corrosion on the last corrosion processing result based on the sizes of the convolution kernels in sequence to obtain a current corrosion processing result; wherein each iterative erosion terminates when an iteration stop condition corresponding to the convolution kernel size is reached;
taking the current corrosion treatment result as the optimal corrosion result;
wherein, during the first etching, the initial segmentation result is etched based on the initial convolution kernel size; the iteration stop condition of any convolution kernel size is that the difference between the number of cells in the current corrosion processing result and the number of cells in the initial segmentation result is smaller than a preset difference threshold corresponding to any convolution kernel size, and the smaller the size of any convolution kernel is, the smaller the preset difference threshold corresponding to any convolution kernel size is.
In any of the above embodiments, the initial convolution kernel size is determined based on the following steps:
counting the area of each cell in the initial segmentation result based on the label information of the cell to which each pixel belongs in the initial segmentation result;
calculating an average area of each cell based on the area of each cell in the initial segmentation result;
determining the initial convolution kernel size based on the average area of the respective cells.
Based on any of the above embodiments, the fine segmentation unit 940 is specifically configured to perform:
fine segmentation step: performing fine segmentation on the initial segmentation result by using a watershed algorithm based on the optimal corrosion result to obtain a current fine segmentation result;
a feedback regulation step: if the statistical characteristics of the cells in the initial segmentation result are not matched with the statistical characteristics of the cells in the current fine segmentation result, adjusting the size of the initial convolution kernel, performing adaptive iterative corrosion processing on the initial segmentation result again to obtain a new optimal corrosion result, and executing the fine segmentation step based on the new optimal corrosion result to obtain the current fine segmentation result;
and (3) circulating step: repeatedly executing the feedback adjustment step until the statistical characteristics of the cells in the initial segmentation result are matched with the statistical characteristics of the cells in the current fine segmentation result;
and a result determination step: and determining the current fine segmentation result as the final segmentation result.
Based on any of the above embodiments, the adjusting the size of the initial convolution kernel, performing adaptive iterative erosion processing again on the initial segmentation result to obtain a new optimal erosion result, and executing the fine segmentation step based on the new optimal erosion result specifically includes:
performing sub-graph division on the cell image to be segmented to obtain a plurality of sub-graph regions of the cell image to be segmented;
obtaining the cell number of each sub-graph region corresponding to the initial segmentation result and the fine segmentation result;
if the cell number of any sub-graph region in the initial segmentation result is not matched with that of any sub-graph region in the fine segmentation result, adjusting the size of the initial convolution kernel, and performing self-adaptive iterative corrosion processing on the part corresponding to any sub-graph region in the initial segmentation result again to obtain a new optimal corrosion result;
and based on the new optimal corrosion result, performing fine segmentation on the part corresponding to any sub-graph region in the initial segmentation result again.
Based on any of the above embodiments, the adjusting the initial convolution kernel size specifically includes:
reducing the initial convolution kernel size based on a plurality of preset convolution kernel sizes.
Based on any of the above embodiments, the performing, by using the watershed algorithm, the fine segmentation on the initial segmentation result based on the optimal erosion result specifically includes:
performing connected domain analysis on the optimal corrosion result to obtain a plurality of connected domains in the optimal corrosion result;
and performing fine segmentation on the initial segmentation result by using a watershed algorithm based on a plurality of connected domains in the optimal corrosion result.
In any of the above embodiments, the cell segmentation model is determined based on the following steps:
acquiring a training sample, and dividing the training sample into a training set and a test set; the training sample comprises a sample cell image, or comprises a sample cell image and mask labeling information of each cell in the sample cell image;
training a segmentation model based on the training set, performing staged performance test on the segmentation model by using the test set in the training process, and storing the segmentation model with the optimal performance test result as the cell segmentation model.
Based on any one of the above embodiments, the obtaining of the training sample specifically includes:
obtaining a cell microscopic image;
if the number of channels of the cell microscopic image is larger than the preset number of channels corresponding to the input condition of the cell segmentation model, decomposing the cell microscopic image into a plurality of low-channel images;
performing image quality evaluation on the plurality of low-channel images to obtain quality evaluation scores of the plurality of low-channel images;
acquiring a plurality of low-channel images with highest quality evaluation scores based on the quality evaluation scores of the low-channel images;
combining the plurality of low-channel images with the highest quality assessment scores into the sample cell image; and the number of channels formed by combining the plurality of low-channel images with the highest quality evaluation scores is equal to the preset number of channels.
Fig. 10 illustrates a physical structure diagram of an electronic device, and as shown in fig. 10, the electronic device may include: a processor (processor)1010, a communication Interface (Communications Interface)1020, a memory (memory)1030, and a communication bus 1040, wherein the processor 1010, the communication Interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. Processor 1010 may invoke logic instructions in memory 1030 to perform a cell edge segmentation method comprising: determining a cell image to be segmented; carrying out example segmentation on the cell image to be segmented by using a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented; performing adaptive iterative corrosion processing on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented; wherein the convolution parameters in the adaptive iterative erosion processing process decrease as the difference between the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current erosion result decreases, and the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result; and finely dividing the initial segmentation result based on the optimal corrosion result by using a watershed algorithm to obtain a final segmentation result of the cell image to be segmented.
Furthermore, the logic instructions in the memory 1030 can be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is capable of executing the cell edge segmentation method provided by the above methods, the method comprising: determining a cell image to be segmented; carrying out example segmentation on the cell image to be segmented by using a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented; performing adaptive iterative corrosion processing on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented; wherein the convolution parameters in the adaptive iterative erosion processing process decrease as the difference between the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current erosion result decreases, and the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result; and finely dividing the initial segmentation result based on the optimal corrosion result by using a watershed algorithm to obtain a final segmentation result of the cell image to be segmented.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements a method for cell edge segmentation provided by the above methods, the method comprising: determining a cell image to be segmented; carrying out example segmentation on the cell image to be segmented by using a cell segmentation model to obtain an initial segmentation result of the cell image to be segmented; performing adaptive iterative corrosion processing on the initial segmentation result based on the statistical characteristics of the cells in the initial segmentation result to obtain an optimal corrosion result corresponding to the cell image to be segmented; wherein the convolution parameters in the adaptive iterative erosion processing process decrease as the difference between the statistical features of the cells in the initial segmentation result and the statistical features of the cells in the current erosion result decreases, and the statistical features of the cells in the optimal erosion result match the statistical features of the cells in the initial segmentation result; and finely dividing the initial segmentation result based on the optimal corrosion result by using a watershed algorithm to obtain a final segmentation result of the cell image to be segmented.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.