Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm

— Sperm analysis is an initial step in the examination conducted to identify infertility cases in humans. One aspect of sperm analysis involves observing the movement of spermatozoa and determining whether it is normal or abnormal. Normal spermatozoa movement is characterized by progressive motion at an average speed of 20 µm/second, while abnormal movement includes slow or non-motile spermatozoa. Traditional methods can be employed to assess the normality or abnormality of sperm movement, but they have drawbacks such as time-consuming procedures and diverse results depending on the expertise of the examiner. On the other hand, utilizing Computer-Assisted Sperm Analysis (CASA) equipment provides consistent results, albeit at a relatively high cost. Therefore, this research proposes an alternative method for determining sperm movement abnormalities using the Gaussian Mixture Model (GMM) for background subtraction and a matching-based algorithm to track and analyze the formed trajectories, distinguishing between normal and abnormal sperm movement. Human spermatozoa in real-time are used, and their movements are recorded in video format using a bright field microscope. The testing results for determining sperm movement abnormalities based on the GMM method and matching-based algorithm were successful, particularly in videos recorded at 50 fps recording speed, 20 minutes of liquefaction time, and 40x microscope lens magnification. This condition exhibited the highest average accuracy, with a tracking accuracy of 77.3% and an average accuracy for determining sperm motility abnormalities of 87.7%. Therefore, the combined tracking of sperm movement based on the GMM method and matching-based algorithm can be utilized to identify abnormalities in the movement of human spermatozoa.


