Acessibilidade / Reportar erro

EFFECT OF WAVELET DE-NOISING ON THE CLASSIFICATION OF PIG BEHAVIOUR

ABSTRACT

To efficiently eliminate the noise generated by the triaxial accelerometer when collecting pigs’ behavioural data, this paper adopted SNR and MSE as the indexes to evaluate the de-noising effect of pigs’ acceleration signal under various combinations of wavelet basis, decomposition layer, threshold rule and threshold function. Based on the optimal wavelet parameter combinations, the de-noised data were divided into a training dataset and test dataset to conduct a 3-fold cross validation. The results showed that Db4 wavelet can achieve a satisfactory de-noising effect when used as a wavelet basis for 8 layers wavelet decomposition based on Rigrsure threshold rules and the new improved threshold function. As a result, compared with traditional wavelet hard threshold de-noising, soft threshold de-noising and EMD de-noising method, the improved threshold function improved the stability of signal filtering, which was shown to be more practical, effective and feasible. As such, wavelet de-noising was found to significantly improve the classification accuracy of all four behaviour classes (lying, standing, walking and exploring) considered for this study, and the overall major mean accuracy was improved from 0.680 to 0.826.

KEYWORDS
triaxial accelerometer; artificial neural network; welfare

INTRODUCTION

With the rapid development of large-scale and intensive pig husbandry, higher requirements have been put forward for the standards of automatic pig farming. Behaviour is one of the most used and sensitive indicators which can reflect livestock’s physical, physiological and health status as well as their reactions to the environment. These feedbacks are of great significance to decision-making on livestock farms and the improvement of livestock welfare ( Barwick et al., 2018Barwick J, Lamb DW, Dobos R, Welch M, Trotter M (2018) Categorising sheep activity using a tri-axial accelerometer. Computers and Electronics in Agriculture 145: 289–297. ). However, livestock behaviour monitoring is not easy, especially in large herds, due to time constraints and available labour. Recent advances in sensor technology open up new possibilities for automatic and continuous monitoring of the behaviour of livestock individuals within a group ( Brown et al., 2013Brown, DD, Kays R, Wikelski M, Wilson R, Klimley AP (2013) Observing the unwatchable through acceleration logging of animal behavior. Animal Biotelemetry 1(20): 1–16. ). Triaxial accelerometer is one such sensor which offers a feasible way to monitor livestock behaviour and the collected data can be used to classify livestock activity by specific algorithms ( Alvarenga et al., 2016Alvarenga FAP, Borges I, Palkovič L, Rodina J, Oddy V, Dobos RC (2016) Using a three-axis accelerometer to identify and classify sheep behaviour at pasture. Applied Animal Behaviour Science 181: 91–99. ; Fogarty et al., 2020Fogarty ES, Swain DL, Cronin GM, Moraes LE, Trotter M (2020) Behaviour classification of extensively grazed sheep using machine learning. Computers and Electronics in Agriculture 169: 1–10. ).

Vázquez Diosdado et al. (2015)Vázquez Diosdado JA, Barker ZE, Hodges HR, Amory JR, Croft DP, Bell NJ, Codling EA (2015) Classification of behaviour in housed dairy cows using an accelerometer-based activity monitoring system. Animal Biotelemetry 3(1): 1–14. mounted a triaxial acceleration sensor on the neck of a cow to remotely monitor its walking, standing and lying behaviour, and constructed a real-time behaviour monitoring system. Tamura et al. (2019)Tamura T, Okubo Y, Deguchi Y, Koshikawa S, Takahashi M, Chida Y, Okada K, (2019) Dairy cattle behavior classifications based on decision tree learning using 3-axis neck-mounted accelerometers. Animal Science Journal 90(4): 589–596. classified the lying, standing, ruminating and other behaviour of goats and the behaviour characteristics of cows by combining nine-axis acceleration sensor, neck-mounted triaxial acceleration sensor and machine learning, and discussed the relationship between behaviour and acceleration data. Barwick et al. (2020)Barwick J, Lamb DW, Dobos R, Welch M, Schneider D, Trotter M (2020) Identifying sheep activity from tri-axial acceleration signals using a moving window classification model. Remote Sensing 12: 1–13. fixed triaxial accelerometers to sheep’s leg, neck and ear, respectively, to classify sheep’s grazing, standing, walking and lying behaviour by using various moving window lengths and machine learning algorithms.

