Mounting Behaviour Recognition for Pigs Based on Deep Learning
Abstract
:1. Introduction
2. Material and Methods
2.1. Experimental Environment and Animal
2.2. Algorithm Overview
3. Algorithm for Mounting Behaviour Detection
3.1. Image Pre-Processing and Labelling
3.2. Pig Segmentation by Mask R-CNN
3.2.1. Related Work
3.2.2. The Architecture of Pig Detector
3.2.3. The Training and Testing Phase of Pig Segmentation Network
- Step 1:
- The training dataset containing 1200 samples was randomly split into 5 subsets. One to four folds were reserved as a train set and the remaining was reserved as the validation set. The train set was put into the applied Mask R-CNN.
- Step 2:
- Load the pre-trained model using the Microsoft Common Objects in Context (MS COCO) dataset.
- Step 3:
- Modify the configuration parameters and the number of categories.
- Step 4:
- Start training and observe the change of the validation dataset loss curve.
- Step 5:
- Reset the parameters such as learning rate, weight decay and the anchor scale of RPN, et al.
- Step 6:
- Evaluate pig segmentation network using the validation dataset.
- Step 7:
- Repeat Step 5~Step 6, until the desired accuracy was achieved.
- Step 8:
- Update train set to 2–5 folds and validation set to the first fold. Repeat Step 2~Step 7 five times until the fivefold cross validation were finished and five models were obtained.
- Step 9:
- Using the test set to test five models respectively, the average accuracy and the average Mean Pixel Accuracy (MPA) values were obtained as evaluation metrics of this network.
3.3. Mounting Behaviour Detection by Kernel-Extreme Learning Machine
3.3.1. Eigenvectors Extraction
- (a)
- HBA: The long side of the bounding-box was found and the area of the mask was divided into two parts with the two long-side midpoint lines as shown in Figure 6a. When the pig’s mask became two parts due to the occurrence of mounting behaviour, the pig’s HBA was defined as .
- (b)
- The distance between centre point of bounding-boxes (Bboxes) A, B, C, and D in Figure 6b are the centre points of the bounding-boxes of four pigs, respectively. The distance between four points was defined as , , …, . The centre point spacing of the bounding-box frame of each pig in each image was extracted as the eigenvectors.
3.3.2. Classification by Kernel-Extreme Learning Machine
3.3.3. The Training and Testing Phase of Extreme Learning Machine
3.4. Performance Evaluation of the Mounting Behaviour Recognition Method
4. Result
4.1. Experiment and Evaluation of Pig Segmentation
4.2. Experiment and Evaluation of Mounting Behaviour Classifier
5. Conclusions
- (a)
- The pig segmentation network based on Mask R-CNN was applied and evaluated. The results showed that taking ResNet50-FPN as the backbone got better accuracy and Mean Pixel Accuracy which were 94.92% and 0.8383. This pig segmentation model can effectively solve the problem of segmentation difficulty caused by partial occlusion and adhesion of the pig body even if the pig bodies’ colour was similar to the background.
- (b)
- We proposed three features extracted in each image for getting the eigenvector—the perimeter of each pig, the half-body area (HBA) of each pig’s mask and the distance between the centre point of every bounding-box in one image.
- (c)
- The complete algorithm was evaluated by external validation and the experiment result showed that this method was efficient and the performance of the algorithm has considerable accuracy (91.47%), sensitivity (95.2%), specificity (88.34%) and Matthews correlation coefficient (0.8324) in mounting behaviour recognition.
Author Contributions
Funding
Conflicts of Interest
References
- Rydhmer, L.; Zamaratskaia, G.; Andersson, H.K.; Algers, B.; Guillemet, R.; Lundström, K. Aggressive and sexual behaviour of growing and finishing pigs reared in groups, without castration. Acta Agric. Scand. Sect. A 2006, 56, 109–119. [Google Scholar] [CrossRef]
- Hemsworth, P.H.; Tilbrook, A.J. Sexual behavior of male pigs. Horm. Behav. 2007, 52, 39–44. [Google Scholar] [CrossRef] [PubMed]
- Rydhmer, L.; Zamaratskaia, G.; Andersson, H.K.; Algers, B.; Lundström, K. Problems with aggressive and sexual behaviour when rearing entire male pigs. In Proceedings of the 55th Annual Meeting of the European Association for Animal Production, Bled, Slovenia, 5–9 September 2004. [Google Scholar]
- Gronskyte, R.; Clemmensen, L.H.; Hviid, M.S.; Kulahci, M. Pig herd monitoring and undesirable tripping and stepping prevention. Comput. Electron. Agric. 2015, 119, 51–60. [Google Scholar] [CrossRef]
- Kashiha, M.A.; Bahr, C.; Ott, S.; Moons, C.P.; Niewold, T.A.; Tuyttens, F.; Berckmans, D. Automatic monitoring of pig locomotion using image analysis. Livest. Sci. 2014, 159, 141–148. [Google Scholar] [CrossRef]
- Zhu, W.; Zhang, J. Identification of Abnormal Gait of Pigs Based on Video Analysis. In Proceedings of the 3rd International Symposium on Knowledge Acquisition and Modeling, Wuhan, China, 20–21 October 2010. [Google Scholar]
- Wu, Y. Detection of Pig Lame Walk Based on Star Skeleton Model. Master’s Thesis, Jiangsu University, Zhenjiang, China, 2014. [Google Scholar]
- Li, Z.Y. Study on Moving Object Detection and Tracking Technology in the Application of Pig Behavior Monitoring. Master’s Thesis, China Agricultural University, Beijing, China, 2013. [Google Scholar]
- Li, Y.Y.; Sun, L.Q.; Sun, X.X. Automatic tracking of pig feeding behavior based on particle filter with multi-feature fusion. Trans. CSAE 2017, 33 (Suppl. 1), 246–252. [Google Scholar]
- Zhu, W.; Wu, Z. Detection of Porcine Respiration Based on Machine Vision. In Proceedings of the 3rd International Symposium on Knowledge Acquisition and Modeling, Wuhan, China, 20–21 October 2010. [Google Scholar]
- Tan, H.L. Recognition Method of Identification and Drinking Behavior for Individual Pigs Based on Machine Vision. Master’s Thesis, Jiangsu University, Zhenjiang, China, 2017. [Google Scholar]
- Pu, X.F.; Zhu, W.X.; Lu, C.F. Sick pig behavior monitor system based on symmetrical pixel block recognition. Comput. Eng. 2009, 35, 250–252. [Google Scholar]
- Nasirahmadi, A.; Hensel, O. A new approach for categorizing pig lying behavior based on a Delaunay triangulation method. Animal 2017, 11, 131–139. [Google Scholar] [CrossRef] [PubMed]
- Lee, J.; Jin, L.; Park, D.; Chung, Y. Automatic Recognition of Aggressive Behavior in Pigs Using a Kinect Depth Sensor. Sensors 2016, 16, 631. [Google Scholar] [CrossRef] [PubMed]
- Mateusz, M.; Eric, T.P. Tracking of group-housed pigs using multi-ellipsoid expectation maximization. IET Comput. Vis. 2018, 12, 121–128. [Google Scholar]
- Zheng, C.; Zhu, X.; Yang, X.; Wang, L.; Tu, S.; Xue, Y. Automatic recognition of lactating sow postures from depth images by deep learning dector. Comput. Electron. Agric. 2018, 147, 51–63. [Google Scholar] [CrossRef]
- Xue, Y.; Zhu, X.; Zheng, C.; Mao, L.; Yang, A.; Tu, S.; Huang, N.; Yang, X.; Chen, P.; Zhang, N. Lactating sow postures recognition from depth image of videos based on improved Faster R-CNN. Trans. Chin. Soc. Agric. Eng. 2018, 34, 189–196. [Google Scholar]
- Aqing, Y.; Huasheng, H.; Xunmu, Z.; Xiaofan, Y.; Pengfei, C.; Shimei, L.; Yueju, X. Automatic recognition of sow nursing behaviour using deep learning-based segmentation and spatial and temporal feature. Biosyst. Eng. 2018, 175, 133–145. [Google Scholar]
- Qiumei, Y.; Deqin, X.; Sicong, L. Feeding behavior recognition for group-housed pigs with the Faster R-CNN. Comput. Electron. Agric. 2018, 155, 453–460. [Google Scholar]
- Qiumei, Y.; Deqin, X. Pig drinking behavior recognition based on machine vision. Trans. Chin. Soc. Agric. Mach. 2018, 49, 232–238. [Google Scholar]
- Sun, L.; Zou, Y.; Li, Y.; Cai, Z.; Li, Y.; Luo, B.; Liu, Y.; Li, Y. Multi target pigs tracking loss correction algorithm based on Faster R-CNN. Int. J. Agric. Biol. Eng. 2018, 11, 192–197. [Google Scholar] [CrossRef]
- Abozar, N.; Oliver, H.; Sandra, A.E.; Barbara, S. Automatic detection of mounting behaviours among pigs using image analysis. Comput. Electron. Agric. 2016, 124, 295–302. [Google Scholar]
- He, K.M.; Gkioxari, G.; Dollar, P.; Girshick, R. Mask R-CNN. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 22–27 October 2017; pp. 2980–2988. [Google Scholar]
- Li, Y.; Qi, H.; Dai, J.; Ji, X.; Wei, Y. Fully convolutional instance-aware semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017. [Google Scholar]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. In Proceedings of the Advances in Neural Information Processing Systems (NIPS), Montreal, QC, Canada, 7–12 December 2015. [Google Scholar]
- Girshick, R.; Donahue, J.; Darrell, T.; Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Columbus, OH, USA, 23–28 June 2014. [Google Scholar]
- Girshick, R. Fast R-CNN. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Boston, MA, USA, 7–12 June 2015. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016. [Google Scholar]
- Huang, G.B.; Zhu, Q.Y.; Siew, C.K. Extreme learning machine: A new learning scheme of feedforward neural networks. Neural Netw. 2004, 2, 985–990. [Google Scholar]
- Huang, G.; Zhu, Q.; Siew, C. Extreme learning machine: Theory and applications. Neurocomputing 2006, 70, 489–501. [Google Scholar] [CrossRef]
- Vinothini, B.; Sathiyamoorthy, S.; Adeel, M.; Gwang, L.; Balachandran, M.; Deok-Chun, Y. mACPred: A Support Vector Machine-Based Meta-Predictor for Identification of Anticancer Peptides. Int. J. Mol. Sci. 2019, 20, 1964. [Google Scholar]
- Balachandran, M.; Shaherin, B.; Tae, H.S.; Leyi, W.; Gwang, L. AtbPpred: A Robust Sequence-Based Prediction of Anti-Tubercular Peptides Using Extremely Randomized Trees. Comput. Struct. Biotechnol. J. 2019, 17, 972–981. [Google Scholar]
- Shaherin, B.; Balachandran, M.; Tae, H.S.; Gwang, L. SDM6A: A Web-Based Integrative Machine-Learning Framework for Predicting 6mA Sites in the Rice Genome. Mol. Ther. Nucleic Acids 2019, 18, 131–141. [Google Scholar]
Methods | ACC | MPA | Time (s/pic) |
---|---|---|---|
ResNet50-FPN | 0.9492 | 0.8383 | 0.0746 |
ResNet101-FPN | 0.9166 | 0.8163 | 0.0866 |
Methods | ACC | MCC | SN | SP |
---|---|---|---|---|
BP neural network | 0.8953 | 0.7917 | 0.9161 | 0.8766 |
Random forest | 0.898 | 0.7962 | 0.8974 | 0.8991 |
Extreme learning machine | 0.9073 | 0.8158 | 0.9298 | 0.8872 |
Kernel-ELM | 0.9147 | 0.8324 | 0.9520 | 0.8834 |
© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Li, D.; Chen, Y.; Zhang, K.; Li, Z. Mounting Behaviour Recognition for Pigs Based on Deep Learning. Sensors 2019, 19, 4924. https://doi.org/10.3390/s19224924
Li D, Chen Y, Zhang K, Li Z. Mounting Behaviour Recognition for Pigs Based on Deep Learning. Sensors. 2019; 19(22):4924. https://doi.org/10.3390/s19224924
Chicago/Turabian StyleLi, Dan, Yifei Chen, Kaifeng Zhang, and Zhenbo Li. 2019. "Mounting Behaviour Recognition for Pigs Based on Deep Learning" Sensors 19, no. 22: 4924. https://doi.org/10.3390/s19224924
APA StyleLi, D., Chen, Y., Zhang, K., & Li, Z. (2019). Mounting Behaviour Recognition for Pigs Based on Deep Learning. Sensors, 19(22), 4924. https://doi.org/10.3390/s19224924