INTRODUCTION
Sperm analysis is performed to determine the number and quality of spermatozoa contained in semen [1] [2], which is the first step in determining fertility [3][4].This examination can help determine whether there is a problem with the sperm production system or sperm quality [5], which is the main factor in determining fertility [6].This fertility level determines the ability to obtain offspring [7].One of the ways that can be used to analyze sperm is by looking at the movement of spermatozoa in semen [8][9] [10].This way is commonly done by manually testing with visual microscopy using a microscope [11] [12].Microscopy [13] has a fairly high subjective value, that there is necessity to have an experienced examiner with expertise and skills in assessing spermatozoa movement to be able to obtain accurate test results [14].This manual analysis has several obstacles including experts in the analysis process having varying abilities, so there is a possibility of differences in reading results [15].To be able to know the results of this manual examination takes quite a long time.In addition to the manual method, currently, there is also a sperm analysis using a computer [16].The product used is CASA (Computer-Aided Sperm Analysis) or sperm analyzer [17].With CASA [18], microscopic photographs of semen are taken, as well as analyzing the number, movement, and morphology of sperm in the semen [19].Despite its capabilities, commercial CASA products are too expensive and rudimentary [20].
Microscopic examination in sperm analysis includes morphological analysis that is based on size, involving head length, head width, mid-piece, and tail length [21] [22].However, the size of spermatozoa is not an absolute requirement for determining normal and abnormal spermatozoa [23] [24].Another characteristic of good sperm is its ability to move quickly and accurately toward the egg to carry out the fertilization process, generally swimming at the speed of 2.5 cm every 15 minutes [25].On the other hand, poor-quality sperm have slow movement or move inaccurately which results in failing to reach or penetrate the egg, thus they cannot carry out the fertilization process [26].Therefore, the determination of the level of liveliness of sperm can be seen from two features [27] [28], which are the speed of movement and the pattern of movement.To get these two features, spermatozoa motility analysis is conducted, which includes motility tracking such as movement, speed, and trajectory of spermatozoa [29].Spermatozoa motility tracking produces position information [30] using algorithms that require high-performance computer.The spermatozoa are called abnormal if it met the requirements of normal morphology but abnormal motility, Journal of Robotics and Control (JRC) ISSN: 2715-5072 104 I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm and vice versa [32].Therefore, there is a need for a system capable of analyzing and classifying normal and abnormal human spermatozoa based on motility morphology and analyze spermatozoa movement patterns [33][34].
Several studies have conducted research on sperm analysis, both in the form of morphological analysis and motility analysis of sperm movement, one of which is research conducted by Prabaharan and Raghunathan (2021), which uses a machine learning approach, especially deep convolutional neural networks (CNN), to perform classification, detection, and segmentation processes.This method also utilizes morphological approaches to represent images [35].In the proposed method, deep convolutional neural networks are used to detect infertility disorders in men.Image morphology process is applied using an improved Otsu threshold method for sperm image segmentation, which helps to detect abnormal regions using convolutional layers [35].The database is sourced from a human sperm image analysis dataset.Overall, this study optimized image representation, image segmentation, and abnormality detection with results in accuracy, detection rate, and computation time.The method achieved an accuracy result of 98.99% in detecting abnormalities effectively and reduced the computation time to 4 minutes and 15 seconds.This research was conducted using MATLAB with the 2018a version adaptation [35].As this research aims to categorize human sperm as normal and abnormal based on images and not videos, it is not able to detect sperm motility movement although the computation time can be reduced.
Research conducted by Ilhan et al. (2021), discusses a new alternative in sperm counting using smartphones, replacing visual assessment techniques in sperm concentration analysis [36].The first stage in infertility diagnosis, the sperm count, involves two main evaluation techniques: Computer Aided Sperm Analysis (CASA) and Visual Assessment (VA) [36].VA involves observation of sperm in the counting chamber, which makes the diagnosis highly dependent on individual expertise and experience.In contrast, CASA uses computer-based techniques but is more expensive and requires complex parameter settings.In this study, a new method that utilizes smartphones and computers for sperm counting analysis was proposed [36].A smartphone is used to take pictures similar to the VA technique, and the sample video is then transferred to a computer.On the computer side, Computerized Sperm Counting Software (CSCS) was developed consisting of four modules: Data Acquisition and Organization, Region of Interest (ROI) Detection, Mobile Sperm Detection, and Counting.Data capture via smartphone provides a more economical design than the CASA system [36].ROI extraction uses a combination of line detection and segmentation methods.Background and Foreground are extracted to detect mobile sperm and stationary sperm.Active contours are applied to improve the segmentation of stationary sperm, and the detected sperm is counted using pixel-based blob analysis.The experimental results show that this smartphone-based sperm concentration analysis can be applied in the laboratory due to its modularity, functionality, accuracy, and lower cost compared to CASA and VA analysis, but requires longer time.
Research by Chen, et al. (2022) discussed the evaluation of sperm activity using feature point detection networks in deep learning.Sperm motility is considered a key indicator for measuring semen quality [37].The Computer Aided Sperm Analysis (CASA) method uses sperm images and image processing algorithms, to detect and track the position of sperm targets to assess their activity.A deep learningbased target detection algorithm is used in this study, to overcome the limitations of traditional algorithms in detecting sperm targets in small and dense images.The method involves a deep learning-based feature point detection network, target tracking using SORT, and sperm viability assessment through sperm trajectory analysis.Experimental results show that the proposed method is effective in analyzing sperm activity with an average detection speed of 65 fps and detection accuracy of 92% [37].The conclusion of this study is that the proposed method can improve the accuracy and speed of sperm target detection and provide better tracking results for sperm activity analysis.
In their paper, research conducted by Alameri, et al. (2021) proposed a modified GMM algorithm to optimize the detection and tracking process of multi-sperm spermatozoa [38].The proposed method consists of two stages: the first stage focuses on accurate sperm detection, while the second stage involves sperm tracking and velocity measurement.Motility results were evaluated on 10 sperm samples, and the performance of the proposed method was compared with several other methods [38].When tested on 10 sperm motility videos, consisting of, 4 samples tested were classified as normal and the other 6 were considered abnormal.The method used in the study achieved accuracy, sensitivity, and specificity of 92.3%, 96.3%, and 72.4%, respectively [38].An obstacle encountered in this study was when two sperm move and collide in a line and the system must distinguish whether it is one sperm or multiple sperm.This problem is solved by optimized feature extraction.In addition, this study used Euclidean distance and similarity method in calculating sperm trajectory analysis, feature histogram, and background information so that the extracted object information will improve the accuracy of the proposed system.However, the limitation of this study is its inapplicability to real-time scenario when two sperm move and collide in a line.
Although it has been explained that optimized feature extraction can help, it is not explained in detail how this technique overcomes such situations.
Javadi and Seyed's (2019) research is about Sperm Morphology Analysis (SMA) for infertility diagnosis in male sperm.In his research using deep learning algorithms to detect sperm morphological abnormalities, using images of human sperm cells, which includes the development of the MHSMA dataset as a standard benchmark, consisting of 1,540 sperm images from 235 infertility patients [39].After applying data augmentation and data imbalance handling, it then uses deep neural networks to detect morphological deformities in different parts of the sperm [39].The test results showed high accuracy, especially in the detection of acrosome, head, and vacuum deformities.The algorithm used is more accurate than other methods in acrosome and vacuum deformity detection.In addition, the method can work fast, even on a common laptop [39].However, this research is not yet applicable in real-time to perform sperm analysis.Thus, it can be focused on improving the accuracy of the algorithm by using transfer learning and more complex deep learning models.
Research conducted by Somasundaram (2021) is about sperm analysis to evaluate clinical examination infertility.This procedure includes the analysis and classification of normal and abnormal sperm, as well as the selection and tracking of healthy sperm in a sample [40].This study proposes the Faster Region Convolutional Neural Network Method (FRCNN) and Elliptical Scanning Algorithm (ESA) to classify human sperm and the Tail to Head Movement algorithm (THMA) for motility analysis and tracking.This proposed method aims to improve the accuracy of computeraided sperm analysis (CASA).The method used provides better results compared to existing methods, with an accuracy of 97.37%.Sperm detection and identification of sperm motility in groups were performed with a minimum execution time of 1.12 seconds [40].From the overall research results, the performance of the proposed model can be implemented in infertility centers to detect healthy sperm in semen.However, this study is only image-based, so it does not address the requirements for sperm movement.
Another research related to tracking conducted by Zhu et al. [41] proposes an algorithm for automatic segmentation, detection, and tracking of nonspecific sperm aggregates.To achieve sperm head segmentation, multi-scale edge and new energy functional are designed using the level set method [41].At the same time, the method can calculate sperm concentration and motility in real time while tracking sperm.In this study, the sperm tracking stage improves the weight condition and quantization standard of the trust flow based on the graph theory method and simplifies the sperm tracking to the point matching between two frames to solve the failure problem of matching adjacent frames with a small space distance.The method used achieved accurate segmentation of non-specific sperm aggregation regions, compared with the level set LBF (Local Binary Fitting) and SBGFR (Selective Binary and Gaussian Filtering Regularized) methods [41].However, this study will be difficult to apply in real-time, due to its high computation time.
Another study related to motion detection is done by Hidayatullah et al. [42], Mean average precision (mAP), confusion matrix, precision, recall, and F1-score are used to measure accuracy.This research compares the proposed method with you only look once (YOLO) v3 and YOLOv4.The end results earn 94.11 mAP on the test dataset, an F1score of 0.93, and a processing speed of 51.9 fps.In comparison with YOLOv4, the proposed method is 2.18 × faster on testing, and 2.9 × faster on training with a small dataset [42], while achieving comparative detection accuracy [42].Although the study achieved good performance (including showing high speed) on the test dataset used, the sustainability and generalizability of the Deep Sperm model may need to be tested on more diverse datasets (larger datasets) and has not been tested on real-time situations in the field.
From several research above, the recorded semen vid data used still did not utilize the necessary sampling rate of 50 fps (frame per second).As an active motility of sperm can reach 5 times the size of its head, researcher would need a sampling rate that corresponds to the 50 fps of the video data used to be able to represent sperm motility more accurately.Thus, this study proposes a new approach (a series of procedures) for tracking and determining abnormalities of spermatozoabased cell motility based on matching-based algorithm, as well as making a complete integrated system beginning from data recording to analysis.Tracking and abnormality determination of sperm motility using the matching-based algorithm was applied to several video types with different frames per second (fps), different spermatozoa liquefactions, and different microscope lens zooms [43].In addition, this research compared tracking results and speed of execution time by using matching-based algorithm using the Kernelized Correlation Filters method [44].
This research has objectives and contributions to create an application for determining the abnormality of spermatozoa movement or sperm motility, which is considered normal at an average speed of 20 pM/sec [45].This application is based on the Gaussian Mixture Model (GMM) to perform background subtraction [46] and matching-based algorithms to generate spermatozoa paths and analyze their motility health [47].It also integrates the process of recording, tracking, generating trajectories, and determining the abnormality of spermatozoa movement.
The discussion of this research paper is organized into four sections.The first section is to discuss previous research, so that a contribution can be made to this research.Section two examines the system design and research methods used.Section three explains the results of the experiments carried out.Finally, the fourth section concludes the results and briefly provides further suggestions for the improvement of this paper.With this research, it is expected that the use of the Gaussian Mixture Model (GMM) method and matchingbased algorithms can be used to determine the abnormality of spermatozoa movement and calculate the number of sperm, as well as run according to the desired conditions and in real time.