However, during the process of collecting pigs’ data, due to the impact of the pigs’ physiological movements, shaking the device or collision, the noise generated will affect the quality of the original acceleration signal, resulting in confused features and reduced analysability. Therefore, the first step of this study is to de-noise the acceleration signal prior to classifying the pig’s behaviour, so as to improve the accuracy of further behaviour classification.

Wavelet as a commonly used filtering method has been applied in many different fields. Such as: animal movement detection ( Gaucherel, 2011Gaucherel C (2011) Wavelet analysis to detect regime shifts in animal movement. Computational Ecology and Software 1(2): 69–85. ), bird song de-noising ( Priyadarshani et al., 2016Priyadarshani N, Marsland S, Castro I, Punchihewa A (2016) Birdsong denoising using wavelets. PLoS One 11(1): 1–26. ), natural geological hazard prevention ( Ren et al., 2015Ren F, Wu X, Zhang K, Niu R (2015) Application of wavelet analysis and a particle swarm-optimized support vector machine to predict the displacement of the Shuping landslide in the Three Gorges, China. Environmental Earth Sciences 73(28): 4791–4804. ), medical diagnosis ( Jain & Tiwari, 2017Jain PK, Tiwari AK (2017) An adaptive thresholding method for the wavelet based denoising of phonocardiogram signal. Biomedical Signal Processing and Control 38: 388–399. ) and so on. As such, wavelet de-noising can be considered as one of the most efficient methods in data processing today.

In general, most noise signals are non-stationary. Wavelet transform due to its multi-resolution analysis and self-similarity characteristics can effectively extract the time-frequency characteristics of a signal through the translational variable window, which is suitable for de-noising non-stationary signals ( Lu et al. , 2016Lu JY, Hong L, Dong Y, Zhang YS (2016) A new wavelet threshold function and denoising application. Mathematical Problems in Engineering 10: 1–8. ).

Furthermore, to classify pigs’ behaviours, an appropriate classification method is also of great importance. Recently proposed methods for classification of animal behaviours are mainly based on different algorithms such as Decision Trees ( Sakai et al., 2019Sakai K, Oishi K, Miwa M, Kumagai H, Hirooka H (2019) Behavior classification of goats using 9-axis multi sensors: The effect of imbalanced datasets on classification performance. Computers and Electronics in Agriculture 166: 105027. ); Support Vector Machine ( Mansbridge et al., 2018Mansbridge N, Mitsch J, Bollard N, Ellis K, Miguel-Pacheco GG, Dottorini T, Kaler J (2018) Feature selection and comparison of machine learning algorithms in classification of grazing and rumination behaviour in sheep. Sensors 18(10): 1–16. ); K Nearest Neighbour ( Benaissa et al., 2019Benaissa S, Tuyttens FAM, Plets D, de Pessemier T, Trogh J, Tanghe E, Martens L, Vandaele L, Van Nuffel A, Joseph W, Sonck B (2019) On the use of on-cow accelerometers for the classification of behaviours in dairy barns. Research in Veterinary Science 125: 425–433. ); Hidden Markov Models (Williams et al., 2017Williams ML, James WP, Rose MT (2017) Fixed-time data segmentation and behavior classification of pasture-based cattle: Enhancing performance using a hidden Markov model. Computers and Electronics in Agriculture 142: 585–596. ); and Artificial Neural Networks (ANN) ( Gutierrez-Galan et al., 2018Gutierrez-Galan D, Dominguez-Morales JP, Cerezuela-Escudero E, Rios-Navarro A, Tapiador-Morales R, Rivas-Perez M, Dominguez-Morales M, Jimenez-Fernandez A, Linares-Barranco A (2018) Embedded neural network for real-time animal behavior classification. Neurocomputing 272: 17–26. ), etc. A fully connected feed-forward ANN has many advantages over traditional statistical methods for complex model fitting, as it is a universal function approximator, and has a strong ability to learn any arbitrary functional relationship between inputs and outputs. For this reason, a fully connected feed-forward ANN was applied in this study.

The aim of this study was to implement a new threshold function based on the drawbacks of the traditional hard and soft threshold function as well as to evaluate the potential for classifying the behaviour of pigs based on triaxial accelerometer data and to assess the value of de-noising the accelerometer data prior to training the ANN.

MATERIAL AND METHODS

Data source

