A detection and measurement method based on dense targets
Through superpixel segmentation and Gaussian blur kernel generation, the problem of failing to accurately consider the influence of cell edge points in the traditional density regression estimation method is solved, and the accuracy of cell number counting and the training effect of the density regression network model are improved.
Patent Information
- Application Number
- CN202410931028.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-12
AI Technical Summary
The traditional density regression estimation method fails to accurately consider the influence of cell edge points when obtaining density images, resulting in inaccurate cell number counting in cell microscopic images and affecting the training effect of the density regression estimation network model.
Through superpixel segmentation and calculation of influence coefficients and direction, a Gaussian blur kernel is generated to obtain a more accurate density image, thus improving the accuracy of cell number counting.
Through the analysis of influence coefficients and trend directions, a more accurate density image is generated, the accuracy of cell number counting is improved, and the training effect of the density regression estimation network model is enhanced.
Smart Images

Figure CN118470020B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a detection and measurement method based on dense targets. Background Art
[0002] Target quantity detection is one of the important applications in the field of computer vision and is widely used in many fields. Density regression estimation is a statistical method used to estimate the probability density function of continuous variables. It combines the idea of regression analysis with probability density function estimation, aiming to establish the relationship between input variables and target variables through regression models. It can effectively estimate the spatial distribution density of cells and then measure the number of cells in dense microscopic images.
[0003] In the process of obtaining density images, traditional density regression estimation only marks each cell at a single point, without considering the influence of the edge points of the cell area. In addition, the orientation of each cell in the cell microscopic image is different. If it is not distinguished, the analysis of the actual cell density will be inaccurate. The subsequent Gaussian blur will cause the acquired density image to be inaccurate, which will lead to inaccurate training of the density regression estimation network model and fail to measure the number of cells in the cell microscopic image to be detected. Summary of the invention
[0004] In order to solve the above problems, the present invention provides a detection and measurement method based on dense targets.
[0005] A detection and measurement method based on dense targets of the present invention adopts the following technical solution:
[0006] An embodiment of the present invention provides a detection and measurement method based on dense targets, the method comprising the following steps:
[0007] Any cell microscopic grayscale image in the training sample set is recorded as a first cell microscopic grayscale image, and superpixel segmentation is performed on the first cell microscopic grayscale image to obtain a plurality of superpixel blocks of the first cell microscopic grayscale image; a binary labeled image of the first cell microscopic grayscale image is obtained;
[0008] According to the distance between the edge pixel point and the center pixel point of the super pixel block and the position of the pixel point, the influence coefficient of the center pixel point of each super pixel block on the edge pixel point is obtained;
[0009] According to the influence coefficient, the position of the edge pixel in the edge of the super pixel block and the gradient direction fluctuation of the edge pixel, the direction of the central pixel of each super pixel block is obtained;
[0010] According to the grayscale value and direction of the pixels in the preset neighborhood of the central pixel, the Gaussian blur kernel of the central pixel of each super pixel block is obtained;
[0011] Gaussian blurring is performed on corresponding pixel points in the binary labeled image of the first cell microscopic grayscale image according to a Gaussian blur kernel to obtain a density image of the first cell microscopic grayscale image;
[0012] The density image of each cell microscopic grayscale image in the training sample set is obtained, and a trained neural network model is obtained based on the training sample set and all density images; the number of cells in the microscopic grayscale image of the cell to be detected is obtained based on the trained neural network model.
[0013] Furthermore, the method of obtaining the influence coefficient of the central pixel of each super pixel block on the edge pixel according to the distance between the edge pixel and the central pixel of the super pixel block and the position of the pixel includes the following specific steps:
[0014] Obtaining a position vector of the pixel point through the coordinate position of the pixel point in the first cell microscopic grayscale image;
[0015] Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as center pixel;
[0016]
[0017] In the formula, For the The position vector of the center pixel, For the The edge of the superpixel The position vector of the edge pixel, To take the second norm, is the preset first value, For the The edge of the superpixel The position vector of the edge pixel, For the The edge of the superpixel The position vector of the edge pixel, is the cross product, For the The edge of the superpixel The mean value of the neighborhood modulus length of edge pixels;
[0018] According to the distance between the edge pixel and the central pixel of the super pixel block and the mean value of the neighborhood modulus length, the influence coefficient of the central pixel of each super pixel block on the edge pixel is obtained.
[0019] Furthermore, the method of obtaining the influence coefficient of the central pixel of each super pixel block on the edge pixel point according to the distance between the edge pixel point and the central pixel point of the super pixel block and the mean value of the neighborhood modulus length includes the following specific steps:
[0020] The first The center pixel and the The edge of the superpixel The Euclidean distance between edge pixels is denoted as The center pixel and The first Euclidean distance of the edge pixel; The edge of the superpixel The ratio of the mean value of the neighborhood modulus length of the edge pixel point to the first Euclidean distance is used as the first The center pixel is The edge of the superpixel The influence coefficient of the edge pixels.
[0021] Furthermore, the step of obtaining the direction of the central pixel of each super pixel block according to the influence coefficient, the position of the edge pixel in the edge of the super pixel block and the gradient direction fluctuation of the edge pixel includes the following specific steps:
[0022] Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as center pixel;
[0023] The first The edge of the superpixel The position vector of the edge pixel is subtracted from the The position vector of the edge pixel point is recorded as edge pixels and the The third vector of edge pixels, , is the preset third value, and the edge pixels and the The angle between the third vector of the edge pixel point and the horizontal line is in the range of , get All angle values within The average value of all the angles in The edge of the superpixel The average of the neighborhood angles of edge pixels;
[0024] According to the influence coefficient, the mean value of the neighborhood angle and the gradient direction fluctuation of the edge pixels, the direction of the central pixel of each superpixel block is obtained.
[0025] Furthermore, the direction of the central pixel of each superpixel block is obtained according to the influence coefficient, the neighborhood angle mean and the gradient direction fluctuation of the edge pixel, and the specific steps include the following:
[0026] Obtaining a gradient vector of a pixel point through a gradient value and a gradient direction of a pixel point in the first cell microscopic grayscale image;
[0027]
[0028] In the formula, For the The number of edge pixels on the edge of a superpixel block, For the The center pixel is The edge of the superpixel The influence coefficient of edge pixels is The specific method of obtaining is as follows: The edge of the superpixel The gradient vector of the edge pixel is The edge of the superpixel block Starting from the edge pixel point, get the edge pixels, is a preset second value, obtaining the The gradient vector of each edge pixel in the edge pixels is The standard deviation of the angle value corresponding to the gradient vector of edge pixels is recorded as , the value range of the angle value corresponding to the gradient vector is , horizontal right is 0° direction; is the first preset hyperparameter, is the linear normalization function, For the The edge of the superpixel The average of the neighborhood angles of edge pixels, For the The direction of the central pixel.
[0029] Furthermore, the Gaussian blur kernel of the central pixel of each superpixel block is obtained according to the grayscale value and the direction of the pixel points in the preset neighborhood of the central pixel point, and the specific steps include the following:
[0030] Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as center pixel;
[0031]
[0032] In the formula, is the preset second hyperparameter, For the The number of pixels within the preset neighborhood of the central pixel, For the The preset neighborhood of the central pixel The gray value of a pixel, is the linear normalization function, For the The initial standard deviation of the central pixels;
[0033] According to the initial standard deviation and the direction of the central pixel, the Gaussian blur kernel of the central pixel of each super pixel block is obtained.
[0034] Furthermore, the Gaussian blur kernel of the central pixel of each super pixel block is obtained according to the initial standard deviation and the direction of the central pixel, and the specific steps include the following:
[0035]
[0036] In the formula, For the The initial standard deviation of the central pixel, For the The direction of the central pixel point, is the cosine function, is a sine function, For the The standard deviation of the Gaussian blur kernel in the horizontal direction of the central pixel is For the The standard deviation of the Gaussian blur kernel of the central pixel in the vertical direction;
[0037] According to The standard deviation of the Gaussian blur kernel in the horizontal direction, the standard deviation of the Gaussian blur kernel in the vertical direction, and the preset Gaussian blur kernel size are used to obtain the The Gaussian blur kernel of the center pixel.
[0038] Furthermore, the specific method of obtaining the binary labeled image of the first cell microscopic grayscale image is as follows:
[0039] The central pixel point of each superpixel block of the first cell microscopic grayscale image is obtained, the grayscale values of the central pixel points of all superpixel blocks in the first cell microscopic grayscale image are set to 1, and the grayscale values of the remaining pixels in the first cell microscopic grayscale image except the central pixel point are set to 0, so as to obtain a binary labeled image of the first cell microscopic grayscale image.
[0040] Furthermore, the neural network model is a DenseNet network.
[0041] Furthermore, the step of obtaining the position vector of the pixel point by the coordinate position of the pixel point in the first cell microscopic grayscale image includes the following specific steps:
[0042] Get the first cell microscopic grayscale image The coordinate position of the pixel point defines the coordinate origin of the first cell microscopic grayscale image. The Euclidean distance between the coordinate position of the pixel point and the coordinate origin is taken as the The modulus of the position vector of the pixel point points the origin of the coordinate system to the The direction of the pixel coordinate position is taken as the The direction of the position vector of the pixel point is obtained The position vector of the pixel.
[0043] The beneficial effect of the technical solution of the present invention is as follows: after obtaining several superpixel blocks of the first cell microscopic grayscale image in the training sample set, the present invention obtains the influence coefficient of the central pixel of each superpixel block on the edge pixel through the distance between the edge pixel and the central pixel of the superpixel block and the position of the pixel, the influence coefficient represents the probability that the edge pixel of the superpixel block is the cell edge pixel, so that the subsequent determination of the density image is more accurate, the direction of the central pixel of each superpixel block is obtained through the influence coefficient, the position of the edge pixel in the edge of the superpixel block and the gradient direction fluctuation of the edge pixel, the direction of the central pixel of each superpixel block is obtained, the direction of the direction reflects the direction of the cell corresponding to the superpixel block, and then the Gaussian blur kernel of the central pixel of each superpixel block is determined, and finally the density image of the cell microscopic grayscale image is obtained through the Gaussian blur kernel, the density image is made more accurate by analyzing the influence coefficient and the direction of the cell, which is convenient for subsequent better counting, the density regression estimation network model is trained through the input set and the output set to obtain the trained neural network model, and then the number of cells in the microscopic grayscale image of the cell to be detected is obtained, and the accuracy of counting the number of cells in the microscopic grayscale image of the cell to be detected is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 A flowchart of a method for detecting and measuring dense targets provided by an embodiment of the present invention;
[0046] Figure 2 A flow chart for obtaining the number of cells in a microscopic grayscale image of cells to be detected provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a detection and measurement method based on dense targets proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0048] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0049] The following is a detailed description of a specific scheme of a detection and measurement method based on dense targets provided by the present invention in conjunction with the accompanying drawings.
[0050] See also Figure 1 and Figure 2 , which shows a flowchart of a method for detecting and measuring dense targets provided by an embodiment of the present invention and a flowchart of obtaining the number of cells in a microscopic grayscale image of cells to be detected, the method comprising the following steps:
[0051] Step S001: record any cell microscopic grayscale image in the training sample set as the first cell microscopic grayscale image, perform superpixel segmentation on the first cell microscopic grayscale image, and obtain a plurality of superpixel blocks of the first cell microscopic grayscale image; obtain a binary labeled image of the first cell microscopic grayscale image.
[0052] Specifically, any cell microscopic grayscale image in the training sample set is recorded as the first cell microscopic grayscale image, and the first cell microscopic grayscale image is subjected to superpixel segmentation to obtain a plurality of superpixel blocks of the first cell microscopic grayscale image, as follows:
[0053] A cell microscopic image of a fluorescently stained cell group is obtained by using a microscope, and the cell microscopic image is gray-scaled to obtain a cell microscopic grayscale image. A set of several cell microscopic grayscale images is recorded as a training sample set; any cell microscopic grayscale image in the training sample set is recorded as a first cell microscopic grayscale image; superpixel segmentation is performed on the first cell microscopic grayscale image to obtain several superpixel blocks of the first cell microscopic grayscale image.
[0054] Specifically, the binary labeled image of the first cell microscopic grayscale image is obtained as follows:
[0055] The central pixel point of each superpixel block of the first cell microscopic grayscale image is obtained, the grayscale values of the central pixel points of all superpixel blocks in the first cell microscopic grayscale image are set to 1, and the grayscale values of the remaining pixels in the first cell microscopic grayscale image except the central pixel point are set to 0, so as to obtain a binary labeled image of the first cell microscopic grayscale image.
[0056] It should be noted that performing superpixel segmentation on the first cell microscopic grayscale image to obtain several superpixel blocks of the first cell microscopic grayscale image is an existing method, which will not be repeated in this embodiment. This embodiment subsequently corrects the density image corresponding to each cell microscopic grayscale image in the training sample set through the position of the central pixel point of each superpixel block in the image to improve the accuracy of the subsequent neural network model training results.
[0057] At this point, several superpixel blocks of the first cell microscopic grayscale image and a binary labeled image of the first cell microscopic grayscale image are obtained.
[0058] Step S002: Obtain the influence coefficient of the central pixel of each super pixel block on the edge pixel according to the distance between the edge pixel and the central pixel of the super pixel block and the position of the pixel.
[0059] It should be noted that after obtaining several superpixel blocks of the cell microscopic grayscale image, each superpixel block divides the central pixel points of different cell areas into different areas. Taking into account the differences in density of different superpixel blocks, there is a single cell area inside a single superpixel block, and there are still many non-cell area pixels inside it. Therefore, the relationship between the center point of the superpixel block and the edge point of the superpixel block where it is located is considered, and its influence coefficient on the edge point is calculated.
[0060] Specifically, according to the distance between the edge pixel point and the center pixel point of the super pixel block and the position of the pixel point, the influence coefficient of the center pixel point of each super pixel block on the edge pixel point is obtained, which includes the following steps:
[0061] First, according to the position of the pixel points, the mean value of the neighborhood modulus length of each edge pixel point in the edge of each super pixel block is obtained.
[0062] Secondly, according to the distance between the edge pixel and the central pixel of the super pixel block and the mean value of the neighborhood modulus, the influence coefficient of the central pixel of each super pixel block on the edge pixel is obtained.
[0063] Specifically, according to the position of the pixel point, the mean value of the neighborhood modulus length of each edge pixel point in the edge of each super pixel block is obtained, as follows:
[0064] Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as It should be noted that obtaining the central pixel point of a super pixel block is an existing method and will not be described in detail in this embodiment.
[0065]
[0066] In the formula, For the The position vector of the center pixel, For the The edge of the superpixel The position vector of the edge pixel, To take the second norm, is a preset first value. This embodiment is described with the first value being 10. For the The edge of the superpixel The position vector of the edge pixel, For the The edge of the superpixel The position vector of the edge pixel, is the cross product, For the The edge of the superpixel The mean value of the neighborhood modulus length of edge pixels.
[0067] It should be noted that in this embodiment, the position vector is a vector determined according to the horizontal and vertical coordinates of the pixel point. For example, the coordinates of a pixel point are , define the upper left corner of the image as the coordinate origin, then the modulus of the position vector is the distance from the coordinate origin to The distance between the points, the direction of the position vector is from the origin of the coordinate system In this embodiment, the order of edge pixels is arranged in a counterclockwise direction.
[0068] Furthermore, according to the distance between the edge pixel and the central pixel of the super pixel block and the mean value of the neighborhood modulus, the influence coefficient of the central pixel of each super pixel block on the edge pixel is obtained. As an embodiment, the specific calculation method is as follows:
[0069] The first The center pixel and the The edge of the superpixel The Euclidean distance between edge pixels is denoted as The center pixel and The first Euclidean distance of the edge pixel; The edge of the superpixel The ratio of the mean value of the neighborhood modulus length of the edge pixel point to the first Euclidean distance is used as the first The center pixel is The edge of the superpixel The influence coefficient of the edge pixels.
[0070] It should be noted that, considering the edge direction of multiple edge pixels that are close to the center pixel, since the cell edge direction should be perpendicular to the line connecting the edge point and its center point, the coordinate vector difference between multiple edge points on the edge of the superpixel block is used to approximate the cell edge tangent direction of the edge point, which is compared with the line vector, and then corrected using the distance between the edge point and the center point of the superpixel block to obtain the final influence coefficient, which represents the probability that the edge pixel of the superpixel block is a cell edge pixel.
[0071] It should be noted that the position vector represents the position of the pixel point.
[0072] At this point, the influence coefficient of the central pixel point of each super pixel block on the edge pixel point is obtained.
[0073] Step S003: Obtain the direction of the central pixel of each super pixel block according to the influence coefficient, the position of the edge pixel in the edge of the super pixel block, and the gradient direction fluctuation of the edge pixel.
[0074] It should be noted that after obtaining the influence coefficient of the central pixel point of each superpixel block on the edge pixel point, the edge direction of each point with a larger influence coefficient is considered; the direction of the cell is approximately the major axis direction of the ellipse close to the cell, and the edge direction of each edge point is related to its position in the ellipse, so the direction of the edge direction of each edge point is considered, and then the direction of each center point is obtained, that is, the corresponding cell direction.
[0075] Specifically, according to the influence coefficient, the position of the edge pixel in the edge of the super pixel block and the gradient direction fluctuation of the edge pixel, the direction of the central pixel of each super pixel block is obtained, including the steps of:
[0076] First, according to the positions of edge pixels in the edge of the superpixel block, the mean of the neighborhood angles of each edge pixel in the edge of each superpixel block is obtained.
[0077] Secondly, according to the influence coefficient, the mean value of the neighborhood angle and the gradient direction fluctuation of the edge pixels, the direction of the central pixel of each superpixel block is obtained.
[0078] Specifically, according to the positions of edge pixels in the edge of the superpixel block, the average value of the neighborhood angle of each edge pixel in the edge of each superpixel block is obtained, as follows:
[0079] The first The edge of the superpixel The position vector of the edge pixel is subtracted from the The position vector of the edge pixel point is recorded as edge pixels and the The third vector of edge pixels, , is the preset third value. In this embodiment, the third value is 10. edge pixels and the The angle between the third vector of the edge pixel point and the horizontal line is in the range of , get All angle values within The average value of all the angles in The edge of the superpixel The average of the neighborhood angles of edge pixels.
[0080] Furthermore, according to the influence coefficient, the neighborhood angle mean and the gradient direction fluctuation of the edge pixel points, the direction of the central pixel point of each super pixel block is obtained. As an embodiment, the specific calculation method is as follows:
[0081]
[0082] In the formula, For the The number of edge pixels on the edge of a superpixel block, For the The center pixel is The edge of the superpixel The influence coefficient of edge pixels is The specific method of obtaining is as follows: The edge of the superpixel The gradient vector of the edge pixel point. It should be noted that the gradient vector is determined by the gradient value and gradient direction of the pixel point. In this embodiment, the gradient direction and gradient value of the pixel point in the image are obtained by the Sobel operator, and then the gradient vector is determined. The gradient value corresponds to the modulus of the gradient vector, and the gradient direction corresponds to the direction of the gradient vector. The edge of the superpixel block Starting from the edge pixel point, get the edge pixels, is a preset second value. In this embodiment, the second value is 10. The gradient vector of each edge pixel in the edge pixels is The standard deviation of the angle value corresponding to the gradient vector of edge pixels is recorded as , the value range of the angle value corresponding to the gradient vector is , horizontal right is 0° direction; is the first preset hyperparameter, the purpose of which is to prevent the denominator from being 0. This embodiment is described with the first hyperparameter being 1. is the linear normalization function, For the The edge of the superpixel The average of the neighborhood angles of edge pixels, For the The direction of the central pixel.
[0083] It should be noted that Indicates The average edge direction of edge points within an edge range with 10 edge pixels close to each other; Indicates The confidence level of each edge pixel point is determined by the edge pixel block. That is, for a point with a large influence coefficient and a relatively stable gradient direction of multiple edge points in the superpixel block where the corresponding edge point is located, the corresponding weight coefficient is higher. This edge point has a higher probability of being the edge point of the cell area represented by the superpixel block, and has a higher probability of moving in the direction of the cell.
[0084] It should be noted that the position vector of the edge pixel point represents the position of the edge pixel point. Indicates the gradient direction fluctuation of edge pixels.
[0085] At this point, the direction of the central pixel of each superpixel block is obtained.
[0086] Step S004: Obtain the Gaussian blur kernel of the central pixel of each super pixel block according to the grayscale value and direction of the pixels within a preset neighborhood of the central pixel.
[0087] It should be noted that after obtaining the direction of the central pixel point of each superpixel block, the obtained direction is considered to be used to correct the traditional Gaussian probability density function of each center point, that is, to give the Gaussian blur kernel different standard deviations along different directions, so that the obtained Gaussian probability density function can better fit the actual cell density.
[0088] Specifically, according to the grayscale values and the direction of the pixels in the preset neighborhood of the central pixel, the Gaussian blur kernel of the central pixel of each super pixel block is obtained, which includes the following steps:
[0089] First, the initial standard deviation of the central pixel of each superpixel block is obtained according to the grayscale values of the pixels in the preset neighborhood of the central pixel.
[0090] Secondly, according to the initial standard deviation and the direction of the central pixel, the Gaussian blur kernel of the central pixel of each superpixel block is obtained.
[0091] Specifically, the initial standard deviation of the central pixel of each super pixel block is obtained according to the grayscale values of the pixels within the preset neighborhood of the central pixel. As an embodiment, the specific calculation method is as follows:
[0092]
[0093] In the formula, is the preset second hyperparameter. This embodiment is described with the second hyperparameter being 0.3. For the The number of pixels within a preset neighborhood of a central pixel. In this embodiment, the preset neighborhood is centered on the central pixel. The neighborhood range of , other embodiments may be set to other neighborhood ranges; For the The preset neighborhood of the central pixel The gray value of a pixel, is the linear normalization function, For the The initial standard deviation of the center pixels.
[0094] It should be noted that the standard deviation of the original Gaussian probability density function along different directions is a fixed value, which is only measured according to the density of the center point. However, in the case of cell counting, the foreground and background relationship of each point should not continue to be measured by the density of each center point. The standard deviation of the density function of each center point should be related to the average gray value in the neighborhood of each point; for the center point with a smaller gray value, a smaller initial standard deviation is given to it. , so that the local density corresponding to the cells that are not clearly focused can be improved; then the direction of the cells corresponding to each center point is considered, and the standard deviation of each direction is further improved, so that the Gaussian probability density function can better fit the actual cell density.
[0095] Furthermore, according to the initial standard deviation and the direction of the central pixel, the Gaussian blur kernel of the central pixel of each super pixel block is obtained. As an embodiment, the specific calculation method is as follows:
[0096]
[0097] In the formula, For the The initial standard deviation of the central pixel, For the The direction of the central pixel point, is the cosine function, is a sine function, For the The standard deviation of the Gaussian blur kernel in the horizontal direction of the central pixel is For the The standard deviation of the Gaussian blur kernel in the vertical direction for each central pixel.
[0098] According to The standard deviation of the Gaussian blur kernel in the horizontal direction, the standard deviation of the Gaussian blur kernel in the vertical direction, and the preset Gaussian blur kernel size are used to obtain the The Gaussian blur kernel of the central pixel is preset in this embodiment. .
[0099] It should be noted that according to The standard deviation of the Gaussian blur kernel in the horizontal direction, the standard deviation of the Gaussian blur kernel in the vertical direction, and the preset Gaussian blur kernel size are used to obtain the The Gaussian blur kernel of the central pixel is an existing method and will not be described in detail in this embodiment.
[0100] It should be noted that according to the standard deviation of the Gaussian blur kernel corresponding to each point in different directions, the parameters of the two-dimensional normal distribution of each point in different directions are corrected, and then the traditional Gaussian blur kernel is improved so that the probability density function of each center point has different changes along different directions, and its probability density result can be closer to the actual situation.
[0101] At this point, the Gaussian blur kernel of the central pixel of each superpixel block is obtained.
[0102] Step S005, performing Gaussian blurring on the corresponding pixel points in the binary labeled image of the first cell microscopic grayscale image according to the Gaussian blur kernel to obtain a density image of the first cell microscopic grayscale image; obtaining the density image of each cell microscopic grayscale image in the training sample set, and obtaining a trained neural network model according to the training sample set and all density images; obtaining the number of cells in the cell microscopic grayscale image to be detected according to the trained neural network model.
[0103] Specifically, Gaussian blur is performed on corresponding pixel points in the binary labeled image of the first cell microscopic grayscale image according to a Gaussian blur kernel to obtain a density image of the first cell microscopic grayscale image.
[0104] It should be noted that performing Gaussian blurring on the corresponding pixel points in the binary labeled image of the first cell microscopic grayscale image according to the Gaussian blur kernel to obtain the density image of the first cell microscopic grayscale image is an existing method and will not be described in detail in this embodiment.
[0105] Furthermore, a density image of each cell microscopic grayscale image in the training sample set is obtained.
[0106] Further, a trained neural network model is obtained based on the training sample set and all density images; and the number of cells in the microscopic grayscale image of the cells to be detected is obtained based on the trained neural network model, including the following steps:
[0107] First, the set consisting of density images of all cell microscopic grayscale images in the training sample set is taken as the output set, and the training sample set is taken as the input set.
[0108] Secondly, the neural network model is trained according to the input set and the output set to obtain a trained neural network model, as follows:
[0109] It should be noted that the neural network model in this embodiment is specifically a DenseNet neural network, the loss function is a mean square error function, and the neural network model is trained by an input set and an output set to obtain a trained neural network model, which is specifically an existing method and will not be repeated in this embodiment.
[0110] Finally, according to the trained neural network model, the number of cells in the microscopic grayscale image of the cells to be detected is obtained as follows:
[0111] A microscopic grayscale image of cells to be detected is obtained. It should be noted that the microscopic grayscale image of cells to be detected is different from the cell microscopic grayscale images in the training sample set. The microscopic grayscale image of cells to be detected is input into the trained neural network model, and a predicted density image of the microscopic grayscale image of cells to be detected is output. Regression counting is performed on the area in the predicted density image to obtain the number of cells in the microscopic grayscale image of cells to be detected.
[0112] It should be noted that the existing method is to input the microscopic grayscale image of the cells to be detected into a trained neural network model, output a predicted density image of the microscopic grayscale image of the cells to be detected, and perform regression counting on the areas in the predicted density image to obtain the number of cells in the microscopic grayscale image of the cells to be detected, which will not be repeated in this embodiment.
[0113] At this point, through the above steps, the detection and measurement based on intensive targets are completed.
[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A detection and measurement method based on dense targets, characterized in that: The method comprises the following steps: Any cell microscopic grayscale image in the training sample set is recorded as a first cell microscopic grayscale image, and superpixel segmentation is performed on the first cell microscopic grayscale image to obtain a plurality of superpixel blocks of the first cell microscopic grayscale image; a binary labeled image of the first cell microscopic grayscale image is obtained; According to the distance between the edge pixel point and the center pixel point of the super pixel block and the position of the pixel point, the influence coefficient of the center pixel point of each super pixel block on the edge pixel point is obtained; According to the influence coefficient, the position of the edge pixel in the edge of the super pixel block and the gradient direction fluctuation of the edge pixel, the direction of the central pixel of each super pixel block is obtained; According to the grayscale value and direction of the pixels in the preset neighborhood of the central pixel, the Gaussian blur kernel of the central pixel of each super pixel block is obtained; Gaussian blurring is performed on corresponding pixel points in the binary labeled image of the first cell microscopic grayscale image according to a Gaussian blur kernel to obtain a density image of the first cell microscopic grayscale image; Obtain a density image of each cell microscopic grayscale image in the training sample set, and obtain a trained neural network model based on the training sample set and all density images; obtain the number of cells in the microscopic grayscale image of the cell to be detected based on the trained neural network model; The method of obtaining the influence coefficient of the central pixel of each super pixel block on the edge pixel according to the distance between the edge pixel and the central pixel of the super pixel block and the position of the pixel includes the following specific steps: Obtaining a position vector of the pixel point through the coordinate position of the pixel point in the first cell microscopic grayscale image; Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as center pixel; In the formula, For the The position vector of the center pixel, For the The edge of the superpixel The position vector of the edge pixel, To take the second norm, is the preset first value, For the The edge of the superpixel The position vector of the edge pixel, For the The edge of the superpixel The position vector of the edge pixel, is the cross product, For the The edge of the superpixel The mean value of the neighborhood modulus length of edge pixels; According to the distance between the edge pixel and the central pixel of the super pixel block and the mean value of the neighborhood modulus length, the influence coefficient of the central pixel of each super pixel block on the edge pixel is obtained; The specific steps of obtaining the direction of the central pixel of each super pixel block according to the influence coefficient, the position of the edge pixel in the edge of the super pixel block and the gradient direction fluctuation of the edge pixel are as follows: Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as center pixel; The first The edge of the superpixel The position vector of the edge pixel is subtracted from the The position vector of the edge pixel point is recorded as edge pixels and the The third vector of edge pixels, , is the preset third value, and the edge pixels and the The angle between the third vector of the edge pixel point and the horizontal line is in the range of , get All angle values within The average value of all the angles in The edge of the superpixel The average of the neighborhood angles of edge pixels; According to the influence coefficient, the mean value of the neighborhood angle and the gradient direction fluctuation of the edge pixels, the direction of the central pixel of each superpixel block is obtained.
2. A detection and measurement method based on dense targets according to claim 1, characterized in that: The method of obtaining the influence coefficient of the central pixel of each super pixel block on the edge pixel point according to the distance between the edge pixel point and the central pixel point of the super pixel block and the mean value of the neighborhood modulus length includes the following specific steps: The first The center pixel and the The edge of the superpixel The Euclidean distance between edge pixels is denoted as The center pixel and The first Euclidean distance of the edge pixel; The edge of the superpixel The ratio of the mean value of the neighborhood modulus length of edge pixels to the first Euclidean distance is used as the first The center pixel is The edge of the superpixel The influence coefficient of the edge pixels.
3. The detection and measurement method based on dense targets according to claim 1, characterized in that: The specific steps of obtaining the direction of the central pixel of each superpixel block according to the influence coefficient, the neighborhood angle mean and the gradient direction fluctuation of the edge pixel are as follows: Obtaining a gradient vector of a pixel point through a gradient value and a gradient direction of a pixel point in the first cell microscopic grayscale image; In the formula, For the The number of edge pixels on the edge of a superpixel block, For the The center pixel is The edge of the superpixel The influence coefficient of edge pixels is The specific method of obtaining is as follows: The edge of the superpixel The gradient vector of the edge pixel is The edge of the superpixel block Starting from the edge pixel point, get the edge pixels, is a preset second value, obtaining the The gradient vector of each edge pixel in the edge pixels is The standard deviation of the angle value corresponding to the gradient vector of edge pixels is recorded as , the value range of the angle value corresponding to the gradient vector is , horizontal right is 0° direction; is the first preset hyperparameter, is the linear normalization function, For the The edge of the superpixel The average of the neighborhood angles of edge pixels, For the The direction of the central pixel.
4. The detection and measurement method based on dense targets according to claim 1 is characterized in that: The Gaussian blur kernel of the central pixel of each superpixel block is obtained according to the grayscale value and direction of the pixel points within the preset neighborhood of the central pixel point, and the specific steps include the following: Any superpixel block of the first cell microscopic grayscale image is recorded as superpixel blocks, The central pixel of the superpixel block is denoted as center pixel; In the formula, is the preset second hyperparameter, For the The number of pixels within the preset neighborhood of the central pixel, For the The preset neighborhood of the central pixel The gray value of a pixel, is the linear normalization function, For the The initial standard deviation of the central pixels; According to the initial standard deviation and the direction of the central pixel, the Gaussian blur kernel of the central pixel of each super pixel block is obtained.
5. A detection and measurement method based on dense targets according to claim 4, characterized in that: The Gaussian blur kernel of the central pixel of each super pixel block is obtained according to the initial standard deviation and the direction of the central pixel, and the specific steps include the following: In the formula, For the The initial standard deviation of the central pixel, For the The direction of the central pixel point, is the cosine function, is a sine function, For the The standard deviation of the Gaussian blur kernel in the horizontal direction of the central pixel is For the The standard deviation of the Gaussian blur kernel of the central pixel in the vertical direction; According to The standard deviation of the Gaussian blur kernel in the horizontal direction, the standard deviation of the Gaussian blur kernel in the vertical direction, and the preset Gaussian blur kernel size are used to obtain the The Gaussian blur kernel of the center pixel.
6. The detection and measurement method based on dense targets according to claim 1, characterized in that: The specific method of obtaining the binary labeled image of the first cell microscopic grayscale image is as follows: The central pixel point of each superpixel block of the first cell microscopic grayscale image is obtained, the grayscale values of the central pixel points of all superpixel blocks in the first cell microscopic grayscale image are set to 1, and the grayscale values of the remaining pixels in the first cell microscopic grayscale image except the central pixel point are set to 0, so as to obtain a binary labeled image of the first cell microscopic grayscale image.
7. The method for detecting and measuring dense targets according to claim 1, characterized in that: The neural network model is a DenseNet network.
8. The method for detecting and measuring dense targets according to claim 1, characterized in that: The step of obtaining the position vector of the pixel point by using the coordinate position of the pixel point in the first cell microscopic grayscale image includes the following specific steps: Get the first cell microscopic grayscale image The coordinate position of the pixel point defines the coordinate origin of the first cell microscopic grayscale image. The Euclidean distance between the coordinate position of the pixel point and the coordinate origin is taken as the The modulus of the position vector of the pixel point points the origin of the coordinate system to the The direction of the pixel coordinate position is taken as the The direction of the position vector of the pixel point is obtained The position vector of the pixel.
Citation Information
Patent Citations
A Single Tree Crown Segmentation Algorithm Based on Super-pixels and Topological Features in Aerial Images
AU2020103026A4
Node2Vec algorithm-based ultra-pixel image edge detection method
CN108682017A
