Cell counting method, device, computer device, storage medium and product

By training single-cell reference area and image processing technology, the cell counting method is optimized, and the problem of time-consuming and insufficient accuracy of counting in traditional methods is solved, and efficient and accurate cell counting is achieved, which is suitable for a variety of scenarios.

CN119273685BActive Publication Date: 2025-07-25ZJU HANGZHOU GLOBAL SCI & TECH INNOVATION CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411795808.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-07-25
Estimated Expiration
2044-12-09

AI Technical Summary

Technical Problem

Traditional cell counting methods are time-consuming and susceptible to subjective influence by observers. Automatic cell image analysis methods are less efficient and have insufficient accuracy when processing complex images and cell clusters. Conventional deep learning methods require high computing power and high requirements for building embedded systems.

Method used

By obtaining cell image samples, the single-cell reference area is trained using the target loss function to optimize the difference between the cell area and the single-cell reference area. Based on this, the number of cells is determined, combined with image preprocessing, threshold segmentation and morphological operations, and counting accuracy and efficiency are improved.

Benefits of technology

It significantly improves the accuracy and efficiency of cell counting, especially when dealing with cell clusters and complex backgrounds, and is suitable for accurate counting in static and flowing states.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273685B_ABST
    Figure CN119273685B_ABST
Patent Text Reader

Abstract

This application relates to a cell counting method, device, computer device, storage medium and product. The method includes: First, obtaining a target cell image of a cell sample to be counted; Then, based on the total area of the cell regions in the image and the single-cell reference area, calculating the number of cells in the target image. Among them, the single-cell reference area is obtained through training with a cell image sample and a target loss function. The target loss function is used to measure the difference between the total area of the cell regions (representing the cell area) in the cell image sample and an integer multiple of the single-cell reference area. This application is trained with a cell image sample, and by reducing the value of the loss function, the parameter of the single-cell reference area is optimized. The optimized single-cell reference area can be used to calculate the number of cells in each cell region in the image, which not only significantly improves the accuracy and efficiency of cell counting, especially when dealing with cell clusters and complex backgrounds, showing superior performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical fields of computer vision and image processing, and particularly relates to a cell counting method, apparatus, computer device, storage medium, and product. Background Art

[0002] Cell counting and image analysis are important links in biological cell research. Traditional cell counting methods mainly rely on manual counting one by one under a microscope. This method is time-consuming and easily affected by the subjective judgment of observers, resulting in uncertainty in the accuracy of the results. With the development of computer vision technology, automated cell image analysis methods have gradually become a research hotspot. Although the automated cell image analysis methods in related technologies improve the counting efficiency, there are still problems of low efficiency and insufficient accuracy when dealing with complex images and cell clusters. Conventional deep learning object detection methods require a large number of manually annotated images for training, and the generated model files are relatively large, with high requirements for the computing power of inference devices, and high requirements for building a high-performance embedded system. Summary of the Invention

[0003] Based on this, it is necessary to provide a cell counting method, apparatus, computer device, storage medium, and product that can improve the processing efficiency and accuracy for the above technical problems.

[0004] In a first aspect, the present application provides a cell counting method. The method includes:

[0005] Obtain a target cell image of a cell sample to be counted;

[0006] Based on the cell area and the single-cell reference area of the cell region in the target cell image, determine the number of cells in the target cell image;

[0007] Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area.

[0008] In one embodiment, the single-cell reference area is obtained through the following steps:

[0009] Obtain a cell image sample;

[0010] Based on the target loss function, determine the difference between the cell area of each cell region in the cell image sample and an integer multiple of the single-cell reference area;

[0011] With the goal of reducing the difference, perform parameter optimization on the single-cell reference area.

[0012] In one embodiment, determining the difference between the cell area of each cell region and an integer multiple of the single-cell reference area from the cell image samples based on the target loss function includes:

[0013] For each of the cell regions, respectively determine the ratio of the cell area of each cell region to the single-cell reference area;

[0014] Compare the ratio and the adjacent integer corresponding to the ratio to obtain the comparison result of each cell region;

