Movatterモバイル変換


[0]ホーム

URL:


CN115457546A - Method, system and storage medium for generating cell image density map - Google Patents

Method, system and storage medium for generating cell image density map
Download PDF

Info

Publication number
CN115457546A
CN115457546ACN202211043046.2ACN202211043046ACN115457546ACN 115457546 ACN115457546 ACN 115457546ACN 202211043046 ACN202211043046 ACN 202211043046ACN 115457546 ACN115457546 ACN 115457546A
Authority
CN
China
Prior art keywords
map
cell
center point
distance
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211043046.2A
Other languages
Chinese (zh)
Inventor
步宏
李波
陈杰
周恩惟
向旭辉
杨永全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
West China Precision Medicine Industrial Technology Institute
Original Assignee
West China Precision Medicine Industrial Technology Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by West China Precision Medicine Industrial Technology InstitutefiledCriticalWest China Precision Medicine Industrial Technology Institute
Priority to CN202211043046.2ApriorityCriticalpatent/CN115457546A/en
Publication of CN115457546ApublicationCriticalpatent/CN115457546A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明属于图像处理技术领域,具体涉及一种生成细胞图像密度图的方法、系统和存储介质。本发明方法包括如下步骤:步骤1,生成与细胞图像大小相同的地图,原图中每个细胞的位置映射为地图中的一个像素点,得到细胞中心点;步骤2,计算所述地图中任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离,得到距离地图;步骤3,根据所述距离地图得到密度图。本发明还进一步提供实现上述方法的系统。本发明有效提升了密度图的质量,进而提高了细胞定位与计数的精度,具有很好的应用前景。

Figure 202211043046

The invention belongs to the technical field of image processing, and in particular relates to a method, system and storage medium for generating a cell image density map. The method of the present invention comprises the following steps: Step 1, generate a map with the same size as the cell image, and map the position of each cell in the original map to a pixel in the map to obtain the cell center point; Step 2, calculate any cell center point in the map. A distance map is obtained from a pixel point other than the cell center point to the nearest cell center point; step 3, a density map is obtained according to the distance map. The present invention further provides a system for realizing the above method. The invention effectively improves the quality of the density map, further improves the accuracy of cell positioning and counting, and has good application prospects.

Figure 202211043046

Description

Translated fromChinese
一种生成细胞图像密度图的方法、系统和存储介质A method, system and storage medium for generating cell image density map

技术领域technical field

本发明属于图像处理技术领域,具体涉及一种生成细胞图像密度图的生成方法、系统和存储介质。The invention belongs to the technical field of image processing, and in particular relates to a generation method, system and storage medium for generating a cell image density map.

背景技术Background technique

细胞定位与计数,即预测图像中每个细胞的具体位置,并得出图像所包含的细胞数量。在生物学和医学中,显微图像分析是一个非常重要的研究领域,细胞定位与计数便是其中一个重要分支。传统的细胞计数方案采用基于深度学习的方式学习图像到细胞数量之间的映射关系,这种方式简单直接,但是受限于监督信息仅为一个数字,深度学习的模型很难学习到更多有用的信息,因此模型的计数性能容易受到图像背景等噪声的干扰,使得结果常常不够准确。Cell location and counting, that is, to predict the specific position of each cell in the image and obtain the number of cells contained in the image. In biology and medicine, microscopic image analysis is a very important research field, and cell localization and counting is one of the important branches. The traditional cell counting scheme uses a deep learning-based method to learn the mapping relationship between images and cell numbers. This method is simple and direct, but limited by the supervision information is only a number, it is difficult for the deep learning model to learn more useful Therefore, the counting performance of the model is easily disturbed by noise such as the image background, making the results often inaccurate.

后来研究人员提出了密度图的概念,即对图像中每个细胞的中心位置进行标注,然后基于高斯模糊算法生成对应的密度图。密度图的出现将细胞计数任务从图像到细胞数量之间的映射关系升级为图像到密度图的映射关系,同时还衍生出了细胞定位的任务。Later, the researchers proposed the concept of density map, that is, to mark the center position of each cell in the image, and then generate the corresponding density map based on the Gaussian blur algorithm. The appearance of the density map upgrades the cell counting task from the mapping relationship between the image to the number of cells to the mapping relationship between the image and the density map, and also derives the task of cell location.

目前研究普遍采用基于密度图的方式来进行细胞定位与计数,因此定位和计数性能在很大程度上取决于所生成的密度图的质量。现有技术中常采用K近邻算法和高斯模糊算法来生成细胞对应的密度图。具体来说,如果该位置(像素点)有一个细胞,就将一个激活函数δ(x-xi)放置在此处,如果一张图上有N个细胞,则可以表示为

