Researchers have released pycasa, an open-source Python toolkit designed to automate the core computational stages of computer-assisted semen analysis, or CASA. The primary motivation for the project is the limited availability of existing CASA systems, which rely on dedicated hardware that restricts their use in many laboratories due to acquisition costs and a lack of methodological transparency.
The pycasa toolkit operates by accepting video files of semen samples as input and outputting a comprehensive set of analytical results. The system aggregates these individual track data into population-level outcomes defined by the World Health Organization laboratory manual, including rapid progressive, slow progressive, non-progressive, and immotile grades. Additionally, the software calculates the percentage of motile sperm, sperm concentration, and total sperm count, providing a complete quantitative profile of the sample’s motility characteristics.
A central feature of pycasa is its modular architecture, which allows users to swap between different detection and tracking algorithms without altering the rest of the pipeline. The toolkit integrates several established methods, including YOLO26 and YOLOv5 for detection, and SORT, DeepSORT, and JPDAF for tracking. This flexibility enables researchers to perform head-to-head comparisons of different algorithms on the same data, a task that previously required re-implementing separate codebases and reconciling incompatible data formats. The software uses a fluent coding style where each stage method returns the updated object, allowing for concise, chained commands that streamline the analysis workflow.
To validate the software’s accuracy, the authors benchmarked pycasa against two independent reference standards using the Human Sperm Microscopy Videos dataset. The first comparison involved 14 subjects whose samples were recorded using a commercial Sperm Class Analyzer system. The researchers compared the WHO-based motility parameters computed by the default pycasa pipeline against the reports generated by the commercial system for the same samples. This system-level comparison treated both pycasa and the commercial instrument as black boxes to determine if the open-source pipeline could produce trustworthy outcomes comparable to established proprietary equipment.
The results of the commercial system comparison showed strong agreement between pycasa and the Sperm Class Analyzer, particularly for volumetric measures. The concordance correlation coefficient, a metric that captures both scatter and systematic offset, was 0.933 for concentration and 0.894 for total sperm count. Agreement was more moderate for motility grades, with coefficients of 0.610 for the progressive fraction and 0.694 for the rapid fraction. Despite these differences in magnitude, every motility grade exhibited a near-zero bias, staying within 1.6 percentage points of the commercial system’s values, which suggests that the pipeline’s core motility calculations are reliable.
The second validation effort tested whether pycasa could compute reliable motility parameters from videos recorded with a standard optical microscope, a more accessible and less expensive setup than dedicated CASA hardware. The researchers used 20 recordings acquired with a Swift M10DB-MP microscope and a consumer-grade Fujifilm X-T30 camera. They compared the parameters computed by pycasa against manual motility measurements provided by a laboratory technician. This experiment was crucial for determining if an ordinary optical microscope could serve as the foundational building block for a CASA-like system in resource-limited settings.
In the optical microscope comparison, the default pycasa pipeline, which pairs YOLO26 detection with SORT tracking, showed a consistent negative bias relative to the technician’s manual measurements. The bias was -12.45 for percentage motile, -21.79 million per milliliter for concentration, and -53.04 million for total count. The analysis revealed that this bias worsens as sperm concentration increases, with the discrepancy growing significantly in high-concentration samples. The pycasa-computed parameters still correlated strongly with the manual measurements, with Pearson correlation coefficients ranging from 0.782 for motility to 0.931 for total count.
To determine the source of the observed bias, the researchers performed a subsystem-level analysis using manually marked ground-truth tracks that contained no algorithmic detection or tracking errors. When the motility parameters were computed from these perfect tracks, the negative bias remained and continued to grow with concentration. This finding indicates that the majority of the discrepancy is likely due to the inherent differences between automated computational methods and manual human assessment, rather than errors in pycasa’s detection or tracking modules. The study highlights that while the software is accurate relative to ground truth, it operates differently from human technicians in high-density samples.
The detection and tracking performance of the default pipeline was also evaluated against ground-truth annotations from the optical microscope subset. The YOLO26 detector, trained on a subset of the data, achieved a mean precision of 76% and a recall of 91%, resulting in an F1-score of 81%. These metrics confirm that the software can reliably identify and follow individual sperm cells in complex video sequences, although performance declines mildly as the density of sperm cells in the field of view increases.
pycasa is positioned strictly as a research and development platform rather than a clinical diagnostic device. The authors explicitly state that the software has not been validated as a medical device and its outputs should not be used for clinical diagnosis or treatment decisions. However, the toolkit offers significant benefits for biological and reproductive research by lowering the barrier to automated semen analysis. It allows users without extensive software backgrounds to analyze recorded samples and investigate differences across populations or experimental conditions using a consistent and reproducible procedure.
The release of pycasa addresses a critical gap in the reproducibility of CASA research. Previous studies often published isolated, incompletely documented implementations that were difficult to reuse or compare. By providing reference implementations of established methods under a single versioned interface, pycasa allows new research groups to benchmark their methods against standard baselines. The software is available under the Apache 2.0 license, ensuring that it remains open for community extension and modification. This open-source approach supports new lines of investigation that would otherwise require substantial implementation effort to develop from scratch.
The toolkit also serves as a practical tool for laboratories that lack access to commercial CASA systems. By enabling the analysis of videos recorded on standard optical microscopes, pycasa provides a path to quantitative motility measurements without the need for proprietary instrumentation. This accessibility is particularly relevant for resource-limited settings where high-cost laboratory equipment is not feasible. The software’s ability to process other public datasets, such as VISEM-Tracking, further supports community benchmarking and the standardization of methods across different research groups.
Limitations of the current release include the systematic bias relative to manual measurement, particularly in high-concentration samples, and the dependence of kinematic parameters on the frame rate of the video. The scope of the software is currently limited to motility analysis, with other endpoints such as sperm morphology and vitality outside its current capabilities. Despite these limitations, pycasa represents a significant step toward democratizing computer-assisted semen analysis, providing a transparent, flexible, and accessible tool for the scientific community to explore sperm kinematics and develop new analytical methods.
Subject of Research: Development and validation of an open-source Python toolkit for computer-assisted semen analysis
Article Title: pycasa : A Python toolkit for computer-assisted semen analysis
Article References: Sivri, A., Kam, M., & Alkhoury, L. (2026). pycasa: A Python toolkit for computer-assisted semen analysis. SoftwareX, 36, Article 103197. https://doi.org/10.1016/j.softx.2026.103197
Image Credits: AI Generated
DOI: 10.1016/j.softx.2026.103197
Keywords: pycasa, semen analysis, computer-assisted semen analysis, Python, open-source software, sperm motility, machine learning, reproductive research, image tracking, laboratory automation, toolkit, computer-assisted
Cite Scienmag News
Denise Maddox. (November 8, 2026). Open-Source Python Toolkit Automates Sperm Motility Analysis. Scienmag. https://scienmag.com/open-source-python-toolkit-automates-sperm-motility-analysis/
Denise Maddox. "Open-Source Python Toolkit Automates Sperm Motility Analysis." Scienmag, 8 November 2026, https://scienmag.com/open-source-python-toolkit-automates-sperm-motility-analysis/. Accessed 8 November 2026.
Denise Maddox. "Open-Source Python Toolkit Automates Sperm Motility Analysis." Scienmag. November 8, 2026. https://scienmag.com/open-source-python-toolkit-automates-sperm-motility-analysis/