[0015] Determine the difference by combining the comparison results of each cell region.

[0016] In one embodiment, determining the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area includes:

[0017] For each cell region in the target cell image, based on the cell area of each cell region and the single-cell reference area, determine the number of cells corresponding to each cell region;

[0018] Obtain the number of cells in the target cell image by combining the number of cells corresponding to each cell region.

[0019] In one embodiment, obtaining the target cell image of the cell sample to be counted includes:

[0020] Obtain the original cell image of the cell sample to be counted;

[0021] Preprocess the original cell image by using a noise reduction method to obtain a preprocessed cell image;

[0022] Perform color space conversion and threshold segmentation on the preprocessed cell image to obtain a binary cell image;

[0023] Perform morphological operation on the binary cell image by using an erosion operation method to obtain the target cell image.

[0024] In one embodiment, after obtaining the target cell image of the cell sample to be counted, it further includes:

[0025] Detect the cell contour of the cell region in the target cell image;

[0026] Determine the cell area of the cell region by using the contour area of the cell contour.

[0027] In a second aspect, the present application further provides a cell counting device. The device includes:

[0028] An acquisition module, configured to acquire a target cell image of cells to be counted;

[0029] A determination module, configured to determine the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area;

[0030] Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area.

[0031] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0032] Acquire a target cell image of cells to be counted;

[0033] Determine the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area;

[0034] Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0036] Acquire a target cell image of cells to be counted;

[0037] Determine the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area;

[0038] Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area.

[0039] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0040] Acquire a target cell image of cells to be counted;

[0041] Determine the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area;

[0042] Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area.

[0043] The above cell counting method, device, computer device, storage medium and product achieve cell counting through the following steps: First, obtain a target cell image of a cell sample to be counted; then, calculate the number of cells in the target image based on the total area of the cell region in the image and the single-cell reference area. Among them, the single-cell reference area is obtained by training with a cell image sample and a target loss function. The target loss function is used to measure the difference between the total area of the cell region in the cell image sample (representing the cell area) and an integer multiple of the single-cell reference area. In an ideal situation (that is, the flat two-dimensional plane structure formed by the forced formation of cell clusters in the microfluidic chip channel), the area of a single cell or cell cluster is linearly proportional to the number of cells it contains, and the area of a single cell or cell cluster is usually close to an integer multiple of the single-cell area. Based on this characteristic, the present application is trained with a cell image sample, and by reducing the value of the loss function, the parameter of the single-cell reference area is optimized. The optimized single-cell reference area can be directly used to calculate the cell count of each cell region in the target cell image. This method not only significantly improves the accuracy and efficiency of cell counting, especially when dealing with cell clusters and complex backgrounds, but also shows superior performance; by optimizing the calculation process and model parameters, the present application effectively overcomes the limitations of traditional cell counting methods in terms of efficiency and accuracy, providing a more reliable and efficient solution for cell image analysis.

[0044] Furthermore, through the above cell counting method, device, computer device, storage medium and product, it is not only possible to achieve precise and efficient counting of a cell sample to be counted in a static and in-situ state (such as a fluorescence micrograph), but also to achieve accurate and efficient counting in a flowing and real-time state (such as a fluorescence microvideo). This greatly improves the applicable range of this method for multiple scenarios. Description of the Drawings

[0045] Figure 1 It is an application environment diagram of the cell counting method in an embodiment;

[0046] Figure 2 It is a flow schematic diagram of the cell counting method in an embodiment;

[0047] Figure 3Schematic flowchart of steps for determining the reference area of a single cell in an embodiment;

[0048] Figure 4 Schematic flowchart of steps for determining differences in an embodiment;

[0049] Figure 5 Schematic flowchart of a cell counting method in another embodiment;

[0050] Figure 6 Structural block diagram of a cell counting device in an embodiment;