II. THE RESEARCH METHOD
The system design of spermatozoa double tracking application based on matching-based algorithm made in this study is shown in Fig. 1.The stages in this study are: data acquisition, spermatozoa tacking, path generation, and abnormality determination.
Spermatozoa tracking was performed on video inputs containing several human semen samples.Every spermatozoa that moves in the input video was tracked.The results of tracking were motility paths from each spermatozoa in the videos.Tracking was performed to determine the normal motility of each spermatozoa in the videos.To facilitate the observation, each path was given a different colour.The trajectory images formed from the tracking can I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm be used to analyze the normalcy of spermatozoa motility in the input video.

A. Data Acquisition
The data used in this study was human semen video obtained from sperm donor conducted at Politeknik Kesehatan Surabaya.Video recording was performed using a Flea3 Point (Gray-type 3S3S2C-CS) Point camera, placed over an ocular lens on a microscope and connected to a computer using a USB 3.0 cable.In this study, the recording speeds used were 30 and 50 fps.If a higher recording speed were used, the performance of the computer used for recording would not be able to compete with the frame rate of the video, resulting in occasional consecutive unrecorded frames.The result would be a skipping video image, in which the movement of spermatozoa would seem very fast or jumpy.In addition to using two types of video recording frame rates, the sample was left in the open for about 10 and 20 minutes at room temperature before being examined [48].This was necessary because at the time the sperm fluid was removed, dilution was necessary to ensure the spermatozoa observed were not too concentrated, could move more actively, and be clearly differentiated.The sperms were removed from the container using a pipette and were put into an object glass arranged so that the inside of the container was extracted.Real video data was retrieved using a bright led microscope located at the Integrated Laboratory of Health Poly-technic K Surabaya, and the camera used was of Point Gray brand, FL3-U3-13S2C-CS type.The microscope used to observe the movement of spermatozoa was a light microscope with 40x magnification and 100x magnification, so that the movement of the spermatozoa can be clearly observed and recorded using the flea3 camera.An illustration of this process can be seen in Fig. 2.