Figure BDA0003821550570000011
为了获得一个连续的密度图,研究人员使用高斯核对整张图进行卷积,可以表示为F(x)=H(x)*Gσ(x)。此外,还考虑到细胞计数场景中细胞并不是均匀分布的,因此如果选用相同的高斯核滤波参数则会导致细胞难以区别,因此使用了K近邻算法来计算滤波参数:对于每一个细胞中心位置,选择距离其最近的K个邻居,然后计算到达K个邻居的平均距离,最后乘以一个经验参数作为最终的高斯核滤波参数。最终密度图的生成方式可以表示为
Figure BDA0003821550570000012
Figure BDA0003821550570000013
其中β是经验参数,一般设置为0.3,
Figure BDA0003821550570000014
表示距离该细胞中心点最近的K个邻居的平均距离。Current research generally adopts a density map-based method for cell location and counting, so the location and counting performance depends to a large extent on the quality of the generated density map. In the prior art, the K-nearest neighbor algorithm and the Gaussian blur algorithm are often used to generate the density map corresponding to the cells. Specifically, if there is a cell at this position (pixel point), an activation function δ(xxi ) is placed here. If there are N cells on a picture, it can be expressed as
Figure BDA0003821550570000011
In order to obtain a continuous density map, the researchers convolved the entire map with a Gaussian kernel, which can be expressed as F(x)=H(x)*Gσ (x). In addition, it is also considered that the cells in the cell counting scene are not evenly distributed, so if the same Gaussian kernel filter parameters are selected, the cells will be difficult to distinguish, so the K nearest neighbor algorithm is used to calculate the filter parameters: For each cell center position, Select the nearest K neighbors, then calculate the average distance to K neighbors, and finally multiply an empirical parameter as the final Gaussian kernel filter parameter. The way the final density map is generated can be expressed as
Figure BDA0003821550570000012
Figure BDA0003821550570000013
where β is an empirical parameter, generally set to 0.3,
Figure BDA0003821550570000014
Indicates the average distance of the K nearest neighbors from the center point of the cell.

但是当前使用的密度图主要存在着两大缺陷:(1)在细胞较为密集的区域,基于高斯模糊算法生成的密度图难以区分,导致模型难以学习到有用的定位和计数信息。(2)密度图中空间梯度信息不够明显,不仅使得模型难以学习,而且在预测时难以准确获取细胞具体位置。因此,本领域亟需开发一种新的密度图生成技术,能够在细胞密集的区域区分密度图的信息且使得密度图中包含空间梯度的信息,实现准确的细胞计数和位置分析。However, there are two main defects in the currently used density map: (1) In areas where cells are relatively dense, the density map generated based on the Gaussian blur algorithm is difficult to distinguish, making it difficult for the model to learn useful positioning and counting information. (2) The spatial gradient information in the density map is not obvious enough, which not only makes it difficult to learn the model, but also makes it difficult to accurately obtain the specific location of cells when predicting. Therefore, there is an urgent need to develop a new density map generation technology in this field, which can distinguish the information of the density map in densely populated areas and make the density map contain information of spatial gradients, so as to achieve accurate cell count and position analysis.

发明内容Contents of the invention

针对现有技术的问题,本发明提供一种生成细胞图像密度图的生成方法、系统和存储介质,目的在于通过逆K近邻算法,基于距离地图生成最终的密度图,实现细胞密集区域密度图的区分,并且进一步解决高斯模糊算法的梯度不明显的问题,有效提升了密度图的质量,进而提高了细胞定位与计数的精度。In view of the problems in the prior art, the present invention provides a generation method, system and storage medium for generating a cell image density map, the purpose of which is to generate the final density map based on the distance map through the inverse K-nearest neighbor algorithm, so as to realize the density map of densely populated areas. Distinguish, and further solve the problem that the gradient of the Gaussian blur algorithm is not obvious, which effectively improves the quality of the density map, thereby improving the accuracy of cell positioning and counting.

一种细胞图像密度图的生成方法,包括如下步骤:A method for generating a cell image density map, comprising the steps of:

步骤1,生成与细胞图像大小相同的地图,原图中每个细胞的位置映射为地图中的一个像素点,得到细胞中心点;Step 1, generate a map with the same size as the cell image, map the position of each cell in the original image to a pixel in the map, and obtain the center point of the cell;

步骤2,计算所述地图中任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离,得到距离地图,所述非细胞中心点为背景点;Step 2, calculating the distance from any pixel point of the non-cell center point in the map to the nearest cell center point to obtain a distance map, and the non-cell center point is a background point;

步骤3,根据所述距离地图得到密度图。Step 3, obtaining a density map according to the distance map.

优选的,步骤3具体包括如下步骤:Preferably, step 3 specifically includes the following steps:

步骤3.1,对所述距离地图求倒,得到初步密度图。Step 3.1, inverting the distance map to obtain a preliminary density map.

优选的,步骤3.1中,所述求倒的公式为:Preferably, in step 3.1, the formula for calculating the inversion is:

Figure BDA0003821550570000021
Figure BDA0003821550570000021

其中,Map为初步密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C为常数。Among them, Map is the preliminary density map, P(x, y) is the distance map, which represents the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, and C is a constant.

优选的,步骤3还包括如下步骤:Preferably, step 3 also includes the following steps:

步骤3.2,利用指数函数优化所述初步密度图,得到最终的密度图。Step 3.2, using an exponential function to optimize the preliminary density map to obtain a final density map.

优选的,步骤3.2中,所述优化过程的公式为:Preferably, in step 3.2, the formula of the optimization process is:

Figure BDA0003821550570000022
Figure BDA0003821550570000022

其中,Location_map为最终生成的密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C1、C2和C3为常数,max(P(x,y))为距离地图中的最大值,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离中的最大值。Among them, Location_map is the final generated density map, P(x,y) is the distance map, indicating the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, C1 , C2 and C3 is a constant, max(P(x,y)) is the maximum value in the distance map, which means the maximum value of the distance from any pixel point other than the cell center point to the nearest cell center point to the point.

