Artificial Intelligence for Automatic Monitoring of Respiratory Health Conditions in Smart Swine Farming

Simple Summary This paper provides a review of recent studies exploring the application of artificial intelligence (AI) in the early detection and monitoring of respiratory disease in swine, emphasizing the significance of early detection for preventing economic losses. The studies primarily focus on utilizing coughing sounds as a feature in disease recognition, comparing different AI models and methodologies. A commercially available AI system that integrates temperature and humidity sensors with audio technologies for respiratory health monitoring through cough-sound identification is also assessed. However, the limitations of the current technology are identified, highlighting the need for further advancements to develop smarter AI solutions for swine respiratory health monitoring. Abstract Porcine respiratory disease complex is an economically important disease in the swine industry. Early detection of the disease is crucial for immediate response to the disease at the farm level to prevent and minimize the potential damage that it may cause. In this paper, recent studies on the application of artificial intelligence (AI) in the early detection and monitoring of respiratory disease in swine have been reviewed. Most of the studies used coughing sounds as a feature of respiratory disease. The performance of different models and the methodologies used for cough recognition using AI were reviewed and compared. An AI technology available in the market was also reviewed. The device uses audio technology that can monitor and evaluate the herd’s respiratory health status through cough-sound recognition and quantification. The device also has temperature and humidity sensors to monitor environmental conditions. It has an alarm system based on variations in coughing patterns and abrupt temperature changes. However, some limitations of the existing technology were identified. Substantial effort must be exerted to surmount the limitations to have a smarter AI technology for monitoring respiratory health status in swine.


Introduction
Porcine respiratory disease complex (PRDC) is one of the most economically important diseases in the swine industry globally [1]. This disease causes economic losses to the industry through increased mortality, increased production costs due to increased medication Global meat production in 2020 reached up to 337 million tons, and pork represented 33% of the total meat production, which makes it the second-largest source of meat among livestock species after poultry meat [10]. According to Komarek et al. [11], the global demand for livestock-derived foods is projected to increase by 38% from 2020 to 2050, driven by population growth and rising incomes in developing countries. It is a challenge for the swine industry to meet the demand for good quality and cheap pork in a situation where global warming is worsening and the prevalence of infectious diseases is increasing.
PRDC is caused by complex factors, including either or a combination of viral (including swine influenza, PRRS, and PCV2) and/or bacterial (including APP, MHP, MHR, PM, and HPS) factors, and is influenced by environmental conditions such as temperature, dust, ammonia, and carbon dioxide [3]. Viral pathogens are the primary causative agent of PRDC that can induce severe lesions and suppress the immune system and attract secondary infection and coinfection with bacteria [12]. The prevalence of PRRS and PCV2 in top pork-producing countries was investigated. In China, the prevalence of PRRS and PCV2 from 2017 to 2021 was 52.04% and 29.75%, respectively [13]; high prevalence was recorded in 56 commercial farms in South Korea with 85.70% and 51.80%, respectively [14]; and the prevalence of PRRS in 3 regions of Ontario, Canada, ranged from 17.0% to 48% [15]. In an investigation conducted in Brazil, only 0.11% (15/12,841) of serum samples from commercial pigs, imported boars, and wild and feral pigs were positive for PRRS. The prevalence of such PRDC-associated pathogens varies from country to country. However, this statistic highlights the importance of surveillance programs to prevent entry and control the spread of the disease.
PRDC is a major concern for the swine industry, resulting in significant economic losses due to decreased pig productivity, increased mortality, increased condemnation at slaughter, and increased medication costs resulting in high production costs [1]. A financial analysis by Calderón Díaz et al. [2] on Irish farrow-to-finish farms showed the negative economic impact of PRDC. The annual net profit was reduced by 14.6%, 12.8%, and 41.0% on farms infected with PRRS, swine influenza, and MHP, respectively. The treatment and control of PRDC are challenging and expensive, making prevention crucial for the swine industry. To minimize the impact of PRDC, swine producers implement strict biosecurity measures to prevent the entry of disease from other farms or within the farm, vaccination, quarantine and acclimatization, proper hygiene practices, and early disease detection [1,16,17]. Effective PRDC control and management are important for the sustainability and profitability of the swine industry.

Artificial Intelligence for Respiratory Disease Detection
Fever, inappetence, lethargy, coughing, sneezing, and dyspnea are common clinical signs of respiratory disease in pigs [18,19]. However, coughing is the most evident symptom and is used for the assessment of the respiratory health condition of the herd [20]. In developing AI for monitoring respiratory health status in pigs, coughing sounds are mostly used as a feature. Eye temperature, ear base temperature, respiration rate, and heart rate can also be used as features using computer vision [1,21]. However, the application of cameras for monitoring respiratory health status is still in the experimental stage. In this paper, the authors mainly reviewed studies that used audio technologies for respiratory disease detection.