[0051] Figure 7 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0052] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0053] Computer Vision Technology (CV): Computer vision is a science that studies how to enable machines to "see". Further, it refers to using cameras and computers to replace human eyes for tasks such as object recognition, tracking, and measurement in machine vision, and further performing graphic processing to make the computer-processed images more suitable for human eyes to observe or be transmitted to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies and attempts to establish artificial intelligence systems that can obtain information from images or multi-dimensional data. Computer vision technology usually includes technologies such as image processing, image recognition, image semantic understanding, image retrieval, OCR (Optical Character Recognition), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, etc., and also includes common biometric recognition technologies such as face recognition and fingerprint recognition.

[0054] Machine Learning (ML) is an interdisciplinary field that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent, and its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.

[0055] The technical solution provided by the embodiments of this application relates to the fields of computer vision and image processing technologies. Computer vision technology is used to perform image processing and analysis on the cell images of the cell samples to be detected, and finally determine the number of cells in the cell images.

[0056] The cell counting method provided by the embodiments of this application can be applied to Figure 1 the application environment shown as follows. This application environment includes a microscope 102 and a terminal 104. Optionally, it may further include a server 106. The microscope 102 can be an ordinary optical microscope. The operator of the microscope 102 can collect the microscopic image in the eyepiece of the microscope 102 through an image acquisition component (such as a camera or other devices integrated with a camera).

[0057] For example, a photographic cassette can be integrated on the above-mentioned microscope 102. The operator of the microscope 102 can take a microscopic image in the eyepiece of the microscope 102 through the camera installed on the photographic cassette, and then import the microscopic image taken by the camera into the terminal 104 or the server 106 through the image output interface integrated in the camera.

[0058] Alternatively, the above-mentioned microscope 102 can also be an electron microscope integrated with an image acquisition component. The electron microscope also provides an external image output interface. The operator of the microscope 102 operates the image acquisition function of the electron microscope to collect the microscopic image in the eyepiece of the microscope 102, and imports the microscopic image into the terminal 104 through the image output interface.

[0059] Among them, the above-mentioned image output interface can be a wired interface, such as a USB (Universal Serial Bus) interface, an HDMI (High Definition Multimedia Interface) interface, or an Ethernet interface, etc.; or, the above-mentioned image output interface can also be a wireless interface, such as a WLAN (Wireless Local Area Network) interface, a Bluetooth interface, etc.

[0060] Correspondingly, according to the different types of the above-mentioned image output interfaces, there can be various ways for the operator to export the microscopic image taken by the camera. For example, the microscopic image can be imported into the terminal 104 through a wired or short-distance wireless method, or it can also be imported into the terminal 104 or the server 106 through a local area network or the Internet.

[0061] An application for obtaining and presenting the processing result of a microscopic image may be installed in the terminal 104. After the terminal 104 obtains the microscopic image in the eyepiece of the microscope 102, it may obtain the processing result obtained by processing the microscopic image through the above application and present the processing result.

[0062] Among them, the terminal 104 may be a terminal device with certain processing capabilities and interface display functions. For example, the terminal 104 may be a mobile phone, a tablet computer, an e-book reader, smart glasses, a laptop computer, a desktop computer, and so on.

[0063] In Figure 1 In the application environment shown, the terminal 104 and the microscope 102 are physically separate entity devices. In a possible implementation, the terminal 104 and the microscope 102 may also be integrated into a single entity device; for example, the microscope 102 may be a smart microscope with the computing and interface display functions of the terminal 104, or the microscope 102 may be a smart microscope with the computing power of the terminal 104, and the smart microscope may output the image processing result through a wired or wireless interface.

[0064] Among them, the server 106 is a server, or consists of several servers, or is a virtualization platform, or is a cloud computing service center.

[0065] Among them, the above server 106 may be a server that provides background services for the application installed in the terminal 104 or the microscope 102. The background server may manage the version of the application, perform background processing on the microscopic image obtained by the application and return the processing result, and so on.

[0066] Optionally, the terminal 104 is connected to the server 106 through a communication network. Optionally, the microscope 102 is connected to the server 106 through a communication network. Optionally, the communication network is a wired network or a wireless network.