优选的,步骤1中,细胞中心点的值记为0,非细胞中心点的值记为255。Preferably, in step 1, the value of the cell center point is recorded as 0, and the value of the non-cell center point is recorded as 255.

优选的,步骤2中,基于K近邻算法找到距离每一个非细胞中心点的像素点最近的其他的细胞中心点的像素点,计算两者之间的距离。Preferably, in step 2, based on the K-nearest neighbor algorithm, other pixel points of the cell center point closest to each non-cell center point pixel point are found, and the distance between the two is calculated.

优选的,步骤2中,对每个像素点的计算公式为:Preferably, in step 2, the calculation formula for each pixel is:

Figure BDA0003821550570000031
Figure BDA0003821550570000031

其中,P(x,y)为距离地图,表示距离任意非细胞中心点最近的细胞中心点的距离值,x、y为待计算的像素点在所述地图中的坐标位置,xi、yi为细胞中心点在所述地图中的坐标位置,I表示所有的细胞中心点。Among them, P(x, y) is the distance map, indicating the distance value of the nearest cell center point from any non-cell center point, x, y are the coordinate positions of the pixel points to be calculated in the map, xi , yi is the coordinate position of the cell center point in the map, and I represents all cell center points.

本发明还提供一种生成细胞图像密度图的系统,包括:The present invention also provides a system for generating a cell image density map, comprising:

输入模块,用于输入细胞图像;An input module for inputting cell images;

计算模块,用于按照上述方法生成密度图;A calculation module for generating a density map according to the method described above;

输出模块,用于输出密度图。Output module for outputting density maps.

本发明还提供一种计算机可读存储介质,其上存储有用于实现上述方法的计算机程序。The present invention also provides a computer-readable storage medium, on which a computer program for realizing the above method is stored.

本发明通过逆K近邻算法,基于距离地图生成最终的密度图,避免了以往基于K近邻算法生成的密度图在密集区域难以分辨的困难,极大程度上促进了细胞精确定位和计数的发展。在优选方案中,通过指数函数优化密度图,避免了以往基于高斯模糊算法所生成的密度图具有的梯度弥散问题,我们为每一个细胞中心点提供了非常良好的梯度信息,便于基于深度学习的模型学习,促进了细胞精确定位任务的发展。因此,本发明具有很好的应用前景。The present invention generates the final density map based on the distance map through the inverse K-nearest neighbor algorithm, avoids the difficulty of distinguishing the density map generated based on the K-nearest neighbor algorithm in dense areas in the past, and greatly promotes the development of precise cell positioning and counting. In the preferred solution, the density map is optimized by an exponential function, which avoids the gradient dispersion problem of the density map generated based on the Gaussian blur algorithm in the past. We provide very good gradient information for each cell center point, which is convenient for deep learning-based Model learning facilitates the development of precise cell localization tasks. Therefore, the present invention has good application prospects.

显然,根据本发明的上述内容,按照本领域的普通技术知识和惯用手段,在不脱离本发明上述基本技术思想前提下,还可以做出其它多种形式的修改、替换或变更。Apparently, according to the above content of the present invention, according to common technical knowledge and conventional means in this field, without departing from the above basic technical idea of the present invention, other various forms of modification, replacement or change can also be made.

以下通过实施例形式的具体实施方式,对本发明的上述内容再作进一步的详细说明。但不应将此理解为本发明上述主题的范围仅限于以下的实例。凡基于本发明上述内容所实现的技术均属于本发明的范围。The above-mentioned content of the present invention will be further described in detail below through specific implementation in the form of examples. However, this should not be construed as limiting the scope of the above-mentioned subject matter of the present invention to the following examples. All technologies realized based on the above contents of the present invention belong to the scope of the present invention.

附图说明Description of drawings

图1为实施例1的流程示意图。Fig. 1 is the schematic flow chart of embodiment 1.

图2为不同方法生成的密度图对比,从左到右依次是:细胞图像原图、基于高斯模糊生成的密度图、实施例1中生成的初步密度图(未进行优化的密度图),实施例1中生成的最终的密度图(优化后的密度图)。Figure 2 is a comparison of density maps generated by different methods, from left to right: the original image of the cell image, the density map generated based on Gaussian blur, the preliminary density map generated in Example 1 (the density map without optimization), and the implementation The final density map (optimized density map) generated in Example 1.

具体实施方式detailed description

需要特别说明的是,实施例中未具体说明的数据采集、传输、储存和处理等步骤的算法,以及未具体说明的硬件结构、电路连接等均可通过现有技术已公开的内容实现。It should be noted that the algorithms for the steps of data collection, transmission, storage and processing not specifically described in the embodiments, as well as the hardware structures and circuit connections not specifically described can be realized by the disclosed content of the prior art.

实施例1细胞图像密度图的生成方法Example 1 Generation method of cell image density map

本实施例的方法流程如图1所示,具体的:The method flow of this embodiment is shown in Figure 1, specifically:

步骤一,距离地图生成:首先,生成一张和原始细胞图像一样大小的地图,将细胞图像中每个细胞的位置映射为地图中的一个像素点(即细胞中心点),将该点的值记为0,非细胞中心点的值记为255。然后基于K近邻算法找到距离任意像素点最近的其他的0值像素点,计算两者之间的距离并记录其中最小值。整个过程可以记为