The experiment was carried out on a pig farm in Hohhot, Inner Mongolia, China (40°40 ‘26 “N, 111°21’ 46”E) from 8:00 to 18:00 every day between 10 March and 17 April 2019. Three pigs at different fattening stages (initial weights of 35.8, 62.3 and 92.4 kg, respectively) were monitored. In addition, the pigs’ activity was measured using a triaxial accelerometer with sampling frequency of 20 Hz (SW-J4601V, China), powered with 5V lithium-ion batteries and controlled by CC2530F256 controller and ADXL325 chip. The triaxial accelerometer was placed in a waterproof box and attached to the back of the pigs. This decision was made because initial tests had shown this positioning to have the least impact on the pigs’ natural behaviour and came with the lowest risk of the box falling off, compared to attaching the box to the neck or the leg of the pigs. The installation direction of the triaxial accelerometer is shown in Figure 1 .

FIGURE 1
Direction of the back-mounted triaxial accelerometer. The X-axis pointed from the left to the right side of the pig’s body, the Y-axis pointed from the tail to the head of the pig, and the Z-axis was perpendicular to the XY plane.

The pigs’ behaviour was video-recorded throughout the experiment, and the camera was time-synchronized to the computer used to initialize the accelerometers. Videos were downloaded and hand-labelled by a single observer to record the exact time and duration of each behaviour bout. For this study, we focused on four behaviours of the pigs: lying, standing, walking and exploring. These are considered to be the main daily activities of pigs, and monitoring these behaviours can provide useful information for abnormal behaviour warning and environment control. The definitions and descriptions of these behavioural characteristics of pigs are summarized in Table 1 .

TABLE 1
Definitions and descriptions of different behavioural characteristics of pigs.

Data pre-processing

Data processing was carried out using both R (The R Core Team, 2013) and MATLAB (2017b). Modelling and statistical analysis were conducted in R. Missing values were removed from the time series of accelerometer data. Then, the data were averaged per second and normalized to a range of [-1, 1].

Wavelet threshold de-noising

The principle of wavelet de-noising is to decompose the noisy signal into different frequencies. When the signal is reconstructed, the wavelet coefficients related to the corresponding high-frequency noisy signals are set to zero. Threshold de-noising can be done using the wavelet toolbox and the function Wden in Matlab.

Firstly, the basic idea of wavelet threshold de-noising is to perform wavelet decomposition on the noisy signal to determine the wavelet basis and the decomposition layers. Then, the noisy signal f ( t ) wavelet transform is conducted to obtain wavelet coefficients at various scales. Wavelet coefficients at large scale and low resolution are all preserved, and high-resolution wavelet coefficients at various scales are processed as thresholds. When the wavelet coefficients of noisy signal do not exceed the threshold, they are considered to be zero. However, they are retained for further analysis. Finally, the filtered wavelet coefficients are reconstructed by inverse wavelet transform to recover the useful signal. It can be seen that the signal de-noising effect is closely related to the selection of wavelet bases, decomposition layers, threshold rules and threshold functions. Only when the selection of each parameter is guaranteed to be the best value, can the ideal de-noising effect be obtained. Figure 2 is the flowchart of wavelet threshold de-noising. f ( t ) represents a noisy signal and f ? ( t ) is the signal after de-noising.

FIGURE 2
Flowchart of wavelet threshold de-noising.

Selection of wavelet basis

The basic principle for choosing the wavelet basis is that it can generate as many wavelet coefficients as possible close to zero when de-noising. The commonly used wavelet bases with preferable performance are as follows ( Liu et al., 2018Liu H, Wang W, Xiang C, Han L, Nie H (2018) A de-noising method using the improved wavelet threshold function based on noise variance estimation. Mechanical Systems and Signal Processing. 99: 30–46. ):

Daubechies wavelet

French scholar Ingrid Daubechies constructed a series of binary wavelets and called them Daubechies functions, abbreviated as DbN, where N is the wavelet order. When N=1, it is a Haar wavelet. As a basic wavelet, the Haar wavelet has poor performance and no explicit functional expression.

Coiflets (CoifN) wavelet

The Coiflet wavelet basis was proposed by Daubechies with compactly supported orthogonal and biorthogonal wavelet, including a series of wavelet functions of CoifN (N = 1,2,3,4,5). Coiflets have a better symmetry than DbN.

Symlet (symN) wavelet