[0067] For the convenience of introduction, the following will be described by taking the execution of the embodiments of the present application by a computer device as an example. The computer device is an electronic device with computing and processing capabilities. The computer device may be a single device. For example, it may be Figure 1 the terminal 104 or the server 106 in the application environment shown; or, the computer device may also be a collection of multiple devices. For example, the computer device may include the terminal 104 and the server 106 in the above Figure 1 shown system, that is, the embodiments of the present application may be executed by the interaction of the above terminal 104 and the server 106.

[0068] In one embodiment, as Figure 2As shown, a cell counting method is provided, including the following steps:

[0069] Step 202, obtain a target cell image of the cell sample to be counted.

[0070] Among them, the target cell image can refer to a microscopic image for cell counting, or it can be an image of the target counting area circled in the microscopic image.

[0071] Exemplarily, the cell sample to be counted is stained with a fluorescent dye or a specific label to enhance the visibility of the cells. The computer device can obtain a microscopic image of the fluorescently stained or labeled cell sample under the microscope field of view through the microscope, so as to obtain the target cell image.

[0072] Step 204, determine the number of cells in the target cell image based on the cell area and the single-cell reference area of the cell regions in the target cell image.

[0073] Among them, the cell region can refer to the image part in the target cell image that can reflect the location of the cell and is significantly distinguishable from the background region, and it can be the region enclosed by the cell boundary.

[0074] Generally, the target cell image includes multiple cell regions, and each cell region may correspond to a single cell or a cell cluster formed by multiple cells. It can be understood that the cell population in the cell sample to be counted is usually the same type of cells in the same growth cycle, and the volume sizes of the individual cells are usually similar, that is, the contour sizes of each cell under the microscope are similar. Then, the area size of the cell region corresponding to the cell cluster is in a proportional relationship with the number of cells included in the cell cluster. Based on this, the single-cell reference area corresponding to the cell sample to be counted is determined in advance in the embodiments of the present application, and the single-cell reference area is used as a standard for comparing and estimating the typical area of a single cell in the cell sample to be counted.

[0075] The single-cell reference area in the embodiments of the present application is pre-trained through an image sample of the same cell sample as the cell sample to be counted and a target loss function. Since a cell cluster includes multiple independent cells and the area contributed by each cell is basically the same, theoretically, the area of the cell cluster is close to an integer multiple of the single-cell area. The embodiments of the present application use the target loss function to guide the optimization of the single-cell reference area parameter so that the relationship between the cell area of each cell region and the single-cell reference area most conforms to the integer multiple condition.

[0076] For example, taking the minimization of the target loss function as the goal to update the single-cell reference area, that is, the sum of the differences corresponding to each cell region should be as small as possible. Among them, the difference corresponding to a single cell region refers to the difference between the cell area of the cell region and the integer multiple of the single-cell reference area closest to it.

[0077] Exemplarily, the computer device can pre-obtain or store the single-cell reference area corresponding to the cell sample to be counted. During the cell counting process, the computer device compares the single-cell reference area with the cell areas of each cell region in the target cell image, so as to distinguish whether each cell region corresponds to a single cell or a cell cluster, and further determine the number of cells in the cell region corresponding to the cell cluster, thereby obtaining the total number of cells in the target cell image.

[0078] The above cell counting method realizes cell counting through the following steps: First, obtain the target cell image of the cell sample to be counted; then, calculate the number of cells in the target image based on the total area of the cell regions in the image and the single-cell reference area. Among them, the single-cell reference area is obtained by training with a cell image sample and a target loss function. The target loss function is used to measure the difference between the total area of the cell regions in the cell image sample (representing the cell area) and an integer multiple of the single-cell reference area. In an ideal situation (that is, the flat two-dimensional plane structure formed by the forced formation of cell clusters in the microfluidic chip channel), the area of a single cell or cell cluster has a linear proportional relationship with the number of cells it contains, and the area of a single cell or cell cluster is usually close to an integer multiple of the single-cell area. Based on this characteristic, the embodiments of the present application are trained with cell image samples, and by reducing the value of the loss function, the parameter of the single-cell reference area is optimized. The optimized single-cell reference area can be directly used to calculate the cell count of each cell region in the target cell image. This method not only significantly improves the accuracy and efficiency of cell counting, especially when dealing with cell clusters and complex backgrounds, showing excellent performance; by optimizing the calculation process and model parameters, the embodiments of the present application also effectively overcome the limitations of traditional cell counting methods in terms of efficiency and accuracy, providing a more reliable and efficient solution for cell image analysis.