B. Sperm Tracking
The second stage in this study is sperm tracking, which aims to obtain the coordinate position of each motile sperm in the input videos.This sperm tracking is accomplished using the matching-based method and represents the most important step in this research because most of the process is done at this stage [49].The processes used to track spermatozoa in the input video were Gaussian Blur, Background Subtraction, Spermatozoa Localization, Morphological filtering, Gap Filling, position search and storage, and tracking using the matching-based algorithm.Fig. 3 illustrates the processes employed to perform spermatozoa tracking in the input video.Smoothing is done by shifting the window (kernel) throughout the pixels in the image, calculating the value and each pixel based on the kernel value and the overlapping original image pixel value [52].In this study the kernel used is 13×13, the larger the kernel, the blurrier the resulting image looks.
2) Background Subtraction: The background subtraction process performed on the videos aims to separate sperm as the foreground in a video from other objects (background) [53] [54].The method used is the Gaussian Mixture Model (GMM), which is able to handle complex and changing backgrounds compared to other methods.By using a Gaussian distribution, GMM can adapt to light variations and background changes that may occur in video footage.An overview of the application of this GMM method is that each X pixel data in the coordinates (, ) in a video frame is modelled into a Gaussian distribution calculated on the basis of the colour vector values of R (Red), G (Green), and B (Blue) [55][56] [57].At the beginning of modelling into the Gaussian distribution, the data of the means and pixel variants of the coordinates need to be initialized in order to form a Gaussian distribution.After forming a Gaussian distribution, the weight of the Gaussian distribution is formed.This weight value is updated every time new input is included.This update of weight value results in the formation of some Gaussian background distribution models [58].The data value of each pixel is then matched to the background model based on its Gaussian probability.In matching these pixel values, there are two possibilities.First, if there is a value that matches the value of the existing Gaussian model, then the corresponding Gaussian models are sorted by their weight values and the smallest value is selected, which represents the  [59].The Gaussian Mixture Model (GMM) method is chosen because it has several characteristics, such as searching for moving objects, which are moving pixels in this case, and modelling with a normal distribution or also called Gaussian distribution [60].As long as there is a pixel movement of the location (, ) in the frame to framen+1, then pixels can be detected as a moving object because the probability value is different, and the more pixels move, the higher the variant value becomes [61].However, this GMM method also has some disadvantages.If the learning rate () is high, then noise is also detected as a moving object; and if the learning rate () is low, objects that should be selected as moving objects become undetectable, or the foreground is considered as background [62].Therefore, while the Gaussian Mixture Model Method is suitable for detecting the movement of objects that have random velocities or random accelerations, GMM results should still be altered.
3) Spermatozoa localization is a stage to find areas that are suspected of being spermatozoa.In looking for areas that are suspected to be sperm, the method used is to look for contours [63] [64].Contour is a condition caused by changes in intensity in neighbouring pixels.Because of this intensity change, the edge of the object in the video can be detected [65].With the detection of the edge of each object in the video, it can be used to distinguish objects with different colours.The colour difference obtained is used to distinguish objects that are considered as sperm, characterized by white areas, and objects that are considered as background, characterized by black areas.
4) Morphological Filtering.The contour obtained from the results of the previous stage still contains some small white areas that are not needed in the tracking process, because these areas are not spermatozoa [66].These small areas from the contour search are noise detected as motion from the background subtraction results.This noise must be removed by applying Morphological Filtering.To be able to eliminate unwanted objects with objects suspected of spermatozoa using morphological filtering, the method is to segment or separate the unwanted area from the desired area based on the area of the area [67].Morphological Filtering is done by providing a boundary value between sperm and noise [68].Areas whose values are below the threshold value are considered noise and removed, while areas whose size is more than or equal to the threshold value are retained or not removed.

5) Gap
Filling is performed to unite objects that are close together or in one area, using the closing process.Closing is an image morphology operation performed through a dilation operation followed by an erosion operation.Dilation is a morphological operation to make the image size thicker while erosion makes the image size thinner.The purpose of this closing process is to connect disconnected objects and close small holes in objects.This is to ensure that when tracing is done, an accurate number of sperm cells is obtained.

6) Finding and Storing the Position of Detected Sperm.
Based on the areas that have been obtained as areas that are considered sperm, the position of each of these areas in the (, ) coordinates is searched.This is done by using moments.Moments can describe an object in terms of area, position, orientation, and other defined parameters.The basic equation of the moment of an object is defined as equation (1).
Zero-order and first-order moments are defined by equation (2). (2) In binary images where   will be 0 or 1, the zero-order moment ( 00 ) is equal to the area of the object.The center of the area or mass (centroid) is a good parameter to express the location of the object.The center of this area is used to determine the position of the detected sperm in (, ).The center of the area of the object is defined by equation (3).
′ =  10  00 and  ′ =  01  00 (3) With ( ′ ,  , ) being the coordinate center of the object [69][70] [71].The x and y coordinate positions obtained are made the center point of this circle and from this center point a circle is then drawn to mark the area of detected spermatozoa in each input video frame.The coordinate positions of the areas considered as spermatozoa are then stored in a file to be used in determining the passage of sperm from one frame to the next based on the proximity of the position of each sperm.Each frame is stored in one text file, then the coordinates in the next frame are stored in another text file.The goal is to make it easier to determine the path travelled by sperm from one frame to the next.) Tracking using Matching-Based Algorithm: Matchingbased is an algorithm to find the greatest similarity from several points based on the greatest similarity values of the points being searched.The point is the coordinate (, ) that had been obtained in the previous process [75] [76].The greatest similarity between two points was determined based on the magnitude of distance.The points considered as the suspected sperm movement from one frame to the next were points in the ROI (Region of Interest) of the point sought.The uses of ROI rely heavily on the depth and additional information provided on the scene geometry [77] or microscope scope to identify areas where sperm can be found.For example, the 3 frames as in Fig. 5.Meanwhile, consider the path obtained in Fig. 6(a).Because from frame a to frame c there are four sperm detected, then four paths were formed with each sperm having a position motility relationship from frame a to c.If there is no preceding point in the path or the point with the more possibilities is the first one, then the next point chosen is the one with the distance that has the greatest similarity or the one that has the smallest displacement, such as Fig. 7(a).On the other hand, if the path has a previous point, then the average gradient from the previous points that exist is considered.This average value is compared with the gradient value of each point in the sperm ROI that is sought for movement and the gradient with the greatest similarity is selected.The illustration can be seen in Fig. 7(b).