Figure BDA0003821550570000041
其中,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,x、y为待计算的像素点在所述地图中的坐标位置,xi、yi为细胞中心点在所述地图中的坐标位置,I表示图中所有的0值点,即所有细胞中心点。对图像中每一个点重复上述搜索步骤便得到了距离地图。Step 1, distance map generation: First, generate a map of the same size as the original cell image, map the position of each cell in the cell image to a pixel point in the map (ie, the center point of the cell), and the value of the point Recorded as 0, the value of the non-cell center point is recorded as 255. Then, based on the K-nearest neighbor algorithm, other 0-value pixel points closest to any pixel point are found, the distance between them is calculated and the minimum value is recorded. The whole process can be recorded as
Figure BDA0003821550570000041
Wherein, P(x, y) is a distance map, indicating the distance value from any pixel point other than the cell center point to the nearest cell center point, and x, y are the coordinates of the pixel point to be calculated in the map position, xi , yi are the coordinate positions of the cell center points in the map, and I represents all 0-value points in the map, that is, all cell center points. The distance map is obtained by repeating the above search steps for each point in the image.

步骤二,初步密度图生成:基于上个步骤中生成的距离地图,对其进行求倒便得到了初步密度图,计算过程为

Figure BDA0003821550570000042
其中,Map为初步密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C为常数。常数C是为了避免分母出现0值,可根据P(x,y)的数量级范围任意选取。Step 2. Preliminary density map generation: Based on the distance map generated in the previous step, the preliminary density map is obtained by inverting it. The calculation process is
Figure BDA0003821550570000042
Among them, Map is the preliminary density map, P(x, y) is the distance map, which represents the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, and C is a constant. The constant C is to avoid 0 values in the denominator, and it can be selected arbitrarily according to the magnitude range of P(x,y).

通过该步骤生成的初步密度图相对于现有技术中基于高斯模糊算法生成的密度图的优势如下:The advantages of the preliminary density map generated by this step relative to the density map generated based on the Gaussian blur algorithm in the prior art are as follows:

首先假设两种极端情况,高斯核零扩散与极端扩散。零扩散的情况下,密度图中对应的细胞中心的密度将仅为一个像素点,周围没有任务梯度信息,这显然是不合理的,因为在训练过程中距离改中心点一个像素和10个像素被认为是一样的误差,即丢失了梯度信息的连续性。对于极端扩散的情况,将导致的密度图的梯度信息不明显,这使得深度学习模型难以学习,更难以给出精确的位置信息。对于任意的高斯核,都将在不同程度上面临上述两个难题。相反,本实施例得到的初步密度图将很好的解决上述难题,对于前景点(即细胞中心点),本实施例的初步密度图在该位置上形成一个尖点,提供一个良好的空间梯度信息。此外,由于本实施例的初步密度图是基于最近邻生成的距离地图,因此其能够很好的区分开每一个细胞,即使在非常密集的区域也能提供准确的位置信息。First assume two extreme cases, Gaussian kernel zero diffusion and extreme diffusion. In the case of zero diffusion, the density of the corresponding cell center in the density map will be only one pixel, and there is no task gradient information around it, which is obviously unreasonable, because during the training process, the distance from the center point is one pixel and 10 pixels considered to be the same error, that is, the continuity of the gradient information is lost. In the case of extreme diffusion, the gradient information of the resulting density map is not obvious, which makes it difficult for deep learning models to learn, and it is even more difficult to give accurate position information. For any Gaussian kernel, the above two problems will be faced to varying degrees. On the contrary, the preliminary density map obtained in this embodiment will solve the above problems well. For the foreground point (ie, the center point of the cell), the preliminary density map of this embodiment forms a sharp point at this position, providing a good spatial gradient information. In addition, since the preliminary density map in this embodiment is based on the distance map generated by the nearest neighbor, it can well distinguish each cell and provide accurate location information even in a very dense area.

步骤三,密度图优化:上述初步密度图已经很好的解决了现有密度图存在的两大难题,但是仍然面临密度图背景区域的梯度衰减过慢的问题。为了使细胞中心点区域缓慢衰减,在背景区域加速衰减,本实施例进一步利用指数函数的特性来进行优化。具体的,对于当前的初步密度图,执行以下操作:Step 3: Density map optimization: The above-mentioned preliminary density map has solved the two major problems existing in the existing density map, but it still faces the problem that the gradient decay of the background area of the density map is too slow. In order to slowly attenuate the cell center point area and accelerate the attenuation in the background area, this embodiment further utilizes the characteristics of the exponential function for optimization. Specifically, for the current preliminary density map, do the following:

Figure BDA0003821550570000051
Figure BDA0003821550570000051

其中,Location_map为最终生成的密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C1、C2和C3为常数,可以根据实际情况进行调整,本实施例将其分别设置为10、0.5和1。max(P(x,y))为距离地图中的最大值,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离中的最大值。经过上述处理后便得到了最终的密度图。Among them, Location_map is the final generated density map, P(x,y) is the distance map, indicating the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, C1 , C2 and C3 is a constant and can be adjusted according to the actual situation. In this embodiment, they are set to 10, 0.5 and 1 respectively. max(P(x,y)) is the maximum value in the distance map, which means the maximum value of the distance from any pixel point other than the cell center point to the nearest cell center point. After the above processing, the final density map is obtained.

