Modified Background Subtraction Statistic Models for Improvement Detection and Counting of Active Spermatozoa Motility

An important early stage in the research of sperm analysis is the phase of sperm detection or separating sperm objects from images/video obtained from observations on semen. The success rate in separating sperm objects from semen fluids has an important role for further analysis of sperm objects. Algorithm or Background subtraction method is a process that can be used to separate moving objects (foreground) and background on sperm video data that tend to uni-modal. In this research, some of the subproject model statistics of substrata model are Gaussian single, Gaussian Mixture Model (GMM), Kernel Density Estimation and compared with some basic subtraction model background algorithm in detecting and counting the number of active spermatozoa. From the results of the tests, the Grimson GMM method has an f-measure value of 0.8265 and succeeded in extracting the sperm form near its original form compared to other methods.


Introduction
Sperm is an important factor in women's pregnancy.Men should heed their sperm qualities because their sperm might not involve spermatozoa, or motility rates of the sperm lower than 40% (poor rates), as suggested by WHO [1].Rates of sperm motility could be measured by analyzing ratio between normal and abnormal sperm cells in fertilities laboratory, then result of motility manually calculated under the microscope with some parameters, but this process might not generate constant values of motility.Some laboratories have Computer-Aided Sperm Analysis or CASA, a computerized device used for calculating motility rates.Unfortunately, CASA is too pricey to be placed in diagnosis centers throughout Indonesia.Some researchers had studied several times about detecting and calculating sperm cells [2] [3] [4] [5] [6] [7].Hidayatullah et al [2] appraised sperms movement in the video, using a combination of Adaptive Local Threshold (ALT) and Ellipse Detection (ED) methods.Step-bystep of this method were: separating objects from the background, removing unwanted objects, then detecting ellipse which assumed as the sperm's head.Khachane et al [3] classified men's spermatozoa using fuzzy logic by its head, neck, and tails.The slide specimens were obtained from a stained image (an image which given special fluid), thus achieved a color differentiation between background and sperms.The sperm then recognized by converting the color space from RGB to grayscale, removing noises using a median filter, converting it to a binary image, and finally, sperms were fully recognized.Susrama et al [4] classified a sperm by its head using threshold segmentation and decision tree.The images were taken from WHO standard book [1], therefore the sperm's shape clearly outlined, although still followed by a few noises.To differentiate between normal and abnormal sperm's head, the image was adjusted (preprocessed) first, then segmented using Otsu threshold method, and classified using decision Li et al. [5] succeeded in order to automatically detected sperm cells in observation video produced by OpenCV microscopy.First, filter Gaussian was applied to reduce the video's noises.Then, active sperms and another object were separated using foreground segmentation.Any affected video frames or objects were tracked using Gaussian Background Modeling.A study from Nurhadiyatna et al [6] applied methods from their previous studies when detecting sperms.The proposed method (named GMMHF) was an enhance of two combinations, Gaussian Mixture Model (GMM) algorithm, and Hole Filling (HF) algorithm.The proposed method indicating that HF algorithm generated object not so different the postprocessing with Morphological Operation.By HF algorithm, noises produced at GMM phase could be removed and the "hole" on the resulted objects were filled.The research [6] used video acquired from Kokopelli Technologies [6].A study by Imani et al. [7] using frame difference algorithm for subtracting background, but some limitedness were faced when choosing appropriate threshold values because the accuracy of output depending on the chosen threshold value.The research had improved the limitedness by using non-linear filtering diffusion in the time domain.
From all the previous studies mentioned, some researchers using Gaussian Filter at preprocessing phase, but did not effective when detecting moving objects, and the average frame rates of the video used were around (sampling rate) 30 fps (frame per second).While this study used a microscopic video of human semen which had average frame rates of 60 fps and recorded by bright field microscope with 40x magnification, the use of 60 fps sampling rate due to active sperm movement can reach 5 times the size of the head, therefore to be able to represent a more accurate sperm movement, the appropriate sampling rate in the video data used is ± 50 fps.
Thus, in this study, we proposed a new approach to detect and counting of active spermatozoa motility by modifying some of the statistical model subtraction algorithms (Single Gaussian, Gaussian Mixture Model, and Kernel Density Estimation) compared to ground truth images obtained from manual observations.The comparison of the results is 10x by taking the detection result on every 30 frames of the video, thus forming the frame sequences: 30, 60, 90, 120, 150, 180, 210, 240, 270, and 300.The results are analyzed using ROC Analysis to obtain the accuracy value of each method used in sperm detection.In addition, in this study, the comparison of detection and counting of active spermatozoa motility using background subtraction algorithm of basic model (Weighted Moving Average and Wren Gaussian Average), so it can be concluded with appropriate background subtraction algorithm for case detection and sperm calculation.This study contributes to further research relating to the analysis of sperm infertility rates in determining the right algorithm for sperm detection and counting.