Development of AI Technology for Cough Recognition
Pig cough recognition studies using machine learning and deep learning involve four steps: data acquisition, preprocessing, feature extraction, and classification. Other studies involved the fusion step for fusing two or more features after feature extraction [22][23][24][25]. As shown in Table 1, the performance of the AI models for cough recognition in terms of accuracy, recall, precision, and F1 score could reach more than 97%. This suggests that AI technology can be used for the automatic monitoring of respiratory health status with high reliability. Nevertheless, differences in performance were observed, and there is more opportunity for improvement. The AI model's performance regarding cough recognition is affected by the methodologies used, particularly in the sound data preprocessing, feature extraction, and classification steps [22,[25][26][27]. These are discussed in the next subsections.
Types of data acquisition tools (sound sensors) can affect sound quality because of noise and eventually degrade the performance of the model in the recognition of sounds [28]. Therefore, the specification of the sound sensor or microphone must be considered in developing an AI device for cough recognition. The devices used in the studies for sound data collection were unidirectional cardioid microphone [22][23][24]29], omnidirectional electret microphone [27,30], M260C microphone [25], digital camcorder [26], CCTV camera with sound sensors [31,32], recording pen [33], and sound sensors fixed in ear tags [34][35][36][37]. Monitoring the respiratory health of an individual animal is feasible using ear tags with sensors. However, it is not cost effective compared to group monitoring. In addition, battery life and proneness to damage are a great concern [36].
As shown in Table 2, most of the studies that have been conducted have focused on the improvement of the performance of the AI model in cough recognition through the application and development of different architectures in the feature extraction and classification steps. Other studies have proposed the use of body-conducted sound for the early detection of respiratory disease [34,35,37]. Wang et al. [27] investigated the association between animal sounds and house air quality. Coughing sounds vary according to the type of infection. AI can distinguish the differences and detect specific infections, for example, MHP, PRRS, and postweaning multisystemic wasting syndrome (PMWS) in pigs [31,38]. Though most of the studies used cough as a feature to detect respiratory disease, sneezing can also be used in the early detection of influenza infection [30].
Wu et al. [39] proposed using vision and audio in respiratory disease detection using a CCTV camera with sound sensors. Eye temperature, ear base temperature, respiration rate, and heart rate can be used as features in respiratory disease detection using an infrared camera and RGB camera [1,21]. The respiration rate and the heart rate can also be measured using a piezoelectric sensor fixed in the ear tag [34,35,37]. Each sensor has some limitations regarding its application in disease detection. The incorporation of two or more sensors is necessary to compensate for the limitations of the individual. Therefore, the ideal AI technology in disease detection is a hybrid.

Feature Extraction and Fusion Techniques
Datasets contain a large amount of irrelevant information. In the feature extraction step, variables that significantly represent the cough-sound signal are selected and combined into a multidimensional feature vector. This step is the most crucial step for sound recognition [40,41]. In speech and sound recognition, the mel-frequency cepstral coefficient (MFCC) is the most popular feature used. Accordingly, the MFCC maps the linear spectrum of the sound signal onto the nonlinear mel spectrum and analyzes the spectrum according to human hearing [25].
In field conditions, background noises (non-cough sounds) are abundant and inevitable and can degrade the quality of cough sounds and affect model recognition performance. The method to improve model performance is to preprocess the sound data to enhance the quality of the cough sounds using background noise filtering [24,25,27,33,38] and by training the model with background noise data [42]. Feature extraction techniques can also solve this problem. One of the reasons for the popularity of the MFCC is its antinoise capability [25,27,31]. However, this statement contradicts the statement of Ji et al. [22] based on the result of Zhao et al. [43]. Furthermore, the method proposed by Choi et al. [26] using the dominant neighborhood structure (DNS) algorithm as an extraction method has shown superior performance in a noisy environment. It is also much better than the MFCC feature. Furthermore, Wang et al. [27] obtained an average recognition rate of 95% after reducing the dimensionality of the MFCC using principal component analysis (PCA), which is better than Chung et al.'s [31] result using conventional MFCC features.
Much effort has been made in research to improve the precision of pig cough recognition. Most of the studies focused on feature extraction techniques. To overcome the limitation of the individual feature, fusion of two or more features to create a new feature has proven to improve cough-sound recognition. Shen et al. [23] fused the MFCC and convolutional neural network (CNN) features to obtain MFCC-CNN, which has shown significantly better performance compared to using MFCC features. Similarly, performance was also improved when fusing all acoustic features (root-mean-square energy or RMS, zero-crossing rate or ZCR, MFCC, spectral centroid, spectral flatness, spectral bandwidth, spectral roll-off, and contrast and flux) and deep features [24]. Furthermore, the fusion of acoustic features and visual features (local binary pattern or LBP and histogram of gradient or HOG) also has superior performance compared to individual features [22]. In the study of Song et al. [25], the combination of MFCC and ∆MFCC has a better performance compared to the MFCC alone. The ∆MFCC is the first-order difference of the MFCC, which is the relationship between two adjacent frames of pig sound signals.