采用上述方法的到的密度图与现有技术的密度图的对比如图2所示,图中,从左到右依次是:细胞图像原图、基于高斯模糊生成的密度图、本实施例生成的初步密度图(未进行优化的密度图),本实施例生成的最终的密度图(优化后的密度图)。通过对比可以发现,在细胞分布密集的区域,基于高斯模糊生成的密度图中细胞的密度信息相互重叠难以区分;而本实施例得到的两个密度图中,在细胞分布密集的区域仍然能够有效地分辨不同的细胞。此外,得益于距离地图和指数函数的梯度陡峭特性,我们最终生成的密度图能够提供一个非常良好的空间梯度信息,从而使得深度学习模型的学习更加高效。The comparison between the density map obtained by the above method and the density map of the prior art is shown in Figure 2. In the figure, from left to right are: the original image of the cell image, the density map generated based on Gaussian blur, and the density map generated in this embodiment. The preliminary density map (density map without optimization), the final density map (optimized density map) generated in this embodiment. Through comparison, it can be found that in areas where cells are densely distributed, the density information of cells in the density map generated based on Gaussian blur overlaps and is difficult to distinguish; while the two density maps obtained in this embodiment can still be effective in areas where cells are densely distributed distinguish different cells. In addition, thanks to the steep gradient characteristics of the distance map and the exponential function, our final generated density map can provide a very good spatial gradient information, which makes the learning of deep learning models more efficient.

实施例2生成细胞图像密度图的系统Example 2 A system for generating cell image density maps

本实施例的系统包括:The system of this embodiment includes:

输入模块,用于输入细胞图像;An input module for inputting cell images;

计算模块,用于计算生成密度图;Calculation module, used to calculate and generate density map;

输出模块,用于输出密度图。Output module for outputting density maps.

利用该系统,可执行实施例1的细胞图像密度图的生成方法。具体的,输入模块输入细胞图像后,计算模块执行如下步骤:Using this system, the method for generating a cell image density map in Embodiment 1 can be implemented. Specifically, after the input module inputs the cell image, the calculation module performs the following steps:

步骤一,距离地图生成:首先,生成一张和原始细胞图像一样大小的地图,将细胞图像中每个细胞的位置映射为地图中的一个像素点(即细胞中心点),将该点的值记为0,非细胞中心点的值记为255。然后基于K近邻算法找到距离任意像素点最近的其他的0值像素点,计算两者之间的距离并记录其中最小值。整个过程可以记为

Figure BDA0003821550570000061
其中,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,x、y为待计算的像素点在所述地图中的坐标位置,xi、yi为细胞中心点在所述地图中的坐标位置,I表示图中所有的0值点,即所有细胞中心点。对图像中每一个点重复上述搜索步骤便得到了距离地图。Step 1, distance map generation: First, generate a map of the same size as the original cell image, map the position of each cell in the cell image to a pixel point in the map (ie, the center point of the cell), and the value of the point Recorded as 0, the value of the non-cell center point is recorded as 255. Then, based on the K-nearest neighbor algorithm, other 0-value pixel points closest to any pixel point are found, the distance between them is calculated and the minimum value is recorded. The whole process can be recorded as
Figure BDA0003821550570000061
Wherein, P(x, y) is a distance map, indicating the distance value from any pixel point other than the cell center point to the nearest cell center point, and x, y are the coordinates of the pixel point to be calculated in the map position, xi , yi are the coordinate positions of the cell center points in the map, and I represents all 0-value points in the map, that is, all cell center points. The distance map is obtained by repeating the above search steps for each point in the image.

步骤二,初步密度图生成:基于上个步骤中生成的距离地图,对其进行求倒便得到了初步密度图,计算过程为

Figure BDA0003821550570000062
其中,Map为初步密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C为常数。常数C是为了避免分母出现0值,可根据P(x,y)的数量级范围任意选取。Step 2. Preliminary density map generation: Based on the distance map generated in the previous step, the preliminary density map is obtained by inverting it. The calculation process is
Figure BDA0003821550570000062
Among them, Map is the preliminary density map, P(x, y) is the distance map, which represents the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, and C is a constant. The constant C is to avoid 0 values in the denominator, and it can be selected arbitrarily according to the magnitude range of P(x,y).

步骤三,密度图优化:对于当前的初步密度图,执行以下操作:Step 3, density map optimization: For the current preliminary density map, perform the following operations:

Figure BDA0003821550570000063
Figure BDA0003821550570000063

其中,Location_map为最终生成的密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C1、C2和C3为常数,可以根据实际情况进行调整,本实施例将其分别设置为10、0.5和1。max(P(x,y))为距离地图中的最大值,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离中的最大值。经过上述处理后便得到了最终的密度图。Among them, Location_map is the final generated density map, P(x,y) is the distance map, indicating the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, C1 , C2 and C3 is a constant and can be adjusted according to the actual situation. In this embodiment, they are set to 10, 0.5 and 1 respectively. max(P(x,y)) is the maximum value in the distance map, which means the maximum value of the distance from any pixel point other than the cell center point to the nearest cell center point. After the above processing, the final density map is obtained.

计算模块完成上述步骤后,输出模块输出最终的密度图。After the calculation module completes the above steps, the output module outputs the final density map.

实施例3计算机可读存储介质Embodiment 3 computer-readable storage medium