Symlet wavelet is a wavelet function that is approximately symmetric with Daubechies wavelet, and is generally expressed as symN (N = 2, 3, …, 8).

Selection of decomposition layer

When the acceleration signal is de-noised by using wavelet transform, the original acceleration signal can be effectively distinguished from the noise signal when the decomposition layer is large. However, with a good de-noising effect, there will be a large error in signal reconstruction. Hence, it is of great significance to select a reasonable decomposition layer ( Madhur et al., 2016Madhur S, Anderson CL, Freed JH (2016) A new wavelet denoising method for selecting decomposition levels and noise thresholds. IEEE Access 4: 3862–3877. ).

Selection of wavelet threshold function

Threshold function is a means to deal with wavelet coefficients by using different methods. Currently, hard threshold function and soft threshold function are the two most popular threshold functions. The role of the hard threshold function is to retain the wavelet coefficients that exceed the threshold and clear the wavelet coefficients that do not exceed the threshold. The hard threshold function was expressed as [ eq. (1) ] and its schematic is shown in Figure 3:

FIGURE 3
The diagram of hard-thresholding function.
(1) Ŵ jk = { W jk | W jk | λ 0 | W jk | < λ

The soft threshold function was defined as [ eq. (2) ] and its schematic is demonstrated in Figure 4:

FIGURE 4
The diagram of soft-thresholding function.
(2) Ŵ jk = { s g n ( W jk ) ( | W jk | λ ) | W jk | λ 0 | W jk | < λ

Where:

sgn() represents a symbolic function;

Wjk is the decomposed wavelet coefficient;

Ŵjk is the estimated wavelet coefficient,

λ is the threshold.

It can be known from eqs (1) and (2) that though the hard threshold function does not change the local characteristics of signal, because it is discontinuous at λ, the noise will be mixed into the wavelet coefficients which were larger than the threshold function, resulting in a large error in the de-noising result. The soft threshold function has good continuity, but some abrupt change points may be swallowed in the signal which causes signal distortion. Moreover, a constant value is used to compress the wavelet coefficients larger than the threshold, which has a great impact on the accuracy of signal reconstruction.

The selection of threshold as a key factor of wavelet threshold de-noising has a great influence on the quality of filtering. If the threshold is over-selected, some useful signal will be filtered out as noise, if the selected threshold is too small, a large number of noise signals will be mixed into the wavelet coefficients, resulting in signal distortion. Threshold is usually selected by [ eq. (3) ]:

(3) λ = σ 2 lnN

Where:

σ represents noise standard variance,

N denotes the length of the signal.

As can be found from [ eq. (3) ], no matter how the wavelet decomposition layer or the wavelet coefficient changes, the calculated value of λ is always a fixed value. In practice, if the same threshold processing is used for different decomposition layers, it will definitely lead to a large deviation in the de-noising result. As a consequence, in this paper the chosen method is the improved threshold as shown in [ eq. (4) ]:

(4) λ j = σ j 2 lnN / ln ( j + 1 )

Where:

j is the scale of decomposition;

σj illustrates the mean square error of the jth layer wavelet coefficients.

According to [ eq. (4) ], with the increase of decomposition scale, the threshold tends to be more pronounced while the wavelet coefficients become less pronounced. Therefore, this threshold can distinguish the useful signal from the noise signal more effectively. Furthermore, in order to overcome the discontinuity of the traditional hard threshold function and the defect of constant deviation caused by the soft threshold function, constant value is used to compress partial wavelet coefficients, as well as to improve the stability and quality of de-noised signal more effectively. In this paper, the idea of exponential function was introduced and an improved threshold function was proposed, it can be formulated as [ eq. (5) ]:

(5) Ŵ j,k = { s g n ( W j , k ) ( | W j , k | | W j , k | e λ | W j , k | ) | W j , k | λ 0 | W j , k | < λ

When |Wj,k|=λ , Ŵj,k=0 indicating that the threshold function is continuous at λ, avoiding the problem of discontinuity in the hard threshold function. When |Wj,k| is infinity, Ŵj,k will be infinitely close to Wj,k, the problem that the soft threshold function compresses part of the wavelet coefficients with a constant value and causes a constant deviation is solved. In addition, there is no uncertainty factor in the improved threshold function, which guarantees the stability of signal de-noising.

EMD threshold de-noising

EMD (Empirical Mode Decomposition) is a time-frequency analysis method for adaptive signal. It can generate different modal functions according to different characteristics of signal without prior selection of basis function. Furthermore, it is good at decomposing complex signal into multiple Eigenmode functions (Intrinsic Mode Function, abbreviated to IMF) and the sum of the residual components from high to low according to frequency. Each IMF as a single component signal has good adaptability and multi-resolution characteristic, which can well reflect the frequency characteristics of local signal at any time ( Wahiba Mohguen & RaïsEl’hadiBekka, 2017Wahiba M, RaïsEl’hadiBekka (2017) New denoising method based on empirical mode decomposition and improved thresholding function. Journal of Physics: Conference Series 787(1): 1–6. ). The noisy signal is usually contained in the high-frequency components. When using EMD to eliminate the noise, the signal of this part should be separated first, then the rest is the useful signal.

Performance evaluation indexes

In order to evaluate the de-noising effect of these wavelet bases more objectively, signal to noise ratio (SNR) and mean square error (MSE) of the de-noised signal were employed as the evaluation indexes ( Guzmán et al., 2017Guzmán IC, Oslinger JL, Darío Nieto R (2017) Wavelet denoising of partial discharge signals and their pattern classification using artificial neural networks and support vector machines. DYNA 84(203): 240–248. ). SNR is the proportion of the signal energy and noise energy in the noise signal, MSE is a mean to measure average errors. Neither of these two evaluation indexes will cause the problem that the de-noising effect cannot be quantified due to the difference in the order of magnitude of the signal composition ( Li et al., 2019Li G, Yang Z, Yang H (2019) A denoising method of ship radiated noise signal based on modified CEEMDAN, dispersion entropy, and interval thresholding. Electronics 8(597): 1–17. ). The higher the SNR and the smaller the MSE are, the better the de-noising effect is. SNR and MSE were defined as eqs (6) and (7) , respectively:

(6) SNR = 10 lg n = 1 N x 2 ( n ) n = 1 N [ x ( n ) x ^ ( n ) ] 2
(7) MSE = 1 N n = 1 N ( x ( n ) x ^ ( n ) ) 2

Where:

x(n) is the original signal;

x^(n) is the signal after de-noising, and

N is the number of sampling points.

Artificial neural network architecture

Fully connected feed-forward ANNs were trained using the back-propagation algorithm, using the function mx.model.FeedForward.create from R package mxnet.

The ANNs trained in this study consisted of an input layer, two hidden layers and an output layer. Two hidden layers were chosen as the structure in this study since this is known to be superior to ANNs with only one hidden layer in terms of the number of parameters needed for the training. Meanwhile, the number of neurons in the input layer was set as 21, including the values of the three axes (X, Y, Z) and the six moving summary statistics calculated for each axis. Considering the number of neurons in the hidden layers is important to the overall neural network architecture; too few neurons will not be sufficient to express the complex nonlinear relationship of the system, while too many neurons will lead to over-fitting and result in the decline of the generalizability of the ANN. This study optimized the number of nodes in the two hidden layers as follows: for the first hidden layer, attempts were made using 2/3, 1 and 4/3 times the number of nodes in the input layer. Similarly, for the second hidden layer, attempts were made using 2/3, 1 and 4/3 times the number of nodes in the first hidden layer ( Larsen et al., 2019Larsen MLV, Pedersen LJ, Jensen DB (2019) Prediction of tail biting events in finisher pigs from automatically recorded sensor data. Animals 9(458): 1–21. ). The best architecture of the ANN was chosen based on the highest accuracy.

Rectified linear units (ReLU) was used as the activation function in the hidden layers, while the softmax function was used as the activation function in the output layer. The output layer had four nodes, corresponding to the four classes of pig behaviour, which were considered in this study. The softmax function adjusts the values of the four outputs, so that they are all between 0 and 1 and always sum to 1. Thus, each of the four output values can be interpreted as the probability of the respective behaviour. The final prediction for a given observation was the behaviour class with the highest probability value.

Model training and evaluation

The ANNs were trained with labelled samples for 120 iterations. In this study, the three pigs’ data were firstly combined together, then the whole dataset was randomly divided into three parts and 3-fold cross validation was used to train and validate the models. Two of the three datasets were combined in turn and used to train a model iteratively, the model was tested on the remaining dataset, respectively.

Accuracy is one of the most commonly used evaluation metrics in classification. The calculation of accuracy uses the four quantities ( TP , TN , FP and FN ), which gives a better summary of the performance of classification algorithms, defined as [ eq. (8) ]:

(8) A C C = T P + T N T N + T P + F N + F P

Where:

TP (True Positives) represents actual positives that are correctly predicted positives;

TN (True Negatives) is actual negatives that are correctly predicted negatives;

FP (False Positives) is actual negatives that are wrongly predicted positives,

FN (False Negatives) is actual positives that are wrongly predicted negatives.

In this study, the main performance metric was the major mean accuracy. For each behaviour class, the per-class accuracy was calculated as the observed instances of that class, which was correctly predicted to be of that class. The major mean accuracy was then calculated as the simple mean of the four per-class accuracies.

RESULTS AND DISCUSSION

In this study, 1,400 continuous sampling points of pigs’ acceleration signal was taken as the original signal, which was sampled at 10 Hz and contained the information of pigs’ lying, standing, walking and exploring. In addition, considering that a pure acceleration signal of pig behaviour is impossible to obtain in this experiment, Gaussian white noise was selected to simulate the noise signal and superimposed with the original signal to form a noisy signal. Figure 5 showed the original acceleration signal and Figure 6 was the noisy acceleration signal.

FIGURE 5
Original acceleration signal.
FIGURE 6
Noisy acceleration signal.

Daubechies wavelet, Coiflets (CoifN) wavelet and Symlet (symN) wavelet were selected to carry out threshold de-noising experiments on noisy acceleration signal, respectively, the results are shown in Table 2 .

TABLE 2
SNR and MSE (×10−2) of acceleration signal de-noised by using different wavelet base.

Meanwhile, in order to find the best wavelet combination, this paper selected the wavelet decomposition layer under different threshold rules based on the Db8 wavelet basis with better de-noising effect obtained above. The noisy acceleration signal was decomposed by wavelet under different wavelet decomposition layers and different threshold rules. The output SNR and MSE after wavelet threshold de-noising are shown in Table 3 .

TABLE 3
Comparison of different thresholding rules under different decomposition layers based on Db4 wavelet basis.

On the basis of these, the wavelet hard threshold function, wavelet soft threshold function, EMD de-noising and the improved threshold function were applied to de-noise the pigs’ behaviour signal respectively. The results are shown in Table 4 and Figures 7 - 10 .

FIGURE 7
Waveform of acceleration signal de-noised using wavelet soft threshold function.
FIGURE 8
Waveform of acceleration signal de-noised using wavelet hard threshold function.
FIGURE 9
Waveform of acceleration signal de-noised using EMD threshold.
FIGURE 10
Waveform of acceleration signal de-noised using wavelet improved threshold function.
TABLE 4
Comparison of four de-noising methods.

Optimal architecture of the ANN

After comparing different combinations of each ANN and their performance, the optimized architecture of the ANN is presented in Table 5 .

TABLE 5
Architecture of the ANN.

Pig behaviour classification

The pigs’ behaviour classification was based on the de-noised data by using the best wavelet parameters. Results of the pigs’ behaviour classification are shown in Table 6 . Normalized confusion matrices are illustrated in Figure 11 .

FIGURE 11
Normalized confusion matrix of pigs’ behaviour classification and corresponding per class accuracy.
TABLE 6
Classification of pigs’ behaviour.

In this study, to improve the quality of accelerator signal and the classification accuracy of pigs’ behaviour, wavelet de-noising was employed to process the pigs’ behavioural signal.

As Table 2 indicated, the SNR and MSE were obtained by selecting different wavelet bases for de-noising. Db4 was selected as the wavelet basis since it obtained a better result than other wavelet bases with SNR of 55.87 and MSE of 1.32×10−2, respectively.

As can be seen from Table 3 , the SNR and MSE output of the de-noised acceleration signal showed a trend of increase and decrease respectively with the increase of wavelet decomposition layers. Whereas, when the wavelet decomposition reached a certain layer, the SNR output gradually decreased. In this study, the optimal combination of threshold rule and decomposition layer was the Rigrsure threshold and the 8th decomposition layer, respectively; SNR was up to 66.42 and the MSE was the lowest of 0.12×10−2.

Moreover, as demonstrated in Table 4 and Figures 7 - 10 , the results obtained under different wavelet threshold functions were different. The hard threshold function retains most of the abrupt points in the original acceleration signal after de-noising, but the de-noising effect was still poor because of the disturbance at λ and the relatively obvious oscillation during signal reconstruction. Although the soft threshold function was continuous at λ, and the signal after de-noising was relatively smooth, there were still parts of the useful acceleration signals that were removed. The EMD threshold de-noising method especially showed a serious problem of over-smoothing. The original data characteristics were retained well by using the improved wavelet threshold and performed better with the highest SNR of 66.42 and lowest MSE of 0.12×10−2. It indicated that the improved algorithm was more advantageous to obtain useful information and eliminate noise in pig acceleration signals.

Furthermore, in this study, classification of pigs’ behaviour was achieved with a fully connected feed-forward ANN trained by BP algorithm. The results of using wavelet to de-noise the original dataset and the results without using any de-noising methods were compared in Table 6 . When the original dataset was de-noised by wavelet, the overall major mean accuracy was improved from 0.680 to 0.826, wavelet de-noising was found to significantly improve the classification accuracy of all four behaviour classes considered for this study.

Specific to the performance of each behaviour, lying was the best identified behaviour with major mean accuracy increased from 0.748 to 0.934. Exploring obtained the second highest major mean accuracy improved from 0.752 to 0.850. Standing followed with an improvement from 0.618 to 0780, walking was poorly classified with a lower major mean accuracy, but an obvious improvement showed as well, from 0.600 to 0.740.

Additionally, as presented in Figure 11 , in the 3-fold cross validation, lying was most misclassified as standing, standing and walking were all mostly confused with exploring, while exploring was misclassified most often as standing and walking. This was possibly related to the behavioural differences between individual pigs, such as: movement amplitude of the pigs, when pig was standing and sniffing or rooting with its head moving slightly, exploring and standing was easily confused. In contrast, when the pig’s head moved strongly for sniffing or rooting, exploring may be misclassified as walking, and vice versa. In future work, the detection of transition states should be included which may help to improve the classification performance. Regarding the frequent misclassification of lying as standing, these two behaviours are both static activities with similar patterns, which is probably responsible for this misclassification. A limitation of this study is that only three pigs’ data were collected and analysed, one of the possible solutions to improve the major mean accuracy in further study would be to increase the number of monitored pigs.

CONCLUSIONS

In conclusion, triaxial accelerometer can be used to classify four behaviour patterns of pigs. Wavelet de-noising was found to significantly improve the classification accuracy of all four behaviour classes considered in this study. The results could provide technical support for the further improvement of pigs’ welfare and decision-making in pig farm management. Additionally, it could provide information for farmers to identify diseases, oestrus in female animals and quick and accurate monitoring of the indoor environment.

ACKNOWLEDGEMENTS

The research is supported by the 12th Five-year National Science and Technology Support Programme of China [2014BAD08B05] and Inner Mongolia Autonomous Region Graduate Student Scientific Research Innovation Projects [B2018111948].

REFERENCES

  • Alvarenga FAP, Borges I, Palkovič L, Rodina J, Oddy V, Dobos RC (2016) Using a three-axis accelerometer to identify and classify sheep behaviour at pasture. Applied Animal Behaviour Science 181: 91–99.
  • Barwick J, Lamb DW, Dobos R, Welch M, Schneider D, Trotter M (2020) Identifying sheep activity from tri-axial acceleration signals using a moving window classification model. Remote Sensing 12: 1–13.
  • Barwick J, Lamb DW, Dobos R, Welch M, Trotter M (2018) Categorising sheep activity using a tri-axial accelerometer. Computers and Electronics in Agriculture 145: 289–297.
  • Benaissa S, Tuyttens FAM, Plets D, de Pessemier T, Trogh J, Tanghe E, Martens L, Vandaele L, Van Nuffel A, Joseph W, Sonck B (2019) On the use of on-cow accelerometers for the classification of behaviours in dairy barns. Research in Veterinary Science 125: 425–433.
  • Brown, DD, Kays R, Wikelski M, Wilson R, Klimley AP (2013) Observing the unwatchable through acceleration logging of animal behavior. Animal Biotelemetry 1(20): 1–16.
  • Fogarty ES, Swain DL, Cronin GM, Moraes LE, Trotter M (2020) Behaviour classification of extensively grazed sheep using machine learning. Computers and Electronics in Agriculture 169: 1–10.
  • Gaucherel C (2011) Wavelet analysis to detect regime shifts in animal movement. Computational Ecology and Software 1(2): 69–85.
  • Gutierrez-Galan D, Dominguez-Morales JP, Cerezuela-Escudero E, Rios-Navarro A, Tapiador-Morales R, Rivas-Perez M, Dominguez-Morales M, Jimenez-Fernandez A, Linares-Barranco A (2018) Embedded neural network for real-time animal behavior classification. Neurocomputing 272: 17–26.
  • Guzmán IC, Oslinger JL, Darío Nieto R (2017) Wavelet denoising of partial discharge signals and their pattern classification using artificial neural networks and support vector machines. DYNA 84(203): 240–248.
  • Jain PK, Tiwari AK (2017) An adaptive thresholding method for the wavelet based denoising of phonocardiogram signal. Biomedical Signal Processing and Control 38: 388–399.
  • Larsen MLV, Pedersen LJ, Jensen DB (2019) Prediction of tail biting events in finisher pigs from automatically recorded sensor data. Animals 9(458): 1–21.
  • Li G, Yang Z, Yang H (2019) A denoising method of ship radiated noise signal based on modified CEEMDAN, dispersion entropy, and interval thresholding. Electronics 8(597): 1–17.
  • Liu H, Wang W, Xiang C, Han L, Nie H (2018) A de-noising method using the improved wavelet threshold function based on noise variance estimation. Mechanical Systems and Signal Processing. 99: 30–46.
  • Lu JY, Hong L, Dong Y, Zhang YS (2016) A new wavelet threshold function and denoising application. Mathematical Problems in Engineering 10: 1–8.
  • Madhur S, Anderson CL, Freed JH (2016) A new wavelet denoising method for selecting decomposition levels and noise thresholds. IEEE Access 4: 3862–3877.
  • Mansbridge N, Mitsch J, Bollard N, Ellis K, Miguel-Pacheco GG, Dottorini T, Kaler J (2018) Feature selection and comparison of machine learning algorithms in classification of grazing and rumination behaviour in sheep. Sensors 18(10): 1–16.
  • Priyadarshani N, Marsland S, Castro I, Punchihewa A (2016) Birdsong denoising using wavelets. PLoS One 11(1): 1–26.
  • Ren F, Wu X, Zhang K, Niu R (2015) Application of wavelet analysis and a particle swarm-optimized support vector machine to predict the displacement of the Shuping landslide in the Three Gorges, China. Environmental Earth Sciences 73(28): 4791–4804.
  • Sakai K, Oishi K, Miwa M, Kumagai H, Hirooka H (2019) Behavior classification of goats using 9-axis multi sensors: The effect of imbalanced datasets on classification performance. Computers and Electronics in Agriculture 166: 105027.
  • Tamura T, Okubo Y, Deguchi Y, Koshikawa S, Takahashi M, Chida Y, Okada K, (2019) Dairy cattle behavior classifications based on decision tree learning using 3-axis neck-mounted accelerometers. Animal Science Journal 90(4): 589–596.
  • Vázquez Diosdado JA, Barker ZE, Hodges HR, Amory JR, Croft DP, Bell NJ, Codling EA (2015) Classification of behaviour in housed dairy cows using an accelerometer-based activity monitoring system. Animal Biotelemetry 3(1): 1–14.
  • Wahiba M, RaïsEl’hadiBekka (2017) New denoising method based on empirical mode decomposition and improved thresholding function. Journal of Physics: Conference Series 787(1): 1–6.
  • Williams ML, James WP, Rose MT (2017) Fixed-time data segmentation and behavior classification of pasture-based cattle: Enhancing performance using a hidden Markov model. Computers and Electronics in Agriculture 142: 585–596.

Edited by

Area Editor: Héliton Pandorfi

Publication Dates

  • Publication in this collection
    25 June 2021
  • Date of issue
    May-Jun 2021

History

  • Received
    14 Dec 2020
  • Accepted
    02 Mar 2021
Associação Brasileira de Engenharia Agrícola SBEA - Associação Brasileira de Engenharia Agrícola, Departamento de Engenharia e Ciências Exatas FCAV/UNESP, Prof. Paulo Donato Castellane, km 5, 14884.900 | Jaboticabal - SP, Tel./Fax: +55 16 3209 7619 - Jaboticabal - SP - Brazil
E-mail: revistasbea@sbea.org.br