Detection of Ammonia Levels in Aquaculture Ponds by Using CNN-LSTM

DOI : 10.17577/IJERTV13IS030145

Download Full-Text PDF Cite this Publication

Text Only Version

Detection of Ammonia Levels in Aquaculture Ponds by Using CNN-LSTM

Yenuganti Siva Lakshmi, Prathigudupu Navya Sri, Siddi Mounika, Tata Usha Sri, Yallamati Suresh

UG Student, Department of Information Technology, Vasireddy Venkatadri Institute of Technology, Peddakakani Mandal, Nambur, Guntur – 522508 Andhra Pradesh, India.

Assistant Professor, Department of Information Technology, Vasireddy Venkatadri Institute of Technology, Peddakakani Mandal, Nambur, Guntur – 522508 Andhra Pradesh, India.

Abstract: Ammonia levels are crucial indicators in various fields, including environmental monitoring, industrial processes, and medical diagnostics. This study investigates the utilization of Convolutional Long Short-Term Memory (ConvLSTM) networks for time series classification of sequential data related to ammonia levels. The dataset is preprocessed and normalized before being split into training and testing sets. A ConvLSTM architecture is developed and trained using the Adam optimizer and sparse categorical cross- entropy loss. The training history is analyzed to assess model performance. Results highlight the effectiveness of ConvLSTM networks in accurately classifying sequential data, particularly in the context of monitoring and analyzing ammonia levels.