[0079] Furthermore, through the above cell counting method, device, computer device, storage medium and product, it is not only possible to achieve accurate and efficient counting of the cell sample to be counted in a static and in-situ state (such as a fluorescence microscopic picture), but also to achieve accurate and efficient counting in a flowing and real-time state (such as a fluorescence microscopic video). This greatly improves the applicable range of this method for multiple scenarios.

[0080] The following will further introduce the determination process of the single-cell reference area in the embodiments of the present application.

[0081] In one embodiment, as Figure 3 shown, the single-cell reference area is obtained through the following steps:

[0082] Step 302, obtain a cell image sample.

[0083] Understandably, a cell image sample refers to an image sample of a cell sample that is the same as the cell sample to be counted. Alternatively, the cell image sample may include a target cell image.

[0084] Step 304: Based on the target loss function, determine the difference between the cell area of the cell region and an integer multiple of the single-cell reference area from the cell image sample.

[0085] Exemplarily, the computer device may set an initial single-cell reference area as an initial parameter. Based on the target loss function and the initial single-cell reference area, for each cell region, calculate the difference between its cell area and the integer multiple of the single-cell reference area closest to it, and then combine the sum of the differences corresponding to each cell region in a large number of cell image samples, so as to obtain the difference between the cell area of the cell region and an integer multiple of the single-cell reference area.

[0086] Step 306: With the goal of reducing this difference, perform parameter optimization on the single-cell reference area.

[0087] Exemplarily, in each iterative training, the computer device calculates this difference based on the target loss function and the current single-cell reference area, and then adjusts the single-cell reference area through an optimization algorithm (such as the gradient descent method, the enumeration method, or other suitable methods) until the difference is less than a preset loss threshold or the number of iterative training reaches a preset number of iterations.

[0088] In a possible implementation manner of the embodiment shown in Figure 3 As shown, based on the target loss function, determining the difference between the cell area of each cell region and an integer multiple of the single-cell reference area from the cell image sample includes: Figure 4 As shown, based on the target loss function, determining the difference between the cell area of each cell region and an integer multiple of the single-cell reference area from the cell image sample includes:

[0089] Step 402: For each cell region, respectively determine the ratio of the cell area of each cell region to the single-cell reference area.

[0090] Step 404: Compare the ratio and the adjacent integer corresponding to the ratio to obtain the comparison result of each cell region.

[0091] Wherein, the adjacent integer corresponding to the ratio refers to the integer closest to the ratio.

[0092] Step 406: Combine the comparison results of each cell region to determine this difference.

[0093] Exemplarily, for each cell region, the computer device divides the cell area of each cell region by the single-cell reference area to obtain the ratio corresponding to each cell region. Then, in combination with the difference between each ratio and the integer closest to it, the final difference value is determined.

[0094] For example, the target loss function can be expressed as:

[0095] ;

[0096] ;

[0097] where, i is the cell contour index representing the cell region, n is the number of found contours, i.e., the number of cell regions, S i is the cell area corresponding to the i th cell contour, s is the single - cell reference area parameter, k i is an intermediate variable.

[0098] Optionally, the cell image sample is a microscopic image of a cell sample at a first microscope magnification, and the target cell image is a microscopic image of the cell sample at a second microscope magnification. The first microscope magnification and the second microscope magnification can be the same, or, the first microscope magnification and the second microscope magnification can also be different. In the case where the first microscope magnification and the second microscope magnification are different, the computer device will perform corresponding conversion on the single - cell reference area obtained by training the cell image sample and the target loss function based on the proportional relationship between the first microscope magnification and the second microscope magnification, so as to determine the single - cell reference area for determining the number of cells in the target cell image.