Research Methodology
The methodology of this study divided into five phases: system design, research data explanation, applied of background subtraction statistical model, applied of morphological operations, and explanation of ground truth image.

System Design
This study had compared some methods for detecting sperm's movement.Flowchart of this research presents in Figure 1, which showing processes for detecting and counting sperm.In the beginning, there was pre-processing for each frames using a Gaussian filter.The process then followed by background subtraction, giving a binary image which is a representation of frame's area of moving objects.Next, applied morphological operations which consist of opening and closing, to reduce noises and making the detected sperm more well-shaped.The result of foreground mask from morphological operation would be compared with ground truth image of manual observation, to validate the detected sperm (from the previous background subtraction phase).Every BLOB region (white region in the binary image) in foreground mask image would be bound-marked and calculated to prove that the system really detecting and counting the active-moving sperms accurately.

Research Data
The video data used here was a microscopy video of semen.Semen was collected from volunteers who were willing to contribute.The semen observed under a bright-field microscope with 40x magnification of objective lenses and recorded using Point Grey FL3-U3-13S2C-CS camera.The observed data then turned into 60fps AVI video.Processes of semen observation shown in Figure 2.

Pre-processing
Preprocessing is the initial process of document classification aimed at preparing data to be structured [8].At pre-processing phase, sperm video data that has been recorded, then performed the process of normalization and image repair.The normalization process gave a rol (the part of sperm which able to move) after modified into 256 x 256 pixels [9] grayscaled (256 level of light) image.To reduce noises in test images, the input images filtered using Gaussian Filter.The filter would generate smooth images, therefore noises and details were reduced.This process would affect the next phases.Filtering with Gaussian Filter could deal with a 5x5 kernel, as used in this study.

Background Subtraction
Background subtraction is a technique for detecting foreground masks (terms for a binary image which contains information of moving objects) in the video frames or captured image.This technique is very common in image processing and computer vision system.and c) until substracting process has finished.This study used background subtraction algorithm as comparing and implementing 3 statistical model algorithms [10], those were Single Gaussian, Gaussian Mixture Model (GMM), and Kernel Density Estimation.

Single Gaussian
This algorithm modeling every pixel based on their normal distribution which grouped by means (μ) and standard deviation (σ).In this study, the fixed constant for classifying a pixel as a background or a foreground was 0.05.

Gaussian Mixture Model
For determining a pixel whether it is background or foreground, Gaussian Model Mixture algorithm modeled pixels using mixtures of K-Gaussian.In this study, the amount of K-Gaussian determined as 3 points.Learning rate (α) which used for renewing weight (ω) was determined by 0.01.Threshold (T) value for determining GMM model which refers to background was 9 points.

Kernel Density Estimation
This algorithm estimates the value of probability density function of every pixel, by using estimator kernel K for the number of recent N-samples from continuously-taken intensity values at W-time of window sizes.In this study, the first foreground model formed by firstly 10 video frames, where the models were continuously refreshed.Every pixel used 50 samples.The threshold value for indicating a pixel refers to a foreground was 10e -8 .

Morphological Operation
After background subtraction phase, binary images which presenting moving pixels in the video (foreground mask) were obtained.The foreground images still have some noises, and some detected moving pixels might not in a whole shape of a sperm.To solve these problems, morphological operation then applied.This study used opening and continued by closing morphological operation.Element structures on all the morphological operation in this study were ellipses with 5x5 kernels.