C. Path Generation
In the path generation of each spermatozoon detected in the videos, there are two stages.The first stage is to smoothen the path through which each spermatozoon is detected, and the second stage is to generate the path of each detected spermatozoa.to smooth a line [78].Mean Smoothing [79] is applied in a 1dimensional array to smooth a line.The formula for calculating the average value is defined by equation ( 4).
2) Smoothing the Path of Every Spermatozoa Detected: To get observable path results, smoothing is required for points in the text file from the following step.If not smoothened, the generated path image results would look coarse and contorted.The way to smooth the path line is by using the 1dimensional mean smoothing method.The equation for performing mean smoothing is the same as equation ( 1).Mean smoothing refines the line by finding the average of the dotted values stored in the text file of previous stages [80].The average searched is not from all points in the line because if it is from all the points searched, only a single point value will be obtained.Meanwhile, drawing a line requires at least two points.In calculating the average, the number of points that the average value is sought needs to be considered.If the number of points averaged is too few, then the resulting path will look not much different from the initial path.On the other hand, if the result is too many, then the resulting path becomes very different from the initial path.In this study, the average sought is from every 15 coordinate points.

3) Path Generation for Each Detected Spermatozoa:
The path through which each spermatozoa is detected in the video is drawn based on the points in the resulting le from the previous stage [81] [82].The line is made from points based on x and y coordinates in the mean smoothing results.The first coordinate in the line becomes the starting point of the drawing, which is then connected to the next point, and so on until the path passed by the spermatozoa in the video is drawn.

D. Determination of Spermatozoa Motility Abnormality
One way to determine whether or not a spermatozoa is normal is to look at the pathway of the spermatozoa.If the spermatozoa move in a straight or directed path, then the spermatozoa are classified as normal spermatozoa.Meanwhile, if the path travelled by the spermatozoa is full of turns and spins or circular movements, then the spermatozoa are not normal.Therefore, this system must be able to distinguish between straight lines and circular or irregular lines.
In the program, in order to distinguish whether the path through which a spermatozoa travels is a normal or abnormal, the method used is to find the perpendicular distance of each coordinate in the path to a straight line and with that value then Root Mean Square Error value (RMSE) is determined [83].RMSE is the average value of the sum of the squared errors [84].If the RMSE value is low, then the variation of the values generated by a forecast model or in this case the spermatozoa path analyzed approximates the variation of its observational value or the straight-line value of  ′ +  ′ +  = 0 [85].An illustration of the relationship between the points in the path with the points in the regression line can be seen in Fig. 8.To obtain a straight line as a comparative to the path through which abnormality is searched, the common straightline equations are generally used, such as equation ( 5) to (8).
Based on the A, B, and C values we can find a straightline equation in which there is a point of coordinate ( , ,  , ) as a comparison with the coordinate points (, ) in the generated path.The path is considered normal if the line is close to a straight line.In other words, the perpendicular distance from each point (, ) in the path passed by spermatozoa to a straight line  ′ +  ′ +  = 0 is small or the Root Mean Square Error (RMSE) value is close to 0. Meanwhile, the path will be considered abnormal if the perpendicular distance value of each point in the track to a straight-line  ′ +  ′ +  = 0 is of great value or if the RMSE value calculated is also great.The equation for calculating the distance between the points in the path with the points in the comparable straight line is is defined by equation (9).
With equation ( 5),  1 is obtained from point (1, 1).2from point (2, 2).2 from point (x2, y2) and so on until dn from point (x n , y n )  is the number of coordinates (, ) in the path of the spermatozoa analyzed for its motility abnormalities.From the obtained 1, 2, 3, … dn values, then the Root Mean Square Error (RMSE) value is calculated using equation (9).This RMSE value is used to determine whether or not a spermatozoa pathway is normal [86][87] [88].each spermatozoa detected in the video which in its implementation is depicted with different colours, each path traversed is given a description in the form of writing a normal or abnormal path.In addition, in the application there is also a result in the form of a description that shows the number of spermatozoa paths analysed, the number of normal paths and the number of abnormal paths.In the application, the process of determining this abnormality becomes one process with the creation of trajectories.From the drawn trajectory, the direction of movement is analysed to determine whether the movement in the trajectory is normal or abnormal.