Classification Techniques
Classifier architectures are classified into traditional machine learning classifiers and deep neural networks (DNN) [44]. A CNN is a popular deep neural network architecture that is inspired by neurons in the human brain. It has been widely applied in different fields like computer vision, face recognition, and sound and speech recognition [45][46][47]. In human health, it can be used in cough recognition [48,49] and in the detection of COVID-19 infection through cough and breathing sounds [50]. Choi et al. [26] compared CNN with traditional machine learning classifiers like support vector machine (SVM), k-nearest neighbors (KNN), and C4.5 in pig sound recognition under various noise conditions. CNN outperformed the other classifier architectures. Unlike the traditional classifiers, CNN can further extract deeper abstract features for classification and can learn in time and frequency simultaneously [51].
Nowadays, there are several CNN architectures that have been presented that differ in strengths and performance [52]. Modification of the architectures has been studied to improve classification performance. To improve the cough recognition performance of a deep learning algorithm, Song et al. [25] came up with an improved DenseNet architecture which they called SE-DenseNet-121. The SE-DenseNet-21 has an improved dense block module and is embedded with a Squeeze-and-Excitation Network (SENet) attention module. The purpose of the SENet is to optimize the extraction of relevant features and ignore irrelevant features. To improve the performance of conventional AlexNet, Yin et al. [29] combined it with softmax architecture and found that it has better performance in cough-sound classification compared to the probabilistic neural network (PNN). The softmax classifier uses logistic regression statistics in classification [53]. It has been widely used in the field of computer vision, especially in deep learning [54]. Similarly, TransformerCNN (a fusion of CNN and an encoder part of Transformer) has better performance in classifying different pig sounds compared to other classifier architectures [55].   To propose a noise-robust system for the classification of sound data. The proposed method can be used to classify sound events in a cost-efficient manner while maintaining high levels of accuracy even in the presence of environmental noise.

NI (commercial farm)
To provide a highly accurate pig cough recognition method for the respiratory disease alarm system using fine-tuned AlexNet model and spectrogram feature.   SVM is the most popular traditional machine learning classifier used for sound applications [44], and it is the common classifier used in the reviewed studies for coughand non-cough-sound classification. It is more robust compared to deep neural network classifiers for a few datasets available for training [24], for example, that in Wang et al. [27] with only 200 sound samples. The principle of SVM is to generate a hyperplane that separates the data into two classes [56]. The functionality of SVM is dependent on its kernel function, which should be for its application [57]. The commonly used kernel functions are linear, Gaussian radial basis function (RBF), and polynomial [58]. Wang et al. [27] used the RBF kernel in pig cough recognition because of its easy design, good generalization, and robust tolerance to noises. More than one kernel can be used in SVM. For example, Shen et al. [24] and Ji et al. [22] used RBF for the non-linear model and linear kernel model in cough recognition.
Other studies used KNN, C4.5, and random forest (RF) in cough recognition. In KNN, the trained data are grouped into subsets, and it classifies the new data on the basis of their values and assigns them to the nearest neighbor [59]. C4.5 is based on a decision-tree classification algorithm [60]. The RF is similar to C4.5. However, the RF generates multiple trees for decision-making [61]. Compared to SVM, these classifiers are inferior in performance in pig cough and non-cough-sound classification [22,23,26]. Shen et al. [23] compared SVM and the softmax in cough recognition. They found that SVM is superior to the softmax. However, this contradicts other studies, especially regarding computer vision [54,62].
Among the studies reviewed, no existing models reached more than 99% performance. That means that there is still room for improvement. The robustness of the model is still the priority concern. However, researchers should also prioritize the speed of recognition without compensating performance.