本实施例的计算机可读存储介质存储有计算机程序,该计算机程序用于执行实施例1的细胞图像密度图的生成方法,具体步骤如下:The computer-readable storage medium of this embodiment stores a computer program, and the computer program is used to execute the method for generating a cell image density map in Embodiment 1, and the specific steps are as follows:

步骤一,距离地图生成:首先,生成一张和原始细胞图像一样大小的地图,将细胞图像中每个细胞的位置映射为地图中的一个像素点(即细胞中心点),将该点的值记为0,非细胞中心点的值记为255。然后基于K近邻算法找到距离任意像素点最近的其他的0值像素点,计算两者之间的距离并记录其中最小值。整个过程可以记为

Figure BDA0003821550570000064
其中,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C为常数。常数C是为了避免分母出现0值,可根据P(x,y)的数量级范围任意选取。Step 1, distance map generation: First, generate a map of the same size as the original cell image, map the position of each cell in the cell image to a pixel point in the map (ie, the center point of the cell), and the value of the point Recorded as 0, the value of the non-cell center point is recorded as 255. Then, based on the K-nearest neighbor algorithm, other 0-value pixel points closest to any pixel point are found, the distance between them is calculated and the minimum value is recorded. The whole process can be recorded as
Figure BDA0003821550570000064
Among them, P(x, y) is a distance map, indicating the distance from any pixel point other than the cell center point to the nearest cell center point, and C is a constant. The constant C is to avoid 0 values in the denominator, and it can be selected arbitrarily according to the magnitude range of P(x,y).

步骤二,初步密度图生成:基于上个步骤中生成的距离地图,对其进行求倒便得到了初步密度图,计算过程为

Figure BDA0003821550570000071
其中,Map为初步密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C为常数。常数C是为了避免分母出现0值,可根据P(x,y)的数量级范围任意选取。Step 2. Preliminary density map generation: Based on the distance map generated in the previous step, the preliminary density map is obtained by inverting it. The calculation process is
Figure BDA0003821550570000071
Among them, Map is the preliminary density map, P(x, y) is the distance map, which represents the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, and C is a constant. The constant C is to avoid 0 values in the denominator, and it can be selected arbitrarily according to the magnitude range of P(x,y).

通过该步骤生成的初步密度图相对于现有技术中基于高斯模糊算法生成的密度图的优势如下:The advantages of the preliminary density map generated by this step relative to the density map generated based on the Gaussian blur algorithm in the prior art are as follows:

首先假设两种极端情况,高斯核零扩散与极端扩散。零扩散的情况下,密度图中对应的细胞中心的密度将仅为一个像素点,周围没有任务梯度信息,这显然是不合理的,因为在训练过程中距离改中心点一个像素和10个像素被认为是一样的误差,即丢失了梯度信息的连续性。对于极端扩散的情况,将导致的密度图的梯度信息不明显,这使得深度学习模型难以学习,更难以给出精确的位置信息。对于任意的高斯核,都将在不同程度上面临上述两个难题。相反,本实施例得到的初步密度图将很好的解决上述难题,对于前景点(即细胞中心点),本实施例的初步密度图在该位置上形成一个尖点,提供一个良好的空间梯度信息。此外,由于本实施例的初步密度图是基于最近邻生成的距离地图,因此其能够很好的区分开每一个细胞,即使在非常密集的区域也能提供准确的位置信息。First assume two extreme cases, Gaussian kernel zero diffusion and extreme diffusion. In the case of zero diffusion, the density of the corresponding cell center in the density map will be only one pixel, and there is no task gradient information around it, which is obviously unreasonable, because during the training process, the distance from the center point is one pixel and 10 pixels considered to be the same error, that is, the continuity of the gradient information is lost. In the case of extreme diffusion, the gradient information of the resulting density map is not obvious, which makes it difficult for deep learning models to learn, and it is even more difficult to give accurate position information. For any Gaussian kernel, the above two problems will be faced to varying degrees. On the contrary, the preliminary density map obtained in this embodiment will solve the above problems well. For the foreground point (ie, the center point of the cell), the preliminary density map of this embodiment forms a sharp point at this position, providing a good spatial gradient information. In addition, since the preliminary density map in this embodiment is based on the distance map generated by the nearest neighbor, it can well distinguish each cell and provide accurate location information even in a very dense area.

步骤三,密度图优化:上述初步密度图已经很好的解决了现有密度图存在的两大难题,但是仍然面临密度图背景区域的梯度衰减过慢的问题。为了使细胞中心点区域缓慢衰减,在背景区域加速衰减,本实施例进一步利用指数函数的特性来进行优化。具体的,对于当前的初步密度图,执行以下操作:Step 3: Density map optimization: The above-mentioned preliminary density map has solved the two major problems existing in the existing density map, but it still faces the problem that the gradient decay of the background area of the density map is too slow. In order to slowly attenuate the cell center point area and accelerate the attenuation in the background area, this embodiment further utilizes the characteristics of the exponential function for optimization. Specifically, for the current preliminary density map, do the following:

Figure BDA0003821550570000072
Figure BDA0003821550570000072