E. Manual Calculation of Spermatozoa Motility Abnormalities
In the calculation stage of sperm movement abnormalities, the data used in this study are in the form of human semen videos obtained from several volunteers who have agreed to be analyzed.The sperm sample is allowed to stand for about 20-30 minutes at room temperature and then observed.This needs to be done because when the sperm fluid is released, it is still thick and needs dilution so that the observed spermatozoa are not too tight, move more actively, and can be clearly distinguished.In sperm research, a dilution time of 10 minutes and 20 minutes is used, to distinguish the liveliness of sperm movement when it is still thick and when it has started to melt.While video recording is done using a Flea3 type Point Grey camera (FL3-U3-13S2C-CS) which is placed above the eyepiece on the microscope and has the ability to record at speeds up to 120 fps (frames per second).However, this study only utilizes only 30 fps and 50 fps recording speeds due to limitations in the specifications of the computer used.If a higher recording speed is used, the performance of the computer used for recording cannot keep up with the frame rate of the video, so sometimes there are frames that are not recorded in a row.The result is a jerky video image where the movement of the spermatozoa looks very fast or like jumping around.The microscope used to observe the movement of spermatozoa is a light microscope with a magnification of 40 on the ocular lens and 100 on the objective lens, so that the movement of spermatozoa can be clearly observed and recorded with a flea camera3.The purpose of taking videos with different fps is to find videos with the lowest fps that can still be used to observe spermatozoa movement and analyze its movement.While the difference in semen dilution aims to get the number of spermatozoa cell populations that can still be traced to analyze their movements.Those exhibiting forward motion move straight and are considered to move well, whereas those indicating poor motion are zigzag, circle, and others.To calculate the number of sperm that move normally, first count the spermatozoa that do not move, then count those that move poorly, then those that move well, for example: those that do not move = 25%, those that move poorly = 50%, those that move well = 100% -25% -50% = 25%.The percentage of movement is simply written with a round number (generally a multiple of 5 for example: 10%, 15%, 20%).If the sperm that does not move > 50% then further examination is required to determine the viability of sperm (the number of living sperm) because even immobile spermatozoa may still be alive.

III. EXPERIMENT AND RESULTS
In this study, the test was performed using several videos of human cement recording using different frames per second (fps), time of cement liquefaction and magnification at microscope during video capture process, divided into 8 conditions according to WHO (World Health Organization) standard [6], as in Table I.Based on Table I, will be presented in the form of Average Accuracy Error (%) and Average Accuracy of Sperm Abnormalities Determination (%).

A. Sperm-tracking and Test Result
Spermatozoa tracking aims to retrieve spermatozoa positions in each frame and maps the path through which each spermatozoa moves in the video.The spermatozoa tracking process consists of the following steps: 1) Gaussian Smoothing: Gaussian smoothing or Gaussian blurring is a 2D convolution operation used to blur an image with the aim of eliminating noise.The smoothing process was performed by sliding the window (kernel) to all parts of the pixel in the image and calculating the value and counting each pixel based on the kernel value and the overlapping original image pixels.In this study, the kernel used was 13×13.The larger the kernel, the more blurred the resulting image will look like.Fig. 9 displays the result of Gaussian smoothing.2) Background Subtraction: The background subtraction process aims to separate the sperms as the foreground in the video from other objects (background).The method used was Gaussian Mixture Model (GMM).An overview of the applicability of this GMM method is that each x pixel data in the coordinate (, ) in a video frame is modelled into a Gaussian distribution calculated based on the input of colour vectors R, G, B. One of the frames resulting from background subtraction can be seen in Fig. 10(a).searching for an area of suspected sperms, the process looks for contours.A contour is a condition caused by changes in intensity in neighboring pixels.Due to this intensity change, the edges of the object on the video can be detected.With edge detection, each object in this video can be used to distinguish objects with different colours.The differences of colour obtained were used to identify objects that were considered as sperms, denoted by the white area, from objects that were recognized as the background, indicated by the black area.

4) Morphological Filtering:
In the contour obtained from the previous stage, there were still some small white areas that were not needed in the tracking process, since these areas are not spermatozoa.Small areas resulting from contour search were noises detected as movements of the resulting background subtraction.This noise should be eliminated by applying morphological filtering.To be able to remove unwanted objects from suspected spermatozoa, morphological filtering was used.The trick is to segment or separate the undesirable area from the desired area based on the area spread.Morphological filtering was done by assigning a boundary value between sperm and noise.An area whose value is below the threshold value was considered to be noise and was removed, whereas an area whose size is greater than or equal to the threshold value was skipped or not removed.The results of this stage can be seen in Fig. 10(b).

5) Gap Filling:
Gap Filling was performed to unify objects that are located adjacently or in one area using the closing process.Closing is an image morphology operation performed through dilation followed by erosion.Dilation is a morphological operation to make the image size thicker, while erosion is done to make the image size thinner.The purpose of this closing process is to connect the disconnected objects and close the small holes in the objects.This is done so that during tracking, the accurate number of sperm cells would be obtained.An illustration of gap filling results can be seen in Fig. 10(c).6) Finding and Storing Detected Sperm Positions: Based on areas that have been found as sperm suspects, the position of each of these areas was found in coordinates (, ).This was performed using moment.

B. Path Generation Test Result
The path generation for each spermatozoa detected in the video was conducted in two stages, namely smoothing the path through which each spermatozoa was detected and drawing the path of each detected spermatozoa.The pathsmoothing step was performed to get easily observable path image results.If not smoothed, the image results of the generated path would look coarse and contorted.The way to smooth the path line is by using the 1-dimensional mean smoothing method.Mean smoothing refines the line by finding the average of the dotted values stored in the text le of previous stages.After the path of movement was smoothed, then the path through which each spermatozoa was detected in the video was drawn based on the mean smoothing points.The line was made from points based on  and  coordinates in the mean smoothing result.An illustration of line drawing results can be seen in Fig. 11(b), while Fig. 11(a).is the result of the path generation without smoothing.