Performance Evaluation Metrics
Many metrics are proposed for AI model algorithm performance evaluation. However, the most common metrics used for cough recognition in the reviewed studies are based on the confusion matrix. These are accuracy, precision, recall or sensitivity, specificity, and F1 score (Table 3). Accuracy is the proportion of correctly classified coughing-sound samples to the total number of the dataset. Accuracy alone is not a reliable parameter for evaluating the cough recognition model. It is sensitive to imbalanced datasets [63], which is not good if there are more non-cough-sound data than cough-sound data, or vice versa. A model can have high accuracy but a low level of recognition of cough sounds. Precision is the ratio of correctly classified cough-sound samples to the total samples classified as cough sounds. Recall is the ratio of correctly classified cough-sound samples to the total cough-sound dataset. Therefore, the higher the precision and recall, the better the model for recognizing cough-sound data. However, this does not mean that the model has a high recognition rate of non-cough sounds. An ideal AI technology should be able to distinguish cough sounds from non-cough sounds at a high rate. In this case, specificity is the matrix. Specificity is the ratio of correctly classified non-cough-sound samples to the total non-cough-sound dataset. Furthermore, high precision and recall do not coincide in a real scenario. The F1 score measures the balance of precision and recall, and, accordingly, it is a good candidate for a formal classifier quality evaluation metric [64]. In developing an AI model for cough recognition, it is important to consider all the metrics and not use them individually to be able to capture the strengths and weaknesses of the model.

Commercial Application
SoundTalks (SoundTalks NV, Leuven, Belgium) is a pioneering and popular AI product for automatic respiratory disease detection that is available on the market today. Additionally, new similar technologies developed in the United States by MASCO Technologies (City of Industry, CA, USA) and in China by iFLYTEK Co., Ltd. (Hefei, China) and Muyuan Foods Co., Ltd. (Nanyang, China). However, the authors have limited knowledge about these new technologies, and thus, the review focuses solely on SoundTalks. This review was conducted to understand the features and the limitations of the existing technology, providing a foundation for the future development of more precise smart technology.

Features of SoundTalks
SoundTalks is an AI technology available on the market today that can automatically monitor the respiratory health status of herds (in the nursery to finishing stages) through cough-sound recognition and quantification. It has sensors for monitoring environmental conditions such as room temperature and relative humidity. It also has an alert system that signals the farmers about potential respiratory problems and abrupt temperature changes. This device has two main pieces of hardware: the monitor and the gateway (Figure 1). The sound sensor (microphone) and the environmental sensors are fixed to the monitor. The device also has LED lights for alert indication. It can gather sound data within a 10 m radius. All the data from the monitor are transferred to the gateway wirelessly. A plurality of monitors can be connected to the gateway not more than 30 m from the location of the gateway. The gateway is connected to a network via LAN. The function of the gateway is to connect and gather data from the monitor and send data to the AI cloud for data processing and analysis. Users can access their data online from every monitor through a PC or smartphone via a mobile app. A strong and undisrupted internet connection is essential for this technology to work optimally. The respiratory health status of the herd is presented as respiratory distress index (RDI). The RDI is the average number of coughs per head within 24 h [65]. Nowadays, the respiratory health status of the herd is presented as ReHS (respiratory health status), with values ranging from 0 to 100. An alert system is an important feature of health monitoring technology for notifying farmers of abnormalities within the farm. This device has a patented algorithm that uses the history of and variation in the respiratory health status of the herd for the calculation of the threshold as the basis of the alarm [65]. A green light represents a normal ReHS, which ranges from 60 to 100. Yellow and red alerts mean there is a potential and a high risk of a respiratory problem, respectively. These are equivalent to 40-59 and 0-39 ReHS, respectively. For thermal shock alerts, a yellow warning is issued when there is a ≥5 • C difference in temperature within a 6 h interval. Furthermore, a red alert is issued when there is a ≥8 • C difference. The alerts can be perceived through LED lights on the monitor and through their website.