Keywords: Ammonia levels, Convolutional Long Short-Term Memory (ConvLSTM), time series classification, sequential data, preprocessing, normalization, training-validation split, Adam optimizer, sparse categorical cross-entropy, training history, model performance evaluation


    Ammonia levels serve as critical indicators across diverse domains, ranging from environmental monitoring to industrial processes and medical diagnostics. Monitoring and accurately classifying ammonia levels in time-series data present significant challenges due to the complex and dynamic nature of the underlying processes. In this context, Convolutional Long Short-Term Memory (ConvLSTM) networks offer a promising solution by leveraging both convolutional and recurrent neural network architectures to effectively capture spatial and temporal dependencies within sequential data. By integrating ConvLSTM networks, this study aims to address the classification task associated with tracking and analyzing ammonia level fluctuations over time.

    The study initiates by preprocessing and normalizing the dataset to ensure consistency and facilitate model training. Subsequently, the dataset is partitioned into training and testing subsets to enable rigorous evaluation of the proposed ConvLSTM architecture. Leveraging the Adam optimizer and sparse categorical cross-entropy loss function, the ConvLSTM model is trained to accurately classify sequential data pertaining to ammonia levels. The training process is

    monitored and analyzed through the examination of training history metrics, providing insights into model performance and efficacy. Through this investigation, the study seeks to demonstrate the effectiveness of ConvLSTM networks in robustly classifying ammonia level variations, thereby contributing to enhanced monitoring and understanding of relevant processes across various applications.

    Furthermore, the utilization of ConvLSTM networks extends beyond traditional time series analysis, offering versatile applications in various domains. ConvLSTM architectures have demonstrated proficiency in capturing intricate patterns and dependencies within sequential data, making them well-suited for tasks such as image recognition, natural language processing, and video analysis. By employing ConvLSTM networks in the context of ammonia level classification, this study not only addresses a specific domain challenge but also contributes to the broader advancement of deep learning methodologies for time series analysis. The findings of this research have the potential to catalyze further exploration and adoption of ConvLSTM networks in diverse fields, empowering researchers and practitioners with powerful tools for extracting insights from complex sequential data stream.


    The literature survey underscores the challenges encountered in traditional methods of water quality monitoring, particularly concerning the critical task of monitoring ammonia levels, pivotal for the health and sustainability of aquatic ecosystems. It elucidates the detrimental impacts of elevated ammonia levels on aquatic life and elucidates the shortcomings of conventional laboratory techniques in capturing the dynamic fluctuations inherent in water quality data. Traditional methods often fail to provide real-time insights into water quality changes, thus hindering timely intervention to mitigate potential ecological risks. In response to these challenges, there has been a paradigm shift towards leveraging advanced machine learning and deep learning models to revolutionize

    water quality monitoring practices.

    Proposed in the literature is the adoption of a hybrid CNN- LSTM model, which amalgamates the robust classification

    capabilities of Convolutional Neural Networks (CNNs) with the proficiency of Long Short-Term Memory (LSTM) networks in capturing long-range dependencies within sequential data. This innovative model architecture represents a significant advancement in the field, offering a potent tool for effectively analyzing and predicting ammonia levels in water bodies. By harnessing the strengths of both CNNs and LSTMs, this hybrid model demonstrates the potential to overcome the limitations of traditional monitoring techniques, enabling more accurate and timely assessment of water quality parameters. The integration of deep learning methodologies into water quality monitoring signifies a transformative approach towards enhancing environmental stewardship and safeguarding aquatic ecosystems for future generations.


    The existing system for detecting ammonia levels relies on laboratory-based methods such as ion-selective electrodes, which measure ammonia concentrations but require specialized equipment and controlled environments. These methods involve complex procedures, making them time- consuming and resulting in longer waits for results. Moreover, they demand costly instrumentation and skilled personnel to operate effectively, rendering them impractical for real-time monitoring or field measurements where immediate detection is necessary. Despite their precision, these drawbacks emphasize the need for exploring alternative detection technologies that offer faster, more cost-effective, and portable solutions for monitoring ammonia concentrations in various settings. The following limitations of existing system are as follows:

    • Manual Intervention: Current methods require manual handling at various stages, leading to increased error risks and inconsistent results.

    • Limited Automation: Lack of comprehensive automation in data processing prolongs result turnaround times and enhances the likelihood of human errors.

    • High Cost of Equipment: Traditional detection methods demand expensive equipment and maintenance, limiting accessibility for smaller laboratories or organizations.

    • Long Turnaround Time: Sequential processes involved in existing methods result in delayed results, affecting timely interventions and decision-making.

    • Environmental Limitations: Laboratory constraints confine existing methods to controlled environments, hindering on-site and real-time onitoring capabilities.


    The proposed system leverages deep learning techniques, specifically Convolutional LSTM (ConvLSTM), for predicting ammonia levels based on sequential data. It begins by loading the dataset and preprocessing features and labels. The features are normalized using Min-Max scaling to ensure uniformity across the dataset. With a defined sequence length and parameters, the dataset is then structured into sequences and corresponding labels suitable for training the model.

    Subsequently, the data is split into training and testing sets, ensuring that the sequential order is preserved to maintain the

    integrity of the temporal relationships within the data. The model architecture comprises ConvLSTM layers, which integrate convolutional and LSTM operations to effectively capture spatial and temporal dependencies in the input data. Following training with the Adam optimizer and sparse categorical cross-entropy loss, the model's performance is evaluated using metrics such as accuracy.

    The training history of the model is visualized to assess its learning dynamics over epochs. This provides insights into the model's convergence and potential for overfitting or underfitting. Overall, the proposed system represents an innovative approach to ammonia level prediction, utilizing deep learning capabilities to handle sequential data effectively. Through experimentation and validation, it aims to offer improved accuracy and efficiency compared to traditional methods, paving the way for advanced monitoring solutions in various domains. The following are the principle advantages of proposed work:

    • Reduced Manual Intervention : Reduction of manual handling in the data analysis process. It emphasizes the automation's role in minimizing human intervention, ensuring more consistent results, and reducing the risks of errors associated with manual handling.

    • Cost-effectiveness: Machine learning models offer cost- effective solutions compared to traditional methods, making them accessible to organizations with budget constraints.

    • Improved Turnaround Time: Faster processing capabilities of machine learning models result in reduced turnaround times for obtaining results, facilitating timely interventions and decision- making processes.

    • Adaptability to Varied Environments: Machine learning models can be deployed in diverse settings, enabling effective monitoring across different conditions, including on-site and real-time scenarios.

    • Scalability: The model architecture is scalable and can accommodate larger datasets or more complex input features, making it suitable for a wide range of applications across different domains.

      Figure 1: System Architecture of Detection of Ammonia Levels


    The results obtained from training the proposed ConvLSTM- based model for predicting ammonia levels show promising performance, with the training accuracy gradually increasing over epochs. The visualization of training accuracy illustrates the model's learning dynamics, depicting a typical trend of improvement over time. However, further analysis of additional evaluation metrics such as validation accuracy and loss would provide a more comprehensive understanding of the model's generalization capabilities and potential for real-world application. Additionally, the effectiveness of the model could be validated through comparison with existing methods or through real-world testing scenarios to assess its practical utility and accuracy in predicting ammonia levels. Overall, these results indicate the potential of the proposed system to offer a viable alternative for accurate and efficient monitoring of ammonia concentrations, with implications for various industries and environmental monitoring applications.

    Figure 2: Ammonia Level Prediction Model Training Performance

    Figure 3: Model Performance Line Plot


    In conclusion, the developed Convolutional LSTM (CNN- LSTM) hybrid model offers a promising solution to the challenge of inaccurate Ammonia concentration forecasting

    in aquaculture management. By integrating CNN and LSTM methods, the model enhances prediction accuracy and stability, particularly in handling noise and local characteristic data collected from water quality sensors. The real-time prediction capability of Ammonia content facilitates precise control of recirculating aquaculture systems, thereby mitigating risks such as elevated fish mortality rates due to excessive Ammonia levels. Through experimental validation, the CNN-LSTM hybrid model demonstrates superior performance compared to traditional prediction approaches, affirming its efficacy in practical applications for aquaculture management.


