# Field-Applicable Pig Anomaly Detection System Using Vocalization for Embedded Board Implementations
## 3 Results
### Pig Anomaly Classification Results  
The data used for sound-based pig anomaly detection included 100 samples of cough, 110 of grunt, 70 of MH, 150 of PMWS, 140 of PRRS, and 140 of Scream, adding up to 710 samples of data. The dataset was divided in the ratio of 8:2, with 8 (568) as the training set and 2 (142) as the testing set. Furthermore, to confirm whether abnormal situations could be detected robustly in various noisy situations, five steps of white Gaussian noise and four environmental noise sounds were used (\(142\times 9\)) by synthesizing them with the original test data. In the first experiment, MnasNet was trained only with the original data for training that did not contain noise. As mentioned in the Introduction, the CNN-based deep learning structure is known to be robust to noise, but it is still necessary to secure more robust anomaly detection performance. Consequently, in the second experiment, the original data for training and the data obtained by synthesizing SNR 0 with the corresponding data were used in the MnasNet model training. Subsequently, an experiment was conducted to confirm the effectiveness of the filter clustering technique proposed in this study for the corresponding MnasNet structure. Then, another experiment, in which the DM option was applied to MnasNet models before training them, was conducted to be used for performance comparison. For MnasNet, Keras 2.2.4 [44] and TensorFlow 1.12.0 [45] were used, and an Adam Optimizer with decay rates \(\beta\)-1 = 0.9 and \(\beta\)-2 = 0.999, a learning rate of 0.001, and a batch size of 142 were used. The first experiment was trained for 80 epochs, whereas the second one for 100 epochs, and default settings were used as hyper-parameters for the training. After filter clustering was applied to MnasNet, additional training was performed on the pruned MnasNet model for fine-tuning. The evaluation index used in the experimental results is the F1-score, which is calculated as follows [46]:  
\[Precision=\frac{TP}{TP+FP}\times 100 \tag{2}\]  
\[Recall=\frac{TP}{TP+FN}\times 100 \tag{3}\]  
\[F1\;score=\frac{2\;\times\;precision\;\times\;recall}{precision+recall} \tag{4}\]  
where true positive (TP) represents the data accurately classified as true, false positive (FP) represents the inaccurate identification of data as true, and false negative (FN) represents the data inaccurately identified as false. Precision indicates the ratio of how much of the data predicted as a specific class actually belongs to it, and recall indicates the ratio of accurately detecting a specific class. Figure 6: Sound detection result in pigsty using the VAD algorithm. Table 3 presents the experimental results of identifying abnormalities in pigs after training with only clean data (not containing any synthesized noise). The table illustrates the results of three experiments with MnasNet using different DM values and three experiments related to filter clustering. The DM values in the first three experiments represent the rate at which the filters are maintained. DM 1.0 represents the training performed without pruning any filters of MnasNet, which we will refer to as the basic structure of MnasNet for the remainder of the paper, and DM set to 0.75 and 0.5 are the ones where MnasNet filters are removed at rates of 25% and 50%, respectively, before the training. However, the remaining three experiments are the result of applying the filter clustering technique to the trained model of the basic structure of MnasNet. In the order of listing, the first experiment uses the model resulting from applying the initial filter clustering algorithm [29], the second one uses the result of applying the 8-bit filter clustering technique to only the convolutional layer comprising \(3\times 3\) filters of the MnasNet, and the last one uses the model resulting from applying the 8-bit filter clustering technique to all layers of MnasNet to identify abnormalities in pig sounds.