A lightweight hybrid model for accurate ammonia prediction in pig houses

In extensive pig farms, keeping good living conditions is crucial for pigs' good health, growth, and productivity, as ammonia (NH₃) negatively impacts health and reproduction. Recently, deep learning techniques have proven potential in predicting ammonia concentration by capturing complex tempo...

Full description

Saved in:
Bibliographic Details
Main Authors: Jacqueline Musabimana, Qiuju Xie, Hong Zhou, Ping Zheng, Honggui Liu, Tiemin Ma, Jiming Liu
Format: Article
Language:English
Published: Elsevier 2025-12-01
Series:Smart Agricultural Technology
Subjects:
Online Access:http://www.sciencedirect.com/science/article/pii/S2772375525004976
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1849392800023445504
author Jacqueline Musabimana
Qiuju Xie
Hong Zhou
Ping Zheng
Honggui Liu
Tiemin Ma
Jiming Liu
author_facet Jacqueline Musabimana
Qiuju Xie
Hong Zhou
Ping Zheng
Honggui Liu
Tiemin Ma
Jiming Liu
author_sort Jacqueline Musabimana
collection DOAJ
description In extensive pig farms, keeping good living conditions is crucial for pigs' good health, growth, and productivity, as ammonia (NH₃) negatively impacts health and reproduction. Recently, deep learning techniques have proven potential in predicting ammonia concentration by capturing complex temporal dependencies. However, the standard transformer deep learning method relies heavily on self-attention, leading to high computational complexity and long training times, limiting its use in dynamic environments and real-time applications with limited resources. To overcome these issues, this study presents a novel, lightweight hybrid transformer model that combines Convolutional Neural Networks, Long Short-Term Memory, and Transformer (CNN-LSTM-Transformer) for NH₃ prediction. The model replaces feedforward networks with separable convolutional layers to capture local and spatial dependencies more efficiently, as well as reduce computational complexity. It also replaces positional encoding with global average pooling, simplifying the architecture and improving temporal feature aggregation. The outcomes indicated that, compared to the standard transformer, the proposed model reduces memory size by 21.1 % (4.9 MB vs. 6.21 MB) and training time by 29.7 % (5 min vs. 7.11 min). It also outperforms the standard transformer in accuracy and efficiency, with Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), and coefficient of determination R² of 0.3994, 0.0225, and 0.9260, respectively, compared to 0.4250, 0.0227, and 0.9162 for the standard model, reducing RMSE by 5.99 %, MAPE by 0.88 %, and increasing R² by 1.08 %. The model improves accuracy compared to other state-of-the-art and ability for NH3 prediction.
format Article
id doaj-art-e5782700d1ec40a19dc62a5e3f850500
institution Kabale University
issn 2772-3755
language English
publishDate 2025-12-01
publisher Elsevier
record_format Article
series Smart Agricultural Technology
spelling doaj-art-e5782700d1ec40a19dc62a5e3f8505002025-08-20T03:40:41ZengElsevierSmart Agricultural Technology2772-37552025-12-011210126610.1016/j.atech.2025.101266A lightweight hybrid model for accurate ammonia prediction in pig housesJacqueline Musabimana0Qiuju Xie1Hong Zhou2Ping Zheng3Honggui Liu4Tiemin Ma5Jiming Liu6College of Electrical and Information, Northeast Agricultural University, Harbin 150030, ChinaCollege of Electrical and Information, Northeast Agricultural University, Harbin 150030, China; The Key Laboratory of Swine Facilities Engineering, Ministry of Agriculture and Rural Affairs, China; Engineering Research Center of Pig Intelligent Breeding and Farming in Northern Cold Region, Ministry of Education, Harbin 150030, China; Correspondence author: College of Electrical and Information, Northeast Agricultural University, Harbin 150030, ChinaCollege of Electrical and Information, Northeast Agricultural University, Harbin 150030, ChinaCollege of Electrical and Information, Northeast Agricultural University, Harbin 150030, ChinaThe Key Laboratory of Swine Facilities Engineering, Ministry of Agriculture and Rural Affairs, China; Engineering Research Center of Pig Intelligent Breeding and Farming in Northern Cold Region, Ministry of Education, Harbin 150030, China; College of Animal Science and Technology, Northeast Agricultural University, Harbin 150030, ChinaCollege of Information and Electrical Engineering, Heilongjiang Bayi Agricultural University, Daqing 163319, ChinaCollege of Information and Electrical Engineering, Heilongjiang Bayi Agricultural University, Daqing 163319, ChinaIn extensive pig farms, keeping good living conditions is crucial for pigs' good health, growth, and productivity, as ammonia (NH₃) negatively impacts health and reproduction. Recently, deep learning techniques have proven potential in predicting ammonia concentration by capturing complex temporal dependencies. However, the standard transformer deep learning method relies heavily on self-attention, leading to high computational complexity and long training times, limiting its use in dynamic environments and real-time applications with limited resources. To overcome these issues, this study presents a novel, lightweight hybrid transformer model that combines Convolutional Neural Networks, Long Short-Term Memory, and Transformer (CNN-LSTM-Transformer) for NH₃ prediction. The model replaces feedforward networks with separable convolutional layers to capture local and spatial dependencies more efficiently, as well as reduce computational complexity. It also replaces positional encoding with global average pooling, simplifying the architecture and improving temporal feature aggregation. The outcomes indicated that, compared to the standard transformer, the proposed model reduces memory size by 21.1 % (4.9 MB vs. 6.21 MB) and training time by 29.7 % (5 min vs. 7.11 min). It also outperforms the standard transformer in accuracy and efficiency, with Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), and coefficient of determination R² of 0.3994, 0.0225, and 0.9260, respectively, compared to 0.4250, 0.0227, and 0.9162 for the standard model, reducing RMSE by 5.99 %, MAPE by 0.88 %, and increasing R² by 1.08 %. The model improves accuracy compared to other state-of-the-art and ability for NH3 prediction.http://www.sciencedirect.com/science/article/pii/S2772375525004976Deep learningTime seriesHybrid modelAir qualityEnvironment control
spellingShingle Jacqueline Musabimana
Qiuju Xie
Hong Zhou
Ping Zheng
Honggui Liu
Tiemin Ma
Jiming Liu
A lightweight hybrid model for accurate ammonia prediction in pig houses
Smart Agricultural Technology
Deep learning
Time series
Hybrid model
Air quality
Environment control
title A lightweight hybrid model for accurate ammonia prediction in pig houses
title_full A lightweight hybrid model for accurate ammonia prediction in pig houses
title_fullStr A lightweight hybrid model for accurate ammonia prediction in pig houses
title_full_unstemmed A lightweight hybrid model for accurate ammonia prediction in pig houses
title_short A lightweight hybrid model for accurate ammonia prediction in pig houses
title_sort lightweight hybrid model for accurate ammonia prediction in pig houses
topic Deep learning
Time series
Hybrid model
Air quality
Environment control
url http://www.sciencedirect.com/science/article/pii/S2772375525004976
work_keys_str_mv AT jacquelinemusabimana alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT qiujuxie alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT hongzhou alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT pingzheng alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT hongguiliu alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT tieminma alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT jimingliu alightweighthybridmodelforaccurateammoniapredictioninpighouses
AT jacquelinemusabimana lightweighthybridmodelforaccurateammoniapredictioninpighouses
AT qiujuxie lightweighthybridmodelforaccurateammoniapredictioninpighouses
AT hongzhou lightweighthybridmodelforaccurateammoniapredictioninpighouses
AT pingzheng lightweighthybridmodelforaccurateammoniapredictioninpighouses
AT hongguiliu lightweighthybridmodelforaccurateammoniapredictioninpighouses
AT tieminma lightweighthybridmodelforaccurateammoniapredictioninpighouses
AT jimingliu lightweighthybridmodelforaccurateammoniapredictioninpighouses