bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. mAIcrobe: an open-source framework for high-throughput bacterial image analysis António D. Brito1 , Dominik Alwardt1 , Beatriz de P. Mariz2 , Sérgio R. Filipe2 , Mariana G. Pinho1, , Bruno M. Saraiva1, , and Ricardo Henriques1, 1 Instituto de Tecnologia Química e Biológica António Xavier, Universidade Nova de Lisboa, Oeiras, Portugal 2 Faculdade de Ciências e Tecnologia, Universidade Nova de Lisboa, Lisbon, Portugal Quantitative analysis in bacterial microscopy is often hindered by diverse cell morphologies, population heterogeneity, and the requirement for specialised computational expertise. To address these challenges, mAIcrobe is introduced as an opensource framework that broadens access to advanced bacterial image analysis by integrating a suite of deep learning models. mAIcrobe incorporates multiple segmentation algorithms, including StarDist, CellPose, and U-Net, alongside comprehensive morphological profiling and an adaptable neural network classifier, all within the napari ecosystem. This unified platform enables the analysis of a wide range of bacterial species, from spherical Staphylococcus aureus to rod-shaped Escherichia coli, across various microscopy modalities within a single environment. The biological utility of mAIcrobe is demonstrated through its application to antibiotic phenotyping in E. coli and the identification of cell cycle defects in S. aureus DnaA mutants. The modular design, supported by Jupyter notebooks, facilitates custom model development and extends AI-driven image analysis capabilities to the broader microbiology community. Building upon the foundation established by eHooke, mAIcrobe represents a substantial advancement in automated and reproducible bacterial microscopy. microbiology | microscopy | image analysis | deep learning | phenotyping Correspondence: (M. G. Pinho) mgpinho@itqb.unl.pt; (B. M. Saraiva) bsaraiva@itqb.unl.pt; (R. Henriques) r.henriques@itqb.unl.pt Introduction Microscopy remains fundamental to microbial cell biology; however, quantitative analysis of bacterial images presents significant challenges. These include population heterogeneity, the small size of bacterial cells, morphological diversity among species, and the range of imaging techniques employed. Manual analysis constitutes a major bottleneck, as it is time-consuming, subjective, and susceptible to human error, thereby limiting research throughput and reproducibility. To overcome these limitations, we developed mAIcrobe, a comprehensive framework for bacterial image analysis. It supports multiple bacterial species, various microscopy modalities, and flexible, customisable analysis workflows. By integrating various segmentation methods, quantitative morphological measurements, and an adaptable classification model, mAIcrobe provides a powerful tool for a broad range of studies in bacterial cell biology. We have made our work accessible through the napari-mAIcrobe plugin, which is accompanied by Jupyter notebooks (Table S1) to facilitate the training of custom classification models usable within the user-friendly napari ecosystem. Acquisition Morphology & Classification Class 1 StarDist Community models Cellpose Zerocost notebooks Segmentation Class 2 Class 3 #ZeroCostDL4Mic mAIcrobe models Feature space Class 1 Pre-existing Class 3 Class 2 Finetuned Fig. 1. mAIcrobe workflow. After image acquisition, the napari-mAIcrobe plugin facilitates analysis through a user-friendly interface for segmentation, morphological measurements, and classification using a variety of pre-trained or custom models. The field has seen several automated image analysis tools tailored for bacterial images, from ImageJ (1) plugins like MicrobeJ (2) to standalone software such as SuperSegger (3) and Oufti (4). Our own contribution, eHooke (5), provided an open-source solution for the semi-automated analysis of cocci, particularly Staphylococcus aureus. Although eHooke was a valuable tool for studying the cell cycle in spherical bacteria, it was architecturally constrained, limiting its application to other morphologies and making integration with new deep learning models challenging. The rapid evolution of bioimage analysis, coupled with the broad adoption of the napari ecosystem (6), presented a clear opportunity to engineer a more powerful and extensible framework built on the modern scientific Python stack. We seized this opportunity to design mAIcrobe (Fig. 1), a nextgeneration platform prioritising versatility and performance. The design philosophy focused on overcoming morphological constraints, enabling the selection of optimal segmentation algorithms, and facilitating the rapid adaptation of deep learning models to address emerging biological questions. The napari framework was selected as the foundation for mAIcrobe due to its modular architecture and interactive visualisation capabilities, which align with these objectives. Results Developed within the napari plugin ecosystem, mAIcrobe provides an intuitive and extensible platform for bacterial image analysis. The framework integrates image segmentation, rxiv-maker | António D. Brito et al. | October 21, 2025 | 1–10 bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. a) SIM Image aquisition b) c) Phase contrast Widefield Image-to-Model Pairing StarDist S. aureus U-Net S. pneumoniae U-Net B. subtilis Fig. 2. mAIcrobe segmentation capabilities. The platform can perform segmentation for a variety of bacterial species, segmentation models, and microscopy modalities. a) SIM image of S. aureus JE2 strain labeled with membrane dye NileRed, with cells segmented using a StarDist model. b) Phase-contrast image of Streptococcus pneumoniae segmented with a U-Net trained via ZeroCostDL4Mic. c) Conventional fluorescence widefield microscopy of a Bacillus subtilis strain expressing FtsZ-GFP also segmented using a U-Net trained via ZeroCostDL4Mic. All scale bars are 2 µm. morphological measurement, and classification into a unified workflow. Its modular design enables the selection of segmentation models and classification strategies tailored to specific experimental requirements (Table S2). A central feature of the napari-mAIcrobe plugin is its support for real-time visualisation and dynamic parameter adjustment, facilitating optimisation of image processing across diverse bacterial species and microscopy setups (Fig. S1). The following sections illustrate these capabilities through selected biological applications. Segmentation. mAIcrobe features a flexible segmentation en- gine designed to accommodate diverse bacterial species and microscopy modalities (Fig. 2 and Table S3). The framework integrates several leading segmentation approaches, including StarDist (7), CellPose (8), and custom U-Net (9) models trained using the ZeroCostDL4Mic framework (10). This multi-model strategy enables the selection of the most suitable algorithm for specific experimental conditions and bacterial morphologies, thereby ensuring high-quality segmentation. Unlike tools limited to particular morphologies, mAIcrobe supports the analysis of rod-shaped, spherical, and other bacterial forms within a single framework. This versatility is demonstrated in several applications. In structured illumination microscopy (SIM) images of S. aureus labelled with membrane dye NileRed, the StarDist model achieves accurate cell boundary detection (Fig. 2 a)). For phase-contrast microscopy of Streptococcus pneumoniae, UNet models trained with ZeroCostDL4Mic provide reliable segmentation of cells (Fig. 2 b)). The framework also processes conventional widefield fluorescence images, segmenting Bacillus subtilis expressing FtsZ-GFP (Fig. 2 c)). By integrating these models within a single interface, mAIcrobe eliminates the need to switch between software packages, thereby streamlining the identification of optimal segmentation approaches. Measurements. Beyond segmentation, mAIcrobe performs quantitative morphological analysis of bacterial cell properties across diverse experimental conditions (Table S2). From segmented cells, the framework extracts key morphological parameters, including cell area, perimeter, and eccentricity, alongside multi-channel fluorescence intensity measurements. This quantitative data provides a solid basis for characterising cellular responses Morphological 2 to drug treatments or genetic modifications. To ensure interoperability and support reproducible research, all results can be readily exported to standard formats, such as CSV, for downstream statistical analysis and visualisation. A practical application is the detection and characterisation of drug-induced morphological changes. For example, treatment of wild-type JE2 S. aureus with PC190723 (11), an FtsZ inhibitor, induces a distinct phenotype. Cells become enlarged and are arrested in the first stage of the cell cycle (13), a stage typically associated with increased roundness. As illustrated in panel a of Fig. 3, mAIcrobe accurately detects and quantifies these morphological changes, underscoring its utility in phenotypic drug screening. Classification. A principal strength of mAIcrobe is its adapt- able classification system, which is powered by a convolutional neural network (CNN). This system is designed for flexibility and can be fine-tuned to address a variety of biological questions, including cell cycle analysis and antibiotic phenotyping. The classification module employs a CNN architecture previously developed for cell cycle analysis of S. aureus (5). For example, on images of S. aureus where the essential DNA replication initiator protein DnaA (14, 15) was depleted using CRISPR interference (CRISPRi) (12), mAIcrobe identified altered cell cycle progression (Fig. 3 b)). This analysis reveals quantifiable differences in cell division timing, which may provide new insights into the role of DnaA in cell cycle regulation. To support adaptation to diverse experimental conditions and applications beyond cell cycle analysis, a codeless Jupyter notebook (Table S1) is provided for straightforward model retraining and fine-tuning. This approach lowers barriers to the development of custom analysis pipelines. The adaptability of the classification system is demonstrated in Fig. 4, which shows the S. aureus cell cycle model retrained for antibiotic phenotype detection in Escherichia coli (Fig. S2). Discussion mAIcrobe addresses key limitations in current bacterial image analysis workflows by offering a unified framework that integrates deep learning approaches with practical accessibility. Offering a variety of segmentation models constitutes a António D. Brito et al. | mAIcrobe bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. a) JE2 treated with PC190723 JE2 (control) Area Frequency (%) 25 Control PC treated 0 0 3500 Area (px) Eccentricity Frequency (%) 14 Control PC treated 0 0 1 Eccentricity b) LCML1 (↓DnaA) BCBMS14 psgRNAspy-2 (control) Cell cycle Phase 1 Control 55 % LCML1 57 % Phase 2 Phase 3 30 % 15 % 15 % 28 % Fig. 3. Quantitative phenotyping with mAIcrobe. mAIcrobe is capable of identifying phenotypic variations in microbial cells. a) Morphological changes of S. aureus cells treated with the antibiotic PC190723 (11), which leads to larger and rounder cells. The histograms show cell area and eccentricity for control (green) and PC190723 treated (yellow) JE2 S. aureus cells. b) Analysis of cell cycle progression in a S. aureus strain following CRISPR interference-mediated knockdown of dnaA expression (12). Cells are classified into three distinct cell cycle phases. Phase 1: round cells with no discernable septa; Phase 2: cells that started to elongate with an open septa; Phase 3: cells with fully closed septa. All scale bars are 1 µm. substantial improvement over single-algorithm methods, as demonstrated by comparative analysis across diverse bacterial morphologies and imaging modalities. Although tools such as eHooke have contributed significantly to the field, they remain constrained by algorithm-specific limitations and morphological restrictions, which reduce their broader applicability. António D. Brito et al. | mAIcrobe The integration of StarDist, CellPose, and custom U-Net models within mAIcrobe enables the selection of optimal segmentation approaches for specific experimental conditions. This flexibility is essential given the morphological diversity among bacterial species and the range of microscopy techniques used in contemporary microbiology. Validation across S. aureus, E. coli, S. pneumoniae, and B. subtilis demonstrates that the multi-model approach maintains high segmentation accuracy while accommodating diverse cell shapes and imaging protocols. The adaptable classification system constitutes a key innovation, facilitating the transition from fixed-purpose tools to customisable analysis platforms. By offering accessible retraining protocols through Jupyter notebooks, mAIcrobe reduces technical barriers that have previously limited the adoption of machine learning in bacterial microscopy. The adaptation of the model from S. aureus cell cycle classification to E. coli antibiotic phenotyping demonstrates the framework’s capacity to address diverse biological questions. Jupyter notebooks, which can be used locally or via Google Colab, enable users to retrain the classification model with minimal computational expertise (Table S1). The morphological measurement capabilities enable comprehensive quantitative profiling of bacterial phenotypes. This functionality is particularly valuable for detecting morphological changes indicative of key biological processes, as demonstrated in analyses of DnaA depletion effects and antibioticinduced morphological alterations. The ability to export quantitative data in standard formats facilitates integration with statistical analysis workflows and supports reproducible research. Integration with the napari ecosystem offers strategic advantages for long-term sustainability and community adoption. In contrast to standalone software requiring independent maintenance and feature development, napari plugins benefit from shared infrastructure, advanced visualisation capabilities, and an active development community. This approach ensures that mAIcrobe evolves in parallel with advances in the broader image analysis field while maintaining compatibility with complementary tools. Conclusions mAIcrobe offers a comprehensive set of computational tools for bacterial microscopy analysis, delivering a unified solution to the fragmented landscape of existing software. The principal innovation of the framework is its seamless integration of multiple segmentation algorithms with adaptable classification models, enabling comprehensive analysis across diverse bacterial species and experimental conditions without requiring transitions between different software packages. Empirical validation indicates that mAIcrobe’s multi-model approach maintains high analytical performance while substantially expanding the range of addressable biological questions. Demonstrated applications, including the detection of cell cycle defects in DnaA-depleted S. aureus and the characterisation of antibiotic-induced morphological changes, highlight the framework’s capacity to reveal biologically relevant 3 bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. valuable addition to the computational microbiology toolkit. a) E.coli antibiotic phenotyping model S. aureus cell cycle model 2 2 Class 1: Control 2 1 2 3 1 Class 2: Mecillinam 1 1 Retrained 3 Class 3: Nalidixate b) ABOUT THIS MANUSCRIPT This manuscript was prepared using Rχ iv-Maker v1.8.5 (16). This work is licensed under CC BY 4.0. DATA AVAILABILITY All the segmentation models and the classification model are available via the mAIcrobe GitHub repository (https://github.com/henriqueslab/maicrobe) All the data used in this study is publicly available. The datasets of B. subtilis and E. coli are available in (17). The datasets of S. aureus strains, JE2, BCBMS14 psg-RNAspy -2 and LCML1, and the dataset of Pen6 S. pneumoniae were acquired in-house and are available on Zenodo (https://doi.org/10.5281/zenodo.17306839). A comprehensive list of all models and the respective training and test datasets can be found in Table S4. CODE AVAILABILITY Source code for the napari-mAIcrobe plugin can be accessed via the GitHub repository (https://github.com/henriqueslab/maicrobe). The plugin is also available and installable through PyPi (https://pypi.org/project/napari-mAIcrobe/). Notebooks for training the classification model can be found in the notebooks folder of the mAIcrobe repository. AUTHOR CONTRIBUTIONS A.D.B., M.G.P., B.M.S. and R.H. designed the study. A.D.B. developed the code and trained the models. A.D.B., B.M.S. and D.A. prepared the samples and acquired the S. aureus data. B.P.M. and S.R.F. prepared the S. pneumoniae samples and A.D.B acquired the data. B.M.S., M.G.P. and R.H. supervised the project. A.D.B., M.G.P., B.M.S. and R.H. wrote the manuscript with input from all authors. Fig. 4. Adaptable classification model in mAIcrobe. a) SIM image of S. aureus labeled with membrane dye NileRed. Orange, green, and purple numbers indicate automatically classified cells in phases 1, 2, or 3, respectively, using mAIcrobe’s pretained classification model. b) Synthetic image obtained by stitching together multiple fields of view showcasing different drug treatments. mAIcrobe classification model was fine-tuned to classify E. coli cells as control or showcasing the effects of different antibiotics (mecillinam and nalidixic acid). Small crosses indicate classification results (orange for control, green for mecillinam and purple for nalidixic acid). Scale bars are 2 µm (S. aureus panel a) and 3 µm (E. coli in panel a and b). phenotypes. Integration with the napari ecosystem positions mAIcrobe as a forward-looking solution that addresses both current analytical needs and future scalability requirements. By leveraging napari’s extensible architecture and active development community, the framework ensures long-term sustainability and seamless integration with complementary analysis tools. The open-source implementation and accessible retraining protocols broaden access to advanced image analysis capabilities, potentially accelerating discovery across multiple areas of bacterial cell biology. With the growing demand for sophisticated analytical approaches to address complex biological questions, mAIcrobe provides a robust foundation for next-generation bacterial microscopy analysis. The modular design and extensible architecture enable the incorporation of future methodological advances while maintaining the accessibility and reliability necessary for routine research. This combination of current capability and future adaptability establishes mAIcrobe as a 4 ACKNOWLEDGEMENTS A.D.B. acknowledges the FCT 2021.06849.BD fellowship. D.A. acknowledges the FCT 2022.12215.BD fellowship. B.P.M. acknowledges the FCT UI/BD/151527/2021 fellowship. B.S. and R.H. acknowledge support from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. 101001332) (to R.H.) and funding from the European Union through the Horizon Europe program (AI4LIFE project with grant agreement 101057970-AI4LIFE and RT-SuperES project with grant agreement 101099654RTSuperES to R.H.). Funded by the European Union. However, the views and opinions expressed are those of the authors only and do not necessarily reflect those of the European Union. Neither the European Union nor the granting authority can be held responsible for them. This work was also supported by a European Molecular Biology Organization (EMBO) installation grant (EMBO-2020-IG-4734 to R.H.), and a Chan Zuckerberg Initiative Essential Open Source Software for Science (EOSS60000000260). This study was funded by the European Research Council through ERC Advanced Grant 101096393 (to MGP), by Fundação para a Ciência e a Tecnologia (FCT) by MOSTMICRO-ITQB RD Unit (UIDB/04612/2020, UIDP/04612/2020 to ITQB-NOVA) and LS4FUTURE Associated Laboratory (LA/P/0087/2020 to ITQBNOVA). EXTENDED AUTHOR INFORMATION • António D. Brito: 0009-0001-1769-2627 • Dominik Alwardt: 0009-0000-6349-3445 • Beatriz de P. Mariz: 0000-0002-0150-5575 • Sérgio R. Filipe: 0000-0002-4485-832X • Mariana G. Pinho: 0000-0002-7132-8842 • Bruno M. Saraiva: 0000-0002-9151-5477; ¯ bsaraiva • Ricardo Henriques: 0000-0002-2043-5234; ¯ ricardo-henriques 7 HenriquesLab; ⋆ henriqueslab.bsky.social; Bibliography 1. Johannes Schindelin, Curtis T. Rueden, Mark C. Hiner, and Kevin W. Eliceiri. The ImageJ ecosystem: An open platform for biomedical image analysis. Molecular Reproduction and Development, 82(7-8):518–529, 2015. ISSN 1098-2795. doi: 10.1002/mrd.22489. Number: 7-8 _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1002/mrd.22489. 2. Adrien Ducret, Ellen M. Quardokus, and Yves V. Brun. MicrobeJ, a tool for high throughput bacterial cell detection and quantitative analysis. Nature microbiology, 1(7):16077, June 2016. ISSN 2058-5276. doi: 10.1038/nmicrobiol.2016.77. 3. Stella Stylianidou, Connor Brennan, Silas B. Nissen, Nathan J. Kuwada, and Paul A. Wiggins. SuperSegger: robust image segmentation, analysis and lineage tracking of bacterial cells. Molecular Microbiology, 102(4):690–700, 2016. ISSN 1365-2958. doi: 10.1111/mmi.13486. _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1111/mmi.13486. António D. Brito et al. | mAIcrobe bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 4. Ahmad Paintdakhi, Bradley Parry, Manuel Campos, Irnov Irnov, Johan Elf, Ivan Surovtsev, and Christine Jacobs-Wagner. Oufti: an integrated software package for high-accuracy, high-throughput quantitative microscopy analysis. Molecular Microbiology, 99(4):767–777, February 2016. ISSN 1365-2958. doi: 10.1111/mmi.13264. 5. Bruno M. Saraiva, Ludwig Krippahl, Sérgio R. Filipe, Ricardo Henriques, and Mariana G. Pinho. eHooke: A tool for automated image analysis of spherical bacteria based on cell cycle progression. Biological Imaging, 1:e3, 2021. ISSN 2633-903X. doi: 10.1017/S2633903X21000027. 6. Nicholas Sofroniew, Talley Lambert, Kira Evans, Juan Nunez-Iglesias, Grzegorz Bokota, Philip Winston, Gonzalo Peña-Castellanos, Kevin Yamauchi, Matthias Bussonnier, Draga Doncila Pop, Ahmet Can Solak, Ziyang Liu, Pam Wadhwa, Alister Burt, Genevieve Buckley, Andrew Sweet, Lukasz Migas, Volker Hilsenstein, Lorenzo Gaifas, Jordão Bragantini, Jaime Rodríguez-Guerra, Hector Muñoz, Jeremy Freeman, Peter Boone, Alan Lowe, Christoph Gohlke, Loic Royer, Andrea PIERRÉ, Hagai Har-Gil, and Abigail McGovern. napari: a multi-dimensional image viewer for Python, November 2022. Programmers: _:n470. 7. Uwe Schmidt, Martin Weigert, Coleman Broaddus, and Gene Myers. Cell Detection with Star-Convex Polygons. In Medical Image Computing and Computer Assisted Intervention - MICCAI 2018 - 21st International Conference, Granada, Spain, September 16-20, 2018, Proceedings, Part II, pages 265–273, 2018. doi: 10.1007/978-3-030-00934-2_30. 8. Carsen Stringer, Tim Wang, Michalis Michaelos, and Marius Pachitariu. Cellpose: a generalist algorithm for cellular segmentation. Nature Methods, 18(1):100–106, January 2021. ISSN 1548-7105. doi: 10.1038/s41592-020-01018-x. Publisher: Nature Publishing Group. 9. Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation, May 2015. arXiv:1505.04597 [cs]. 10. Lucas von Chamier, Romain F. Laine, Johanna Jukkala, Christoph Spahn, Daniel Krentzel, Elias Nehme, Martina Lerche, Sara Hernández-Pérez, Pieta K. Mattila, Eleni Karinou, Séamus Holden, Ahmet Can Solak, Alexander Krull, Tim-Oliver Buchholz, Martin L. Jones, Loïc A. Royer, Christophe Leterrier, Yoav Shechtman, Florian Jug, Mike Heilemann, Guillaume Jacquemet, and Ricardo Henriques. Democratising deep learning for microscopy with ZeroCostDL4Mic. Nature Communications, 12(1):2276, April 2021. ISSN 2041-1723. doi: 10.1038/s41467-021-22518-0. Publisher: Nature Publishing Group. 11. David J. Haydon, Neil R. Stokes, Rebecca Ure, Greta Galbraith, James M. Bennett, David R. Brown, Patrick J. Baker, Vladimir V. Barynin, David W. Rice, Sveta E. Sedelnikova, Jonathan R. Heal, Joseph M. Sheridan, Sachin T. Aiwale, Pramod K. Chauhan, Anil Srivastava, Amit Taneja, Ian Collins, Jeff Errington, and Lloyd G. Czaplewski. An inhibitor of FtsZ with potent and selective anti-staphylococcal activity. Science (New York, N.Y.), 321 (5896):1673–1675, September 2008. ISSN 1095-9203. doi: 10.1126/science.1159961. 12. Patricia Reed, Moritz Sorg, Dominik Alwardt, Lúcia Serra, Helena Veiga, Simon Schäper, and Mariana G. Pinho. A CRISPRi-based genetic resource to study essential Staphylococcus aureus genes. mBio, 15(1):e02773–23, January 2024. ISSN 2150-7511. doi: 10.1128/mbio. 02773-23. 13. João M. Monteiro, Ana R. Pereira, Nathalie T. Reichmann, Bruno M. Saraiva, Pedro B. Fernandes, Helena Veiga, Andreia C. Tavares, Margarida Santos, Maria T. Ferreira, Vânia Macário, Michael S. VanNieuwenhze, Sérgio R. Filipe, and Mariana G. Pinho. Peptidoglycan synthesis drives an FtsZ-treadmilling-independent step of cytokinesis. Nature, 554(7693): 528–532, February 2018. ISSN 1476-4687. doi: 10.1038/nature25506. 14. Paul D. Fey, Jennifer L. Endres, Vijaya Kumar Yajjala, Todd J. Widhelm, Robert J. Boissy, Jeffrey L. Bose, and Kenneth W. Bayles. A Genetic Resource for Rapid and Comprehensive Phenotype Screening of Nonessential Staphylococcus aureus Genes. mBio, 4(1): 10.1128/mbio.00537–12, February 2013. doi: 10.1128/mbio.00537-12. Publisher: American Society for Microbiology. 15. Roy R Chaudhuri, Andrew G Allen, Paul J Owen, Gil Shalom, Karl Stone, Marcus Harrison, Timothy A Burgis, Michael Lockyer, Jorge Garcia-Lara, Simon J Foster, Stephen J Pleasance, Sarah E Peters, Duncan J Maskell, and Ian G Charles. Comprehensive identification of essential Staphylococcus aureus genes using Transposon-Mediated Differential Hybridisation (TMDH). BMC Genomics, 10:291, July 2009. ISSN 1471-2164. doi: 10.1186/1471-2164-10291. 16. Bruno M. Saraiva, António D. Brito, Guillaume Jaquemet, and Ricardo Henriques. Rxiv-maker: an automated template engine for streamlined scientific publications, 2025. 17. Christoph Spahn, Estibaliz Gómez-de Mariscal, Romain F. Laine, Pedro M. Pereira, Lucas von Chamier, Mia Conduit, Mariana G. Pinho, Guillaume Jacquemet, Séamus Holden, Mike Heilemann, and Ricardo Henriques. DeepBacs for multi-task bacterial image analysis using open-source deep learning approaches. Communications Biology, 5(1):688, July 2022. ISSN 2399-3642. doi: 10.1038/s42003-022-03634-z. Publisher: Nature Publishing Group. 18. Alexander Tomasz. Choline in the Cell Wall of a Bacterium: Novel Type of Polymer-Linked Choline in Pneumococcus. Science, 157(3789):694–697, August 1967. doi: 10.1126/science. 157.3789.694. Publisher: American Association for the Advancement of Science. 19. Kevin D. Whitley, Calum Jukes, Nicholas Tregidgo, Eleni Karinou, Pedro Almada, Yann Cesbron, Ricardo Henriques, Cees Dekker, and Séamus Holden. FtsZ treadmilling is essential for Z-ring condensation and septal constriction initiation in Bacillus subtilis cell division. Nature Communications, 12(1):2448, April 2021. ISSN 2041-1723. doi: 10.1038/ s41467-021-22526-0. Publisher: Nature Publishing Group. 20. Nikolay Ouzounov, Jeffrey P. Nguyen, Benjamin P. Bratton, David Jacobowitz, Zemer Gitai, and Joshua W. Shaevitz. MreB Orientation Correlates with Cell Diameter in Escherichia coli. Biophysical Journal, 111(5):1035–1043, September 2016. ISSN 1542-0086. doi: 10.1016/j.bpj.2016.07.017. 21. Mariana G. Ferreira, Bruno M. Saraiva, António D. Brito, Mariana G. Pinho, Ricardo Henriques, and Estibaliz Gómez-de Mariscal. ReScale4DL: Balancing Pixel and Contextual Information for Enhanced Bioimage Segmentation, April 2025. Pages: 2025.04.09.647871 Section: Confirmatory Results. 22. Stéfan van der Walt, Johannes L. Schönberger, Juan Nunez-Iglesias, François Boulogne, Joshua D. Warner, Neil Yager, Emmanuelle Gouillart, and Tony Yu. scikit-image: image processing in Python. PeerJ, 2:e453, June 2014. ISSN 2167-8359. doi: 10.7717/peerj.453. Publisher: PeerJ Inc. 23. Jos B.T.M. Roerdink and Arnold Meijster. The Watershed Transform: Definitions, Algorithms and Parallelization Strategies. Fundamenta Informaticae, 41:187–228, 2000. ISSN 0169- António D. Brito et al. | mAIcrobe 2968. doi: 10.3233/FI-2000-411207. 24. François Chollet and others. Keras, 2015. 25. Thomas Kluyver, Benjamin Ragan-Kelley, Pé, Fernando Rez, Brian Granger, Matthias Bussonnier, Jonathan Frederic, Kyle Kelley, Jessica Hamrick, Jason Grout, Sylvain Corlay, Paul Ivanov, Damiá Avila, n, Safia Abdalla, Carol Willing, and Jupyter Development Team. Jupyter Notebooks – a publishing format for reproducible computational workflows. In Positioning and Power in Academic Publishing: Players, Agents and Agendas, pages 87–90. IOS Press, 2016. doi: 10.3233/978-1-61499-649-1-87. 26. S. Zighelboim and A. Tomasz. Penicillin-binding proteins of multiply antibiotic-resistant South African strains of Streptococcus pneumoniae. Antimicrobial Agents and Chemotherapy, 17 (3):434–442, March 1980. ISSN 0066-4804. doi: 10.1128/AAC.17.3.434. Methods Image acquisition. The datasets of S. aureus strains, JE2 (14), BCBMS14 psg-RNAspy -2 and LCML1 (12) (Table S6) were acquired in-house. For the growth of BCBMS14 psg-RNAspy -2 and LCML1 overnight cultures of both strains were back-diluted 1:500 into 10 mL of fresh tryptic soy broth (TSB, Difco) media containing 10 µg/ml chloramphenicol (Sigma-Aldrich) and grown at 37 °C for 1 hour. After 1 hour, anhydrotetracycline (aTc, Sigma-Aldrich) was added to the medium to a final concentration of 100 ng/ml. After another hour, a 1 mL aliquot of each culture was incubated with 2.5 µg/mL NileRed (Invitrogen) for 5 min at 37 °C with shaking. The culture was pelleted (10000 rpm for 1 min), supernatant was removed and the pellet was resuspended in 30 µL of phosphate-buffered saline (PBS, NaCl 137 mM, KCl 2.7 mM, Na2 HPO4 10 mM, KH2 PO4 1.8 mM). One microliter of the resuspended culture was then placed on a thin layer of 1.2% (w/v) agarose (TopVision Thermo Fisher Scientific) in PBS and imaged via structured illumination microscopy (SIM). For the growth of untreated JE2, an overnight culture was back-diluted 1:200 into 10 mL of fresh TSB media and grown at 37 °C until cells reached mid-exponential growth phase (OD600 of 0.8). Afterwards, a 1 mL aliquot of culture was incubated with 5 µg/mL NileRed (Invitrogen) and 1 µg/mL Hoechst 33342 (Invitrogen) for 5 min at 37 °C with shaking. Culture was then centrifuged, washed with 1 ml of 1:3 (vol/vol) TSB/PBS solution, and resuspended in 20 µL of the same solution. Cells were mounted on microscope slides covered with a layer of 1.2% (w/v) agarose in PBS and imaged via structured illumination microscopy (SIM). SIM was performed using an Elyra PS.1 microscope (Zeiss) with a Plan-Apochromat 63x/1.4 oil DIC M27 objective. SIM images were acquired using three grid rotations, with a 34-µm grating period for the 561-nm laser (100 mW) and 23 µm grating period for the 405-nm laser (50 mW). Images were captured using a Pco.edge 5.5 camera and reconstructed using ZEN software (black edition, 2012; version 8.1.0.484) on the basis of a structured illumination algorithm, with synthetic, channel-specific optical transfer functions and noise filter settings ranging from 6 to 8. The dataset of Pen6 S. pneumoniae strains was also acquired in-house. Briefly, overnight cultures were back-diluted 1:50 into 5 mL of fresh C medium supplemented with yeast extract (0.8% Difco Laboratories) (C+Y media). C medium was prepared as described in (18). Cells were grown at 37 °C to early exponential phase (OD600 0.2-0.3). A 1 mL aliquot of the culture was centrifuged (10000 rpm for 1 min) and the 5 bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. pellet was resuspended in 30 µL of pre-C medium (18). Two microliters of the resuspended culture were then placed on a thin layer of 1.2% (w/v) agarose in pre-C (18) media and imaged using a Zeiss Axio Observer microscope equipped with a Plan-Apochromat 100x/1.4 oil Ph3 objective, a Retiga R1 CCD camera (QImaging), a white-light source HXP 120 V (Zeiss) and the software ZEN blue v2.0.0.0 (Zeiss). Biological image datasets. Datasets of B. subtilis express- ing FtsZ-GFP (strain SH130, PY79 Δhag ftsZ::ftsZ-gfp-cam (19)), which was used to train a U-Net segmentation model, and E. coli (strain NO34 (20)) exposed to various antibiotics, which was used to train a classification network, are publicly available in (17) alongside their annotations. The dataset of Pen6 S. pneumoniae that was used to test and train a U-Net segmentation model, was acquired in-house and is available on Zenodo (https://doi.org/10.5281/zenodo. 17306839). The S. aureus dataset containing untreated and PC190723 treated JE2 cells labeled with NileRed is publicly available in (21). The same dataset alongside in-house acquired images of BCBMS14 psg-RNAspy -2 was used to train and test a StarDist segmentation model and can be found in Zenodo (https://doi. org/10.5281/zenodo.17306839). The dataset WT JE2 S. aureus cells labeled with NileRed and Hoechst, used for validating morphometrics, is available in Zenodo (https://doi.org/10.5281/zenodo.17306839). The S. aureus dataset containing CRISPRi-depleted strain (LCML1) and its respective control (BCBMS14 psg-RNAspy 2) was used to test the pretrained S. aureus cell cycle classification model. The dataset was acquired in-house and is available on Zenodo (https://doi.org/10.5281/zenodo.17306839). A comprehensive list of all biological datasets used in this study can be found in Table S4. B. subtilis training and test datasets are publicly available in (17). For both training datasets, data augmentation was performed using image rotations and flips. The hyperparameters of each model can be found in Table S5. Classification network. The classification network trained on E. coli data is a convolutional neural network with an architecture described in (5). This network was retrained using the E. coli antibiotic phenotyping dataset from (17). The fields of view pertaining to the control condition plus those corresponding to exposure to mecillinam and nalidixic acid were split into the DNA and membrane channels, and the membrane channel was segmented using the CellPose cyto3 model (8). Individual cell crops were extracted from the segmented fields of view using mAIcrobe to generate the final dataset needed for training and testing. In total, the training dataset contained 1164 E. coli cell crops while the test dataset contained 416 cells. The network was trained for 200 epochs with a batch size of 32 and a learning rate of 0.001 and a validation split of 20%. Data augmentation was performed using Keras (24) RandomRotation and RandomFlip preprocessing layers. These layers, at training time only, perform random horizontal and vertical flipping and random rotations between -180º and 180º. Training was done using a Jupyter notebook (25) available in our GitHub repository (Table S1). Segmentation networks. The StarDist model used for S. au- reus segmentation was trained using a dataset of untreated (10 FoVs) and PC190723 treated (12 FoVs) JE2 S. aureus labeled with NileRed.The training dataset is the dataset available in (21). The test dataset contains 3 FoVs of BCBMS14 psg-RNAspy -2 S. aureus strain labeled with NileRed (Table S6) (12). Both the training and the test dataset are deposited in Zenodo (https://doi.org/10.5281/zenodo.17306839). Training was performed on a Jupyter notebook, adapted from the example notebooks provided by StarDist authors, that can be found in the code repository of this work (Table S1). The U-Net model used for S. pneumoniae and B. subtilis segmentation was trained on an adapted ZeroCostDL4Mic 2D U-Net notebook (10), that can be found in the code repository of this work (Table S1). The U-Net model was trained to identify background, cell edge, and cell interior. To obtain the final label image, scikit-image’s (22) watershed segmentation was used (23). First, a mask image is generated by performing the binary union of the cell edge and cell interior. The input to the watershed algorithm is the inverted mask alongside the cell interiors as marker basins. The training and test datasets of S. pneumoniae were obtained in-house and are available on Zenodo (https://doi.org/10.5281/zenodo.17306839). The 6 António D. Brito et al. | mAIcrobe bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. Supplementary Information mAIcrobe: an open-source framework for high-throughput bacterial image analysis bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. Notebook StarDist2D training notebook U-Net2D training notebook CNN classification network training Link https://github.com/HenriquesLab/mAIcrobe/blob/main/notebooks/StarDistSegmentationTraining.ipynb https://github.com/HenriquesLab/mAIcrobe/blob/main/notebooks/U_Net_2D_Multilabel_ZeroCostDL4Mic_adapted.ipynb https://github.com/HenriquesLab/mAIcrobe/blob/main/notebooks/napari_mAIcrobe_cellcyclemodel.ipynb Sup. Table S1. Jupyter notebooks available as part of mAIcrobe Description S. aureus datasets S. pneumoniae U-Net dataset B. subtilis U-Net dataset E. coli classification model dataset Species S. aureus S. pneumoniae B. subtilis E. coli Microscopy modality SIM Widefield (phase contrast) Widefield (fluorescence) Widefield (fluorescence) Reference This study, (21) This study (17) (17) Sup. Table S2. Experimental conditions for datasets used in this study. Model StarDist S.aureus U-Net S.pneumoniae U-Net B.subtilis Average IoU 0.999 0.998 0.923 Recall 0.994 0.988 1.00 Precision 0.872 0.898 0.840 Sup. Table S3. Performance metrics for the segmentation networks used in this study. Average Intersection over Union (IoU), Recall and Precision values were calculated on the respective test datasets. Name JE2 WT treated with PC190723 psg-RNASpy -2 and LCML1 StarDist S.aureus dataset U-Net S.pneumoniae dataset U-Net B.subtilis dataset E.coli classification model dataset Description Wild-type strain of S.aureus with PC190723 treatment S.aureus dnaA CRISPRi knockdown strain and its respective control Training and test dataset for StarDist segmentation model Training and test dataset for U-Net segmentation model Training and test dataset for U-Net segmentation model Training and test dataset for mAIcrobe classification model Link https://zenodo.org/records/15169018 https://doi.org/10.5281/zenodo.17306839 https://doi.org/10.5281/zenodo.17306839 https://doi.org/10.5281/zenodo.17306839 https://zenodo.org/records/5550968 https://zenodo.org/records/5551057 Sup. Table S4. Datasets used in this study and their respective repository links Organism S.aureus S.pneumoniae B.subtilis Microscopy SIM Phase Contrast Fluorescence Network StarDist U-Net U-Net Train/test images 20/3 16/3 7/3 Epochs 400 100 100 Steps 100 70 6 Image size 2430x2430 1392x1040 1024x1024 Patch size 256x256 256x256 512x512 Batch size 4 4 4 Learning rate 0.0003 0.0003 0.0005 %Validation 15 10 10 Augmentation Random flip and intensity changes VHFlip and 180 VHFlip and 180°rot Misc grid 2, 32 rays Finetuned from a S.aureus U-Net model Finetuned from a S.aureus U-Net model Sup. Table S5. Hyperparameters for the segmentation networks used in this study. Name JE2 BCBMS14 psg-RNASpy -2 LCML1 Pen6 Description Staphylococcus aureus Derivative of community acquired MRSA JE2 ∆spa:Pxyl/tet03 − dcas9Spy containing psg-RNASpy -2 JE2 ∆spa:Pxyl/tet03 − dcas9Spy containing psg-0001_dnaA Streptococcus pneumoniae PenR , unencapsulated laboratory strain; carries mosaic pbp alleles Reference (14) (12) (12) (26) Sup. Table S6. Strains used in this study. 8 António D. Brito et al. | mAIcrobe bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. Sup. Fig. S1. Example screenshot of the mAIcrobe napari plugin. In this screenshot, we showcase an image of B.subtilis cells being segmented using a U-Net model loaded into the mAIcrobe plugin. The plugin’s segmentation interface is visible on the right side of the image, displaying various options and settings for segmentation, that dynamically change according to the segmentation model chosen. António D. Brito et al. | mAIcrobe 9 bioRxiv preprint doi: https://doi.org/10.1101/2025.10.21.683709; this version posted October 21, 2025. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. Control 0.88 0.00 0.12 Mecillinam 0.14 0.82 0.04 Nalidixate True classification Accuracy 80% (n=416) 0.20 0.00 0.80 Control Mecillinam Nalidixate Predicted classification Sup. Fig. S2. Confusion matrix for E. coli classification model. The confusion matrix shows the performance of the retrained mAIcrobe CNN on a test dataset of 416 cells. 10 António D. Brito et al. | mAIcrobe