其中,Location_map为最终生成的密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C1、C2和C3为常数,可以根据实际情况进行调整,本实施例将其分别设置为10、0.5和1。max(P(x,y))为距离地图中的最大值,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离中的最大值。经过上述处理后便得到了最终的密度图。Among them, Location_map is the final generated density map, P(x,y) is the distance map, indicating the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, C1 , C2 and C3 is a constant and can be adjusted according to the actual situation. In this embodiment, they are set to 10, 0.5 and 1 respectively. max(P(x,y)) is the maximum value in the distance map, which means the maximum value of the distance from any pixel point other than the cell center point to the nearest cell center point. After the above processing, the final density map is obtained.

通过上述实施例可以看到,本发明提供的密度图生成方法和系统能够有效地生成区分度更好和空间梯度信息更加明显的密度图,有效提升了密度图的质量,进而提高了细胞定位与计数的精度,具有很好的应用前景。It can be seen from the above embodiments that the density map generation method and system provided by the present invention can effectively generate a density map with better discrimination and more obvious spatial gradient information, effectively improve the quality of the density map, and further improve cell positioning and Counting accuracy has a good application prospect.

Claims (10)

Translated fromChinese
1.一种生成细胞图像密度图的方法,其特征在于,包括如下步骤:1. A method for generating a cell image density map, comprising the steps of:步骤1,生成与细胞图像大小相同的地图,原图中每个细胞的位置映射为地图中的一个像素点,得到细胞中心点;Step 1, generate a map with the same size as the cell image, map the position of each cell in the original image to a pixel in the map, and obtain the center point of the cell;步骤2,计算所述地图中任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离,得到距离地图;Step 2, calculating the distance from any pixel point other than the cell center point in the map to the nearest cell center point to the point to obtain a distance map;步骤3,根据所述距离地图得到密度图。Step 3, obtaining a density map according to the distance map.2.按照权利要求1所述的方法,其特征在于:步骤3具体包括如下步骤:2. according to the described method of claim 1, it is characterized in that: step 3 specifically comprises the following steps:步骤3.1,对所述距离地图求倒,得到初步密度图。Step 3.1, inverting the distance map to obtain a preliminary density map.3.按照权利要求2所述的方法,其特征在于:步骤3.1中,所述求倒的公式为:3. according to the described method of claim 2, it is characterized in that: in the step 3.1, the formula of described inverting is:
Figure FDA0003821550560000011
Figure FDA0003821550560000011
其中,Map为初步密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C为常数。Among them, Map is the preliminary density map, P(x, y) is the distance map, which represents the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, and C is a constant.4.按照权利要求2所述的方法,其特征在于:步骤3还包括如下步骤:4. according to the described method of claim 2, it is characterized in that: step 3 also comprises the following steps:步骤3.2,利用指数函数优化所述初步密度图,得到最终的密度图。Step 3.2, using an exponential function to optimize the preliminary density map to obtain a final density map.5.按照权利要求4所述的方法,其特征在于:步骤3.2中,所述优化过程的公式为:5. according to the described method of claim 4, it is characterized in that: in step 3.2, the formula of described optimization process is:
Figure FDA0003821550560000012
Figure FDA0003821550560000012
其中,Location_map为最终生成的密度图,P(x,y)为距离地图,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离值,C1、C2和C3为常数,max(P(x,y))为距离地图中的最大值,表示任意非细胞中心点的像素点到距离该点最近的细胞中心点的距离中的最大值。Among them, Location_map is the final generated density map, P(x,y) is the distance map, indicating the distance from any pixel point that is not the center point of the cell to the center point of the cell closest to the point, C1 , C2 and C3 is a constant, max(P(x,y)) is the maximum value in the distance map, which means the maximum value of the distance from any pixel point other than the cell center point to the nearest cell center point to the point.
6.按照权利要求1所述的方法,其特征在于:步骤1中,细胞中心点的值记为0,非细胞中心点的值记为255。6. The method according to claim 1, characterized in that: in step 1, the value of the cell center point is recorded as 0, and the value of the non-cell center point is recorded as 255.7.按照权利要求1所述的方法,其特征在于:步骤2中,基于K近邻算法找到距离每一个非细胞中心点的像素点最近的其他的细胞中心点的像素点,计算两者之间的距离。7. according to the described method of claim 1, it is characterized in that: in step 2, based on K nearest neighbor algorithm, find the pixel point of other cell center point closest to the pixel point apart from each non-cell center point, calculate the distance between the two distance.8.按照权利要求7所述的方法,其特征在于:步骤2中,对每个像素点的计算公式为:8. according to the described method of claim 7, it is characterized in that: in step 2, the calculation formula to each pixel is:
Figure FDA0003821550560000021
Figure FDA0003821550560000021
其中,P(x,y)为距离地图,表示距离任意非细胞中心点最近的细胞中心点的距离值,x、y为待计算的任意像素点在所述地图中的坐标位置,xi、yi为细胞中心点在所述地图中的坐标位置,I表示所有的细胞中心点。Among them, P(x, y) is the distance map, which represents the distance value of the nearest cell center point from any non-cell center point, x, y are the coordinate positions of any pixel point to be calculated in the map, xi , yi is the coordinate position of the cell center point in the map, and I represents all the cell center points.
9.一种生成细胞图像密度图的系统,其特征在于,包括:9. A system for generating a cell image density map, comprising:输入模块,用于输入细胞图像;An input module for inputting cell images;计算模块,用于按照权利要求1-8任一项所述的方法生成密度图;A computing module, configured to generate a density map according to the method according to any one of claims 1-8;输出模块,用于输出密度图。Output module for outputting density maps.10.一种计算机可读存储介质,其特征在于:其上存储有用于实现权利要求1-8任一项所述方法的计算机程序。10. A computer-readable storage medium, wherein a computer program for realizing the method according to any one of claims 1-8 is stored thereon.
CN202211043046.2A2022-08-292022-08-29Method, system and storage medium for generating cell image density mapPendingCN115457546A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202211043046.2ACN115457546A (en)2022-08-292022-08-29Method, system and storage medium for generating cell image density map

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202211043046.2ACN115457546A (en)2022-08-292022-08-29Method, system and storage medium for generating cell image density map