C. Abnormality Determinations Test Result
The accuracy value of path determination is calculated based on the number of paths correctly tracked by the actual path or the number of paths calculated manually.Here is the formula for finding tracking accuracy in percent (%): Where: The accuracy value of determining the abnormality here is the level of truth of the system in identifying the normal or abnormal path.The value is calculated based on values of True Positive (TP) indicating the correct path identified as the normal path, True Negative (TN) indicating the correct path identified as an abnormal path, False Positive (FP) indicating the wrong path identified as the normal path, and False Negative (TN) indicating the wrong path identified as an abnormal path.The equations for determining the accuracy rates are as defined by equation ( 13) [89].The following are the results of the tests in this study, which can be seen in Table II and Fig. 12. Table II is an example of traceability and determination of abnormalities for condition G and Fig. 12 is the result of average tracking accuracy and average results of determination of sperm motility abnormalities for all conditions.Video analysis at condition A involves Video with recording speed 30 fps, sperm liquefaction time 10 minutes and magnification of 40x lens microscope.Test result of average tracking and determination of abnormalities of spermatozoa movement on 6 input videos at condition A, shows the tracking result accuracy of 78.2% and the average result of the determination of sperm abnormality is 74.6%.
For video analysis on conditions B, C, D, E, F and H, with the conditions of each (according to Table I), for the average accuracy of the results of tracking and the average result of accuracy determination of sperm motility abnormalities can be seen on Fig. 12. Video Analysis at G condition involves Video with recording speed 50 fps, sperm liquefaction time 20 minutes and magnification of 40x microscope lens.The result of the average tracking and determination of sperm motility abnormality is 89% and 87,7%, as per Table II.In the tracking test, there are 2 videos with precision over 90% accuracy value, i.e. on video 5 and video 6.In both the videos there are 98 moving spermatozoa and 89 tracked by using matching based algorithm.Tracking results on the other 4 videos also gave pretty good results.The most significant error occurred in video 1, amounting to 89.4%.In video 1 of 85 existing spermatozoa, there were nine spermatozoa that failed to trace.This means 76 other spermatozoa successfully traced.The average tracking result in 6 videos is quite good that is equal to 89.4%.For the results of the path determination in 6 input videos can be seen in Table II and the graph can be seen in Fig. 12.
From the results of the determination of sperm motility abnormalities in Table II, it appears that the program runs quite well in determining the abnormalities of the path on 6 videos.In Table II and graphs in Fig. 12, it is seen that the number of TP values has a high enough value.This shows that tracking that generates many normal paths is true if applied to a video under condition G.Although there are some errors in determining the normal path, the value is not so great.Another thing that shows this is the average value of great accuracy seen in Table II, which is 87.7%, although there is still an error in determining the abnormal paths seen at the FN value or the wrongly identified abnormal path value, the greatest value being 5 TN values or true abnormal path values are also identified only However, the average accuracy of tracking results is still relatively good, as there are not many abnormal paths in 6 input videos.

D. Comparison with Other Methods
In addition to program testing with input of some types of videos, the test is also done by comparing with commonly used tracking methods.The method used as a comparison in this study is Kernelized Correlation Filters (KCF) [90] [91], which is one of the existing tracking methods in the OpenCV library.KCF is an extension of the existing tracking methods of Boosting and Multiple Instance Learning (MIL).Kernelized Correlation Filters refer to the presence of overlapping regions when using MIL trackers, the overlapping data indicates that the resulting data matrix is circulant, and the matrix can be diagonalized by Discrete Fourier Transform to reduce storage and computation.KFC uses a linear regression equation that is equivalent to the correlation filter used in some other trackers that have good speed.However, the regression kernel used is not like other kernel algorithms that have exactly the same complexity as the linear one.This makes tracking with KCF faster and more accurate at the same time [92] [93].
Comparative testing with KCF method is observed from the results of tracking the number of spermatozoa in 10 input videos.The comparison is made to evaluate the performance of algorithms by contrasting the result of Matching Based (MB), the result of Kernelized Correlation Filters (KCF), and the manual calculation result (Fig. 12).In addition, Fig. 13 shows the execution durations for the tracking process with MB, KCF, and the duration of the input video.The result of the comparison with KCF method is depicted in Fig. 12

IV. CONCLUSION
In this research, a series of procedures have been implemented to track and determine abnormalities in spermatozoa cell movement based on a matching-based algorithm, creating a complete integrated system from data recording to analysis.Tracking and determining abnormalities in sperm motion based on matching-based algorithms are applied to several types of videos with differences in frames per second and some videos with variations in liquefaction time and microscope lens magnification.
From the results of the tracking test and the determination of sperm motility abnormalities under 8 different video conditions, video condition G with recording speed of 50 fps, liquefaction time of 20 minutes, and magnification of a 40x microscope lens, demonstrated the highest average accuracy.The highest tracking accuracy was 77.3%, and the average accuracy for determining sperm motility abnormalities was 87.7%, compared to other video conditions.The lowest accuracy recorded was 77.3%, with the smallest average accuracy for sperm motility abnormalities determination at 73.5%.
Comparing the tracking results and execution speed, Gaussian Mixture Model and matching-based algorithms outperformed the Kernelized Correlation Filters method.However, there are errors in tracking spermatozoa using Gaussian Mixture Model and matching-based algorithms which are attributed to several factors, such as low video quality, making it difficult to distinguish objects considered as spermatozoa from the video background.This results in some spermatozoa going untracked due to their shape or colour resembling the background.This research only utilized pre-processing in the form of image enhancement with Gaussian blurring.For subsequent development, additional pre-processing steps can be considered to reduce noise in input videos.These preprocessing steps could incorporate video brightness adjustment or histogram equalization before background subtraction.The Gaussian Mixture Model and matchingbased algorithms applied in this research are not yet optimal, with some factors remaining unresolved or causing errors in tracking and determining motion abnormalities.Future studies may explore alternative methods or optimize the matching-based algorithm to address these factors and improve the accuracy of tracking and determining abnormalities in motion.

