Developing Edge AI Computer Vision for Smart Poultry Farms Using Deep Learning and HPC
Abstract
:1. Introduction
2. Related Work
3. Materials and Methods
3.1. Datasets
3.2. Tools Selection and Setup
3.3. Experiment Execution
4. Results and Discussion
4.1. Detection of Objects
Algorithm 1 Object detection: implementation steps needed to select the network architecture and create the prediction model |
while do |
while |
do |
while do |
if < then |
end if |
end while |
end while |
end while |
while do |
while do |
while do |
if < then |
end if |
end while |
end while |
end while |
4.2. Instance Segmentation Results
Algorithm 2 Instance segmentation: implementation steps needed to select the network architecture and create the prediction model |
while do |
while |
do |
while do |
if < then |
end if |
end while |
end while |
end while |
while do |
while do |
while do |
if < then |
end if |
end while |
end while |
end while |
4.3. Initial Field Evaluation and Validation
5. Conclusions
- Conceptual approach and methodology how to combine offline computing using HPC and AI to develop and refine prediction models, and online processing of the data using these models ported onto the edge AI devices. This includes the preparation of the data set and selection of software tools that enabled creation of the models that have necessary accuracy with a possibility to be ported and used on the edge AI IoT nodes, and integrated with an existing IoT based digital platform for poultry farms. The experimenting is performed using Python and Detectron 2 library.
- For object detection, the Faster R-CNN deep convolutional network was used. HPC was used to compute and test six different architectures offered by Detectron2. After testing with different parameters, the faster_rccn_R_101_FPN_3x network architecture was selected as one offering a good balance between accuracy and prediction time. Further experimenting with the hyperparameter optimization resulted in a prediction model with AP = 84.62%, AP50 = 97.88%, and AP75 = 95.68%.
- The mask R-CNN network was selected for the instance segmentation problem. HPC was used to test seven different architectures and mask_rcnn_R_101_FPN_3x was selected based on the accuracy and prediction time. With further refining of the hyperparameters, we obtained a model with AP = 89.73%, AP50 = 98.35%, and AP75 = 96.23%.
- For the initial field evaluation, these prediction models were ported onto NVIDIA Jetson Nano devices equipped with cameras. These sensor prototypes were integrated with an actual IoT based platform installed in a real-life farm. The setup is configured so that it can be also used to collect new images to enhance the dataset for future research.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
AI | Artificial Intelligence |
AP | Average Precision |
AutoML | Automated Machine Learning |
CNN | Convolutional Neural Network |
CVAT | Computer Vision Annotation Tool |
COCO | Common Object in Context |
CPU | Central Processing Unit |
HPC | High-Performance Computing |
HPO | Hyperparameter Optimization |
GPU | Graphics Processing Unit |
IoT | Internet of Things |
JSON | JavaScript Object Notation |
ML | Machine Learning |
RAM | Random Access Memory |
SSD | Single Shoot Detector |
USB | Universal Serial Bus |
YOLO | You Only Look Once |
References
- FAO. The Future of Food and Agriculture: Alternative Pathways to 2050; Food and Agriculture Organization of the United Nations: Rome, Italy, 2018; p. 228. [Google Scholar]
- USDA. Livestock and Poultry: World Markets and Trade; United States Department of Agriculture, Foreign Agriculture Service: Washington, DC, USA, 2022. Available online: https://www.fas.usda.gov/data/livestock-and-poultry-world-markets-and-trade (accessed on 20 January 2023).
- ETP4HPC. Strategic Research Agenda for High-Performance Computing in Europe: European HPC Research Priorities 2022–2027; European Technology Platform for High Performance Computing, NS Oegstgeest: Leiden, The Netherlands, 2022. [Google Scholar]
- Cakic, S.; Popovic, T.; Krco, S.; Nedic, D. Babic, Developing Object Detection Models for Camera Applications in Smart Poultry Farms. In Proceedings of the 2022 IEEE International Conference on Omni-layer Intelligent Systems (COINS), Barcelona, Spain, 1–3 August 2022; pp. 1–5. [Google Scholar] [CrossRef]
- FF4EuroHPC. HPC Innovation for European SMEs. Available online: https://cordis.europa.eu/project/id/951745 (accessed on 20 January 2023).
- Raghu, M.; Unterthiner, T.; Kornblith, S.; Zhang, C.; Dosovitskiy, A. Do Vision Transformers See Like Convolutional Neural Networks? Adv. Neural Inf. Process. Syst. 2021, 34, 12116–12128. [Google Scholar]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You Only Look Once: Unified, Real-Time Object Detection. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar] [CrossRef] [Green Version]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. In Proceedings of the 28th International Conference on Neural Information Processing Systems, Montreal, QC, Canada, 7–12 December 2015; Volume 1, pp. 91–99. [Google Scholar] [CrossRef]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.E.; Fu, C.-Y.; Berg, A.C. SSD: Single Shot MultiBox Detector. ECCV 2016, 9905, 21–37. [Google Scholar] [CrossRef] [Green Version]
- Kim, J.; Sung, J.; Park, S. Comparison of Faster-RCNN, YOLO, and SSD for Real-Time Vehicle Type Recognition. In Proceedings of the 2020 IEEE International Conference on Consumer Electronics-Asia (ICCE-Asia), Seoul, Republic of Korea, 1–3 November 2020; pp. 1–4. [Google Scholar] [CrossRef]
- He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask R-CNN. In Proceedings of the 2017 IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 22–29 October 2017; pp. 2980–2988. [Google Scholar] [CrossRef]
- Hafiz, A.M.; Bhat, G.M. A survey on instance segmentation: State of the art. Int. J. Multimed. Inf. Retr. 2020, 9, 171–189. [Google Scholar] [CrossRef]
- Cao, L.; Xiao, Z.; Liao, X.; Yao, Y.; Wu, K.; Mu, J.; Li, J.; Pu, H. Automated Chicken Counting in Surveillance Camera Environments Based on the Point Supervision Algorithm: LC-DenseFCN. Agriculture 2021, 11, 493. [Google Scholar] [CrossRef]
- Laradji, I.H.; Rostamzadeh, N.; Pinheiro, P.O.; Vazquez, D.; Schmidt, M. Where Are the Blobs: Counting by Localization with Point Supervision. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; Springer: Cham, Switzerland, 2018; Volume 11206. [Google Scholar] [CrossRef] [Green Version]
- Tan, M.; Pang, R.; Le, Q.V. EfficientDet: Scalable and Efficient Object Detection. In Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020; pp. 10778–10787. [Google Scholar] [CrossRef]
- Yang, X.; Chai, L.; Bist, R.B.; Subedi, S.; Wu, Z. A Deep Learning Model for Detecting Cage-Free Hens on the Litter Floor. Animals 2022, 12, 1983. [Google Scholar] [CrossRef] [PubMed]
- Nguyen, N.; Do, T.; Ngo, T.; Le, D. An Evaluation of Deep Learning Methods for Small Object Detection. Electr. Comput. Eng. 2020, 2020, 3189691. [Google Scholar] [CrossRef]
- Cowton, J.; Kyriazakis, I.; Bacardit, J. Automated Individual Pig Localisation, Tracking and Behaviour Metric Extraction Using Deep Learning. IEEE Access 2019, 7, 108049–108060. [Google Scholar] [CrossRef]
- Lin, C.-Y.; Hsieh, K.-W.; Tsai, Y.-C.; Kuo, Y.-F. Automatic Monitoring of Chicken Movement and Drinking Time Using Convolutional Neural Networks. Trans. ASABE 2020, 63, 2029–2038. [Google Scholar] [CrossRef]
- Neethirajan, S. ChickTrack—A quantitative tracking tool for measuring chicken activity. Measurement 2022, 191, 110819. [Google Scholar] [CrossRef]
- Tian, M.; Guo, H.; Chen, H.; Wang, Q.; Long, Q.; Ma, Y. Automated pig counting using deep learning. Comput. Electron. Agric. 2019, 163, 104840. [Google Scholar] [CrossRef]
- Oñoro-Rubio, D.; López-Sastre, R.J. Towards Perspective-Free Object Counting with Deep Learning. In Proceedings of the Computer Vision—ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, 11–14 October 2016. [Google Scholar] [CrossRef]
- Xu, B.; Wang, W.; Falzon, G.; Kwan, P.; Guo, L.; Chen, G.; Tait, A.; Schneider, D. Automated cattle counting using mask R-CNN in Quadcopter Vision System. Comput. Electron. Agric. 2020, 171, 105300. [Google Scholar] [CrossRef]
- Liu, H.-W.; Chen, C.-H.; Tsai, Y.-C.; Hsieh, K.-W.; Lin, H.-T. Identifying Images of Dead Chickens with a Chicken Removal System Integrated with a Deep Learning Algorithm. Sensors 2021, 21, 3579. [Google Scholar] [CrossRef] [PubMed]
- Yao, Y.; Yu, H.; Mu, J.; Li, J.; Pu, H. Estimation of the Gender Ratio of Chickens Based on Computer Vision: Dataset and Exploration. Entropy 2020, 22, 719. [Google Scholar] [CrossRef] [PubMed]
- Li, J.; Su, H.; Zheng, X.; Liu, Y.; Zhou, R.; Xu, L.; Liu, Q.; Liu, D.; Wang, Z.; Duan, X. Study of a QueryPNet Model for Accurate Detection and Segmentation of Goose Body Edge Contours. Animals 2022, 12, 2653. [Google Scholar] [CrossRef] [PubMed]
- Ren, Z.; Liu, Y.; Shi, T.; Xie, L.; Zhou, Y.; Zhai, J.; Zhang, Y.; Zhang, Y.; Wenguang, C. AIPerf: Automated Machine Learning as an AI-HPC Benchmark. Big Data Min. Anal. 2021, 4, 208–220. [Google Scholar] [CrossRef]
- Lin, T.-Y.; Maire, M.; Belongie, S.; Bourdev, L.; Girshick, R.; Hays, J.; Perona, P.; Ramanan, D.; Zitnick, C.L.; Dollár, P. Microsoft COCO: Common Objects in Context. In Proceedings of the in Computer Vision—ECCV 2014: 13th European Conference, Zurich, Switzerland, 6–12 September 2014. [Google Scholar] [CrossRef] [Green Version]
- Detectron2 vs. Yolov5. Which One Suits Your Use Case Better? Available online: https://medium.com/ireadrx/detectron2-vs-yolov5-which-one-suits-your-use-case-better-d959a3d4bdf (accessed on 20 January 2023).
- Object Detection: Speed and Accuracy Comparison (Faster R-CNN, R-FCN, SSD, FPN, RetinaNet and YOLOv3). Available online: https://jonathan-hui.medium.com/object-detection-speed-and-accuracy-comparison-faster-r-cnn-r-fcn-ssd-and-yolo-5425656ae359 (accessed on 20 January 2023).
- Detectron2 Package. Available online: https://github.com/facebookresearch/detectron2 (accessed on 20 January 2023).
- Buber, E.; Diri, B. Performance Analysis and CPU vs. GPU Comparison for Deep Learning. In Proceedings of the 2018 6th International Conference on Control Engineering & Information Technology (CEIT), Istanbul, Turkey, 25–27 October 2018; pp. 1–6. [Google Scholar] [CrossRef]
- Yoo, A.; Jette, M.; Grondona, M. SLURM: Simple Linux Utility for Resource Management. In Proceedings of the 9th International Workshop, JSSPP 2003, Seattle, WA, USA, 24 June 2003; Springer: Berlin/Heidelberg, Germany, 2003; Volume 2862. [Google Scholar] [CrossRef] [Green Version]
- Yotta Advanced Computing Provider. Available online: https://www.yac.hr/ (accessed on 20 January 2023).
- Coco Dataset Metrics. Available online: https://cocodataset.org/#detection-eval (accessed on 20 January 2023).
- Rezatofighi, H.; Tsoi, N.; Gwak, J.; Sadeghian, A.; Reid, I.; Savarese, S. Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression. arXiv 2019, arXiv:2019.00075. [Google Scholar]
- Why Parallelized Training Might Not Be Working for You. Available online: https://towardsdatascience.com/why-parallelized-training-might-not-be-working-for-you-4c01f606ef2c (accessed on 20 January 2023).
- agroNET—Digital Farming Management. Available online: https://digitalfarming.eu/ (accessed on 20 January 2023).
Number of GPUs | Neural Network Arhitecture | Training Time [min] | Batch Size | Validation Loss | AP | AP50 | AP75 | Prediction Time [s] |
---|---|---|---|---|---|---|---|---|
1 | faster_r_cnn_R_101_C4_3x | 50:50 | 128 | 0.27 | 83.92 | 97.79 | 94.31 | 0.6 |
faster_r_cnn_R_101_FPN_3x | 22:44 | 256 | 0.31 | 82.96 | 97.8 | 94.3 | 0.2 | |
faster_r_cnn_R_50_C4_1x | 44:44 | 64 | 0.34 | 81.74 | 97.68 | 93.1 | 0.6 | |
faster_r_cnn_R_50_C4_3x | 44:41 | 32 | 0.31 | 82.78 | 97.76 | 94.32 | 0.6 | |
faster_r_cnn_R_50_FPN_1x | 16:43 | 8 | 0.36 | 80.75 | 97.7 | 93.2 | 0.2 | |
faster_r_cnn_X_101_32x8d_FPN_3x | 42:05 | 8 | 0.31 | 83.39 | 97.81 | 94.42 | 0.4 | |
2 | faster_r_cnn_R_101_C4_3x | 34:16 | 2 | 0.27 | 84.1 | 97.81 | 94.43 | 0.6 |
faster_r_cnn_R_101_FPN_3x | 15:58 | 4 | 0.3 | 82.9 | 97.82 | 94.4 | 0.2 | |
faster_r_cnn_R_50_C4_1x | 30:03 | 4 | 0.34 | 82.22 | 97.73 | 93.9 | 0.6 | |
faster_r_cnn_R_50_C4_3x | 30:0 | 256 | 0.31 | 82.73 | 97.78 | 94.2 | 0.6 | |
faster_r_cnn_R_50_FPN_1x | 12:10 | 4 | 0.35 | 81.18 | 97.74 | 93.22 | 0.2 | |
faster_r_cnn_X_101_32x8d_FPN_3x | 31:00 | 16 | 0.3 | 83.34 | 97.86 | 94.51 | 0.4 | |
4 | faster_r_cnn_R_101_C4_3x | 32:19 | 256 | 0.26 | 84.1 | 97.8 | 94.3 | 0.6 |
faster_r_cnn_R_101_FPN_3x | 17:56 | 4 | 0.29 | 83.14 | 97.81 | 94.44 | 0.2 | |
faster_r_cnn_R_50_C4_1x | 28:36 | 256 | 0.33 | 82.43 | 97.72 | 93.13 | 0.6 | |
faster_r_cnn_R_50_C4_3x | 28:30 | 256 | 0.3 | 82.58 | 97.8 | 94.3 | 0.6 | |
faster_r_cnn_R_50_FPN_1x | 14:25 | 128 | 0.33 | 81.34 | 97.74 | 93.22 | 0.2 | |
faster_r_cnn_X_101_32x8d_FPN_3x | 31:17 | 64 | 0.31 | 83.47 | 97.82 | 94.56 | 0.4 | |
8 | faster_r_cnn_R_101_C4_3x | 36:10 | 256 | 0.25 | 83.8 | 97.81 | 94.3 | 0.6 |
faster_r_cnn_R_101_FPN_3x | 13:57 | 16 | 0.28 | 83.24 | 97.81 | 94.43 | 0.2 | |
faster_r_cnn_R_50_C4_1x | 32:28 | 256 | 0.32 | 82.43 | 97.72 | 93.21 | 0.6 | |
faster_r_cnn_R_50_C4_3x | 32:31 | 256 | 0.29 | 82.83 | 97.8 | 94.3 | 0.6 | |
faster_r_cnn_R_50_FPN_1x | 20:57 | 8 | 0.32 | 81.61 | 97.76 | 94.15 | 0.2 | |
faster_r_cnn_X_101_32x8d_FPN_3x | 37:36 | 32 | 0.32 | 83.59 | 97.85 | 94.56 | 0.4 |
Number of GPUs | Training Time [min] | Gamma | Batch Size | Validation Loss | AP | AP50 | AP75 |
---|---|---|---|---|---|---|---|
1 | 22:20 | 0.8 | 1 | 0.31 | 83.7 | 97.86 | 94.62 |
2 | 15:45 | 0.8 | 128 | 0.3 | 84.11 | 97.85 | 95.43 |
4 | 17:53 | 1 | 256 | 0.27 | 84.56 | 97.88 | 95.59 |
8 | 24:25 | 1 | 8 | 0.26 | 84.62 | 97.88 | 95.68 |
Number of GPUs | Neural Network Arhitecture | Training Time [min] | Batch Size | Validation Loss | AP | AP50 | AP75 | Prediction Time [s] |
---|---|---|---|---|---|---|---|---|
1 | mask_rcnn_R_50_FPN_3x | 11:50 | 8 | 0.48 | 87.5 | 97.45 | 95.19 | 0.2 |
mask_rcnn_R_101_C4_3x | 31:39 | 32 | 0.37 | 85.7 | 98.29 | 95.93 | 0.7 | |
mask_rcnn_R_101_FPN_3x | 15:24 | 8 | 0.43 | 88.3 | 98.3 | 96.15 | 0.3 | |
mask_rcnn_R_50_C4_1x | 28:10 | 128 | 0.46 | 84.4 | 97.21 | 94.96 | 0.6 | |
mask_rcnn_R_50_C4_3x | 28:11 | 0.8 | 0.41 | 84.8 | 97.26 | 95.13 | 0.6 | |
mask_rcnn_R_50_FPN_1x | 11:58 | 8 | 0.51 | 86.7 | 97.33 | 95.01 | 0.2 | |
mask_rcnn_X_101_32x8d_FPN_3x | 28:47 | 64 | 0.42 | 88.5 | 98.28 | 96.50 | 0.6 | |
2 | mask_rcnn_R_50_FPN_3x | 12:21 | 2 | 0.47 | 87.4 | 97.44 | 95.99 | 0.2 |
mask_rcnn_R_101_C4_3x | 28:47 | 128 | 0.37 | 85.69 | 98.31 | 96.07 | 0.7 | |
mask_rcnn_R_101_FPN_3x | 15:35 | 8 | 0.43 | 88.57 | 98.34 | 96.19 | 0.3 | |
mask_rcnn_R_50_C4_1x | 25:31 | 256 | 0.46 | 84.48 | 97.21 | 94.96 | 0.6 | |
mask_rcnn_R_50_C4_3x | 25:27 | 128 | 0.43 | 85.00 | 97.28 | 95.12 | 0.6 | |
mask_rcnn_R_50_FPN_1x | 12:23 | 8 | 0.5 | 86.94 | 97.32 | 95.05 | 0.2 | |
mask_rcnn_X_101_32x8d_FPN_3x | 27:55 | 2 | 0.42 | 88.33 | 97.43 | 96.1 | 0.7 | |
4 | mask_rcnn_R_50_FPN_3x | 15:51 | 8 | 0.41 | 87.6 | 98.23 | 96.02 | 0.2 |
mask_rcnn_R_101_C4_3x | 31:43 | 16 | 0.34 | 85.8 | 98.26 | 96.08 | 0.7 | |
mask_rcnn_R_101_FPN_3x | 19.06 | 64 | 0.38 | 88.67 | 98.36 | 96.19 | 0.3 | |
mask_rcnn_R_50_C4_1x | 28:07 | 32 | 0.4 | 84.51 | 97.22 | 94.97 | 0.6 | |
mask_rcnn_R_50_C4_3x | 28:11 | 4 | 0.38 | 84.8 | 97.31 | 95.07 | 0.6 | |
mask_rcnn_R_50_FPN_1x | 15:51 | 32 | 0.44 | 86.7 | 97.35 | 95.01 | 0.2 | |
mask_rcnn_X_101_32x8d_FPN_3x | 31:59 | 4 | 0.38 | 88.3 | 97.38 | 96.05 | 0.7 | |
8 | mask_rcnn_R_50_FPN_3x | 24:22 | 64 | 0.41 | 87.67 | 98.24 | 96.08 | 0.2 |
mask_rcnn_R_101_C4_3x | 37:58 | 64 | 0.35 | 85.66 | 98.27 | 96.07 | 0.7 | |
mask_rcnn_R_101_FPN_3x | 27:38 | 32 | 0.41 | 88.29 | 97.5 | 96.11 | 0.3 | |
mask_rcnn_R_50_C4_1x | 34:14 | 16 | 0.42 | 84.47 | 97.23 | 94.89 | 0.7 | |
mask_rcnn_R_50_C4_3x | 34:16 | 8 | 0.38 | 84.88 | 97.29 | 95.06 | 0.7 | |
mask_rcnn_R_50_FPN_1x | 24:23 | 128 | 0.44 | 86.74 | 97.37 | 95.08 | 0.2 | |
mask_rcnn_X_101_32x8d_FPN_3x | 40:14 | 8 | 0.37 | 88.45 | 97.46 | 96.13 | 0.7 |
Number of GPUs | Training Time [min] | Gamma | Batch Size | Validation Loss | AP | AP50 | AP75 |
---|---|---|---|---|---|---|---|
1 | 15:17 | 0.8 | 2 | 0.44 | 89.13 | 97.41 | 94.09 |
2 | 15:38 | 1 | 4 | 0.43 | 89.3 | 98.3 | 96.16 |
4 | 19:09 | 1 | 4 | 0.36 | 89.73 | 98.35 | 96.23 |
8 | 27:37 | 1 | 256 | 0.35 | 89.49 | 97.47 | 96.16 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Cakic, S.; Popovic, T.; Krco, S.; Nedic, D.; Babic, D.; Jovovic, I. Developing Edge AI Computer Vision for Smart Poultry Farms Using Deep Learning and HPC. Sensors 2023, 23, 3002. https://doi.org/10.3390/s23063002
Cakic S, Popovic T, Krco S, Nedic D, Babic D, Jovovic I. Developing Edge AI Computer Vision for Smart Poultry Farms Using Deep Learning and HPC. Sensors. 2023; 23(6):3002. https://doi.org/10.3390/s23063002
Chicago/Turabian StyleCakic, Stevan, Tomo Popovic, Srdjan Krco, Daliborka Nedic, Dejan Babic, and Ivan Jovovic. 2023. "Developing Edge AI Computer Vision for Smart Poultry Farms Using Deep Learning and HPC" Sensors 23, no. 6: 3002. https://doi.org/10.3390/s23063002
APA StyleCakic, S., Popovic, T., Krco, S., Nedic, D., Babic, D., & Jovovic, I. (2023). Developing Edge AI Computer Vision for Smart Poultry Farms Using Deep Learning and HPC. Sensors, 23(6), 3002. https://doi.org/10.3390/s23063002