Optimizing hyperparameters for the CNN-LSTM hybrid model in ammonia concentration forecasting can significantly enhance its accuracy and generalization. By systematically exploring configurations like filter numbers, LSTM units, and dropout rates, and leveraging techniques like grid search, the model's performance can be fine-tuned efficiently. Sensitivity analyses and collaborative efforts among experts can further ensure balanced outcomes.


  1. Patel, J., Amipara, C., Ahanger, T. A., Ladhva, K.,

    Gupta, R. K., Alsaab, H. O., … & Ratna, R. (2022). A Machine Learning-Based Water Potability Prediction Model by Using Synthetic Minority Oversampling Technique and Explainable AI. Computational Intelligence & Neuroscience, 2022.

  2. Suwadi, Nur Afyfah, et al. "An Optimized Approach for Predicting Water Quality Features Based on Machine Learning." Wireless Communications & Mobile Computing (2022)

  3. Song, Chenguang, et al. "A novel hybrid model for water quality prediction based on synchrosqueezed wavelet transform technique and improved long short- term memory." Journal of Hydrology 603 (2021): 126879.

  4. Yu, H., Yang, L., Li, D., & Chen, Y. (2021). A hybrid intelligent soft computing method for ammonia nitrogen prediction in aquaculture. Information processing in agriculture, 8(1), 64-74.

  5. Aldhyani, T. H., Al-Yaari, M., Alkahtani, H., & Maashi,

    1. (2020). Water quality prediction using artificial intelligence algorithms. Applied Bionics and Biomechanics, 2020.

  6. Leal-Junior, A. G., Frizera, A., & Marques, C. (2020). Low-cost fiberoptic probe for ammonia early detection in fish farms. Remote Sensing, 12(9), 1439.

  7. Aldhyani, T. H., Al-Yaari, M., Alkahtani, H., & Maashi,

    1. (2020). Water quality prediction using artificial intelligence algorithms. Applied Bionics and Biomechanics, 2020.

  8. J. Liu, C. Yu, Z. Hu et al., Accurate prediction scheme of water quality in smart mariculture with deep Bi-S- SRU learning network, IEEE Access, vol. 8, pp. 24784 24798, 2020.