Fig. 1 .
Fig. 1.Block diagram of determining spermatozoa movement abnormalities based on gaussian mixture model and matching-based algorithm

Fig. 3 .
Fig. 3. Spermatozoa tracing flow 1) Gaussian Blur.Gaussian smoothing or Gaussian blurring is a 2D convolution operation used to give a blur effect to the image with the aim of removing noise [50][51].Smoothing is done by shifting the window (kernel) throughout the pixels in the image, calculating the value and each pixel based on the kernel value and the overlapping original image pixel value[52].In this study the kernel used is 13×13, the larger the kernel, the blurrier the resulting image looks.

7 )
Fig. 4 illustrates the  points, which are points in both frames.The black lines indicate the relationships, while the red lines show the greatest similarities obtained.

Fig. 4 .
Fig.4.Complete bipartite graph 8) Tracking using Matching-Based Algorithm: Matchingbased is an algorithm to find the greatest similarity from several points based on the greatest similarity values of the points being searched.The point is the coordinate (, ) that had been obtained in the previous process[75][76].The greatest similarity between two points was determined based on the magnitude of distance.The points considered as the suspected sperm movement from one frame to the next were points in the ROI (Region of Interest) of the point sought.The uses of ROI rely heavily on the depth and additional information provided on the scene geometry[77] or microscope scope to identify areas where sperm can be found.For example, the 3 frames as in Fig.5.

Fig. 5 .
Fig. 5.The frames show the displacement of the spermatozoa in (a) Frame a, (b) Frame b, (c) Frame c, (d) Relationship of a and b, (e) Last point 1, (f) Relationship of point 1 and c (g) Last point 2 From each sperm detected in frame a of Fig. 5(a), the relationship indicating the possibility of movement to frame b was sought.Based on the ROI of each sperm in frame a, sperm 1 and sperm 3 had a possibility of movement in frame b.Possible movements from frame a to b were S1a to S2b and S3a to S3b, whereas S2a has no pairs in frame b.Each of these formed relationships was stored as the paths through which

Fig. 6 .
Fig. 6.(a) An overview of system design and (b) multiple possibilities in one ROI

Fig. 7 .
Fig. 7. Determination of the possibility of sperm motility based on distance and gradient 1) Mean Smoothing: Mean smoothing is a technique in image processing that belongs to the category of spatial filtering, by calculating the average value of the surrounding pixels.Mean Smoothing is applied in a 1-dimensional array,

Fig. 8 .
Fig. 8. Flow chart displaying the determination of the normality of spermatozoa motility

5 )
Where: x ′ = Position of the point on the -axis in a straight line,  ′ = The position of the point on the -axis in a straight line, = Coefficient ,  = Coefficient  and  = Constanta. = ((∑)(∑) − (∑)) Implementation into the program of the above equations to perform the process of determining the abnormality of the path travelled by each detected spermatozoa in the input video.The result of this stage is an image of the trajectory of Journal of Robotics and Control (JRC) ISSN: 2715-5072 110 I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm

3 )
Spermatozoa Localization: Spermatozoa localization is the stage to look for areas suspected as spermatozoa.In ISSN: 2715-5072 111 I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm

Fig. 11 .
Fig. 11.Determination of sperm motility possibility based on distance and gradient (a) Distance calculation, (b) Gradient calculation Where P = TP + FN and N = FN + TN.Journal of Robotics and Control (JRC) ISSN: 2715-5072 112 I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm

Fig. 12 .
Fig. 12. Graph of test result accuracy of average and test results Average accuracy of determination of sperm motility abnormalities for 6 video input in all conditions and Fig. 13.From Fig. 13 and Fig. 14, it can be seen that the number of spermatozoa tracked by the results of the macthing-based algorithm is closer to the manual tracking results, compared to those of the KCF method.Likewise for the duration of Journal of Robotics and Control (JRC) ISSN: 2715-5072 113 I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm program execution.The duration of tracking with macthingbased algorithm is much faster, even almost equal to the actual duration of the video, when compared to the KCF method.

Fig. 13 .Fig. 14 .
Fig. 13.Results of comparison of macthing based (MB) algorithm tracing with Kernelized Correlation Filters (KCF) the other values are considered as the foreground.Then, the subsequent matching would first update the mean, standard deviation, and weight.The second possibility is that if there is no pixel value matching the value of the Gaussian model, then this pixel is considered as the foreground and the value with the lowest probability is set up for a new distribution value.The newly formed distribution has the same mean value as the pixel value, a high variance value, and a low weight value I Gede Susrama Mas Diyasa, Abnormality Determination of Spermatozoa Motility Using Gaussian Mixture Model and Matching-based Algorithm background, while

TABLE I .
TEST RESULTS OF SPERM DETECTION AND CALCULATION AND THE RESULTS OF THE VALIDATION PROCESS (PRECISION, RECALL, AND F-MEASURE)

TABLE II .
RESULTS OF TRACKING AND DETERMINATION OF SPERMA MOTILITY ABNORMALITIES FOR 6 VIDEO INPUTS ON CONDITION G