Opening Operation
The opening operation consists of two processes, the first is morphological erosion then followed by morphological dilation.Erosion helped to reduce noises in foreground image and background-subtracted image.Dilation would expand the result of erosion, so the object restored to the original shape.

Closing Operation
This phase consists of two operations, those were morphological dilation and morphological erosion.Morphological dilation process aimed to fill the space of objects, in order to connect the separate parts of a detected sperm.The last morphological erosion in this closing operation fulfilled the entire shape of detected moving sperm.

Ground Truth Spermatozoa
In this study, ground truth image refers to an image containing actual regions of moving sperm in a certain video frame.Ground truth image obtained by manual observations in the regions of video frames which containing moving sperms.The region-containing frames then manually segmented and generated into a ground truth.
LONTAR KOMPUTER VOL. 9, NO.To ensure the availability of active-moving sperms in a region, 10 frames backward and 10 frames forward the ground truth tracked and observed.As shown in Figure 3, ground truth of 30th frame was generated by observing sperm's movement from 20th frame to 40th frame of the video.The pixel which indicating an active sperm given 255 values (white), while the empty one will be given 0 (black).This method would produce a ground truth which would be a reference when counting sperms.Precision is calculated as follows: (1) Recall is calculated as follows: (2) F -Measure is calculated as follows: (3)