[0099] In some preferred embodiments, the first microscope magnification and the second microscope magnification are the same, that is, a cell image with the same microscope magnification as the target cell image is used as a sample to train and optimize to determine the single - cell reference area parameter, thereby further improving the accuracy of cell counting.

[0100] In some other preferred embodiments, before obtaining the target cell image or the cell image sample, the present application embodiment can try to control the cells in the microscope field of view to be flat, to a certain extent avoiding the formation of a three - dimensional structure of cell clusters, that is, preventing the cells from overlapping in the microscope field - of - view direction, thereby further improving the accuracy of the cell counting method provided by the present application embodiment. For example, when preparing a microscope sample, the cell suspension can be diluted to an appropriate concentration to make the cells evenly distributed on the slide and reduce the aggregation phenomenon; or, when using a microchannel device, through the planar microchannel in the microfluidic chip, the flow channel depth of the microfluidic chip can be set to be slightly larger than the diameter of the cells to control the movement and distribution of the cells in a two - dimensional plane to avoid stacking.

[0101] In one embodiment, asFigure 5 As shown, a cell counting method is provided, which includes:

[0102] Step 502, obtaining an original cell image of the cell sample to be counted.

[0103] For example, after the cell sample to be counted is fluorescently labeled, the cells in the microfluidic chip channel are imaged by a fluorescence confocal microscope to obtain the original cell image. The fluorescence confocal microscope can obtain high-resolution images by labeling the sample with fluorescein and can observe the process of biochemical reactions inside the cells without damage. The fluorescence confocal microscope can be an intelligent microscope with terminal computing and interface display functions, or can output the original cell image to a terminal or a server through an interface.

[0104] Step 504, preprocessing the original cell image by a method of reducing noise to obtain a preprocessed cell image.

[0105] For example, the computer device applies Gaussian blur to the original cell image using the cv.GaussianBlur function of the OpenCV library. The purpose of Gaussian blur is to reduce image noise and enhance the smoothness of the image, providing a clearer image for subsequent image processing steps. The degree of blur can be determined by the size and standard deviation of the Gaussian kernel.

[0106] Step 506, performing color space conversion and threshold segmentation on the preprocessed cell image to obtain a binary cell image.

[0107] For example, the computer device uses the cv.cvtColor function of the OpenCV library to convert the preprocessed cell image from the BGR color space to the HSV color space. The HSV color space is more suitable for image segmentation based on color features because it separates color information and brightness information. Next, the computer device determines the ranges of hue (H), saturation (S), and brightness (V) of the cells according to the distribution characteristics of the cells in the HSV color space, determines the HSV value distribution of the cells through experiments or statistical analysis, and thus sets appropriate thresholds. Then, using the cv.inRange function, the cells are segmented from the background according to the set HSV thresholds to obtain a binary cell image. The cv.inRange function sets the pixel points in the image that fall within the threshold range to white and the rest to black, thus achieving the preliminary segmentation of the cells.

[0108] Step 508, performing morphological operations on the binary cell image by a method of erosion operation to obtain a target cell image.

[0109] For example, a computer device uses the cv.erode function to perform an erosion operation on a binarized cell image. The erosion operation can remove small noise points and reduce the boundaries of cell objects. Then, the cv.dilate function is used to perform a dilation operation on the eroded image. The dilation operation can connect adjacent cells and fill small holes inside cell objects.

[0110] Step 510: Detect the cell contours in the cell regions of the target cell image, and determine the cell area of the cell regions based on the contour areas of the cell contours.

[0111] For example, a computer device uses the cv.findContours function to detect the contours in the target cell image. This function can return a list of all the contours in the image. The computer device analyzes the detected contours and calculates the area of each contour as the cell area of the corresponding cell region.

[0112] Step 512: Determine the number of cells in the target cell image based on the cell areas of all the cell regions in the target cell image and the single-cell reference area of the cell sample at the current microscope magnification.

[0113] Exemplarily, for each cell region in the target cell image, based on the cell area of each cell region and the single-cell reference area, determine the number of cells corresponding to each cell region. Combine the number of cells corresponding to each cell region to obtain the number of cells in the target cell image.

