Wastewater treatment depends on the stability of complex microbial communities that drive biological processes and ensure effective solids separation. At the centre of this system is the balance between filamentous bacteria and floc-forming bacteria within activated sludge. When this balance is disrupted, plants can experience sludge bulking, reduced settling efficiency, and declining treatment performance.

Traditionally, operators rely on indicators such as sludge volume index (SVI) and manual microscopic examination to assess sludge health. While widely used, these methods are delayed, labour-intensive, and limited in explaining why problems occur. As Dr. Younggy Kim, Professor in Civil Engineering at McMaster University, explains, “SVI tells us how well sludge settles, but it doesn’t tell us why problems are happening.”

This gap has driven interest in automated approaches that can convert microscopic observations into operational insight. A collaboration between McMaster University and Veolia Water Tech has been exploring how artificial intelligence (AI) and computer vision can shift sludge microbiology from manual diagnosis to scalable digital monitoring.

The work began with a practical operational challenge. Microscopic sludge analysis contains valuable information, but it is too slow and subjective for real-time use. “Collecting and analyzing microscope images manually, determining what’s happening in the system, and then deciding on the appropriate actions can take days or even weeks,” said Dr. Hui Guo, Process Engineer, R&D Project Manager at Veolia Water Tech. “We needed a faster and more consistent way to understand the system and respond effectively.”

To address this, the project team developed an AI-based image analysis system to classify filamentous and floc-forming bacteria in sludge samples. Veolia provided microscope images and operational data from pilot & fullscale systems, while McMaster contributed expertise in machine learning algorithm development and model training using the Veolia’s data.

The technical approach used a two-stage pipeline. First, a rule-based segmentation method generated labelled training data from microscopy images using morphological and colour-based features. This created a structured dataset for model .

A supervised deep learning model with an encoder–decoder architecture was then trained to classify bacterial structures from raw images. Despite a relatively small dataset, the model achieved strong performance, showing that well-structured data can be more important than large-scale datasets in environmental applications.

From Model Development to Operational Validation

Beyond model construction, the collaboration examined how training conditions affect performance. Increasing training sample size improved accuracy up to around 300 images, after which gains plateaued. This suggests that data diversity matters more than sheer volume once a threshold is reached.

Higher image resolution improved detection of fine filamentous structures but increased computational demand. Additional training epochs produced only marginal gains once the model had learned core features.

As Dr. Kim notes, “The key is understanding what actually drives performance. Improving the quality and diversity of data is often more important than increasing model complexity.”

While McMaster focused on algorithm development, Veolia ensured the system could operate in real treatment environments. A key challenge was bridging academic development with industrial deployment, including differences in tools, workflows, and constraints.

“There is always a gap between developing a model in a research environment and deploying it in a live plant,” said Dr. Guo. “We had to ensure the solution was accurate and practical for operators.”

Real-world data from treatment plants was essential for validation. Variability in sludge composition and operating conditions helped test robustness and ensure the system could generalize beyond laboratory settings.

Towards Digital, Real-Time Wastewater Intelligence

Looking ahead, the collaboration is exploring more accessible applications, including smartphone-based imaging tools that would allow operators to capture and analyze sludge directly in the field. “We are not fully there yet,” Dr. Guo noted, “but the direction is toward simpler tools that give operators immediate insight.”

Future work will focus on improving robustness across plant conditions, expanding dataset diversity, and integrating AI outputs into decision-support tools. These developments reflect a broader shift toward digital water systems where AI supports more adaptive operations.

The collaboration also highlights the importance of ecosystem-level support in enabling innovation. The Ontario Water Consortium played a key role in facilitating the initial connection between McMaster and Veolia through a project supported under its former Advancing Water Technologies Program. Dr. Kim notes, “It made the very first industry connection possible. That initial step eventually grew into a sustained research partnership.”

For Veolia, academic partnerships provide access to specialized AI expertise that complements internal capabilities. “We don’t always have the in-house resources for advanced AI development,” Dr. Guo explained. “Working with academic partners allows us to combine operational knowledge with cutting-edge research.”

As the partnership continues, both sides see strong potential for further advancement, including improved scalability, efficiency, and real-time integration.

While fully autonomous wastewater treatment remains a long-term goal, incremental innovations such as AI-based microbial monitoring represent important steps forward. As Dr. Guo described, “We can imagine a future where monitoring becomes largely automated, but it will be built gradually.”

For McMaster, the collaboration reinforces its role in applied AI within civil engineering and environmental systems. For Veolia, it supports more intelligent and data-driven operations. For Ontario’s water innovation ecosystem, it demonstrates how structured collaboration can accelerate the translation of research into impact.

Further Reading

  • Al-Ani, S., Guo, H., Fyfe, S., Long, Z., Donnaz, S., & Kim, Y. Effect of training sample size, image resolution and epochs on filamentous and floc-forming bacteria classification using machine learning. Journal of Environmental Management, 379, 124803.
  • Al-Ani, S., Guo, H., Fyfe, S., Long, Z., Donnaz, S., & Kim, Y. Deep learning-based image analysis for filamentous and floc-forming bacteria in wastewater treatment. Journal of Water Process Engineering, 65, 105772.