Gaussian Filter
Gaussian Filter is a filter which is able to smoothen images, reducing noises and details in the image.On a one-dimensional image, formulas of Gaussian is written as follows: (4) Where is the standard deviation of distribution, and the average of the distribution assumed as 0. If it is applied on the 1D (1-dimension) Gaussian distribution, then it needed 2D Gaussian LONTAR KOMPUTER VOL. 9, NO.distributions.Therefore, there are 2 kinds of 1D Gaussian distribution were used, both of them placed in the x-axis (x) and y-axis (y).Equations of 2D Gaussian distribution written as follows: ( 2D Gaussian distributions in equation ( 5) become a Point Spread Function (PSF) for processing the image.The image would be convoluted with a 2D Gaussian function.The discrete approach needed when determining and choosing appropriate Gaussian function.

Statistical Model Background Subtraction
When detecting which part of video's scene belongs to foregrounds or backgrounds, each pixel in the frame were statistically modeled using background subtraction algorithm.All the parameters would be continuously maintained to keep the algorithm adapting towards the video scenes alteration.Three statistical methods were used in this study, those were Single Gaussian, Gaussian Mixture Model (GMM), and Kernel Density Estimation (KDE).

Single Gaussian
Single Gaussian algorithm [11] modeling every background based on their normal distribution which categorized by means and standard deviations in YUV color space.This model needs more than one frame for counting mean and standard deviation in each color of the YUV color space.
(6) (7) Where is the intensity of pixel at time period t.A pixel which belonged to a foreground should be in this rule: (8) Where is a specific constant.The pixel which assumed a foreground will be marked as 1, thus the other supposed as backgrounds and marked by 0. This method suits when the video/image taken in a light room with a little change of light intensities but failed in some cases: unexpected light intensity changes, moving background like moved trees and flags.

Gaussian Mixture Model
Gaussian Mixture Model algorithm introduced for the first time by Stauffer and Grimson.GMM is a density model includes Gaussian functions.For each pixels, , modeled by mixture of the Gaussian distribution.Probability rates of each pixel were calculated by the following formulas: [12] (9) Where is the total amount of distribution, is weight estimation Gaussian mixture i at time period t, is average Gaussian mixture i at time period t, is covariance matrix Gaussian mixture at time period t, is Probability Density Function of Gaussian which could be written as the following formula: e-ISSN 2541-5832 (10) is a determinant of covariance, superscript T is the transpose of the matrix, -1 is the inverse of the matrix, is exponential, is phi value, and is the dimensions of scalar image or vector image (RGB).The value of K ranged from 3 to 5. Covariance matrix obtained by the equation: (11) A pixel is a distribution if the position was in the range of 2.5 standard deviations from the following distribution: (12) Vector is the average of RGB image at Gaussian-i, is the standard deviation of Gaussian-i, and is the vector of the RGB image.Component of the GMM which would continuously updated were (weight), (mean), (variance).Weight would be updated every: (13) is the learning rates and would be valued 1 for the appropriate model and 0 for the other.Mean will be updated when any models if and only if adequated: The variance will be updated when any models if and only if adequated: The equation for selecting the first distribution B which would be a background was: (16)

Kernel Density Estimation
Elgammal [12] determining Probability Density Function for each color pixels by estimator Kkernel for the number of recent N-samples of intensity values as follows: [13] (17) Foregrounds were detected by the following rules:

If
then the pixel is a foreground.Other than that, the pixel categorized as a background.This algorithm works like GMM, in the sense of being able adapting to multi-modal backgrounds, however, did not estimate parameters of Gaussian.

Mathematical Morphology
Morphology is a branch of image processing which is purposed for analyzing images.Morphological operations based on the regions of the image (segments).Because it is focused on the object's morphology, this technique usually applied on binary images (only have 1 and 0 pixel values).This is frequently operated only on the interest parts of an image.Segmentation achieved by distinguishing between the object and the background, sometimes using thresholding and turning the grayscaled image into a binary image.The result of the morphological operations generally would be considered for further analysis.Morphological operations include: contour tracing, dilation, erosion, closing, opening, filling, connectedcomponent labeling, and skeletonization.

Result and Analysis
The xperiment result shown here were pre-processing results, statistical model of background subtraction results, morphological operation results, and simultaneously of detecting and counting from ground truth of sperm, which would be analyzed by receiver operating characteristic.

Pre-processing Results
The image was processed at pre-processing phase using filter Gaussian with 5x5 of kernel size.
The input was captured frames of the video.Sample of the frame was showing in Figure 4 (a) and Figure 4 (b) referred to the frame which had already pre-processed.Pre-processing phase aimed to reduce white noises effect, blur images, and decrease image details.

Background Subtraction Results
The result of background subtraction phase was foreground masks, a binary image which represents moving pixels in the video.In this study, foreground mask referred to the moving sperms.Three background subtraction methods had tested to detect moving sperms.The results, including explanation, opportunity, and challenges of those three background subtraction method, were present below.The red boxes indicating samples of detected moving backgrounds, and the yellow boxes indicating samples of detected moving sperms.Further explanations for each background subtraction methods were present below.

Single Gaussian
When detecting which pixels in the frame are foregrounds, this algorithm modeled every pixel based on their normal distribution which classified based on their averages (μ) and standard deviation (σ). Figure 5 (b) showed the foreground mask of the moving sperms was generated by this algorithm.Seen in Figure 5 (b), a few moving backgrounds correctly detected as backgrounds.This could be seen in Figure 5(b), where the red boxes did not have white areas.
Active sperms in the yellow boxes were not detected separately and surrounded by fewer noises.If compared to the other three background subtraction algorithm, this Single Gaussian produced a foreground mask which having more perfect-shaped of detected sperms and fewer noises.Those facts indicated that Single Gaussian was suitable and appropriate for detects moving sperms.

Gaussian Mixture Model
Gaussian Mixture Model algorithm classifying pixel to a background or foreground based on the mixture of K Gaussian.Foreground mask of the moving sperms as the output of this algorithm shown in Figure 5 (c).
The detected moving sperms in the yellow boxes were not appearing separately as using basicmodel background subtraction algorithm.Resulted foreground mask by this algorithm was LONTAR KOMPUTER VOL. 9, NO.equivalent to the foreground mask from Single Gaussian.Although the sperm's head completely detected, however, Gaussian Mixture Model produced more noises.A few of moving backgrounds also wrongly-detected as foregrounds, when it should be backgrounds.Seen from the Figure 5 (c), there were little-white noises above the red boxes which indicate the existence of moving objects.

Kernel Density Estimation
This algorithm estimating probabilities of the density function of each pixels using estimator Kkernel for the number of recent N-samples from intensity values taken continuously at W-time size window.Foreground mask of the moving sperms as the output of this algorithm shown in Figure 5 (d).Active objects inside the red boxes erroneously detected as foregrounds, when it should be backgrounds.Moving sperms inside the yellow boxes appeared separately with some noises around it.The detected objects seem did not have whole form, vague and noisy.This result did not happen when applying the other background subtraction method.Seeing overall frames, every detected sperm surrounded by noises on the sperm's head.

Morphological Operation Results
This study had applied sequenced morphological operation, started with Opening Operations and finished by Closing Operations, in order: erosiondilationdilationerosion.Opening purposed to reduce noises on the foreground mask as the result of background subtraction, and also restore the object after reduced it noises (erosions).Closing aimed to fill the holes in order to link any separates part and completing the shape of detected sperms.
The input for this morphological operations was foreground mask as the result of background subtraction process, where it still has noises and some objects were separately detected.Morphological operations would produce a clean image without noises, also enhanced the detected object to be more combined, therefore every blob (binary large object) could be a representation of moving sperms.Each of background subtraction methods produced three different foreground masks, exactly, outputs of morphological operation would be various, which seen in Figure 6.

Detection and Calculation Sperm Test
After passed morphological operation phase, the foreground mask assumed was already in a whole form and clean from noises.Every blob in the foreground mask represented valid moving sperms.For visualization purpose, the detection process of all the BLOBs based on it contours, therefore information of contours shape, number of all the contours, and center points of the detected sperm would be recorded.The information helped the system to bound the object with a box (bounding box) and sequenced it.It proofed that the system already made an achievement in order to detect and calculating sperm accurately.The result of detection and calculation would be evaluated by comparing it with the result of ground truth's manual calculation.Comparison processed 10 times by selecting and collecting every 30th frame, then grouped into an array with sequences: 30th, 60th, 90th, 120th, 150th, 180th, 210th, 240th, 270th, dan 300th.Result or comparison then analyzed using ROC Analysis, hence the outputs of analysis were: True Positive (TP) which referred to a condition where the sperm actually existed and it is rightly detected, False Negative (FN) which referred to a condition where the sperm actually did not exist but wrongly detected as a sperm, False Positive (FP) which referred to a condition where the sperm actually did not exist and it was not detected.After results of ROC analysis had collected, then the precision, recall, and f-measure from each algorithm used were calculated.The calculation would indicate the most suitable background subtraction algorithm for the detection and calculation of moving sperms.Table 1 and Figure 7 showed the result of experiment of each background subtraction algorithms, which Figure 7(a) referred to the Single Gaussian, Figure 7(b) referred to the Gaussian Mixture Model, Figure 7(c) referred to the Kernel Density Estimation, and Table 1 listed the comparison between results of experiment with those three algorithms and the ground truth.

Experiment Results
The precision, recall dan f-measure value of each tested background subtraction algorithms would be calculated and compared.The result of comparison process of the values presented in Table 1.

Figure 1 .
Figure 1.Flowchart of Detecting and Counting Spermatozoa's Movement
The foreground masks calculated by comparing between the current video frame and the background model image.The general way to subtracting background is as follows: a) initializes background from N-frames to obtain the initial background model (an image without any moving objects), b) detects foregrounds (moving objects) by comparing the initial background model with current frame, c) maintenance the background sustainedly in order to refresh the background model, if ) repeats step b)

Figure 3 . 2 . 7 .
Figure 3. Illustration of Generating Ground Truth Image on the 30 th Frame

Figure 4 .
Figure 4. (a) Original frame of sperm video, (b) Frame which had already pre-processed

Figure 5 .
Figure 5. (a) Ground truth image, (b) Result of foreground mask by Single Gaussian algorithm, (c) Result of foreground mask by Gaussian Mixture Model algorithm, (d) Result of foreground mask by Kernel Density Estimation algorithm

Figure 6
Figure 6 (a) Result of foreground mask after the morphological operation by Single Gaussian algorithm, (b) Gaussian Mixture Model algorithm, (c) Kernel Density Estimation algorithm

Figure 7 .
Figure 7. (a) Visualization of detected and counted sperm cells with Single Gaussian algorithm, (b) Gaussian Mixture Model, and (c) Kernel Density Estimation

Figure 8
also presented the comparison in a graphical form.