[0114] For example, divide the area of each contour (which may be the contour of a single cell or a cell cluster) by the single-cell reference area. After rounding the division result to the nearest integer, it is the number of cells of the cell contour (the division result of a single cell is close to 1). Sum up the number of cells corresponding to all cell contours to obtain the number of cells in the target cell image.

[0115] In this embodiment, through the image preprocessing function, threshold segmentation function, morphological operation function, and contour detection function, it is possible to accurately extract the target cell regions from complex microscope images, providing a reliable basis for subsequent cell counting. Directly using the optimized single-cell reference area for calculating the cell count of each cell region in the target cell image can complete cell counting more accurately and efficiently, especially in the case of dealing with cell clusters and complex backgrounds, improving the counting efficiency and accuracy.

[0116] In a possible implementation manner of the embodiment shown in FIG. 5, the computer device of the embodiment of the present application can also provide a user-friendly interface, parameter adjustment function, and performance evaluation function, making the cell image analysis process more efficient and intuitive.

[0117] Exemplarily, the computer device displays a parameter adjustment page, which includes parameter adjustment controls, such as controls like sliders and input boxes. The computer device responds to the slider dragging operation and / or the input box input operation, obtains the adjustment parameter values corresponding to the slider dragging operation and / or the input box input operation, and adjusts the above-mentioned cell image processing process based on the adjustment parameter values. For example, the user is allowed to adjust the image processing parameters through the graphical user interface, and the parameters include HSV threshold, Gaussian blur kernel size, the number of iterations of morphological operations, etc.

[0118] Exemplarily, during the image processing process, the computer device displays an image processing speed page, which can display the frame rate (FPS) of the software program for real-time calculation by the computer device. The frame rate is an important indicator for measuring the image processing speed.

[0119] In this embodiment, the graphical user interface (GUI) of the computer device can create a graph using the PySide6 library. The GUI includes an image display area, parameter adjustment controls, a result display area, etc. The preprocessed, segmented, and morphologically operated images are displayed in the GUI, and the results of cell counting and analysis are displayed. The GUI provides controls such as sliders and input boxes, allowing the user to adjust the image processing parameters, and the parameters input by the user will be updated in real time to the image processing process.

[0120] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indication of the arrows, these steps do not necessarily have to be executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily have to be executed at the same moment, but can be executed at different moments. The execution order of these steps or stages does not necessarily have to be sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0121] Based on the same inventive concept, the embodiment of the present application also provides a cell counting device for implementing the above-mentioned cell counting method. The implementation solution provided by this device to solve the problem is similar to the implementation solution described in the above method. Therefore, the specific limitations in one or more embodiments of the following cell counting devices can refer to the limitations on the cell counting method in the above text, and will not be repeated here.

[0122] In one embodiment, as Figure 6 shown, a cell counting device is provided, including: an acquisition module 602 and a determination module 604, where:

[0123] An acquisition module 602, configured to acquire a target cell image of a cell sample to be counted.

[0124] A determination module 604, configured to determine the number of cells in the target cell image based on the cell area of the cell region in the target cell image and a single-cell reference area; wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area.

[0125] In one embodiment, the cell counting device further includes a single-cell reference area determination module, configured to acquire a cell image sample; based on the target loss function, determine the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area; and optimize the parameters of the single-cell reference area with the goal of reducing the difference.

[0126] In one embodiment, when the single-cell reference area determination module executes to determine the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area based on the target loss function, it is configured to: for each of the cell regions, respectively determine the ratio of the cell area of each cell region to the single-cell reference area; compare the ratio and the adjacent integer corresponding to the ratio to obtain the comparison result of each cell region; and determine the difference by combining the comparison results of each cell region.

[0127] In one embodiment, when the determination module 604 executes to determine the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area, it is configured to: for each cell region in the target cell image, determine the number of cells corresponding to each cell region based on the cell area of each cell region and the single-cell reference area; and obtain the number of cells in the target cell image by combining the number of cells corresponding to each cell region.