Research Using SoundTalks
Several studies have been conducted using SoundTalks for automatic quantification of the respiratory health status of pigs because of its advantages and reliability. It has shown that the coughing frequencies recorded using manual and automatic quantifications of coughing have a similar trend [65,66]. However, manual quantification is time-consuming and not efficient in a field situation. Moreover, farmers are not present 24 h inside the house. Therefore, coughs are often not detected, particularly at night [67].
A study by Clavijo et al. [5] showed that this device can detect respiratory disease in MHP-infected pigs. The RDI value increased as more pigs tested positive for MHP. The first alert was observed 55 days post-infection (DPI), 27 days late from the first day of MHP detection in uninoculated pigs. Similarly, Poeta Silva et al. [66] found an increase in RDI value in MHP-infected pigs as the infection progressed. However, an alarm from the device was not observed during the study despite mortality being observed at 10 DPI, and the RDI value was lower compared to Clavijo et al. [5]. The population is the main factor in these differences because this device was designed to recognize cough sounds in large pig populations [65], suggesting that the alarm system in future AI technology should work in multiple populations and should be refined on the basis of the severity of infection for earlier detection.
Data generated from SoundTalks can be used to improve the management of the housing environment and respiratory disease in finishing pigs. Pessoa et al. [68] conducted a study that correlates coughing frequency and environmental conditions of healthy pigs. They found that coughing frequencies are affected by a high ammonia concentration and high ventilation rates. However, the coughing incidence and ammonia concentration during the study were low. Another study by Pessoa et al. [65] has found an association between lung lesions at slaughter and values of RDI toward the end of growing. Coughing episodes in the early stage of the growing period are not associated with the prevalence of lung lesions at slaughter. This could mean that intervention and treatment should be conducted once a coughing episode is observed in the late finishing stage to reduce condemnation at slaughter.
SoundTalks is not yet able to distinguish whether coughing is caused by pathogens or by environmental conditions. However, by thoroughly analyzing the patterns of RDI, PRDC-associated pathogens can potentially be distinguished. For example, as shown in Figure 2, the RDI patterns in influenza A virus-infected pigs had a distinct double-peaked shape, whereas the pattern associated with MHP showed a gradual increasing pattern [69]. Further study is recommended to compare the RDI/ReHS patterns of pigs infected with other PRDC-associated pathogens and environmental conditions. With this information, farmers will be given a tool for more timely, precise diagnosis and control of the disease.

Existing Technology: Limitations and Opportunities for Improvement
In a decade, several studies have been conducted on AI's application in livestock production. One application of AI is cough detection for monitoring the respiratory health status of swine. AI for cough detection has been implemented in commercial applications, and it has been found to have a great advantage in enhancing farming productivity and efficiency through improvements in decision-making for herd health management. However, the authors found some limitations of the existing technology that should be considered for the improvement and development of smarter technology.

Farm-Dependent Coughing Threshold
Early detection of a respiratory problem is crucial for controlling the disease to prevent further economic losses. Thus, an alarm system is a very important feature of technology for accurately and promptly alerting the user of an early respiratory problem. The existing technology has a patented algorithm that calculates the threshold as the basis of the alarm. This threshold is based on the history of and the variation in the respiratory health status of a specific room where a monitor is installed. This system has a possible drawback. For example, two farms with different coughing histories may have different thresholds, and once the farms are infected at the same rate, one room might not alarm (possibly the room with more coughing at the start). Thus, further research is recommended to generate a threshold value that is associated with the severity of infection. As stated, historical data were used for threshold calculation as the basis for the alarm. In the authors' opinion, the algorithm was designed to detect acute respiratory disease. Is this algorithm able to detect chronic respiratory disease? This is something that needs to be explored.

Population-Dependent Coughing Threshold
The existing technology is built to monitor the respiratory health status of a large population. Several studies found lower RDI values and no alert even in infected, small populations compared to large populations. The threshold for alarm should be associated with infection. Further research is recommended to generate a threshold value that is corrected by population.

Monitoring of Herd Respiratory Health Status
Studies using audio technology have shown great performance in detecting respiratory problems caused by pathogens or environmental conditions. However, the current technology can only evaluate the general health status of the herd in a specific room. Automatic recognition of individual pigs is essential for monitoring an individual's health condition. Currently, the application and development of computer vision technology for individual pig recognition are still in the experimental stage, the cost of hardware being a notable limiting factor in its large-scale application. However, the integration of visual technology with audio technology can be a better technology for monitoring the health of the herd and the individual pig. In this system, the specific sick pig can be immediately recognized, and the health management will be more precise.

Conclusions
PRDC is a major concern for the swine industry that results in significant economic losses. Thus, early detection of and response to the disease at the farm level is essential for preventing and minimizing the potential damage that it may cause. Studies about the application of AI in respiratory health disease detection have shown its great advantage in swine farming. Respiratory diseases can be detected using AI for automatic cough-sound recognition and quantification with high sensitivity and precision. However, different AI models have demonstrated differences in performance. These differences might be due to methodologies and architectures used in data preprocessing, feature extraction, and classification. Additionally, the size and diversity of the dataset used for training are crucial for this part.
The AI technology available is commercially used audio technology that can monitor and evaluate the herd's respiratory health status with temperature and humidity sensors to monitor environmental conditions. Moreover, some limitations of the existing technology were identified. The limitations are mainly regarding the sensitivity of the alarm system to coughing episode variations. The alarm system is farm-dependent and populationdependent. Lastly, it cannot detect a respiratory problem in an individual pig. Substantial effort must be exerted to surmount the limitations to have a smarter AI technology for monitoring respiratory health status in swine.