Precise biofilm thickness prediction in SWRO desalination from planar camera images by DNN models | npj Clean Water
npj Clean Water volume 8, Article number: 22 (2025) Cite this article
875 Accesses
1 Altmetric
Metrics details
Detecting and quantifying biofouling is a challenging process inside a seawater reverse osmosis (SWRO) module due to its design complexity and operating obstacles. Herein, deep Convolutional Neural Network (CNN) models were developed to accurately calculate the cross-sectional biofilm thickness (vertical plane) through membrane surface images (horizontal plane). Models took membrane surface image as input; the classification model (CNN-Class) predicted fouling classification, while the regression model (CNN-Reg) predicted the average biofilm thickness on the membrane surface. CNN-Class model showed 90% accuracy, and CNN-Reg reached a moderate mean difference of ±24% in predicting the classification and biofilm thickness, respectively. Both models performed well and validated with 80% accuracy in classification and a mean difference of ±18% in biofilm thickness prediction from a new set of unseen live OCT images. The developed CNN models are a novel technology that has the potential to be implemented in desalination plants for early decision-making and biofouling mitigation.
The global availability of clean water remains a persistent challenge in contemporary times1. Desalination of seawater via reverse osmosis (RO) membrane filtration has emerged as one of the feasible technologies to tackle this problem2. However, membrane fouling such as inorganic, organic, and bacterial fouling poses a significant obstacle over time to the effectiveness of seawater RO (SWRO) desalination process3. Biofouling, which is characterized as the most severe4 and irreversible type of fouling in SWRO, necessitates a comprehensive understanding for preventive action and process enhancement. While cleaning-in-place (CIP) protocol5 is commonly employed in desalination plants to address the fouling concern, it is applied with high economic and environmental costs. Traditional methods for detecting fouling, such as monitoring pressure drop within the filtration module, are limited as they only respond to fouling formation. Early detection of biofouling is essential for implementing timely cleaning measures, ultimately leading to improved plant efficiency and extending the lifespan of membrane modules.
The early detection of biofilm formation and monitoring of its development is challenging, particularly in industrial filtration membrane modules. While it is difficult to detect these issues at early stage, it is even more challenging to do so promptly. However, the detection of biofilm development is achievable in lab-scale applications via Optical Coherence Tomography (OCT) imaging. OCT imaging is a non-intrusive and real-time observation technique commonly used to monitor the evolution of biofouling on filtration membranes6. It allows in-situ observation of the membrane within the filtration module through 2D or 3D scans of the biofilm structure, enabling the determination of biofilm thickness7. Given the heterogeneous nature of biofilm development on the membrane surface, OCT scans must be conducted at multiple locations to obtain a representative average biofilm thickness. However, the image analysis process using OCT equipment is currently manual and time-consuming, limiting its application outside of laboratory settings. Despite its potential, deploying OCT technology in real plants is limited from economic and technical standpoints.
To address this defiance on biofilm development tracing, one potential solution is to install a parallel toolbox adjacent to the membrane module, replicating the filtration conditions. A study by Ho et al. 8 demonstrated the effectiveness of this approach by integrating membrane fouling simulation with Electrical Impedance Spectroscopy (EIS) to monitor fouling in industrial RO modules over an extended period. A similar design could be implemented with an imaging system that exploits machine learning/artificial intelligence (ML/AI) models to facilitate faster image analysis. This would enhance the feasibility of detecting biofilm inside industrial membrane filtration modules, offering a promising pathway to address the ongoing challenge.
The rise of AI/ML models in recent years has opened great potential for application in membrane filtration processes. These models have been studied and utilized to predict membrane performance including permeate flux and solute rejection9,10, determine the optimal chemical composition for membrane fabrication11, and quantify membrane fouling layers12,13. Neural Network (NN) models mimic the structure of neurons in our brains to find solutions14. They can predict the correlation between input and output parameters without the need to understand the underlying mathematical equations, making them known as “black box” models15. Convolutional neural network (CNN) models are commonly used for tasks such as image classification, pattern recognition, and computer vision16. They work by learning features from images and correlating them with target parameters, such as biofilm thickness in this study. Deep CNN models have been employed to predict biofilm thickness from cross-section membrane images obtained through OCT12,13, demonstrating high prediction accuracy across various membrane filtration types (RO, ultrafiltration, nanofiltration, and membrane distillation) with a short amount of calculation time. However, applying these models using membrane surface images as input has not been previously explored due to the lack of correlations between the horizontal plane (membrane surface) with the vertical plane (biofilm thickness), but the potential is there. As membrane surface gets more fouling, the image will get more darker spots, which is correlated to a more developed biofilm on the surface, as observed as well in the corresponding cross-section image, hence correlating surface image to the biofilm thickness has a high possibility to be successful.
The present work aims to investigate the correlation between these sets of images through machine learning. The OCT possesses the ability to capture biofouling images simultaneously in both planes (horizontal surface and vertical cross-section). It not only provides valuable insights into the biofouling, but also reveals the data to investigate corrections between the set of images. These correlated images enable each horizontal membrane surface image to be associated with an average biofilm thickness value that is measured from the cross-sectional image. Hence, this capability paves the way for predicting average biofilm thickness directly from membrane surface images, particularly using CNN models. In addition, the concept of cross-plane prediction is revolutionary, as it could potentially eliminate the need for advanced imaging systems like OCT. Thus, this approach has the potential to replace OCT entirely with a simple camera image, enabling the development of CNN models for accurate and automated prediction of membrane fouling based solely on the membrane surface. Integrating this system into industrial plants would enable real-time and in-situ monitoring of membrane fouling. This would significantly improve process monitoring and facilitate earlier decision-making for optimizing plant operations.
In the present study, an in-situ biofouling detection framework using CNN models is developed, trained, and evaluated to address the challenge of cross-plane prediction. A database comprising approximately 1500 OCT image scans taken from various RO experiments was established. The input of the developed CNN models was the membrane surface images while the outputs consist of (i) classification of fouling or non-fouling formation, and (ii) prediction of the biofilm thickness, as illustrated in Fig. 1. Both models were subsequently tested and validated using a new set of unseen images provided from lab-scale RO experiments. For classification, the model performance is monitored from the accuracy and recall values to minimalize the false no-fouling prediction, while for regression, it is monitored via the mean squared error (MSE) and percentage difference between the manual measured and predicted biofilm thickness. This study pioneers the concept of cross-plane prediction for biofilm thickness using CNNs. The developed models would have the potential to revolutionize membrane biofouling detection, significantly enhancing the efficiency and intelligence of SWRO desalination plant operations.
Membrane surface image was taken as the input, while the output was fouling classification for the first CNN model and biofilm thickness for the second model. Illustration prepared by Thom Leach, scientific illustrator at KAUST.
Table 1 shows the performance of the CNN-Class model during multi-stages: training, validation, and testing with various transfer learning models. Transfer learning is used to give a better starting point and a shorter time to reach convergence since it has been pre-trained with a bigger dataset. In the preliminary result, it is observed that the usage of transfer learning helps to improve the model performance by 30–50% in both CNN-Class and CNN-Reg models. Although membrane surface image is different from the images used for the training of the transfer learning models, this process is possible due to several reasons. Firstly, in the early layer, the model learned low-level image feature such as edges, structure, or color gradient, which was commonly found in any images. Secondly, fine-tuning of the hyper-parameters was done as well to make the transfer learning method more adaptable to membrane fouling images. Hence, it made the usage of transfer learning possible with membrane surface image as the input.
For this fouling classification, two key performance metrics are monitored: accuracy and recall. The higher the value of these parameters, the better the performance of the CNN-Class model. Accuracy refers to the proportion of images correctly identified. This is calculated by dividing the sum of correctly classified clean and fouled images (true no-fouling and true fouling) by the total number of images analyzed. Recall mainly measures the model’s effectiveness in identifying the true fouling cases. It is calculated as the number of correctly classified fouled images (true fouling) divided by the total number of images that had fouling (including those the model might have missed, true fouling and false no-fouling). The number of true fouling, false fouling, true no-fouling, and false no-fouling predictions comes from the confusion matrix shown in Fig. 2 of the CNN-Class model with MobileNet (i.e., as the transfer learning models) and learning rate of 0.001. The recall value is correlated with type 2 error, where the model fails to predict a positive case (such as fouling for this study) and produces a false no-fouling prediction. Since the prediction of the positive case or fouling is the critical purpose of the CNN-Class model, a high recall value is needed. This translates to low type 2 error or false no-fouling prediction, which means the model can well detect the fouling with few misjudgments. In addition to accuracy and recall, the confusion matrix also includes the precision and f1-score parameters shown in Table 1, which are two other commonly used metrics for evaluating classification models. Precision value is calculated by dividing true fouling value with the total predicted fouling value, whether it is true or false. The precision value is important if we want to minimize the false fouling value (true condition in no-fouling but prediction is fouling). F1-score assess the overall performance of the model. These four parameters have minimum and maximum values of 0 (worst performance) to 1 (best performance), respectively.
For training (a), validation (b), and test (c) with MobileNet and learning rate of 0.001.
The CNN-Class model achieved high accuracy (0.85–0.90) during both training and validation stages. Additionally, the recall values were consistently above 0.9, indicating the model’s strong ability to identify fouling based on membrane surface image inputs. The CNN-Class model’s performance was tested on a small set of unseen images (i.e., not used in training and validation process) and revealed 0.7–0.8 accuracy. However, the recall remained high, reaching 1 in most transfer learning models. On the other hand, its performance did not significantly improve by applying a smaller learning rate or using larger transfer learning models such as Xception or the DenseNet. As the fouling classification only includes 2 class (Fouling and No-Fouling), the model can distinguish this feature faster with a smaller and simpler architecture, therefore, the CNN-Class model trained with the MobileNet model, and the default learning rate (0.001) could achieve a similar performance for fouling classification like the bigger models although having a smaller structure. The CNN-Class model leverages MobileNet model, the lightweight model in this study, with only 4.2 million parameters. This translates to lower computational costs17, enabling CNN-Class to deliver rapid predictions. In a test with 20 unseen images, CNN-Class processed them within a second on a standard 14-core machine (Intel Xeon, 2.4 GHz) with 128 GB RAM.
The confusion matrix in Fig. 2 provides insights into the classification performance of the CNN-Class model. Across the training (Fig. 2a), validation (Fig. 2b), and test (Fig. 2c) stages, the CNN-Class model achieved good performance in correctly classifying fouling and no-fouling images. This is evident by the concentration of predictions in the top-left and bottom-right of the confusion matrix. Conversely, low rates of false predictions (i.e., either no-fouling or fouling) were identified in the top-right and bottom-left corners of the matrix compared to the correctly predicted images. The main objective of the CNN-Class model is to minimize the false no-fouling predictions (top right), where fouling is present but remains undetected. This is successfully demonstrated by the lowest category values across all stages. Mitigating false no-fouling prediction is crucial because undetected fouling can severely compromise membrane performance and hinder early decision-making within the plants for rapid intervention.
The accuracy of the CNN-Class model during training and validation is plotted in Fig. 3a as a function of the epoch number. The initial training and validation accuracy values were 0.74 and 0.84, respectively (Fig. 3a). The figure demonstrates the benefit of the transfer learning method in achieving faster convergence. By leveraging pre-trained convolutional and pooling layers from a larger database, transfer learning provides a strong starting point for the CNN-Class model, leading to improved performance on our smaller database. In the present study, all the models were trained with an early stopper function to prevent overfitting18. Figure 3b, c depict the loss and accuracy of the CNN-Class model trained for increased epoch number (200 epochs). While the training loss continuously decreases and training accuracy increases, the validation loss and validation accuracy remain relatively stable. This trend indicates potential overfitting, where the model learns to fit the training data too well, affecting its ability to generalize to unseen data18. Furthermore, Fig. 3d shows that increasing the size of the image database improves the model’s performance, though the improvement is modest. Using only two classes (fouling/no-fouling) enables the model to perform well with a limited database. However, a larger database can help the model learn more distinctive fouling features from the images, leading to more accurate predictions. Hence, this indicates further improvement in the performance of the CNN-Class model.
Training and validation accuracy as a function of numerical iterations (a), training and validation loss (b) and accuracy (c) after 200 epochs. Accuracy-recall values of CNN-Class model with an increase of image number while maintaining 80-20 ratio (d).
The main purpose of CNN-Reg model development is to achieve cross-plane predictions by learning and extracting unique features from a surface image (horizontal plane) to predict the average biofilm thickness on the membrane surface (vertical plane). Training the CNN-Reg model involved leveraging the same variation of transfer learning models and learning rates used for the CNN-Class model. Each 2D OCT scan provides a pair of images: a membrane surface image and a corresponding cross-section image from a specific location within the scan. This pairing allows for the extraction of an average biofilm thickness value from the cross-section image, which serves as the ground truth for the surface image. Consequently, the surface images became the input for the CNN-Reg model, while the average biofilm thickness values were the model’s output layer. Table 2 summarizes the performance of the CNN-Reg model in predicting biofilm thickness. It evaluates the model’s accuracy using two metrics: mean square error as the loss function and the mean difference (i.e., in µm) between the experimentally measured and predicted average biofilm thickness, which are commonly used in a regression model. An early stopper was also applied during training to prevent the model from overfitting on the training data. Training and validation revealed that the mean square error and mean difference were similar across various models, while in the testing step, both decreased with two key factors: a smaller learning rate and a more complex transfer learning model. For example, employing DenseNet121 architecture19 produced the smallest mean difference, around ±24.59%. Cross-plane prediction by CNN-Reg model is not a straightforward process compared to CNN-Class fouling classification, hence, denser and bigger architecture model, such as DenseNet helps to produce a slightly better performance. However, the difference between each model is not too far from each other, thus showing that any transfer learning model can help enhance the cross-plane prediction training process.
Furthermore, Fig. 4 delves deeper into the CNN-Reg model’s performance during the training and validation. As shown in Fig. 4a, a rapid convergence of the loss function for both the training and validation datasets was manifested within the first 25 epochs. This signifies the model’s efficient learning of the training data. Subsequently, the loss values continued to decrease gradually until they flattened, indicating that the model had reached an optimal learning point. This behavior highlights the effectiveness of transfer learning in providing a strong foundation for the CNN-Reg model, similar to its role in the CNN-Class model.
Training and validation loss of CNN-Reg in log-scale (a) along with the correlation of manually measured and predicted thickness during training-validation (b) and model testing on unseen images (c).
Furthermore, the CNN-Reg model demonstrated a strong correlation between the manually measured and predicted average biofilm thickness during both training and validation phases. As illustrated in Fig. 4b, the data points cluster tightly around the diagonal linear line, indicating accurate predictions. This trend persisted in testing with 100 unseen membrane surface images in Fig. 4c. Impressively, this model requires only 1.186 seconds to process 100 membrane surface images on the same hardware as CNN-Class, highlighting its exceptional efficiency in predicting the biofilm thickness from membrane surface images only. In contrast, the manual measurement using image analysis software on OCT cross-section images is considerably more time-consuming. One thing to notice is that the CNN-Reg model does not work well in predicting biofilm thickness when the input is a non-fouled image (biofilm thickness < 30 µm), as shown in Fig. 4b, c by the populated straight vertical line at the bottom left. The model performance in predicting low thickness can be improved in the future by expanding the image database, especially the non-fouling and early-stage of fouling images.
The trained CNN-Reg model not only excels in prediction speed but also demonstrates accurate prediction of average biofilm thickness. As seen in Fig. 5, the model effectively predicts average biofilm thickness on unseen fouled membrane surface images. While the mean difference is approximately ±24% between the manually measured and predicted thickness, this discrepancy still falls within the standard deviation of the manual measurements. Out of 100 tested images, only prediction from 73 fouled images was shown in Fig. 5, while the predictions from non-fouled images was not included. Given the inherent uneven nature of biofilm formation on membrane surfaces (as illustrated in OCT images in Fig. 5), this mean difference value is considered reasonable for representing the average thickness of the overall biofilm layer developed on the membrane surface. Interestingly, the model manifested robust predictive performance across diverse biofilm coverage conditions. As such, whether the membrane was fully or partially covered by biofilm, the model maintained its accuracy in estimating average biofilm thickness.
Along with three images illustrating the membrane surface and cross-section OCT images. “Manual” denotes the average biofilm thickness obtained by manual measurement while “CNN_pred” represents the average biofilm thickness predicted by CNN-Reg model.
These results demonstrate the feasibility of cross-plane predictions using machine learning models. The CNN-Reg model excels in predicting biofilm thickness (vertical plane) from the membrane surface image only (horizontal plane), which was a previously challenging task. This breakthrough paves the way for efficient and intelligent plant operations by enabling fouling detection from surface image inputs.
To further validate the performance of CNN-Class and CNN-Reg, both models were tested on a new set of unseen images from a fresh RO experiment using seawater as feed. The experiment was conducted for three days under 4 bar, operating pressure with live OCT scans taken daily. The biofilm formation on the membrane surface initiated on the second day and progressed to heavy fouling by the third day. Thus, a dataset of 25 clean membrane images from day 1 and 75 fouled membrane images from days 2 and 3 was used as input for the experimental model validation. Figure 6a presents the confusion matrix of the CNN-Class on this new fouled image dataset. The model achieved an overall accuracy of 80% and a recall value of 0.76 (76%) for the fouled class, indicating that 24% of the fouled membrane images were misclassified as clean images. A potential cause for the model’s misclassification is the inclusion of early-stage fouling images from day 2, where biofilm deposits were not yet pronounced, leading to confusion with the no-fouling image class. For CNN-Reg, the model exhibited accurate biofilm thickness prediction, as depicted in Fig. 6b, c. The predicted values clustered closely around the ideal diagonal linear line (Fig. 6b) and were not far of the manual thickness measurements (Fig. 6c).
It was done for experimental model validation: confusion matrix for CNN-Class model (a) and correlation between manually measured and predicted average biofilm thicknesses (b and c).
The CNN-Reg model maintains consistent predictive performance for average biofilm thickness across various membrane surface locations. As depicted in Fig. 7, this consistency is observed at three different locations on the membrane surface at the inlet (Fig. 7a,d), middle (Fig. 7b,e), and outlet (Fig. 7c,f) during days 2 and 3 of filtration. The CNN-Reg model demonstrated exceptional computational efficiency, requiring less than a second for prediction on the same hardware used previously. The images in Fig. 7 provide illustrative examples of membrane input images and corresponding predicted and actual biofilm thicknesses. Irrespective of fouling or location on the membrane surface, the trained CNN-Reg model demonstrated robust predictive accuracy for average biofilm thickness, exhibiting a mean difference of ±18%. This finding underscores the generalizability of both the CNN-Class and CNN-Reg models, as their exceptional performance extended to unseen images from an independent membrane filtration experiment not included in the training and validation datasets.
Captured at three distinct locations: inlet (a, d), middle (b, e), and outlet (c, f) during days 2 and 3 of RO filtration process. “Manual” denotes the average biofilm thickness obtained by manual measurement, while “CNN_pred” represents the average biofilm thickness predicted by CNN-Reg model.
It is expected as well that the generalizability of both the CNN-Class and CNN-Reg models to be intact with different conditions or operational parameters. It is because the prediction is based on the fouling formation on the membrane surface image and not correlated directly with the operational parameters. The variation of the filtration conditions and parameters might affect the fouling evolution or development on the membrane surface, but the models do prediction based on the fouling formation on the membrane surface at the moment regardless on how the fouling develops.
The potential application of this models is to be used in a monitoring system that is placed parallel to the membrane modules in the real plant, such as done by Ho et al. 8. The membrane fouling simulator experiences the same operating conditions as the membrane module, and the AI models can predict the biofilm thickness based on the image from the simulator, which is taken hourly or daily. This will shift the cleaning protocol to be executed based on the membrane surface conditions from the traditional methods, which might be triggered when the fouling has been too severe and damaging the membrane in the long run. However, the current performance of the CNN models in this study is not suitable yet for plant deployments, as the models needs to be complemented with a correlation to the operational parameters as well as cost analysis for a more comprehensive coverage of the plant operation to achieve an efficient cleaning strategy. This is needed because the adaptive cleaning mechanism cannot be based only on the membrane fouling condition but also considering other aspects such as time and cost as well.
In conclusion, this study developed and evaluated two deep convolutional neural network (CNN) models using membrane surface images as input. A classification model (CNN-Class) was designed to determine membrane fouling status (fouled or not), while a regression model (CNN-Reg) predicted average biofilm thickness on the membrane surface. The transfer learning method was employed for both models to accelerate the training. A database of approximately 1500 membrane surface images was constructed from 2D Optical Coherence Tomography (OCT) scans. A total of 80% of this database images were allocated for model training. The CNN-Class model achieved a high accuracy of 90% in predicting membrane fouling status. The CNN-Reg model demonstrated competent performance in estimating the average biofilm thickness, with predicted values falling within the standard deviation of manually measured thicknesses. Both CNN models exhibited consistent performance when evaluated on unseen images of the original database. To assess generalizability, the models were challenged with unseen images from an independent RO experiment. The CNN-Class model maintained a strong accuracy of 80% while the CNN-Reg model continued to provide reliable predictions with a mean difference of ±18% from manually measured biofilm thickness. These findings underscore the capability of the ML/AI model for accurately predicting average biofilm thickness (vertical plane) from membrane surface images (horizontal plane). The developed CNN models offer both speed and precision, making them promising tools for early biofouling detection in desalination processes.
Figure 8 presents a schematic diagram of the RO filtration experiment setup. A Sterlitech Polyamide-TFC membrane coupon and spacer are housed within RO filtration cell featuring a flow channel measuring 200 mm × 35 mm x 1.2 mm, with the spacer filled the channel height. The system operated at a constant trans-membrane pressure (TMP) of 4 bar, in a crossflow configuration. The feed solution was prepared by dissolving 1 g/L Bacto Yeast extract (Extract of Autolyzed yeast cells, Becton Dickinson, and Company) in Red Seawater, followed by incubation for 24 hours at 30 oC. A gear pump (Model 72211-70, Cole Parmer, USA) delivered the feed solution to the filtration cell at a constant flow rate of 12 and 23 L/h. This corresponds to an inlet flow velocity of 0.075 and 0.15 m/s. The retentate stream was then recirculated back to the feed tank. Precise control of both flow rate and pressure during filtration was achieved using a mass flow controller (MINI CORI-FLOW™ M14, Bronkhorst, Ruurlo) and a pressure controller (EL-PRESS P502C, Bronkhorst, Ruurlo). Permeate weight measurements were automated using an electrical balance (Mettler Toledo, model ML6002T/00) interfaced with a data acquisition system (LabView, National Instruments, version 17.0) connected to a computer. This setup facilitated the execution of a series of RO experiments with varying parameters to induce the development of biofilm layers with different thicknesses, such as spacer design, different incubation time for the seawater, or days of filtration up to 6 days. Images were taken daily at fixed and random spots on the membrane surface during the filtration to ensure the biofilm heterogeneity is represented.
Schematic of the lab-scale RO filtration system for biofouling development.
A collection of 2D OCT biofilm images, constituting a database for DNN model development, was generated in this study. These images (around 1500 images) captured biofilms formed on membrane surfaces during different stages of lab-scale RO experiments without prior curation to ensure the variability of the database hence increase the model’s capability. Each OCT scan provided two distinct views: a horizontal plane image of the membrane surface and a vertical plane image revealing a cross-section of the membrane and the biofilm, as depicted in Fig. 9. Details regarding the specific 2D OCT scanning procedure can be found in our previous study13. To quantify biofilm growth, the average thickness was initially measured manually for each cross-section image obtained from the OCT scans. As the image could be represented as a matrix of pixel values, the measurement was done by measuring the fouling pixel. The fouling pixels were above the membrane line. The amount of fouling pixel at multiple fixed locations was then averaged and converted to µm based on the ratio of pixels and µm from the OCT image. In the first day of filtration, the membrane was considered not fouled or clean, and the manual measurement for the biofilm thickness was observed around 20–30 µm. Hence, it was decided that a fouled membrane had a biofilm thickness greater than 30 µm, as observed and measured for the cross-section image from the second day onwards (>24 hours).
Surface (a) and cross-sectional (b) OCT images were taken on the membrane surface during the RO experiment.
This allowed to associate each membrane surface image with a corresponding value for average biofilm thickness. A small subset of images was further reserved randomly for testing the model’s performance, 20 images (10 fouled and 10 non-fouled) for CNN-class model and 100 images for CNN-reg model. Since cross-plane prediction was expected to be more challenging than fouling classification that involved two classes, higher number of testing images for CNN-Reg was chosen. Subsequently, 80% of the remaining images were designated randomly for training the machine learning model, while the remaining 20% were used for validation. Each run was done 3 times to assess the model performance. Hyper-parameters tuning was done manually by changing various parameters, such as the transfer learning model, learning rate and optimizer; the result is compared based on the validation step. The testing step was done for reconfirming the results; hence, a small number of test datasets was chosen.
To further assess the applicability of these models, fouling formation and biofilm thickness were predicted on a new dataset of live OCT images generated from new 72-hour RO filtration experiments. Biofilm formation was observed to begin on days 2 and 3. The developed models were used to analyze images of biofilms grown during these two days captured from different membrane locations (i.e., inlet, middle, and outlet of the filtration cell).
CNN model is commonly used for image classification, pattern recognition, and computer vision13. The model captures various features of the images (such as darker color at the edges and surface of fouling layer) to adjust their weights and biases throughout the training process. As an image can be represented as a matrix of pixel value, CNN works by applying a series of filters and a pooling process to reduce the dimension of the image while maintaining the spatial and temporal dependencies of the image20. Common filter values, typically small and square matrices, are 3 × 3, 5 × 5, or 7 × 7, while there are average and maximum for pooling20. This process helps to extract high-level visual patterns of the image. In this study, the CNN model is deployed via TensorFlow 2.0 and Keras API in a Python (3.11) environment. Figure 10 shows the schematic of CNN models, where the input is the membrane surface image with an associated biofilm thickness label for each image. Two CNN models were trained, validated, and tested. The first one, designated as CNN-Class, served a classification purpose. It aimed to predict whether a given membrane surface image indicated the presence or absence of fouling. In contrast, the second model, CNN-Reg, was designed for regression and aimed to predict the exact value of the average biofilm thickness. In each model, the CNN model firstly applied a series of filters on the whole membrane surface image and then continued with a pooling process21 to decrease the dimension of the image while extracting its important features. After a series of convolutional and pooling layers, the image was flattened and sent to the dense layer with 1024 neuron units, a dropout layer with a rate of 0.522 and an output layer. The transfer learning method23 was applied to both models to give a better starting point and a shorter time to reach convergence by using weights and biases of the feature extraction step (convolutional and pooling layers) from a model that has been trained for a similar task on a larger database. In this study, the pre-trained model for transfer learning was done with the ImageNet database16.
The output layer of the CNN-Class model and CNN-Reg model is fouling classification and biofilm thickness, respectively.
Before processing, each image pixel value of the input layer was resized to 224 × 224 pixels and scaled by 255 (maximum of grayscale intensity). Simultaneously, the corresponding average biofilm thickness values were normalized to a consistent range of −0.5 and 0.5 using the following equation24;
where H, Hmin, and Hmax are the raw, minimum, and maximum thickness values in the database, respectively. The scaling improved the convergence during the training process. During the training process, data augmentation was done by rotating, flipping, zooming, and shearing the input image to increase the model robustness. The dense layer was activated by ReLU activation25 while the output layer for CNN-Class and CNN-Reg models was activated by sigmoid and linear activation, respectively26,27. Both models used the Adam optimizer28. For the loss function, the CNN-Class model used binary cross-entropy29 while CNN-Reg used mean squared error (MSE). An early stopper was implemented by tracking the validation step loss value. Training stopped when the validation loss did not decrease further after 25 consecutive epochs from the epoch that achieved the best loss value (patience = 25).
The datasets can be shared on request by following KAUST data sharing policies and guidelines.
Van Vliet, M. T. et al. Global water scarcity including surface water quality and expansions of clean water technologies. Environ. Res. Lett. 16, 024020 (2021).
Article Google Scholar
Altmann, T. & Das, R. Process improvement of sea water reverse osmosis (SWRO) and subsequent decarbonization. Desalination 499, 114791 (2021).
Article CAS Google Scholar
Gonzalez-Gil, G. et al. Clinical Autopsy of a Reverse Osmosis Membrane Module. Front. Chem. Eng. 3 (2021).
Wang, X. et al. The effects of hydrogen peroxide pre-oxidation on ultrafiltration membrane biofouling alleviation in drinking water treatment. J. Environ. Sci. 73, 117–126 (2018).
Article CAS Google Scholar
Siebdrath, N., Farhat, N., Ding, W., Kruithof, J. & Vrouwenvelder, J. S. Impact of membrane biofouling in the sequential development of performance indicators: Feed channel pressure drop, permeability, and salt rejection. J. Membr. Sci. 585, 199–207 (2019).
Article CAS Google Scholar
Huisman, K. T. et al. Noninvasive monitoring of fouling in membrane processes by optical coherence tomography: A review. J. Membr. Sci. 692, 122291 (2024).
Article CAS Google Scholar
Kerdi, S., Qamar, A., Alpatova, A. & Ghaffour, N. An in-situ technique for the direct structural characterization of biofouling in membrane filtration. J. Membr. Sci. 583, 81–92 (2019).
Article CAS Google Scholar
Ho, J. S. et al. Monitoring fouling behavior of reverse osmosis membranes using electrical impedance spectroscopy: A field trial study. Desalination 407, 75–84 (2017).
Article CAS Google Scholar
Hu, J. et al. Artificial intelligence for performance prediction of organic solvent nanofiltration membranes. J. Membr. Sci. 619, 118513 (2021).
Article CAS Google Scholar
Ridwan, M. G., Altmann, T., Yousry, A., Basamh, H. & Das, R. RO-TRACK: data driven predictive analytics for seawater reverse osmosis desalination plants. Desalin. Water Treat. 309, 8–21 (2023).
Article CAS Google Scholar
Fetanat, M. et al. Machine learning for advanced design of nanocomposite ultrafiltration membranes. Ind. Eng. Chem. Res. 60, 5236–5250 (2021).
Article CAS Google Scholar
Park, S. et al. Deep neural networks for modeling fouling growth and flux decline during NF/RO membrane filtration. J. Membr. Sci. 587, 117164 (2019).
Article CAS Google Scholar
Qamar, A. et al. A deep neural networks framework for in-situ biofilm thickness detection and hydrodynamics tracing for filtration systems. Sep. Purif. Technol. 301, 121959 (2022).
Article CAS Google Scholar
Wu, Y.-c & Feng, J.-w Development and Application of Artificial Neural Network. Wirel. Personal. Commun. 102, 1645–1656 (2018).
Article Google Scholar
Chew, J. W. & Cocco, R. A. Application of machine learning methods to understand and predict circulating fluidized bed riser flow characteristics. Chem. Eng. Sci. 217, 115503 (2020).
Article CAS Google Scholar
A. Krizhevsky, I. Sutskever, G. E. Hinton, Imagenet classification with deep convolutional neural networks, Advances in neural information processing systems, 25 (2012).
A. G. Howard, et al., Mobilenets: Efficient convolutional neural networks for mobile vision applications, arXiv:1704.04861 (2017).
Ying, X. An Overview of Overfitting and its Solutions. J. Phys.: Conf. Ser. 1168, 022022 (2019).
Google Scholar
Huang, G., Liu, Z., Van Der Maaten, L. & Weinberger, K. Q. Densely connected convolutional networks, In Proceedings of the IEEE conference on computer vision and pattern recognition, 4700–4708. (2017)
Zhao, L. & Zhang, Z. A improved pooling method for convolutional neural networks. Sci. Rep. 14, 1589 (2024).
Article CAS Google Scholar
Cheung, M., Shi, J., Jiang, L., Wright, O. & Moura, J. M. Pooling in graph convolutional neural networks, In 2019 53rd Asilomar Conference on Signals, Systems, and Computers, pp. 462-466 (IEEE, 2019)
H.-i. Lim, A study on dropout techniques to reduce overfitting in deep neural networks, in: Advanced Multimedia and Ubiquitous Engineering: MUE-FutureTech 2020, Springer, pp. 133-139, (2021)
S. Bozinovski, Reminder of the first paper on transfer learning in neural networks, 1976, Informatica, 44 (2020).
Tanudjaja, H. J. & Chew, J. W. Application of Machine Learning-Based Models to Understand and Predict Critical Flux of Oil-in-Water Emulsion in Crossflow Microfiltration. Ind. Eng. Chem. Res. 61, 8470–8477 (2022).
Article CAS Google Scholar
Nair, V. & Hinton, G. E. Rectified linear units improve restricted boltzmann machines, In Proceedings of the 27th international conference on machine learning (ICML-10), pp. 807-814., (2010)
Han, J. & Moraga, C. The influence of the sigmoid function parameters on the speed of backpropagation learning, In: International workshop on artificial neural networks, pp. 195-201, (Springer, 1995)
Ramachandran, P., Zoph, B. & Le, Q. V. Searching for activation functions, arXiv:1710.05941 (2017).
Kingma, D. P. & Ba, J. Adam: A method for stochastic optimization, arXiv:1412.6980 (2014).
Rubinstein, R. Y. & Kroese, D. P. The cross-entropy method: a unified approach to combinatorial optimization, Monte-Carlo simulation, and machine learning, Springer, (2004).
Download references
The research reported in this paper was supported by funding from the collaboration project (RGC/3/5162-01-01) between ACWA Power and King Abdullah University of Science and Technology (KAUST), Saudi Arabia. The authors would like to thank Thom Leach, scientific illustrator at KAUST, for producing Figure 1.
Environmental Science and Engineering Program, Division of Biological and Environmental Science and Engineering (BESE), King Abdullah University of Science and Technology (KAUST), Thuwal, Saudi Arabia
Henry J. Tanudjaja, Najat A. Amin, Adnan Qamar, Sarah Kerdi & Noreddine Ghaffour
Innovation and New Technology, ACWA Power, Building 24, Research Park, Innovation Cluster 3-185, King Abdullah University of Science and Technology (KAUST), Thuwal, Saudi Arabia
Hussain Basamh, Thomas Altmann & Ratul Das
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
You can also search for this author inPubMed Google Scholar
H.J.T. built models, analyzed data, wrote original draft, and revised manuscript. N.A.A. collected experimental data, wrote original draft, and revised manuscript. A.Q. conceived ideas, built models and reviewed the manuscript. S.K. collected experimental data and reviewed manuscript. H.B., T.A., R.D. reviewed, edited the manuscript, and funding acquisition. N.G. conceived ideas, supervised, and reviewed manuscripts.
Correspondence to Noreddine Ghaffour.
The authors declare no competing interests.
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
Reprints and permissions
Tanudjaja, H.J., Amin, N.A., Qamar, A. et al. Precise biofilm thickness prediction in SWRO desalination from planar camera images by DNN models. npj Clean Water 8, 22 (2025). https://doi.org/10.1038/s41545-025-00451-9
Download citation
Received: 03 November 2024
Accepted: 05 March 2025
Published: 23 March 2025
DOI: https://doi.org/10.1038/s41545-025-00451-9
Anyone you share the following link with will be able to read this content:
Sorry, a shareable link is not currently available for this article.
Provided by the Springer Nature SharedIt content-sharing initiative