[0128] In one embodiment, when the acquisition module 602 executes to acquire a target cell image of a cell sample to be counted, it is configured to: acquire the original cell image of the cell sample to be counted; preprocess the original cell image by using a noise reduction method to obtain a preprocessed cell image; perform color space conversion and threshold segmentation on the preprocessed cell image to obtain a binary cell image; and perform a morphological operation on the binary cell image by using an erosion operation method to obtain the target cell image.

[0129] In one embodiment, the determining module 604 is further configured to detect the cell contour of the cell region in the target cell image; and determine the cell area of the cell region by using the contour area of the cell contour.

[0130] Each module in the above cell counting device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor in the computer device in hardware form or be independent of the processor, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.

[0131] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structural diagram can be as Figure 7 shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. The computer program, when executed by the processor, implements a cell counting method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the computer device housing, or an external keyboard, a touchpad, or a mouse, etc.

[0132] Those skilled in the art can understand that Figure 7 the structure shown in

[0133] is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements. In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0134] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0135] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0137] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0138] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0139] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A cell counting method, characterized in that, The method includes: Obtaining a target cell image of the cell sample to be counted; Determining the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area; Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area; The single-cell reference area is obtained through the following steps: Obtaining a cell image sample; Based on the target loss function, determining the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area; Taking reducing the difference as the goal, optimizing the parameters of the single-cell reference area; Wherein, the target loss function is expressed as: ; ; Among them, i is the cell contour index representing the cell region, n is the number of found contours, that is, the number of cell regions, S i is the cell area corresponding to the i th cell contour, s is the single-cell reference area parameter, k i is an intermediate variable.

2. The method according to claim 1, wherein Based on the target loss function, determining the difference between the cell area of each cell region in the cell image sample and an integer multiple of the single-cell reference area includes: For each of the cell regions, respectively determining the ratio of the cell area of each cell region to the single-cell reference area; Comparing the ratio with the adjacent integer corresponding to the ratio to obtain the comparison result of each cell region; Combining the comparison results of each cell region to determine the difference.

3. The method according to any one of claims 1 to 2, characterized in that Based on the cell area of the cell region in the target cell image and the single-cell reference area, determining the number of cells in the target cell image includes: For each cell region in the target cell image, determining the number of cells corresponding to each cell region based on the cell area of each cell region and the single-cell reference area; Combining the number of cells corresponding to each cell region to obtain the number of cells in the target cell image.

4. The method according to claim 1, wherein Obtaining the target cell image of the cell sample to be counted includes: Obtaining the original cell image of the cell sample to be counted; Preprocessing the original cell image by using a noise reduction method to obtain a preprocessed cell image; Performing color space conversion and threshold segmentation on the preprocessed cell image to obtain a binary cell image; Performing a morphological operation on the binary cell image by using an erosion operation method to obtain the target cell image.

5. The method according to claim 4, characterized in that, After obtaining the target cell image of the cell sample to be counted, it further includes: Detecting the cell contour of the cell region in the target cell image; Determining the cell area of the cell region by using the contour area of the cell contour.

6. A cell counting device, characterized in that, The device includes: An acquisition module for obtaining a target cell image of the cell sample to be counted; A determination module for determining the number of cells in the target cell image based on the cell area of the cell region in the target cell image and the single-cell reference area; Wherein, the single-cell reference area is obtained by training with a cell image sample and a target loss function, and the target loss function is used to indicate the difference between the cell area of the cell region in the cell image sample and an integer multiple of the single-cell reference area; The single-cell reference area is obtained through the following steps: Obtaining a cell image sample; Based on the target loss function, determine the difference between the cell area of the cell region and an integer multiple of the single-cell reference area from the cell image samples; With the goal of reducing the difference, perform parameter optimization on the single-cell reference area; wherein, the target loss function is expressed as: ; ; Among them, i is the cell contour index for characterizing the cell region, n is the number of found contours, that is, the number of cell regions, S i is the i cell area corresponding to the s th cell contour, k i is an intermediate variable.

7. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

9. A computer program product, comprising a computer program, characterized in that, When this computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Medical image processing method and device, computer equipment and storage medium

    CN112419295A

  • Method and device for determining cell density of sample

    CN117218139A