Publications (1)

Publication NumberPublication Date
CN115457546Atrue CN115457546A (en)2022-12-09

Family

ID=84301959

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202211043046.2APendingCN115457546A (en)2022-08-292022-08-29Method, system and storage medium for generating cell image density map

Country Status (1)

CountryLink
CN (1)CN115457546A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JPH0696192A (en)*1992-09-101994-04-08Sumitomo Metal Ind Ltd Nuclear extraction method
CN107389536A (en)*2017-07-312017-11-24上海纳衍生物科技有限公司Fluidic cell particle classifying method of counting based on density distance center algorithm
FR3082982A1 (en)*2018-06-212019-12-27Centre National De La Recherche Scientifique (Cnrs) METHOD FOR DETERMINING THE INFILTRATION OF BIOLOGICAL CELLS INTO A BIOLOGICAL OBJECT OF INTEREST
CN114764762A (en)*2020-12-302022-07-19富泰华工业(深圳)有限公司Cell density classification method and device, electronic device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JPH0696192A (en)*1992-09-101994-04-08Sumitomo Metal Ind Ltd Nuclear extraction method
CN107389536A (en)*2017-07-312017-11-24上海纳衍生物科技有限公司Fluidic cell particle classifying method of counting based on density distance center algorithm
FR3082982A1 (en)*2018-06-212019-12-27Centre National De La Recherche Scientifique (Cnrs) METHOD FOR DETERMINING THE INFILTRATION OF BIOLOGICAL CELLS INTO A BIOLOGICAL OBJECT OF INTEREST
CN114764762A (en)*2020-12-302022-07-19富泰华工业(深圳)有限公司Cell density classification method and device, electronic device and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
BO LI ET.AL.: "Exponential distance transform maps for cell localization", ENGINEERING APPLICATIONS OF ARTIFICIAL INTELLIGENCE, 30 June 2024 (2024-06-30)*
DINGKANG LIANG ET.AL.: "(Focal Inverse Distance Transform Maps for Crowd Localization and Counting in Dense Crowd", COMPUTER VISION AND PATTERN RECOGNITION, 18 March 2021 (2021-03-18), pages 1 - 7*
夏威;单洪明;: "采用密度估计进行物体计数", 计算机科学与探索, no. 11, 15 May 2013 (2013-05-15)*
王伟智;刘秉瀚;施作霖;: "基于HSV空间的肿瘤免疫组化阳性目标自动提取分析", 中国体视学与图像分析, no. 01, 30 March 2006 (2006-03-30)*

Similar Documents

PublicationPublication DateTitle
CN108986050B (en)Image and video enhancement method based on multi-branch convolutional neural network
CN110781924B (en)Side-scan sonar image feature extraction method based on full convolution neural network
CN111028327B (en) A processing method, device and equipment for a three-dimensional point cloud
CN105701508B (en)Global local optimum model and conspicuousness detection algorithm based on multistage convolutional neural networks
JP2023545199A (en) Model training method, human body posture detection method, apparatus, device and storage medium
CN113420643A (en)Lightweight underwater target detection method based on depth separable cavity convolution
CN114463492A (en) A deep learning-based adaptive channel attention 3D reconstruction method
CN114511041B (en) Model training method, image processing method, apparatus, equipment and storage medium
CN111260660B (en)3D point cloud semantic segmentation migration method based on meta-learning
CN115953330B (en)Texture optimization method, device, equipment and storage medium for virtual scene image
CN120277279B (en) A collaborative filtering recommendation method based on spectral graph neural network
CN110659724B (en) Construction Method of Deep Convolutional Neural Network for Target Detection Based on Target Scale
CN119888174A (en)Target detection method for surface defects of steel plate
CN114821140A (en) Image clustering method, terminal device and storage medium based on Manhattan distance
CN112200310B (en) Intelligent processor, data processing method and storage medium
CN115937381A (en)Dynamic drawing and rendering method based on three-dimensional model
Liu et al.Arctangent entropy: a new fast threshold segmentation entropy for light colored character image on semiconductor chip surface
CN118351516A (en)Head posture estimation method, device, equipment and vehicle
CN115457546A (en)Method, system and storage medium for generating cell image density map
CN116206212B (en) A SAR image target detection method and system based on point features
CN117475055A (en)Agent learning method, system, equipment and medium
CN116977285A (en)Point cloud quality assessment method based on non-local geometric and color gradient aggregation diagram
CN115995024A (en) Image Classification Method Based on Graph-like Neural Network
CN112598043B (en) A Cooperative Saliency Detection Method Based on Weakly Supervised Learning
CN116721250A (en)Medical image graffiti segmentation algorithm based on low-quality pseudo tag refinement

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp