A sperm automatic detection and tracking method, device and storage medium

By using multidimensional feature fusion scoring and trajectory sealing processing, the problem of insufficient differentiation between stationary and motile sperm in existing technologies has been solved, thereby improving the accuracy and efficiency of sperm detection and tracking, and making it suitable for sperm motility analysis in complex environments.

CN121281053BActive Publication Date: 2026-02-27WUHAN MUTUAL UNITED TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511842732.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-02-27
Estimated Expiration
2045-12-09

AI Technical Summary

Technical Problem

Existing technologies lack an effective mechanism to distinguish between stationary and motile sperm in sperm detection and tracking, leading to broken tracks and repeated counting, which affects the calculation of sperm motility indicators, and the detection efficiency and accuracy are insufficient in complex environments.

Method used

A multi-dimensional feature fusion scoring system and trajectory sealing processing method are adopted. By scoring position consistency, movement direction consistency, velocity consistency, color consistency and trajectory continuity, combined with particle filter prediction, accurate matching and continuous tracking of sperm targets are achieved. In particular, multi-frame historical analysis is performed on stationary sperm and their participation is excluded in subsequent matching.

Benefits of technology

It enables continuous and unique tracking of sperm trajectories in complex scenarios, avoiding mismatches and trajectory breaks, improving the accuracy of sperm motility index calculation and system stability, and supporting high-density sperm detection and assisted reproductive technology applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121281053B_ABST
    Figure CN121281053B_ABST
Patent Text Reader

Abstract

The application provides a sperm automatic detection and tracking method, device and storage medium. The method first pre-processes a sperm image, performs head-tail rotation boundary box labeling, and generates a training set containing center point coordinates, width, height and angle; a target detection model is trained using the training set to obtain a model capable of automatically identifying sperm and outputting a rotation boundary box; the model is applied to detect video frames to extract the position, orientation and size of each frame of sperm; a multi-dimensional fusion scoring system is constructed through position, direction, speed, color and trajectory continuity to match adjacent frames of targets, generate a comprehensive score and associate the targets to form a continuous trajectory and a unique identifier for calculating motion parameters; and then whether the trajectory is stationary or low active is judged according to the speed and displacement of the last N frames, the trajectory is sealed to exclude subsequent matching, and only the non-sealed trajectory is retained to calculate the motion parameters. The method effectively avoids interference, significantly improves the tracking accuracy and the reliability of sperm motility parameter calculation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of sperm detection, and in particular to a sperm automatic detection and tracking method, device and storage medium. BACKGROUND

[0002] In the field of reproductive health, a large number of sperm samples need to be detected and analyzed every moment, and many sperm quality evaluation methods still rely on manual observation, resulting in low efficiency and easy errors. The motility and morphology of sperm directly affect the fertility outcome, and if these sperm cannot be analyzed in a timely and accurate manner, effective treatment opportunities may be missed. In addition, sperm samples are diverse, and the quality of different sperm varies significantly, which requires classification and different processing and analysis methods, such as screening high motility sperm for assisted reproductive technology and excluding morphologically abnormal or insufficiently motile sperm. In the face of a large number of sperm samples, manual detection alone requires a large amount of manpower and cost, therefore, using deep learning technology to detect, classify and analyze sperm samples can greatly improve the detection efficiency and accuracy, and provide strong support for research and treatment in the field of reproductive health.

[0003] Early sperm detection technology usually relies on traditional image processing methods, which detect targets by extracting sperm morphology, motion features, etc. However, manually designed features require a lot of time and effort, and these features are often only effective under certain conditions, such as ideal experimental environments. With the diversification of application scenarios, traditional methods have encountered bottlenecks in terms of accuracy and efficiency in handling complex environments. This limitation has prompted the application of deep learning technology in sperm detection, which can automatically extract and learn image features, improving the generalization ability and accuracy of detection, and better adapting to sperm target detection and tracking tasks in different scenarios.

[0004] In existing computer vision-based sperm detection and tracking systems, the "detection-association" mechanism (Tracking-by-Detection) is commonly used to match sperm targets in consecutive frames to obtain complete motion trajectories, which are used for subsequent sperm motility indicators such as curve velocity VCL, straight line velocity VSL, and motion linearity LIN. However, existing technologies generally lack an effective mechanism to distinguish between stationary sperm and motile sperm, which in the context of dense sperm and complex occlusion micrographs, can lead to serious tracking errors.

[0005] For example, when a moving sperm approaches a stationary sperm, the prior art is prone to misjudging the stationary sperm as the continued trajectory of the moving sperm in the subsequent frame, thereby erroneously splitting the trajectory belonging to the same sperm into two trajectories. This trajectory breakage and misconnection phenomenon not only destroys the continuity of the trajectory, but also causes the same sperm to be counted repeatedly, seriously interfering with the calculation of sperm motility indicators. For example, when counting the number of progressively motile (PR) sperm, the system may overestimate the proportion of this category of sperm due to repeated counting, causing the LIN value to deviate and the motion classification to be distorted, affecting the basis for subsequent reproductive medical diagnosis and assisted reproductive treatment.

[0006] In addition, although some systems have a preliminary speed filtering mechanism, they do not analyze the trajectory over multiple frames of history, are easily disturbed by single-frame noise, short-term occlusion, etc., and cannot achieve stable recognition of stationary sperm. They also lack a "sealing" mechanism for stationary targets, and cannot effectively exclude these sperm that should no longer participate in trajectory association in subsequent frames, thereby increasing the target matching error rate. SUMMARY

[0007] To solve the above technical problems, the present application provides a sperm automatic detection and tracking method, comprising the following steps:

[0008] Step S1: processing the sperm image, labeling the head and tail of the sperm with a rotating bounding box, and generating a training set containing center point coordinates, width, height, and rotation angle;

[0009] Step S2: training a target detection model using the training set to generate a model that can automatically detect sperm and output a rotating bounding box;

[0010] Step S3: using the trained model to detect the sperm video image, obtaining the rotating bounding box of each frame of sperm, including the position, orientation, and size of the sperm;

[0011] Step S4: matching the sperm targets in adjacent frames, evaluating the matching reliability through a multi-dimensional feature fusion scoring system, the scoring system including position consistency, motion direction consistency, speed consistency, color consistency, and trajectory continuity; weighting and fusing each score according to a pre-set weight to generate a comprehensive matching score, and associating the sperm targets in the previous and subsequent frames according to the score to generate the continuous time sequence trajectory and unique identification of each sperm;

[0012] Step S5: Determine whether the sperm trajectory generated in step S4 is in a static or low-activity state based on the speed and maximum displacement of the last N frames; perform quarantine processing on the trajectory of sperm determined to be static or low-activity, exclude it from participating in matching in the subsequent matching logic, but retain its detection data for filtering in the subsequent matching, only perform matching in non-quarantined trajectories, thereby avoiding interference of static sperm with the generation of moving sperm trajectories; and calculate sperm motion parameters based on each non-quarantined trajectory and unique identifier.

[0013] Preferably, the method for determining whether the sperm is in a static or low-activity state in step S5 is: statistically analyzing the motion characteristics of multiple consecutive frames within a window length N for each sperm trajectory, extracting the historical position points of the last N frames, calculating the average speed of adjacent frames within the window and the maximum displacement of all points within the window relative to the starting point, and when both the average speed and the maximum displacement are lower than the set threshold, determining that the sperm trajectory is static or low-activity and marking it as a quarantine state, thereby excluding it from participating in matching in the subsequent frame matching logic.

[0014] Preferably, the multi-dimensional feature fusion scoring system is used for matching and trajectory generation of sperm targets in consecutive video frames, and the multi-dimensional feature scoring includes: position consistency score, motion direction consistency score, speed consistency score, color consistency score, and trajectory continuity score.

[0015] The position consistency score is a quantitative measure of sperm position matching by evaluating the spatial deviation or intersection over union (IoU) value of the center point coordinates of the sperm target in the previous and subsequent frames;

[0016] The motion direction consistency score is a measure of the consistency of the motion direction of the sperm by comparing the difference in the motion direction of the historical trajectory of the sperm and the direction of the current frame sperm detection box, thereby avoiding incorrect exchange of sperm trajectories;

[0017] The speed consistency score is a measure of the change in the motion state of the sperm by calculating the difference between the average speed of the sperm in the historical trajectory and the speed of the current frame, thereby avoiding matching errors caused by abnormal speed;

[0018] The color consistency score is a measure of the identity consistency of the sperm by analyzing the similarity of the color histogram within the sperm detection box in the previous and subsequent frames;

[0019] The trajectory continuity score is a measure of the continuity and stability of the sperm trajectory by predicting the deviation of the sperm position from the current frame detection box using particle filtering, thereby supporting continuous time series trajectory generation.

[0020] Preferably, the target detection model in step S2 uses a YOLOv8_OBB detection model, and the YOLOv8_OBB detection model includes a backbone network, a feature fusion layer, and a detection head.

[0021] the backbone network is configured to extract multi-scale features of the sperm image;

[0022] the feature fusion layer is connected with the backbone network and the detection head, and is configured to perform bidirectional fusion on the multi-scale feature maps and output fused feature maps;

[0023] the detection head is configured to perform prediction on the fused feature maps to obtain the center coordinates, width, height and rotation angle of each sperm.

[0024] Preferably, in the step S2 of training the YOLOv8_OBB detection model, a CIoU and DFL joint loss function is used for training.

[0025] the CIoU loss function has an expression as follows:

[0026] ;

[0027] ;

[0028] In the formula, denotes the intersection union; denotes the distance between the center points of the target frame and the predicted frame; denotes the diagonal distance of the minimum circumscribed rectangle; denotes a correction factor; and denote the width and height of the real target frame, respectively; and denote the width and height of the predicted frame, respectively;

[0029] the DFL loss function has an expression as follows:

[0030] ;

[0031] In the formula, and denote the output predicted value and the adjacent predicted value, respectively; denotes the actual value of the label; and denote the probabilities of the left and right positions closest to the actual value of the label, respectively.

[0032] Preferably, the motion direction consistency score has an expression as follows:

[0033] ;

[0034] In the formula, denotes the average motion direction angle of the sperm trajectory, The first The motion direction angle of the frame relative to the first frame, and N represents the total number of frames of the entire video.

[0035] Preferably, the method for calculating sperm motion parameters based on each non-occluded trajectory and unique identification in step S5 comprises:

[0036] Step S5.1: According to the position information of each sperm in the consecutive frames, the curve velocity VCL of the sperm head along the total length of the motion trajectory is calculated, and the motion time is divided by the motion time;

[0037] Step S5.2: Calculate the linear velocity VSL of the sperm head between the starting frame and the current frame, and the linear distance is divided by the motion time;

[0038] Step S5.3: Calculate the motion linearity LIN according to the ratio of VCL and VSL;

[0039] Step S5.4: Calculate the continuous trajectory of each sperm to obtain the numerical motion parameters that can be used for sperm classification or subsequent analysis.

[0040] Preferably, the multi-dimensional feature fusion scoring system is realized by a dynamic weighting fusion strategy, wherein the weight of each feature score is dynamically adjusted according to the spatial distance between the sperm candidate point and the historical trajectory point, and the weighted comprehensive matching score is combined with the particle filter predicted sperm position to select the optimal historical trajectory and the current sperm candidate point in the target matching process., so as to form a continuous sperm time sequence trajectory and maintain the consistency of the sperm identity.

[0041] The present application also provides an electronic device comprising a memory, a processor and a computer program stored on the memory, wherein the processor executes the program to realize the steps of the above method.

[0042] The present application also provides a computer readable storage medium storing a computer program, wherein the program is executed by a processor to realize the steps of the above method.

[0043] The beneficial effects of the present application at least include:

[0044] 1、The multi-dimensional feature fusion scoring system proposed by the present application comprehensively weights the sperm position, motion direction, speed, color and trajectory continuity, realizes the accurate matching of adjacent frame sperm targets. This method is especially suitable for sperm dense scenes, effectively avoids mis-matching and trajectory breakage by comprehensively considering multi-dimensional features, ensures the continuity and uniqueness of each sperm trajectory, and provides reliable technical support for motion trajectory analysis;

[0045] 2. The application proposes a trajectory storage processing method for static or low-activity sperm. The static sperm is determined through multi-frame historical trajectory analysis, and is dynamically excluded from participation in the subsequent matching process. This method avoids interference of static sperm with moving sperm matching, eliminates trajectory splitting and repeated counting phenomenon, while retaining static sperm data for statistical analysis, improving the accuracy of motility index calculation;

[0046] 3. The application combines particle filter prediction and dynamic weighted fusion strategy to realize sperm matching. The spatial distance between sperm candidate points and historical trajectories is used for near and far distance weight distribution, combined with particle filter prediction position for trajectory association. This method can maintain trajectory continuity when sperm moves quickly, is blocked or changes direction, and ensures the identity consistency of each sperm trajectory;

[0047] 4. The application can process high-density, multi-target, frequent appearance or disappearance of sperm. Through multi-dimensional feature scoring, dynamic weighting and storage processing strategy, the optimal matching path is automatically selected to realize independent and continuous tracking of each sperm. This method ensures that sperm trajectories are not disturbed in complex scenes, supports sperm motility classification, motion parameter analysis and assisted reproductive technology application, and provides technical support for stable operation of the system. BRIEF DESCRIPTION OF DRAWINGS

[0048] Figure 1 The method flowchart of the embodiment of the application is shown in the figure;

[0049] Figure 2 The sperm training image of the embodiment of the application is shown in the figure;

[0050] Figure 3 The feature fusion layer structure diagram of the embodiment of the application is shown in the figure;

[0051] Figure 4 The schematic diagram of the meeting matching error of moving sperm is shown in the figure;

[0052] Figure 5 The intersection and union solution calculation diagram of the embodiment of the application is shown in the figure;

[0053] Figure 6 The intersection and union score application diagram of the embodiment of the application is shown in the figure;

[0054] Figure 7 The schematic diagram of the meeting matching error of moving sperm is shown in the figure;

[0055] Figure 8 The storage of static sperm of the embodiment of the application is shown in the figure;

[0056] Figure 9 The storage of static sperm of the embodiment of the application is shown in the figure;

[0057] Figure 10 Sperm phantom diagram for embodiments of the present application;

[0058] Figure 11 Sperm trajectory sudden disappearance and sudden appearance diagram for embodiments of the present application. DETAILED DESCRIPTION

[0059] The technical solutions in the embodiments of the present application will be apparently and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the protection scope of the present application.

[0060] As shown in Figure 1 , the sperm automatic detection and tracking method provided by the embodiments of the present application comprises the following steps:

[0061] Step S1: processing the sperm image, rotating the boundary box of the sperm head and tail, and generating a training set containing the center point coordinates, width, height and rotation angle.

[0062] Specifically, the data used in the present embodiment is sperm video data taken by a sperm quality analyzer, and each frame of image of the video is extracted. In order to simplify the processing flow and make full use of the advantages of gray-scale images, the relevant functions in the OpenCV library are used to convert the image into a gray-scale image and improve the contrast of the image, so as to enhance the training and inference ability of the subsequent model.

[0063] When making the sperm data set, as shown in Figure 2 , the pre-processed image is labeled using the roLabelImg position labeling software tool. The normal morphology of sperm usually includes head, neck, middle segment, main segment and end segment. Since it is difficult to observe the end segment of sperm through an optical microscope, it can be considered that the sperm is composed of head, neck, tail, middle segment and main segment. In the process of making the training data set, the head of the sperm in the image and the part of the tail connected to the head are labeled.

[0064] The labeled box of the sperm is rotated, so as to introduce the head direction parameter of the sperm in the training data set. The oriented bounding box (OBB) is a kind of boundary box definition method, which can more accurately wrap the target at any angle in the image. The definition of the oriented bounding box is composed of five parameters: center point coordinates , width , height and rotation angle . The rotation angle is usually defined in or The embodiment adopts a long side definition method, and determines the orientation of the object by defining the rotation angle of the bounding box relative to the direction of the long side of the bounding box.

[0065] The sperm image is marked with a rotating bounding box by using the roLabelImg software, and the generated data set is an xml file, and the saved information is the center point coordinates , height, width and rotation angle. The subsequent model needs to input the data set with four vertex coordinates, so the generated xml file needs to be converted. The specific steps are as follows:

[0066] 1) Calculate the coordinates of the four vertices of the object in the non-rotating state.

[0067] 2) According to the geometric transformation of the rotation matrix, the vertex coordinates after rotation are calculated.

[0068] Through the above steps, the data set with the four vertices of the rotating bounding box is obtained.

[0069] Step S2: training the target detection model using the training set to generate a model capable of automatically detecting sperm and outputting a rotating bounding box.

[0070] The target detection model described in the embodiment of the application adopts a model supporting rotating bounding box labeling and detection, which includes but is not limited to YOLOv5_OBB model, YOLOv8_OBB model and YOLOv11_OBB model.

[0071] In recent years, with the rapid development of computer technology, deep learning has made important breakthroughs in the field of medical image analysis, especially in sperm detection and analysis, which has shown great potential. Traditional sperm detection methods often rely on manual observation and basic image processing techniques, while the introduction of deep learning provides strong support for automated and accurate detection. Based on the convolutional neural network (CNN), the model in sperm detection can be divided into two categories: one is the "two-stage model" represented by RCNN, which has high detection accuracy but relatively slow reasoning speed; the other is the "one-stage model" represented by YOLO, which has lower detection accuracy but faster speed, suitable for real-time sperm analysis. No matter which kind of deep learning model, the core task is to accurately locate the sperm in the microscopic image, analyze its motion trajectory and morphological characteristics, and classify it. Therefore, these models also rely on techniques such as Intersection over Union (IoU) to evaluate detection accuracy, providing a scientific basis for subsequent analysis and screening.

[0072] In order to solve the problems that the traditional sperm detection process usually relies on manual operation and observation, the efficiency is low and the accuracy is not high, especially when a large number of targets need to be processed at the same time, the operation is complicated and the error rate increases, and the like, the embodiment of the present application designs an improved YOLOv8_OBB model based on the existing network, combines the YOLOv8 model with a sperm trajectory detection method based on a multi-feature fusion scoring system, and detects and tracks the sperm image under the microscope. Through this method, the sperm target can be quickly and accurately identified under complex background and motion conditions, and efficient motion trajectory tracking is realized. This not only improves the accuracy and efficiency of sperm detection, but also provides reliable data support for subsequent reproductive medical research.

[0073] The following YOLOv8_OBB model is used for illustration, and the YOLOv8_OBB model is used for training and subsequent tracking processing.

[0074] As another implementation, the YOLOv8_OBB model is improved as follows to improve the accuracy and efficiency of sperm target detection and tracking, and the network structure includes the following key parts:

[0075] Network module introduction: including backbone network (Backbone), feature fusion layer (Neck) and detection head (Detection Head), which can efficiently extract multi-scale features, and realize accurate detection of sperm through rotated bounding box (OBB) prediction.

[0076] CIoU loss and DFL loss: through the improved CIoU loss function and DFL loss function, the accuracy and stability of the bounding box regression are improved, and the overall target detection performance is enhanced.

[0077] Rotated bounding box detection: using the rotated bounding box (Oriented Bounding Box, OBB) labeling method, the target at any angle in the image can be wrapped more accurately, and the detection accuracy and tracking effect are improved.

[0078] In the embodiment, the backbone network Backbone of YOLOv8_OBB is based on convolutional neural network CNN, which is responsible for extracting multi-scale features from input images. This part inherits the lightweight design of YOLOv8, and realizes efficient feature extraction through multi-layer convolution operation, residual block and pooling operation. The convolution layer captures the local features of the image through the sliding convolution kernel, the low-level convolution extracts the edges, corners and other details, and the high-level convolution captures the abstract semantic information of the target. The pooling layer reduces the spatial size of the feature map through downsampling, reduces the computational complexity and parameter amount, and improves the efficiency and generalization ability of the model.

[0079] The feature fusion layer (Neck) acts as a bridge in the entire network structure, connecting the backbone network and the detection head. Its main responsibility is to fuse feature maps of different scales extracted from the backbone network, ensuring the model can simultaneously handle large, small, and rotating targets. Figure 3 As shown, Neck employs a combination of Feature Pyramid Network (FPN) and Path Aggregation Network (PAN) to improve multi-scale detection and feature accuracy. FPN combines high-level semantic information with low-level detail information via a top-down path, while PAN further enhances the transmission of feature information flow via a bottom-up path. This bidirectional information transmission path ensures mutual influence of feature maps at different levels, thereby improving detection accuracy.

[0080] The YOLOv8_OBB detection head in this embodiment is similar to YOLOv8, but adds a rotated bounding box (OBB) prediction mechanism. The detection head, based on a combination of convolutional and fully connected layers, transforms the feature map into a prediction result. The output includes the center coordinates, width, height, and rotation angle of the target. The rotation angle regression is achieved through convolutional layers, and the predicted angle typically ranges within a certain range. or This design allows the model to adapt to targets at various angles, improving detection accuracy and tracking performance.

[0081] As an example, as another implementation, training is performed using CIoU loss and DFL loss.

[0082] The CIoU loss function in this embodiment improves upon the traditional IoU loss by considering the complete intersection between bounding boxes and introducing a correction factor to more accurately measure the similarity between them. CIoU loss introduces concepts such as the minimum bounding rectangle of the labeled and predicted boxes, the diagonal length of the minimum bounding rectangle, and the distance between the center points of the labeled and predicted boxes, thus better describing the intersection of the labeled and predicted boxes. The formula for calculating CIoU loss is as follows:

[0083] ;

[0084] In the formula, Represents the intersection and union of sets. The distance between the center points of the target box and the predicted box. The distance between the diagonals of the minimum bounding rectangle. This is a correction factor used to further adjust the loss function, taking into account the shape and orientation of the target box. The specific calculation method is as follows:

[0085] ;

[0086] in and is the width and height of the ground truth bounding box, and is the width and height of the predicted bounding box.

[0087] The calculation method of the CIoU loss function is more complex than the traditional IoU, which comprehensively considers multiple factors such as position, shape and direction, so that the model learns the characteristics of the target frame more comprehensively, which helps to improve the performance of the model in complex scenes.

[0088] The DFL loss function models the position of the bounding box as a probability distribution rather than a single deterministic value, which allows the network to focus more quickly on the distribution close to the target position. The calculation formula of the DFL loss is as follows:

[0089] ;

[0090] wherein and represent the predicted value and the adjacent predicted value output by the network, is the actual value of the label, , are the probabilities of the left and right positions closest to the actual value of the label, such as When predicting, if the actual is 9.3, then is 9.3, is 9, is 10, is the probability that the model predicts is 9, is the probability that the model predicts is 10. By using DFL as the loss function, the probabilities of the left and right positions closest to the label are optimized in the form of cross-entropy, so that the network focuses more quickly on the distribution of the target position and its adjacent area.

[0091] Step S3: Use the trained model to detect the sperm video image to obtain the sperm rotation bounding box of each frame, which contains the position, orientation and size of the sperm.

[0092] Step S4: Match the sperm targets of adjacent frames, evaluate the matching reliability through a multi-dimensional feature fusion scoring system, and the multi-dimensional feature fusion scoring system includes position consistency, motion direction consistency, speed consistency, color consistency and trajectory continuity; weight the scores according to the preset weight and fuse to generate a comprehensive matching score, and associate the sperm targets of the previous and subsequent frames according to the score to generate a continuous time sequence trajectory and a unique identifier for each sperm, which can be used to calculate the motion parameters of the sperm.

[0093] In order to further enhance the performance of the system, the sperm detection and tracking function are combined in the embodiment of the present application, and a multi-dimensional feature fusion scoring system is designed to realize real-time multi-target tracking of sperm in dynamic video stream and discrimination of static and approximately static sperm.

[0094] The multi-dimensional feature fusion scoring system proposed in the embodiment of the present application is a comprehensive evaluation mechanism, which uses multiple features of sperm in the movement process to evaluate and match the trajectory of sperm. The method quantifies the similarity and matching degree between sperm detection boxes through multiple scoring dimensions, so as to realize accurate tracking of the movement trajectory of sperm.

[0095] It is found in practice that when two sperm meet, the subsequent trajectories of the two sperm may be exchanged, as shown in Figure 4 The subsequent trajectories of the purple and green sperm are exchanged, resulting in false trajectory information, and both sperm are not moving along a straight line, and the distance between the starting points of the sperm trajectories is also changed. In the calculation of the curve velocity VCL and the straight line velocity VSL, the VCL will calculate an error, and the VSL will be smaller. Since the VSL is smaller, the LIN will have a larger error in the calculation of the straightness LIN = VSL / VCL, thereby having a greater impact on the subsequent classification, and the sperm moving forward may be classified as non-forward moving sperm.

[0096] Therefore, the present system accurately tracks by evaluating the matching reliability through the multi-dimensional feature fusion scoring system. The multi-dimensional feature scoring system includes position consistency score, motion direction consistency score, velocity consistency score, color consistency score and trajectory continuity score; each score is weighted and fused according to a preset weight to generate a comprehensive matching score, and the sperm targets in the front and rear frames are associated according to the score to generate a continuous time sequence trajectory and a unique identifier for each sperm, which can be used to calculate the motion parameters of the sperm.

[0097] Step S4.1: Calculate the position consistency score. In the present embodiment, the position consistency score is used to evaluate the difference between the center point coordinates of the sperm targets in the front and rear frames, and to quantify the matching degree of the sperm position. In the implementation, the means include but are not limited to spatial deviation and IoU value evaluation.

[0098] IoU (Intersection over Union) is an index for measuring performance, which is used to evaluate the accuracy of labeling, segmentation and target detection algorithms. In order to accurately evaluate the overlap degree of the sperm detection boxes in the front and rear frames, this method is introduced. As shown in Figure 5 The index measures the overlap degree between the sperm detection box in the rear frame and the sperm detection box in the front frame.

[0099] The Intersection over Union (IoU) is calculated by dividing the area of ​​the intersection of the sperm detection bounding boxes in the later frame by the area of ​​their union. The formula for IoU can be expressed as:

[0100] ;

[0101] A higher IoU value indicates better alignment between the detection boxes in the later frame and the previous frame, increasing the likelihood that the two boxes belong to the same sperm, and reflecting a more accurate model. When two bounding boxes do not overlap, the IoU is 0. When two bounding boxes completely overlap, the IoU is 1. We can set a threshold for IoU; when the calculated IoU value is greater than the set threshold, the two boxes are considered to belong to the same sperm. Figure 6 As shown, the position information of each sperm detection box is first obtained in the previous frame image, and the sperm are divided into 1, 2, 3, and 4. Then, combined with the position of each sperm detection box in the subsequent frame image, the IoU score is performed on each detection box in the previous frame and each detection box in the subsequent frame. The score value is used to determine whether they belong to the same sperm.

[0102] In the scoring system, especially in matching scenarios where the sperm detection frames are far apart, the importance of the IoU score is appropriately increased to ensure that different sperm targets can still be effectively distinguished even when the detection frame position is significantly offset.

[0103] Step S4.2: Calculate the motion direction consistency score. In high-density semen samples, severe occlusion between sperm makes them difficult for high-performance detection models to fully identify. In these abnormal situations, it is often necessary to rely on subsequent image frames to re-detect those sperm that were initially missed, or to re-identify those sperm that are detected again, leading to frequent changes in sperm IDs. To maintain tracking accuracy and trajectory consistency in the event of detection failure, we introduce a motion direction consistency score. By comparing the motion direction of the historical sperm trajectory with the direction of the sperm detection box in the current frame (i.e., the motion direction consistency), we determine the degree of consistency in the sperm motion direction and avoid erroneous exchange of sperm trajectories.

[0104] In this embodiment, the consistency of sperm motility direction is measured by calculating the average angle of the sperm trajectory and comparing it with the angle of the detection box in the current frame. A higher score indicates greater consistency in motility direction. The expression is:

[0105] ;

[0106] In the formula, No. Frame relative to the first The motion direction angle of the frame, and N represents the total number of frames in the entire video.

[0107] The motion direction consistency score is used to measure the motion direction consistency of the sperm. By calculating the average angle of the sperm trajectory and comparing it with the angle of the current frame detection box, the higher the score, the more consistent the trajectory direction, thereby achieving correct trajectory connection.

[0108] Step S4.3: Calculate the speed consistency score. In the embodiment of the present application, the speed score is calculated by analyzing the historical trajectory of the sperm, calculating the average motion speed, and comparing it with the speed change of the current detection box to evaluate the motion state change of the sperm. The smaller the speed change, the higher the score, thereby verifying the rationality of the matching and avoiding false matching caused by sudden speed change or abnormal speed. Step S4.4: Color histogram similarity score. By calculating the similarity of color distribution in the detection box in the front and rear frames, the color consistency of the sperm in the motion process is evaluated. The Bhattacharyya distance is used in the code to quantify the difference between two color histograms. If the color histograms of two image regions are similar, their Bhattacharyya distance will be smaller, which indicates that their color distribution is similar, and the smaller the distance, the higher the similarity. Therefore, when evaluating the color consistency of the sperm in the motion process, a smaller Bhattacharyya distance means that the color distribution of the sperm in the front and rear frames is more similar, thereby helping to confirm that they are the same sperm. The solution formula is as follows:

[0110] ;

[0111] wherein, is the color histogram of the target model, is the current frame target color histogram, represents the total number of pixels of the histogram or the normalization factor.

[0112] Step S4.5: Calculate the trajectory continuity score. In this embodiment, the deviation of the predicted sperm position by particle filtering from the current frame detection box is used to evaluate the continuity and stability of the sperm trajectory to support the generation of continuous time sequence trajectory.

[0113] Specifically, for the sperm whose identity cannot be determined, the position is predicted by the linear motion speed and the average motion angle to complete the identity matching:

[0114] ;

[0115] wherein, represents the predicted position of the kth sperm in the tth frame, is the horizontal coordinate of the kth sperm in the t-1 frame, is the vertical coordinate of the kth sperm in the t-1 frame, is the linear velocity of the kth sperm in the t-1 frame, is the average motion angle of the k sperms in the t-1 frame.

[0116] Meanwhile, in a high-density sperm sample, in order to effectively reduce the possible matching range, a rough distance score is also added in the scoring system. The score is obtained by calculating the distance between the current detection frame and each sperm in the previous frame, and a shorter distance obtains a higher score, which plays a basic screening role in the matching process.

[0117] To further improve the accuracy and robustness of sperm target matching, the application dynamically adopts different feature weighting fusion strategies according to the spatial distance between sperm candidate points and historical trajectories. Specifically, it includes:

[0118] Close distance weight distribution: when the spatial distance between the candidate point and the historical trajectory point is within the preset close distance threshold, the following close distance weight distribution scheme is adopted, and the weight in the scheme is an adjustable parameter, which is weighted according to the relative ratio:

[0119] For the position consistency score, set the IoU feature weight: 0.6;

[0120] For the color consistency score, set the appearance similarity (Bhattacharyya distance) feature weight: 0.2;

[0121] For the motion direction consistency score, set the angle similarity feature weight: 0.4;

[0122] For the trajectory continuity score, set the trajectory distance feature weight: 0.3;

[0123] For the speed consistency score, set the speed feature weight: 0.4.

[0124] Far distance weight distribution: when the spatial distance between the candidate point and the historical trajectory point exceeds the close distance threshold, the following far distance weight distribution scheme is adopted, and the weight in the scheme is an adjustable parameter, which is weighted according to the relative ratio:

[0125] For the position consistency score, set the IoU feature weight: 0.45;

[0126] For the color consistency score, set the appearance similarity (Bhattacharyya distance) feature weight: 0.2;

[0127] For the motion direction consistency score, set the angle similarity feature weight: 0.4;

[0128] For trajectory continuity score, set trajectory distance feature weight: 0.3;

[0129] For speed consistency score, set speed feature weight: 0.2.

[0130] The above weight distribution scheme can be flexibly adjusted according to actual application requirements. Each feature score is denoted as scorek, and the final fusion score is the weighted sum of each feature score and its corresponding weight. By dynamically adjusting the weight distribution of each feature, adaptive matching optimization of sperm targets in different motion states is realized, effectively improving the overall recognition and tracking performance of the system.

[0131] In the process of sperm tracking and identity maintenance, simply relying on spatial distance or appearance features for target matching is easily disturbed by occlusion, deformation, illumination change, etc., leading to sperm trajectory loss or identity switching. Therefore, as another embodiment, the present embodiment proposes a sperm matching method combining particle filter prediction and multi-feature scoring, which realizes high-robustness tracking of sperm identity by combining dynamic prediction of historical trajectory and multi-dimensional feature scoring for each detected sperm candidate point in each frame.

[0132] For each tracked sperm, a set of particles and corresponding weights are maintained to describe its possible motion state. When each frame arrives, Gaussian noise is first added to each particle to simulate the uncertainty of sperm motion, and the current detected sperm position is expanded to be consistent with the particle state dimension. The predicted position of the sperm is obtained by weighted averaging the states of all particles. The calculation formula is:

[0133] ;

[0134] where w i is the weight of the i-th particle, and p i is the state of the i-th particle.

[0135] Particle filter technology can effectively estimate the most likely position of the sperm in the current video frame and evaluate the deviation between the predicted position and the actual detected position. Smaller deviation indicates high accuracy of prediction. Therefore, in the near-distance matching scene, the score of particle filter prediction is given a higher weight, because this method can effectively capture the subtle movement of sperm in consecutive video frames.

[0136] According to the spatial distance between the sperm and the detected point, different feature weights (near-distance / distance weight) are dynamically selected, and the final total score is:

[0137] ;

[0138] where w is the weight of each feature. score each feature, score each feature.

[0139] Step S5 calculates sperm motion parameters based on each non-encapsulated trajectory and unique identification.

[0140] Sperm tracking is to better complete the calculation of sperm activity indicators. The classification criteria for sperm motility are shown in Table 1.

[0141] Table 1

[0142]

[0143] The method for calculating sperm motion parameters based on each non-encapsulated trajectory and unique identification comprises:

[0144] Step S5.1: According to the position information of each sperm in the continuous frames, the curve velocity VCL of the sperm head along the motion trajectory is calculated, that is, the total length of the motion trajectory is divided by the motion time.

[0145] VCL represents the curve velocity, with the unit of µm / s, which is measured by measuring the total length L of the sperm head along the sperm motion trajectory in the two-dimensional plane, and then dividing by the motion time T, that is, VCL=L / T.

[0146] Step S5.2: Calculate the linear velocity VSL of the sperm head between the starting frame and the current frame, that is, the linear distance R between the position of the sperm head when the detection starts and the last position, and then divide by the motion time T, that is, VSL=R / T.

[0147] VSL represents the linear velocity, with the unit of µm / s, which is calculated by calculating the linear distance R between the position of the sperm head when the detection starts and the last position, and then dividing by the motion time T, that is, VSL=R / T.

[0148] Step S5.3: Calculate the motion linearity LIN according to the ratio of VCL and VSL;

[0149] LIN=VSL / VCL, observe whether the sperm moves in a straight line, and divide the sperm into forward motion PR and non-forward motion NP, and completely immobile sperm IM.

[0150] Calculate the total number of sperm N. In the case where the model detection accuracy is high, it can be considered that the number of sperm detected by the model = the number of actual sperm, so the number of sperm is the average of the number of sperm detected by the yolo model in the last 10 frames.

[0151] Then, the number of each type (PR, NP, IM) of sperm / the total number of sperm N is obtained to obtain the proportion.

[0152] Step S5.4: Calculate the continuous trajectory of each sperm to obtain the numerical motion parameters that can be used for sperm classification or subsequent analysis.

[0153] To better calculate the metrics, we need to obtain the complete and accurate trajectory of each sperm, that is, the position of the sperm in each frame. To obtain the complete trajectory of a sperm, we need to correctly identify and match the same sperm between consecutive frames. However, many problems are often encountered in the process of obtaining sperm trajectories:

[0154] 1) A mismatch occurs when a motile sperm encounters a non-motile sperm.

[0155] like Figure 7 As shown in the figure, the trajectory changes from pink to purple, indicating a matching error. The same sperm generated two trajectories. If both trajectories are considered as motile sperm, the number of motile sperm will be one more than the actual number, meaning the number of forward (PR) sperm will increase by one. Subsequently, when calculating the ratio using the formula PR / N, the PR index will be too high, which is incorrect.

[0156] To eliminate this error, a method of sealing stationary sperm was used. During the tracking process, sperm with excessively slow speed or minimal positional movement were considered stationary and sealed. After sealing, the location was treated as if there were no sperm there. Thus, when motile sperm approached, they would ignore the stationary sperm, preventing matching errors. Figure 8 As shown in the figure, the red box represents the sealed, quiescent sperm.

[0157] Accurately distinguishing between quiescent and motile sperm is crucial in automated sperm tracking and motility analysis. If quiescent sperm cannot be effectively identified, the system may repeatedly count the same quiescent target as a new target, leading to an inflated total sperm count, distorted motility parameter analysis, and even affecting subsequent motility classification and medical diagnosis.

[0158] In step S5, the sperm trajectories generated in step S4 are determined to be either stationary or in a low-activity state, based on the velocity and maximum displacement of the most recent N frames. Trajectories determined to be stationary or in a low-activity state are archived, excluding them from subsequent matching logic, but their detection data is retained for filtering in subsequent matching. Matching is only performed on non-archived trajectories, thereby preventing stationary sperm from interfering with the generation of motile sperm trajectories. In this invention, for sperm trajectories determined to be stationary or in a low-activity state, an archiving process is used instead of simple filtering. This technique can prevent stationary sperm from interfering with the matching of motile sperm trajectories, ensuring the continuity and uniqueness of motile sperm trajectories, thereby preventing trajectory splitting, duplicate counting, or deviations in motility index calculation.

[0159] The method realizes robust discrimination of the static sperm by statistical analysis of the motion characteristics of each sperm trajectory in continuous multiple frames, and comprehensively considers two indexes of average speed and maximum displacement. In the embodiment, the window length is set to N, and the typical value is 10 frames for processing. The specific steps are as follows:

[0160] (1) Track window extraction. For each sperm trajectory, the historical position points of the last N frames are extracted, denoted as:

[0161]

[0162] (2) Average speed calculation. The average speed velocity between adjacent frames in the window is calculated:

[0163]

[0164] (3) Maximum displacement calculation. The maximum displacement max disp of all points in the window relative to the starting point is calculated:

[0165]

[0166] (4) Static discrimination condition. The static speed threshold static velocity threshold and the maximum displacement threshold max disp threshold are set. When and only when velocity < static velocity threshold and max disp < max disp threshold, the sperm trajectory is determined as a static sperm, as shown in the box selection. Figure 9

[0167] The sperm trajectory determined as static will be specially marked and filtered in the subsequent target detection and matching process to prevent repeated counting and mismatching. This method can effectively identify and isolate static sperm in a complex motion environment, greatly improving the accuracy of sperm tracking and motility analysis and the automation level of the system, and providing a solid data foundation for subsequent sperm motility classification, quantity statistics and related medical research.

[0168] ​​​​​In this embodiment, for sperm trajectories determined to be in a static or low activity state, a quarantine process is adopted instead of simple filtering. The present application determines whether a sperm is in a static or low activity state by analyzing the motion characteristics of the sperm's historical trajectory in consecutive multiple frames, including average speed and maximum displacement, and marks its trajectory as a quarantine state; in the target matching process of subsequent frames, the quarantine trajectory does not participate in the matching calculation with moving sperm, but its detection data is still retained in the system for statistics or subsequent analysis. This technical means can avoid the interference of static sperm with the trajectory matching of moving sperm, ensure the continuity and uniqueness of the trajectory of moving sperm, and thus prevent trajectory splitting, repeated counting or deviation in the calculation of motility indicators.

[0169] 2) Sperm appearing and disappearing (out of frame)

[0170] In complex sperm image conditions, there may be such a sperm that appears and disappears as shown in Figure 10 Due to the fact that such sperm is not very obvious, the model may not be able to detect it every frame, which may result in the appearance of sperm out of thin air.

[0171] As shown in Figure 11 During tracking, the situation of appearing out of thin air may be that the previous purple sperm trajectory is disconnected because it has not been detected for a period of time, and then it is detected, so a new red trajectory appears, which is equivalent to appearing out of thin air. In fact, the previous trajectory and the newly appearing trajectory should be counted as one sperm, so the previous purple trajectory can be deleted by detecting the latest frame, and only the current red trajectory is retained, so that one sperm corresponds to one trajectory. If both trajectories are considered as moving sperm, the number of moving sperm is one more than the actual number, that is, the number of forward (PR) sperm increases by one, and when the proportion is calculated by the formula PR / N, the PR index will be larger.

[0172] Disappearing out of thin air is that the sperm moves out of the boundary or the sperm suddenly becomes dark and cannot be tracked for a long time. Both of these situations will be filtered out by the latest frame detection.

[0173] This approach ensures that each sperm value in the graph corresponds to a trajectory, providing a correct premise for subsequent indicator calculation.

[0174] In the detection stage, the present embodiment mainly uses accuracy (Accuracy, Acc), precision (Precision, P), recall (Recall, R), mean average precision (mean Average Precision, mAP) and the like as evaluation indexes. Their calculation formulas are as follows:

[0175] ;

[0176] ;

[0177] ;

[0178] ;

[0179] ;

[0180] Target detection definition (True Positive) is the same as the true value, that is, the number of positive samples correctly identified; (True Negative) is the same as the true value, that is, the number of negative samples correctly identified; FP (False Positive) is a positive sample while the true value is negative, that is, the number of false negative samples; FN (False Negative) is the opposite of FP, which is the number of missed positive samples. is the class in the data set, since there is only one class, so is 1. Secondly, (Average Precision) is the average precision, with recall as the horizontal axis and accuracy as the vertical axis. The area surrounded by the P-R curve and the two coordinate axes is AP. As shown in the above formula, set the intersection over union (IOU) of mAP to 0.5. Under the condition of protecting the privacy of patients, obtain the corresponding sperm data from the hospital, test after centrifugation, select 5 representative videos in the provided data set for testing, and the following Table 2 is the detection statistical results of the YOLOv8_OBB model parameters and the test data set.

[0181] Table 2

[0182]

[0183] From the data results, the detection head of YOLOv8_OBB greatly improves the adaptability of the sperm detection model by increasing the regression prediction of the rotation angle. Multi-scale detection and efficient loss function further optimize the detection accuracy and speed. Whether it is a complex sperm rotation trajectory or a real-time detection task, the detection head of YOLOv8_OBB can provide a stable and efficient solution for sperm detection, meeting the needs of reproductive medical research and clinical applications.

[0184] Multi-Object Tracking, MOT for short, is to track multiple objects in a video. Since it is multi-object, new objects will enter and old objects will disappear, which is the biggest difference from single-object tracking algorithm. Due to this difference, the tracking strategy is also different. The common tracking strategy in the field of multi-object tracking is TBD (Tracking by Detection). That is, target detection is performed in each frame, and the results of target detection are used for target tracking. This step is called data association (Data Association). MOTA (MOT Accuracy) accuracy and MOTP (MOT Precision) precision are two important indicators in tracking strategy. MOTA (Multiple Object Tracking Accuracy) is an indicator to measure the accuracy of the algorithm tracking objects. It considers three problems: false positives (FP), false negatives (FN) and ID switching (ID Switch), and combines these factors to provide a comprehensive measure of tracking performance. The calculation method of MOTA is to weight the average of the number of missed detections, false detections and ID changes in all frames. The higher the MOTA value, the better the tracking performance, but MOTA can also be negative if the tracker produces more errors than the number of objects in the scene. MOTP (Multiple Object Tracking Precision) measures positioning accuracy, mainly focusing on detector performance rather than tracker. It evaluates the distance between the detected objects in each frame and the corresponding ground truth, such as IOU or Euclidean distance. The higher the MOTP value, the better the positioning accuracy of the detector. The MOTA calculation formula is as follows:

[0185] ;

[0186] Where: is the sum of all frame false negatives, i.e. assuming is the false negative of the t-th frame, then ; similarly, . is the sum of all frame true target numbers, i.e. assuming the t-th frame has targets, then ; is the number of target jumps in all frames, is the target jump number of the t-th frame, then .

[0187] The MOTP calculation formula is as follows:

[0188] ;

[0189] wherein, represents the number of matches of the t-th frame; the matching error is calculated for each pair of matches represents the distance between the target and its paired hypothesis position in the t-th frame.

[0190] The tracking data statistics of the test video are shown in Table 3.

[0191] Table 3

[0192]

[0193] In summary, the sperm target detection and tracking technology provided by the embodiments of the present application is committed to significantly improving the accuracy and automation level of sperm motility analysis. The sperm target in the sperm image is efficiently recognized and positioned, and key information such as the position and movement direction of the sperm target is accurately captured. Meanwhile, in the field of sperm target tracking, a sperm trajectory detection method of a comprehensive multi-feature scoring system is innovatively proposed, which covers multiple advanced technologies such as IoU score, color histogram, Bhattacharyya distance, and particle filtering technology based on Bayesian estimation, and realizes accurate tracking of the sperm movement trajectory.

[0194] The embodiments of the present application also provide an electronic device, including a memory, a processor and a computer program stored in the memory, and the processor implements the steps of the above method when executing the program.

[0195] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the program is executed by the processor to implement the steps of the above method.

[0196] The technical features of the above embodiments can be combined arbitrarily, in order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, only the preferred embodiments of the present application are expressed, and the description is more specific and detailed, but it cannot be understood as limiting the scope of the present application. As long as the combination of these technical features does not exist contradictory, it should be considered as the scope of the present application.

[0197] It should be noted that, for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A method for automated sperm detection and tracking, characterized in that: The method comprises the following steps: Step S1: processing the sperm image, rotating the boundary box of the sperm head and tail, and generating a training set containing the center point coordinates, width, height and rotation angle; Step S2: training the target detection model using the training set to generate a model capable of automatically detecting sperm and outputting a rotating boundary box; Step S3: using the trained model to detect the sperm video image, obtaining the rotating boundary box of each frame of sperm, including the position, orientation and size of the sperm; Step S4: matching the sperm targets of adjacent frames, evaluating the matching reliability through a multi-dimensional feature fusion scoring system, the multi-dimensional feature fusion scoring system comprising position consistency, motion direction consistency, speed consistency, color consistency and trajectory continuity; weighting and fusing each score according to a preset weight to generate a comprehensive matching score, and associating the sperm targets of the previous and subsequent frames according to the score to generate the continuous time sequence trajectory and unique identification of each sperm, which can be used to calculate the motion parameters of the sperm; Step S5: determining whether the sperm trajectory generated in step S4 is in a stationary or low-activity state, determining the speed and maximum displacement based on the last N frames; performing archiving processing on the trajectory of the sperm determined as stationary or low-activity, excluding it from participating in matching in the subsequent matching logic, but retaining its detection data for filtering in the subsequent matching, and only performing matching in non-archived trajectories, thereby avoiding interference of stationary sperm with the generation of motion sperm trajectories; and calculating the motion parameters of the sperm based on each non-archived trajectory and unique identification.

2. The method of claim 1, wherein: The method for determining whether the sperm is in a stationary or low-activity state in step S5 is: statistically analyzing the motion features of a plurality of consecutive frames within a window length N of each sperm trajectory, extracting the historical position points of the last N frames, calculating the average speed of adjacent frames within the window and the maximum displacement of all points within the window relative to the starting point, and when the average speed and the maximum displacement are both lower than a set threshold, determining the sperm trajectory as stationary or low-activity and marking it as an archived state, which is excluded from participating in matching in the subsequent frame matching logic.

3. The automatic sperm detection and tracking method according to claim 1, wherein, The multi-dimensional feature fusion scoring system is used for matching and trajectory generation of sperm targets in consecutive video frames, and the multi-dimensional feature fusion scoring system comprises: position consistency score, motion direction consistency score, speed consistency score, color consistency score and trajectory continuity score. The position consistency score is obtained by evaluating the spatial deviation or intersection over union (IoU) value of the center point coordinates of the sperm targets of the previous and subsequent frames to quantify the matching degree of the sperm position; The motion direction consistency score is obtained by comparing the difference between the motion direction of the sperm historical trajectory and the direction of the sperm detection box in the current frame to determine the consistency degree of the sperm motion direction, thereby avoiding incorrect exchange of sperm trajectories; The speed consistency score is obtained by calculating the difference between the average speed of the sperm in the historical trajectory and the speed of the current frame to evaluate the change in the motion state of the sperm, thereby avoiding matching errors caused by abnormal speed; The color consistency score is obtained by analyzing the similarity of the color histogram within the sperm detection box of the previous and subsequent frames to determine the identity consistency of the sperm. The trajectory continuity score is obtained by predicting the sperm position by particle filtering and deviating from the current frame detection box, evaluating the continuity and stability of the sperm trajectory, to support continuous time trajectory generation.

4. The method of claim 1, wherein: The target detection model in step S2 adopts a YOLOv8_OBB detection model, which includes a backbone network, a feature fusion layer, and a detection head. The backbone network is configured to extract multi-scale features of the sperm image. The feature fusion layer is connected to the backbone network and the detection head, and is configured to perform bidirectional fusion on the multi-scale feature maps and output fused feature maps. The detection head is configured to predict the fused feature maps to obtain the center coordinates, width, height, and rotation angle of each sperm.

5. The method of claim 4, wherein: When training the YOLOv8_OBB detection model in step S2, a CIoU and DFL joint loss function is used for training. The CIoU loss function The expression is: ; ; In the formula, represents the intersection set; represents the distance between the center points of the target frame and the predicted frame; represents the diagonal distance of the minimum circumscribed rectangle; represents the correction factor; and respectively represent the width and height of the real target frame; and respectively represent the width and height of the predicted frame; The DFL loss function The expression is: ; In the formula, and respectively represent the output predicted value and the neighboring predicted value; represents the actual value of the label; and respectively represent the probability of the left and right positions closest to the actual value of the label.

6. The method of claim 3, wherein: The motion direction consistency score The expression is: ; wherein represents the frame relative to the frame, while N represents the total number of frames of the entire video.

7. The method of claim 1, wherein: The method for calculating sperm motion parameters based on each non-occluded trajectory and unique identifier in step S5 includes: Step S5.1: According to the position information of each sperm in the continuous frames, the curve velocity VCL of the sperm head along the motion trajectory is calculated, i.e., the total length of the motion trajectory divided by the motion time. Step S5.2: Calculate the straight-line velocity VSL, i.e., the straight-line distance between the sperm head in the starting frame and the current frame divided by the motion time. Step S5.3: Calculate the motion linearity LIN according to the ratio of VCL and VSL. Step S5.4: Calculate the continuous trajectory of each sperm to obtain numerical motion parameters that can be used for sperm classification or subsequent analysis.

8. The method of claim 3, wherein the method further comprises: The multi-dimensional feature fusion scoring system is realized through a dynamic weighting fusion strategy, wherein the weight of each feature score is dynamically adjusted according to the spatial distance between the sperm candidate point and the historical trajectory point, and the weighted comprehensive matching score is combined with the particle filtering predicted sperm position to select the optimal historical trajectory and the current sperm candidate point for association in the target matching process, thereby forming a continuous sperm time trajectory and maintaining the consistency of the sperm identity.

9. An electronic device, comprising: A computer program is stored in the memory, and the processor executes the program to realize the steps of the method according to any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the memory, and the processor executes the program to realize the steps of the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Method and system for rapidly detecting remains

    CN104881643A

  • System and method for identifying static elements at infrastructure using radar data

    WO2023086875A1