Sperm identification method, device, electronic equipment and medium
The method employs sperm head recognition and target tracking with Euclidean distance analysis to accurately identify sperm in video images, addressing misidentification issues and improving sperm identification accuracy.
Patent Information
- Application Number
- CN202410352409.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-03-26
AI Technical Summary
Existing sperm identification methods are prone to misidentification due to the influence of impurities and do not accurately account for the swimming characteristics of sperm, leading to inaccurate sperm identification.
A method involving sperm head recognition, target tracking, and Euclidean distance calculation to identify sperm in a swimming state, using video images captured under a microscope, which includes selecting a reference frame, performing sperm head recognition, tracking candidate sperms in subsequent frames, and determining real sperms based on maximum Euclidean distance exceeding a preset threshold.
Accurately identifies sperm in a swimming state, significantly reducing impurity misidentification rates and enhancing the precision of sperm identification in dynamic video images.
Smart Images

Figure CN118469898B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video image processing, and in particular to a sperm identification method, device, electronic equipment and medium. Background Art
[0002] With the continuous improvement of computer data processing capabilities and the rapid development of computer image processing technology, computer-assisted analysis of sperm quality has also been widely used. Computer-assisted analysis of sperm quality mainly includes the following processing steps: acquisition of microscopic sequence images, sperm segmentation and identification, and sperm quality analysis. Sperm segmentation and identification are the prerequisites for sperm quality analysis. Since sperm images contain a large amount of impurities in addition to semen and sperm, accurate identification of sperm from sperm images plays a vital role in molecular sperm quality.
[0003] At present, there are mainly two types of existing sperm identification: one is to find sperm by distinguishing the brightness in the image field of view, but this method is easily affected by impurities, resulting in the misidentification of impurities as sperm; the other is to find real sperm by setting reference characteristic values and reference tail lengths for sperm. However, this method does not take into account the swimming characteristics of sperm. The length and shape of the tail will change during the swimming process. The sperm characteristic value and tail length threshold greatly affect the accuracy of sperm identification. If the setting value is inaccurate, sperm identification is likely to be missed. Summary of the invention
[0004] The present invention provides a sperm identification method, device, electronic equipment and medium, which are used to solve the defects in the prior art that sperm identification is easily affected by impurities and is inaccurately identified, and realize accurate identification of swimming sperm in combination with target tracking.
[0005] According to a first aspect of the present invention, the present invention provides a sperm identification method, the method comprising:
[0006] Acquire a sperm swimming video image, and select a frame from the sperm swimming video image as a reference frame;
[0007] Performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm;
[0008] Based on the candidate head contour corresponding to each candidate sperm, target tracking is performed on the remaining frames of the sperm swimming video image to obtain the tracking area of each candidate sperm in each remaining frame;
[0009] Searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame;
[0010] For each candidate sperm, respectively, the Euclidean distance between the center of the sperm outline in adjacent frames is calculated to obtain the maximum Euclidean distance corresponding to each candidate sperm;
[0011] When the maximum Euclidean distance corresponding to any candidate sperm exceeds the preset distance, it is determined that the any candidate sperm is a real sperm.
[0012] In some possible implementations, acquiring a sperm swimming video image and selecting a frame from the sperm swimming video image as a reference frame includes:
[0013] Recording the video under the microscope lens with a preset magnification by a camera to obtain the video image of the sperm swimming;
[0014] Any frame of the sperm swimming video image is used as the reference frame.
[0015] In some possible implementations, performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm includes:
[0016] converting the reference frame into a first grayscale image;
[0017] Calculating a cumulative probability function of pixel values in the first grayscale image;
[0018] Performing inflection point detection on the cumulative probability function to obtain a plurality of inflection points and a pixel value corresponding to each inflection point;
[0019] Determine a target pixel value according to the pixel values corresponding to each inflection point and the background of the first grayscale image, and set the target pixel value as a fixed threshold of a fixed threshold algorithm;
[0020] Using the fixed threshold algorithm to perform binarization processing on the first grayscale image to obtain a first processed image;
[0021] The contour detection algorithm is used to extract the contour of the first processed image, and each extracted contour is regarded as a candidate head contour of a candidate sperm.
[0022] In some possible implementations, determining the target pixel value according to the pixel values corresponding to the respective inflection points and the background of the first grayscale image includes:
[0023] In response to the background of the first grayscale image being white, taking the minimum value of the pixel values corresponding to the inflection point between ten and one hundred as the target pixel value;
[0024] In response to the background of the first grayscale image being black, the maximum value of the pixel values corresponding to the inflection points between 200 and 250 is taken as the target pixel value.
[0025] In some possible implementations, the target tracking of the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm to obtain the tracking area of each candidate sperm in each remaining frame includes:
[0026] Taking each candidate sperm as a target object in a traversal manner, and performing the following operations on the target object: calculating the circumscribed ellipse of the candidate head contour corresponding to the target object, taking the center of the circumscribed ellipse as the center point of the head contour of the target object in the reference frame, and obtaining a square area with the center point of the head contour as the center and a side length equal to a preset length;
[0027] The square area corresponding to each candidate sperm is set as the tracking area of the multi-target tracking algorithm;
[0028] The multi-target tracking algorithm is used to obtain the tracking area of each candidate sperm in each remaining frame of the sperm swimming video image except the reference frame.
[0029] In some possible implementations, searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame includes:
[0030] Each tracking area is taken as a target area in a traversal manner, and the following operations are performed on the target area: the image corresponding to the target area is converted into a second grayscale image; the second grayscale image is binarized using an adaptive threshold algorithm to obtain a second processed image; the contour of the second processed image is extracted using a contour detection algorithm to obtain a sperm contour;
[0031] The center point of the sperm outline of each candidate sperm in each remaining frame is calculated to obtain the sperm outline center of each candidate sperm in each remaining frame.
[0032] In some possible implementations, before the step of calculating the center point of the sperm contour of each candidate sperm in each remaining frame, the method further screens the sperm contour by the following steps:
[0033] Taking each remaining frame as a reference frame, and returning to perform the step of performing sperm head recognition on the reference frame, to obtain a candidate head contour of each candidate sperm in each remaining frame;
[0034] Calculate the center of the circumscribed ellipse of the candidate head contour of each remaining frame to obtain the center point of the head contour of each candidate sperm in each remaining frame;
[0035] Determine whether the center point of the head contour of each candidate sperm in each remaining frame is located inside the sperm contour of the corresponding sperm in the corresponding frame;
[0036] If so, the corresponding sperm outline is retained;
[0037] If not, delete the corresponding sperm contour.
[0038] According to a second aspect of the present invention, the present invention further provides a sperm identification device, the device comprising:
[0039] An acquisition module is used to acquire a sperm swimming video image and select a frame from the sperm swimming video image as a reference frame;
[0040] A sperm head recognition module, used to perform sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm;
[0041] A tracking module, used for tracking the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm, to obtain the tracking area of each candidate sperm in each remaining frame;
[0042] A search module, used for searching the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame;
[0043] A calculation module, used for calculating the Euclidean distance of the center of the sperm contour in adjacent frames for each candidate sperm, and obtaining the maximum Euclidean distance corresponding to each candidate sperm;
[0044] The determination module is used to determine that any candidate sperm is a real sperm when the maximum Euclidean distance corresponding to the any candidate sperm exceeds a preset distance.
[0045] According to the third aspect of the present invention, the present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a sperm identification method as described above is implemented.
[0046] According to a fourth aspect of the present invention, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the sperm identification methods described above.
[0047] The present invention provides a sperm identification method, which selects a frame from a sperm swimming video image as a reference frame, then performs sperm head identification on the reference frame to obtain multiple candidate sperms and candidate head contours corresponding to each candidate sperm, then performs target tracking on the candidate sperm in the remaining frames to obtain the tracking area of each candidate sperm in each remaining frame, then performs contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame, and finally calculates the Euclidean distance between the sperm contour centers of each candidate sperm in adjacent frames to obtain the maximum Euclidean distance corresponding to each candidate sperm, and takes the candidate sperm whose maximum Euclidean distance exceeds a preset distance as a true sperm, thereby achieving accurate identification of sperm in a swimming state, significantly reducing the impurity misidentification rate, and enriching the existing sperm identification method of dynamic sperm swimming video images.
[0048] In addition, a sperm identification device, an electronic device and a non-transitory computer-readable storage medium provided by the present invention can also achieve the above-mentioned technical effects, which will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 It is a schematic diagram of the flow chart of the sperm identification method provided by the present invention;
[0051] Figure 2 It is a schematic diagram of the process of obtaining sperm swimming video images and reference frames provided by the present invention;
[0052] Figure 3 It is a schematic diagram of the process of sperm head identification provided by the present invention;
[0053] Figure 4 It is a schematic diagram of the process of tracking the candidate sperm target provided by the present invention;
[0054] Figure 5 This is a schematic diagram of sperm outline center search provided by the present invention;
[0055] Figure 6 It is a schematic diagram of the process of sperm profile screening provided by the present invention;
[0056] Figure 7 It is a schematic diagram of the structure of the sperm identification device provided by the present invention;
[0057] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] Combine the following Figures 1 to 8 The invention describes a sperm identification method, a sperm identification device, an electronic device and a non-transitory computer-readable storage medium.
[0060] Figure 1 This is a schematic diagram of the sperm identification method provided by the present invention. Please refer to Figure 1 As shown, this embodiment provides a sperm identification method, which can be implemented through steps S101 to S106. Each step will be described in detail below:
[0061] Step S101, obtaining a sperm swimming video image, and selecting a frame from the sperm swimming video image as a reference frame.
[0062] In this embodiment, the sperm swimming video image refers to an image of sperm swimming in semen taken under a microscope, and the sperm swimming video image can be acquired through existing video acquisition equipment, such as a professional video recorder, a terminal with a video recording function, or a camera. The frame rate and clarity of the sperm swimming video image can meet the requirements. The reference frame refers to a frame of image selected from the sperm swimming video image for reference, and the reference frame belongs to the sperm swimming video image.
[0063] Step S102, performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm.
[0064] In this embodiment, performing sperm head recognition on the reference frame refers to identifying the area in the reference image that meets the characteristics of the sperm head and extracting the outline of the identified sperm head. The head recognition can adopt any existing head recognition method. In the process of head recognition, each identified sperm head can be considered to be an identified candidate sperm, that is, each candidate sperm has a corresponding candidate head outline.
[0065] Step S103, target tracking is performed on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm, so as to obtain the tracking area of each candidate sperm in each remaining frame.
[0066] In this embodiment, the remaining frames refer to the frames other than the reference frame in all the frames of the sperm swimming video image. Target tracking refers to taking the candidate head contours corresponding to each candidate sperm as the target, and performing corresponding target tracking in the remaining frames of the sperm swimming video image; in the specific implementation process, the number of candidate sperm is usually large, so in the specific implementation process, a multi-target tracking method can be used to simultaneously track all candidate sperm. The tracking area is the area corresponding to the contours of each candidate sperm in each frame image; for example, assuming that there are ten candidate sperms and there are sixty frames of sperm swimming video images, then the ten sperms have their own corresponding tracking areas in the remaining fifty-nine frames except the reference frame. The tracking area can be any shape that can circle the position of the candidate sperm in the image, for example, the tracking area can be set to a square or rectangle of a specific size.
[0067] Step S104, searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame.
[0068] In this embodiment, the contour center refers to the center point of a complete sperm contour. In a specific implementation, the contour center search may first find a complete sperm contour, and then calculate the center point of each complete sperm contour.
[0069] Step S105, calculating the Euclidean distance of the center of the sperm contour in adjacent frames for each candidate sperm, and obtaining the maximum Euclidean distance corresponding to each candidate sperm.
[0070] Step S106: When the maximum Euclidean distance corresponding to any candidate sperm exceeds a preset distance, it is determined that any candidate sperm is a real sperm.
[0071] It should be noted that, in the specific implementation process, if the maximum Euclidean distance corresponding to any candidate sperm does not exceed the preset distance, it can be determined that the candidate sperm is not a normal sperm. It should be noted that the candidate sperm determined to be in this case may be impurities or abnormally moving sperm.
[0072] The sperm identification method of the present embodiment selects a frame from the sperm swimming video image as a reference frame, then performs sperm head identification on the reference frame to obtain multiple candidate sperms and candidate head contours corresponding to each candidate sperm, then performs target tracking on the candidate sperm in the remaining frames to obtain the tracking area of each candidate sperm in each remaining frame, then performs contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame, and finally calculates the Euclidean distance between the sperm contour centers of each candidate sperm in adjacent frames to obtain the maximum Euclidean distance corresponding to each candidate sperm, and takes the candidate sperm whose maximum Euclidean distance exceeds the preset distance as the real sperm, thereby achieving accurate identification of sperm in the swimming state, which can significantly reduce the impurity misidentification rate and enrich the existing sperm identification method of dynamic sperm swimming video images.
[0073] In some possible implementations, Figure 2 This is a flow chart of obtaining sperm swimming video images and reference frames provided by the present invention. Please refer to Figure 2 As shown, the aforementioned step S101, obtaining a sperm swimming video image, and selecting a frame from the sperm swimming video image as a reference frame, can be specifically implemented by the following steps:
[0074] Step S201, recording a video under a microscope lens with a preset magnification through a camera to obtain a video image of sperm swimming; wherein the preset magnification refers to a pre-set magnification of the microscope lens. In the specific implementation process, the microscope lens is preferably a ten-fold lens.
[0075] Step S202: taking any frame of the sperm swimming video image as a reference frame.
[0076] In this embodiment, the reference frame may be any frame of the sperm swimming video image. In the specific implementation process, the first frame (ie, the first frame) of the sperm swimming video image may be selected as the reference frame.
[0077] In some possible implementations, Figure 3 This is a schematic diagram of the sperm head identification process provided by the present invention. Please refer to Figure 3 As shown, the aforementioned step 102, performing sperm head recognition on the reference frame to obtain multiple candidate sperms and a candidate head contour corresponding to each candidate sperm, can be specifically implemented by the following steps:
[0078] Step S301, converting the reference frame into a first grayscale image;
[0079] Step S302, calculating the cumulative probability function of the pixel values in the first grayscale image;
[0080] Step S303, performing inflection point detection on the cumulative probability function to obtain multiple inflection points and a pixel value corresponding to each inflection point;
[0081] Step S304, determining a target pixel value according to the pixel values corresponding to each inflection point and the background of the first grayscale image, and setting the target pixel value as a fixed threshold of a fixed threshold algorithm;
[0082] Step S305, binarizing the first grayscale image using a fixed threshold algorithm to obtain a first processed image;
[0083] Step S306: using a contour detection algorithm to extract contours from the first processed image, and each extracted contour is regarded as a candidate head contour of a candidate sperm.
[0084] In some possible implementations, determining the target pixel value according to the pixel values corresponding to the respective inflection points and the background of the first grayscale image includes:
[0085] In response to the background of the first grayscale image being white, taking the minimum value of the pixel values corresponding to the inflection point between ten and one hundred as the target pixel value;
[0086] In response to the background of the first grayscale image being black, the maximum value of the pixel values corresponding to the inflection points between 200 and 250 is taken as the target pixel value.
[0087] For example, let's take the first frame of the sperm swimming video image as a reference frame, and the sperm head recognition process for this frame of image is as follows:
[0088] First, obtain the first frame image of the sperm swimming video and convert the image into a grayscale image.
[0089] Next, the cumulative probability function (CDF) of the image pixel values is calculated.
[0090] Next, the inflection point in the CDF function is detected by using an inflection point detection algorithm such as knee. i represents the detected i-th inflection point, p i The table shows the pixel value corresponding to the i-th inflection point detected.
[0091] Next, if the image has a white background, find p i The value p in the interval [10,100] th If there are multiple values in the interval [10,100], take the minimum value as p th ; If the image has a black background, then find p i The value p in the interval [200,250] th If there are multiple values in the interval [200,250], take the maximum value as pth .
[0092] Next, the image is binarized using a fixed threshold algorithm, with the fixed threshold set to p th .
[0093] Finally, the contour detection algorithm is used to analyze the binarized image, and the detected contour is the candidate sperm head contour.
[0094] The sperm recognition method of this embodiment takes the first frame in the sperm swimming video image as a reference frame, calculates the cumulative probability function of the image pixel value and performs inflection point detection on it to obtain each inflection point, then finds the best fixed threshold from each inflection point in combination with the background color of the image, uses the fixed threshold to first perform binarization processing on the image, and finally performs contour detection on the binarized image to obtain each candidate sperm and the sperm head contour corresponding to each candidate sperm, thereby achieving preliminary identification of candidate sperm based on sperm head detection, preparing for the subsequent further search for real sperm, and can further improve recognition accuracy.
[0095] In some possible implementations, Figure 4 This is a schematic diagram of the process of tracking the candidate sperm target provided by the present invention. Please refer to Figure 4 As shown, the previous step S103, based on the candidate head contour corresponding to each candidate sperm, the remaining frames of the sperm swimming video image are tracked to obtain the tracking area of each candidate sperm in each remaining frame, which can be specifically achieved by the following steps:
[0096] Step S401, taking each candidate sperm as a target object in a traversal manner, and performing the following operations on the target object: calculating the circumscribed ellipse of the candidate head contour corresponding to the target object, taking the center of the circumscribed ellipse as the center point of the head contour of the target object in the reference frame, and obtaining a square area with the center point of the head contour as the center and a side length equal to a preset length;
[0097] Step S402, setting the square area corresponding to each candidate sperm as the tracking area of the multi-target tracking algorithm;
[0098] Step S403, using a multi-target tracking algorithm, obtain the tracking area of each candidate sperm in each remaining frame of the sperm swimming video image except the reference frame.
[0099] For example, the following takes the first frame as the reference frame as an example, assuming that the microscope uses a ten-fold lens and the side length of the tracking area is set to 400 pixels. The specific implementation process of target tracking for the remaining frames of the sperm swimming video image is as follows: calculate the circumscribed ellipse of the contour of each candidate sperm head, take the center point of the circumscribed ellipse as the center point of the contour, and use Indicates the center point of the head outline of the mth candidate sperm in the first frame of the video. All candidate sperm are tracked by the multi-target tracking algorithm of computer vision. The multi-target tracking algorithm needs to set the tracking area of each tracked object. For the mth candidate sperm, the tracking area of the sperm is set to the center point of the candidate sperm head outline. A square area with a side length of 400 pixels and centered on Represents the tracking area of the mth candidate sperm in the tth frame image of the video.
[0100] The sperm identification method of this embodiment first finds the tracking area centered on the sperm head outline center of each candidate sperm on the reference frame, and uses a multi-target tracking algorithm to find the tracking area corresponding to each candidate sperm in each remaining frame of the sperm swimming video image, thereby achieving accurate marking of each candidate sperm in each frame of the entire sperm swimming video image, which can further improve the accuracy of true sperm identification.
[0101] In some possible implementations, Figure 5 This is a schematic diagram of sperm contour center search provided by the present invention. Please refer to Figure 5 As shown, the previous step S104 is to search for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame, which can be specifically achieved by the following steps:
[0102] Step S501, taking each tracking area as a target area in a traversal manner, and performing the following operations on the target area: converting the image corresponding to the target area into a second grayscale image; binarizing the second grayscale image using an adaptive threshold algorithm to obtain a second processed image; extracting the contour of the second processed image using a contour detection algorithm to obtain a sperm contour;
[0103] Step S502, calculating the center point of the sperm contour of each candidate sperm in each remaining frame, and obtaining the sperm contour center of each candidate sperm in each remaining frame.
[0104] In some possible implementations, Figure 6 This is a schematic diagram of the sperm profile screening process provided by the present invention, please refer to Figure 6 As shown, before the step of calculating the center point of the sperm contour of each candidate sperm in each remaining frame, the sperm identification method further includes screening the sperm contour by the following steps:
[0105] Step S601, taking each remaining frame as a reference frame, and returning to the step of performing sperm head recognition on the reference frame to obtain a candidate head contour of each candidate sperm in each remaining frame;
[0106] Step S602, calculating the center of the circumscribed ellipse of the candidate head contour of each remaining frame to obtain the center point of the head contour of each candidate sperm in each remaining frame;
[0107] Step S603, determining whether the center point of the head contour of each candidate sperm in each remaining frame is located inside the sperm contour of the corresponding sperm in the corresponding frame;
[0108] Step S604, if yes, retain the corresponding sperm outline;
[0109] Step S605: if not, delete the corresponding sperm outline.
[0110] By way of example, the following will describe in detail the process of identifying the center of the sperm outline of each candidate sperm in each tracking area and determining whether it is a real sperm:
[0111] First, for the mth candidate sperm, Convert the region to grayscale.
[0112] Next, the sperm head recognition technology (refer to the sperm head recognition process of the reference frame) is used to calculate the head contour of the mth candidate sperm. Represents the head outline of the mth candidate sperm in the tth frame image of the video, and uses Represents the center point of the head outline of the mth candidate sperm in the tth frame image of the video.
[0113] Next, the image is binarized using an adaptive threshold algorithm that uses a Gaussian weighted sum method.
[0114] Next, the binarized image is analyzed using a contour detection algorithm. For all detected contours, the center point of the head contour of the candidate sperm m is calculated. Is it inside the contour? If it is inside a certain contour, then the contour is the contour of the candidate sperm m. Represents the outline of the mth candidate sperm in the tth frame image of the video.
[0115] Next, calculate The center point of the contour, Represents the center point of the outline of the mth candidate sperm in the tth frame image of the video.
[0116] Finally, first calculate and The Euclidean distance between them; then find the maximum value of all distances Max dsp If Max dsp >2, then candidate sperm m is the correct sperm and n represents the true sperm; otherwise, delete candidate sperm m.
[0117] The sperm recognition method of this embodiment selects a frame of the sperm swimming video image as a reference frame to find candidate sperm, and combines target tracking to achieve candidate sperm tracking of the entire sperm swimming video image. The differences in sperm contours between different frames can effectively distinguish sperm and impurities in the video. Moreover, the entire process of sperm recognition does not require the identification of sperm tails, so the influence of changes in sperm tails in the swimming state can be ignored. Compared with existing sperm recognition schemes, it has a higher accuracy rate.
[0118] The sperm identification device provided by the present invention is described below. The sperm identification device described below and the sperm identification method described above can be referenced to each other.
[0119] Please refer to Figure 7 As shown, this embodiment provides a sperm identification device, specifically, the device includes: an acquisition module 710, a sperm head identification module 720, a tracking module 730, a search module 740, a calculation module 750 and a determination module 760, and the above modules are described in detail below:
[0120] An acquisition module 710 is used to acquire a sperm swimming video image and select a frame from the sperm swimming video image as a reference frame;
[0121] The sperm head recognition module 720 is used to perform sperm head recognition on the reference frame to obtain multiple sperm candidates and a candidate head contour corresponding to each sperm candidate;
[0122] A tracking module 730 is used to perform target tracking on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm, and obtain a tracking area of each candidate sperm in each remaining frame;
[0123] A search module 740 is used to search for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame;
[0124] A calculation module 750 is used to calculate the Euclidean distance of the center of the sperm contour in adjacent frames for each candidate sperm, and obtain the maximum Euclidean distance corresponding to each candidate sperm;
[0125] The determination module 760 is used to determine that any candidate sperm is a real sperm when the maximum Euclidean distance corresponding to any candidate sperm exceeds a preset distance.
[0126] The sperm identification device of the present embodiment selects a frame from the sperm swimming video image as a reference frame, then performs sperm head identification on the reference frame to obtain multiple candidate sperms and candidate head contours corresponding to each candidate sperm, then performs target tracking on the candidate sperm in the remaining frames to obtain the tracking area of each candidate sperm in each remaining frame, then performs contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame, and finally calculates the Euclidean distance between the sperm contour centers of each candidate sperm in adjacent frames to obtain the maximum Euclidean distance corresponding to each candidate sperm, and regards the candidate sperm whose maximum Euclidean distance exceeds the preset distance as the real sperm, thereby achieving accurate identification of sperm in the swimming state, which can significantly reduce the impurity misidentification rate and enrich the existing sperm identification method of dynamic sperm swimming video images.
[0127] In some possible implementations, the acquisition module 710 is further configured to:
[0128] The video under the microscope lens with preset magnification is recorded by a camera to obtain a video image of sperm swimming;
[0129] Any frame of the sperm swimming video image is used as a reference frame.
[0130] In some possible implementations, the sperm head identification module 720 is further used to:
[0131] converting the reference frame into a first grayscale image;
[0132] Calculating a cumulative probability function of pixel values in the first grayscale image;
[0133] Perform inflection point detection on the cumulative probability function to obtain multiple inflection points and pixel values corresponding to each inflection point;
[0134] Determine a target pixel value according to the pixel values corresponding to each inflection point and the background of the first grayscale image, and set the target pixel value as a fixed threshold of a fixed threshold algorithm;
[0135] Binarizing the first grayscale image using a fixed threshold algorithm to obtain a first processed image;
[0136] The contour detection algorithm is used to extract the contour of the first processed image, and each extracted contour is regarded as a candidate head contour of a candidate sperm.
[0137] In some possible implementations, the sperm head identification module 720 is further used to:
[0138] In response to the background of the first grayscale image being white, taking the minimum value of the pixel values corresponding to the inflection point between ten and one hundred as the target pixel value;
[0139] In response to the background of the first grayscale image being black, the maximum value of the pixel values corresponding to the inflection points between 200 and 250 is taken as the target pixel value.
[0140] In some possible implementations, the tracking module 730 is further configured to:
[0141] Each candidate sperm is taken as a target object in a traversal manner, and the following operations are performed on the target object: the circumscribed ellipse of the candidate head contour corresponding to the target object is calculated, the center of the circumscribed ellipse is taken as the center point of the head contour of the target object in the reference frame, and a square area with the center point of the head contour as the center and a side length equal to a preset length is obtained;
[0142] The square area corresponding to each candidate sperm is set as the tracking area of the multi-target tracking algorithm;
[0143] A multi-target tracking algorithm is used to obtain the tracking area of each candidate sperm in each remaining frame of the sperm swimming video image except the reference frame.
[0144] In some possible implementations, the search module 740 is further configured to:
[0145] Each tracking area is taken as a target area in a traversal manner, and the following operations are performed on the target area: the image corresponding to the target area is converted into a second grayscale image; the second grayscale image is binarized using an adaptive threshold algorithm to obtain a second processed image; the contour of the second processed image is extracted using a contour detection algorithm to obtain a sperm contour;
[0146] The center point of the sperm outline of each candidate sperm in each remaining frame is calculated to obtain the sperm outline center of each candidate sperm in each remaining frame.
[0147] In some possible implementations, the sperm identification device further includes a screening module, and the screening module is used to:
[0148] Each of the remaining frames is used as a reference frame, and the step of performing sperm head recognition on the reference frame is returned to obtain the candidate head contour of each candidate sperm in each of the remaining frames;
[0149] Calculate the center of the circumscribed ellipse of the candidate head contour of each remaining frame to obtain the center point of the head contour of each candidate sperm in each remaining frame;
[0150] Determine whether the center point of the head contour of each candidate sperm in each remaining frame is located inside the sperm contour of the corresponding sperm in the corresponding frame;
[0151] If so, the corresponding sperm outline is retained;
[0152] If not, delete the corresponding sperm contour.
[0153] It should be noted that each module in the above sperm identification device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0154] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8 As shown, the electronic device may include: a processor (processor) 810, a communication interface (Communications Interface) 820, a memory (memory) 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call the logic instructions in the memory 830 to execute the sperm identification method, which includes: obtaining a sperm swimming video image, and selecting a frame from the sperm swimming video image as a reference frame; performing sperm head identification on the reference frame to obtain multiple candidate sperm and a candidate head contour corresponding to each candidate sperm; performing target tracking on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm, and obtaining the tracking area of each candidate sperm in each remaining frame; performing contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame; calculating the Euclidean distance of the sperm contour center in adjacent frames for each candidate sperm, and obtaining the maximum Euclidean distance corresponding to each candidate sperm; when the maximum Euclidean distance corresponding to any candidate sperm exceeds the preset distance, it is determined that any candidate sperm is a true sperm.
[0155] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0156] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the sperm identification method provided by the above-mentioned methods, which includes: obtaining a sperm swimming video image, and selecting a frame from the sperm swimming video image as a reference frame; performing sperm head identification on the reference frame to obtain multiple candidate sperm and a candidate head contour corresponding to each candidate sperm; performing target tracking on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm to obtain the tracking area of each candidate sperm in each remaining frame; performing contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame; calculating the Euclidean distance of the sperm contour center in adjacent frames for each candidate sperm to obtain the maximum Euclidean distance corresponding to each candidate sperm; when the maximum Euclidean distance corresponding to any candidate sperm exceeds the preset distance, it is determined that any candidate sperm is a true sperm.
[0157] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented by a processor to execute the sperm identification method provided by the above-mentioned methods when executed, the method comprising: obtaining a sperm swimming video image, and selecting a frame from the sperm swimming video image as a reference frame; performing sperm head identification on the reference frame to obtain multiple candidate sperm and a candidate head contour corresponding to each candidate sperm; performing target tracking on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm to obtain a tracking area of each candidate sperm in each remaining frame; performing contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame; calculating the Euclidean distance of the sperm contour center in adjacent frames for each candidate sperm to obtain the maximum Euclidean distance corresponding to each candidate sperm; when the maximum Euclidean distance corresponding to any candidate sperm exceeds a preset distance, it is determined that any candidate sperm is a true sperm.
[0158] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0159] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A sperm identification method, characterized in that: The method comprises: Acquire a sperm swimming video image, and select a frame from the sperm swimming video image as a reference frame; Performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm; Based on the candidate head contour corresponding to each candidate sperm, target tracking is performed on the remaining frames of the sperm swimming video image to obtain the tracking area of each candidate sperm in each remaining frame; Searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame; For each candidate sperm, respectively, the Euclidean distance between the center of the sperm outline in adjacent frames is calculated to obtain the maximum Euclidean distance corresponding to each candidate sperm; When the maximum Euclidean distance corresponding to any candidate sperm exceeds the preset distance, it is determined that the any candidate sperm is a real sperm; The step of acquiring a sperm swimming video image and selecting a frame from the sperm swimming video image as a reference frame includes: Recording the video under the microscope lens with a preset magnification by a camera to obtain the video image of the sperm swimming; Taking any frame of the sperm swimming video image as the reference frame; Performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm includes: converting the reference frame into a first grayscale image; Calculating a cumulative probability function of pixel values in the first grayscale image; Performing inflection point detection on the cumulative probability function to obtain a plurality of inflection points and a pixel value corresponding to each inflection point; Determine a target pixel value according to the pixel values corresponding to each inflection point and the background of the first grayscale image, and set the target pixel value as a fixed threshold of a fixed threshold algorithm; Using the fixed threshold algorithm to perform binarization processing on the first grayscale image to obtain a first processed image; The first processed image is subjected to contour extraction using a contour detection algorithm, and each extracted contour is marked as a candidate head contour of a candidate sperm, wherein the target pixel value is determined according to the pixel value corresponding to each inflection point and the background of the first grayscale image, including: in response to the background of the first grayscale image being white, the minimum value of the pixel value corresponding to the inflection point between ten and one hundred is taken as the target pixel value; In response to the background of the first grayscale image being black, the maximum value of the pixel value corresponding to the inflection point between two hundred and two hundred and fifty is taken as the target pixel value, and the target tracking is performed on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm to obtain the tracking area of each candidate sperm in each remaining frame, including: taking each candidate sperm as a target object in a traversal manner, and performing the following operations on the target object: calculating the circumscribed ellipse of the candidate head contour corresponding to the target object, taking the center of the circumscribed ellipse as the center point of the head contour of the target object in the reference frame, obtaining a square area with the center point of the head contour as the center and a side length equal to a preset length, and setting the square area corresponding to each candidate sperm as the tracking area of the multi-target tracking algorithm; The multi-target tracking algorithm is used to obtain the tracking area of each candidate sperm in each remaining frame of the sperm swimming video image except the reference frame, and the contour center of each tracking area is searched to obtain the sperm contour center of each candidate sperm in each remaining frame, including: taking each tracking area as a target area in a traversal manner, and performing the following operations on the target area: converting the image corresponding to the target area into a second grayscale image; Binarizing the second grayscale image using an adaptive threshold algorithm to obtain a second processed image; Using a contour detection algorithm to extract the contour of the second processed image to obtain a sperm contour; Calculate the center point of the sperm contour of each candidate sperm in each remaining frame to obtain the center of the sperm contour of each candidate sperm in each remaining frame. Before the step of calculating the center point of the sperm contour of each candidate sperm in each remaining frame, the method further screens the sperm contour by the following steps: use each remaining frame as a reference frame, and return to perform the step of performing sperm head recognition on the reference frame to obtain the candidate head contour of each candidate sperm in each remaining frame; Calculate the center of the circumscribed ellipse of the candidate head contour of each remaining frame to obtain the center point of the head contour of each candidate sperm in each remaining frame; determine whether the center point of the head contour of each candidate sperm in each remaining frame is located inside the sperm contour of the corresponding sperm in the corresponding frame; If yes, the corresponding sperm outline is retained; if no, the corresponding sperm outline is deleted.
2. A sperm identification device, characterized in that: The sperm identification method according to claim 1 is adopted, and the device includes: an acquisition module, which is used to acquire a video image of sperm swimming and select a frame from the video image of sperm swimming as a reference frame; a sperm head recognition module, which is used to perform sperm head recognition on the reference frame to obtain multiple candidate sperm and a candidate head contour corresponding to each candidate sperm; a tracking module, which is used to perform target tracking on the remaining frames of the sperm swimming video image based on the candidate head contour corresponding to each candidate sperm, and obtain the tracking area of each candidate sperm in each remaining frame; a search module, which is used to perform contour center search on each tracking area to obtain the sperm contour center of each candidate sperm in each remaining frame; a calculation module, which is used to calculate the Euclidean distance of the sperm contour center in adjacent frames for each candidate sperm, and obtain the maximum Euclidean distance corresponding to each candidate sperm; a judgment module, which is used to judge that any candidate sperm is a true sperm when the maximum Euclidean distance corresponding to any candidate sperm exceeds a preset distance.
3. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the sperm identification method as claimed in claim 1 is implemented.
4. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the sperm identification method as claimed in claim 1 is implemented.