Next Article in Journal
Determination Method of Core Parameters for the Mechanical Classification Simulation of Thin-Skinned Walnuts
Next Article in Special Issue
Investigation on Minimum Ventilation, Heating, and Energy Consumption of Pig Buildings in China during Winter
Previous Article in Journal
Impact of 40 Years Use of Different Herbicide Strategies and Crop Rotations on Weed Communities in Two Sites of the Czech Republic
Previous Article in Special Issue
Effects of Body-Mounted Inertial Measurement Unit (IMU) Backpacks on Space Use and Behaviors of Laying Hens in a Perchery System
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Systems to Monitor the Individual Feeding and Drinking Behaviors of Growing Pigs Based on Machine Vision

1
College of Water Resources & Civil Engineering, China Agricultural University, Beijing 100083, China
2
Key Laboratory of Agricultural Engineering in Structure and Environment, Ministry of Agriculture and Rural Affairs, Beijing 100083, China
3
Beijing Engineering Research Center on Animal Healthy Environment, Beijing 100083, China
*
Author to whom correspondence should be addressed.
Agriculture 2023, 13(1), 103; https://doi.org/10.3390/agriculture13010103
Submission received: 29 November 2022 / Revised: 25 December 2022 / Accepted: 27 December 2022 / Published: 29 December 2022

Abstract

:
Feeding and drinking behaviors are important in pig breeding. Although many methods have been developed to monitor them, most are too expensive for pig research, and some vision-based methods have not been integrated into equipment or systems. In this study, two systems were designed to monitor pigs’ feeding and drinking behaviors, which could reduce the impact of the image background. Moreover, three convolutional neural network (CNN) algorithms, VGG19, Xception, and MobileNetV2, were used to build recognition models for feeding and drinking behaviors. The models trained by MobileNetV2 had the best performance, with the recall rate higher than 97% in recognizing pigs, and low mean square error (RMSE) and mean absolute error (MAE) in estimating feeding (RMSE = 0.58 s, MAE = 0.21 s) and drinking durations (RMSE = 0.60 s, MAE = 0.12 s). In addition, the two best models trained by MobileNetV2 were combined with the LabVIEW software development platform, and a new software to monitor the feeding and drinking behaviors of pigs was built that can automatically recognize pigs and estimate their feeding and drinking durations. The system designed in this study can be applied to behavioral recognition in pig production.

1. Introduction

Monitoring the behaviors of pigs can reflect their health status timely [1]. Feeding and drinking behaviors are two behaviors with a strong relationship [2], and there is a positive correlation between feed and water intake [3]. Monitoring of feeding and drinking behaviors can help users determine pigs’ feed intake [1], carry out relevant nutritional studies [4], and keep up with the environmental condition in pen, health, and social stressors of pigs [5].
Traditional methods of monitoring the feeding and drinking behaviors of pigs require a large number of work hours and might stress the pigs [6]. In some research, to improve the efficiency of behavior monitoring, radio frequency identification (RFID), which can accurately identify pigs, was used to monitor feeding and drinking behaviors [6,7,8,9,10]. In addition, an electronic feeding station (EFS) or feed intake recording equipment (FIRE), integrated with many sensors including RFID and the others mentioned above, can monitor the behaviors of pigs and include many other parameters in addition to feeding and drinking behaviors [11,12]. However, because of the high cost of the EFS and FIRE, they are usually used in research on sows and boars, but hardly ever for growing pigs. Moreover, the EFS, FIRE, and RFID systems need to pierce pigs’ ears to place the tags, which causes stress.
With the development of computer science, machine vision methods are widely used in the recognition of pigs’ feeding behavior [13], drinking behavior [14], identity [15], and weight [16]. The deep learning (DL) method, especially the convolutional neural network (CNN) method, a widely used method in machine vision, has developed rapidly in recent years. Because of the fast processing speed and the end-to-end manner, CNNs are used in many areas including animal science. Many studies on recognizing pigs’ identity and feeding and drinking behaviors [2,13,15,17,18,19,20] used the CNN method and obtained good results. However, these methods remained in the model establishment stage, did not form equipment or systems for recognition, are not suitable for group-housed pigs, cannot be applied in real time, are limited by usage scenarios (pen size, feeding density, etc.), some are lack of individual recognition or have low individual recognition performance, and some research based on object detection algorithm required complex program compilation. Therefore, it is necessary to build a system that is more adaptable and can be used in pig farms.
In this research, a system that can recognize pigs’ individual feeding and drinking behaviors based on the machine vision method was established. The main objectives were to: (1) design a system, which includes equipment to monitor pigs’ individual feeding and drinking behaviors; (2) establish models based on CNNs, which can be used to recognize pigs’ identity, feeding behavior, and drinking behavior; and (3) test the performance and integrate them into a new software.

2. Materials and Methods

2.1. Design of the Acquisition and Recognition System

The acquisition and recognition system included the feeding behavior acquisition and recognition system (FARS, Figure 1) and the drinking behavior acquisition and recognition system (DARS, Figure 2). The material of both systems was 304 stainless steel. The size of the FARS was 520 × 360 × 1000 mm, with a 360 × 380 × 200 mm built-in feeder. The camera was installed on the rear plate of the FARS and was 750 mm above the ground. In addition, because of the light-blocking effect of the inner wall, an LED belt was installed on the top. The DARS was a 260 × 130 × 530 mm irregular-shaped drinker; the upper and lower ends were semicircles with a radius of 130 mm. The camera was installed on the top of the DARS, and the distance between the drinker and the camera was 380 mm.

2.2. Animal and System Layout

This study was conducted in January 2020 at the Ministry of Agriculture Feed Industry Centre Fengning Animal Test Base (Fengning Hebei, China). Six growing pigs (Duroc × Landrace × Yorkshire (DYL)) were monitored in this research, and the pig fodder was delivered at 8 a.m. and 3 p.m. every day. The system was placed on one side of the pen, the FARS was located on the right, and the DARS was placed in the middle (Figure 3). Because a change in the feeder might affect the normal feeding of the pigs, the original feeder was retained [12].

2.3. Programming Language

All code was run on a desktop computer with an Intel i7-10750H CPU, 32 GB RAM, Windows 10 (64 bit), and a NVIDIA GeForce GTX 2070 8 GB GPU.
To train and test the model, the choice of language was significant. The Tensorflow system of Python is a second-generation artificial intelligence learning system developed by Google. Tensorflow is completely open source, has a good development environment, and is widely used in the field of machine vision research of pigs [15,16], which provides experience for the programming language selection of this study. Therefore, Python was selected as the programming language for model training and verification in this study.
After training and testing, the model should be automatically loaded and applied. Virtual Instrument Engineering Workbench (LabVIEW) is an unusual graphical programming language based on virtual instruments that can easily be used for capturing images and outputting intuitive data. Moreover, the Python integration toolkit LabVIEW can automatically load Python-trained models and generate good display interfaces. Thus, LabVIEW was selected as the language for data acquisition and system integration.

2.4. Data Acquisition and Preprocessing

2.4.1. Image Acquisition

In this study, 48,425 images (26,505 from FARS, 21,920 from DARS) were collected from 8:00 to 18:00 per day and named raw data. In addition, 180 consecutive sets of data (50 from FARS, 130 from DARS), which included 4796 images (1809 from FARS, 2987 from DARS), were collected and named test data. The size of the images was 1280 × 720 pixels, and the frequency of taking images was once per second. The cameras used in this research were miniature industrial cameras (LRCP10620_1080P, Shenzhen, China). To better distinguish pigs and facilitate the marking of images, crayons were used to mark the back of the pigs every day. For the cameras placed in the FARS and DARS that could not capture the marks on the pigs’ backs, a top-view camera (EZVIZ C3C, Shenzhen, China) was installed to take images of the pen. All images were named according to the time they were taken.

2.4.2. Image Resizing, Cutting, and Marking

Before model training, the image data in this research were resized, cut, marked and cleaned. The resizing and cutting of images made the images suitable for training by different CNN models and saved on calculation costs. The image marking, which included identity marking and behavior marking in this research, was a significant step to teaching the computer the differences between the pigs and their behaviors. The image resizing was based on Python code during training and the model to be used in training; the image cutting was based on the LabVIEW Vision Toolkit; the image marking was based on a comparison of the images from the FARS and DARS to the top camera; the image cleaning was based on the open-source platform of Baidu (https://ai.baidu.com/easydata/, accessed on 7 October 2022), which cleans out blurred and highly approximate data.
The images captured by FARS (Figure 4a, 1280 × 720 pixels) included a lot of useless information, such as other pigs or the inner wall of the FARS, which could affect the performance of the models and make the marking work difficult, so these images were cut to a suitable size (Figure 4b, 640 × 360 pixels). Subsequently, the images of the feeding behavior dataset were reduced from 26,505 to 12,200, and these 12,200 images were marked by the number of pigs. These marked images are shown in Figure 5, with the feeding images of six pigs marked from 1 to 6. Images with no feeding were marked as 0.
Compared with the images caught by FARS, the images caught by DARS (Figure 6, 1280 × 720 pixels) had little useless information and only needed to be marked and cleaned. After cleaning, the original 21,920 images were reduced to 11,298. The marked images are shown in Figure 6: six pigs that were drinking water were marked from 1 to 6. Images with no drinking were marked as 0.
After the images were cut and cleaned, in order to be better applied in model training, it was necessary to resize the preprocessed images to 224 × 224 pixels or 299 × 299 pixels for different models, which was the optimal image size for training.

2.5. CNN Algorithm

In this study, the raw data were divided into a training dataset and a validation dataset according to a ratio of 4:1. The image data were used as input, and the labels of each image (0–6) were used as output. The models were built based on VGG19, Xception, and MobileNetV2 models. For the training and validation of the three models, the training epochs numbered 30, the training batch size was 32, and the learning rate was 0.0001. All three models had two fully connected layers, and Softmax was selected as the activation function in the output layer. In addition, the sparse categorical cross-entropy was used to determine the loss, and Adam was used as an optimizer. For testing, recall rate was used to evaluate the performance of the three models used in recognizing pigs’ individual feeding and drinking behaviors, and the formula was as follows:
Recall   rate ( i ) = t p ( i ) T ( i ) × 100 % ,
where t p ( i ) is the number of results identifying pig i as pig i , and T ( i ) is the total number of images of pig i in the dataset.
Moreover, the root mean square error (RMSE) and mean absolute error (MAE) were used to evaluate the estimation of feeding duration and drinking duration, and the formula of each evaluation index was as follows:
RMSE = 1 M   m = 1 M   ( t m t ^ m ) 2
MAE = 1 M   m = 1 M   | t m t ^ m |
where M is the number of datasets for the period of feeding behavior and drinking behavior; m is the sample number of the datasets; t m is the actual feeding or drinking duration; and t ^ m is the measured value for the feeding or drinking duration.

2.5.1. VGG19

A VGG series convolutional neural network is a very deep CNN developed by the Visual Geometry Group of the University of Oxford. It has been applied in many agricultural studies and achieved good results [21], including the recognition of pigs’ faces [15,22]. Compared with the previous VGG16 model, the VGG19 used in this study added three convolutional layers, which improved the depth of the model and could effectively improve the accuracy. The architecture of VGG19 is shown in Figure 7. The input size of the image is 224 × 224 pixels, and the model consists of 16 convolution layers (Conv) with a ReLU activation function, five max-pooling layers, and a global average pooling layer. Finally, two dense layers were used and output by the Softmax activation function.

2.5.2. Xception

Xception is an improved model of InceptionV3 [23] developed by Google, based on a linear stack of depth-wise separable convolution layers with residual connections [24]. Different from the VGG algorithm, which simply increases the number of convolution layers to improve the model efficiency, the use of depth-wise separable convolutions can reduce the computational complexity and make the model more easily defined and modified. The architecture of Xception is shown in Figure 8. The input size of the image is 299 × 299 pixels, and the model consists of 36 convolution layers, four max-pooling layers, and a global average pooling layer. Furthermore, 34 convolution layers were depth-wise separable convolution layers (Sep-Conv), and the above 36 convolutional layers were divided into 14 modules, all of which had linear residual connections around them, except the first and last modules. In addition, each convolution layer was followed by batch normalization (not marked in the figure). Finally, similar to the VGG19 model used in this study, ReLU was used as the activation function in the convolution layers, and two dense layers were used and output by the Softmax activation function.

2.5.3. MobileNetV2

MobileNetV2 is a lightweight CNN (Figure 9a) based on the bottleneck residual block and can effectively reduce the parameters of the model [25]. The input size of the image is 224 × 224 pixels, the initial and final convolutional layers are both fully convolutional layers, and there are 17 residual bottleneck layers divided into seven sequences in the middle. Each sequence repeats a different number of times (the repeat times of each sequence are shown in Figure 9a). The stride(s) marked in each sequence in Figure 9a represents the s in the first layer, and all other layers used s = 1 × 1. Figure 9b,c shows the residual bottleneck layer structure when s = 1 × 1 and s = 2 × 2, respectively. In addition, unlike VGG19 and Xception, ReLU6, which can improve the robustness of low-precision computation [26], was used as the activation function in the convolutional layers and residual bottleneck layers. Finally, the model also had a global average pooling layer, and two dense layers were used and output by the Softmax activation function.

3. Results and Discussion

3.1. Model Training

The model size and training duration for the training of recognition of feeding behavior and drinking behavior are shown in Table 1. The model trained by VGG19 had a medium size and training duration, with a training duration of 132 min 30 s (159 s per iteration) for the feeding dataset and 80 min 03 s (96 s per iteration) for the drinking dataset. The model trained by Xception was the largest and had the longest training duration of 275 min 59 s (331 s per iteration) and 190 min 19 s (228 s per iteration) for the feeding and drinking datasets, respectively. The model trained by MobileNetV2 was the smallest and had the shortest training duration of 56 min 26 s (68 s per iteration) for the feeding dataset and 31 min 53 s (38 s per iteration) for the drinking dataset.
The results of each model are shown in Figure 10. The accuracy and loss of the models trained by MobileNetV2 were basically consistent with those of Xception and VGG19, with the accuracy of the validation dataset in FARS and DARS exceeding 99%. However, the results of VGG19 had great fluctuation in the model training of the feeding dataset, which might be because the architecture of VGG19 was just a simple stack of convolution layers and pooling layers. In addition, for the training of the feeding and drinking datasets, the accuracy of the models trained by Xception reached 98% in the first epoch, while VGG needed more than five epochs to achieve the same effect, and for MobilenetV2, more than seven epochs were needed. Considering the training duration of each iteration, although MobilenetV2 needed more epochs to reach a high accuracy, the whole training duration was the shortest. Therefore, in the training stage, MobilenetV2 achieved the best results, Xception was in second place, and the VGG model was the poorest.

3.2. Model Test

In this study, 130 sets of continuous images from DARS (2987 images) and 50 sets of continuous images from FARS (1809 images) were used for the test. For a shooting frequency of one image per second, the average drinking duration was 27.72 s, and the average feeding duration was 21.37 s. The performances of each model are shown in Table 2 and Table 3.
As shown in Table 2, for the testing dataset from DRAS, MobileNetV2 achieved the best performance with a recognition recall rate of each pig higher than 97%, and the recall rate of pigs 3 and 4 was 100%. In addition, the model trained by MobileNetV2 was used to estimate the drinking duration, and RMSE and MAE were only 0.60 s and 0.12 s. The effects of the models trained by VGG19 and Xception were similar, which showed that, except for the recognition recall rate of pig 5, which was lower than 95%, the recognition recall rate of other pigs was higher than 98%. It is worth mentioning that the recall rate of all the models for distinguishing between drinking and nondrinking was 100%.
The performance of the testing dataset from FARS was also very good (Table 3): all models distinguished between feeding and nonfeeding 100% of the time. It is worth mentioning that VGG19, which had the poorest effect in the model training stage, achieved the best performance in the testing stage. The recall rate for individual pig recognition exceeded that of MobileNetV2, with a 100% recall rate for identifying pigs 1, 3, and 5. However, because of the differences in the feeding habits of pigs, the image number of each pig was not the same. Therefore, the RMSE of VGG19 was higher than that of MobilenetV2 for estimating the feeding duration. Unexpectedly, Xception, which achieved good results in the training stage and could reach a high level with only one epoch, did not achieve good performance in the testing stage; the recognition recall rate was only 93.75% for pig 4.
As a lightweight model, MobileNetV2 achieved the best performance with the lowest training duration. Compared with previous studies, the model trained by MobileNetV2 in this study had significantly improved the accuracy of individual pig recognition, and the model training process was simpler, without complex model training operations. These findings could be attributed to FARS and DARS limiting the image shooting area, reducing the impact of a complex background environment on the recognition of pigs, and a lightweight model could be used in recognizing pigs. However, MobilenetV2 was a lightweight model after all. Whether it could achieve the same efficiency of individual recognition when there were more pigs remains to be further studied. VGG19, which was introduced many years ago [21], still achieved good performance. While, due to its large fluctuations and long training duration, VGG19 might cause a series of problems in subsequent applications, the VGG19 was not suitable to be promoted and applied as the core algorithm in feeding and drinking behaviors recognition. As a model with many excellent results [16,18,27,28], although Xception did not achieve the best results in this study, it still got a good recall rate in recognizing most pigs. Because the FARS and DARS could effectively reduce the impact of the background, the advantages of the Xception might be difficult to capture, the Xception model might be more suitable for building complex models or situations, where the computing power was high enough.

3.3. Application Prospects

In view of the excellent achievements of MobilenetV2, in this study, models trained by MobileNetV2 were chosen for building the application. LabVIEW and its Python Integration Toolkit were combined to design a new behavior monitoring software to monitor the feeding and drinking behaviors of pigs, which could automatically be used for FARS and DARS.
The model trained by MobilenetV2 was able to distinguish whether pigs were feeding/drinking. Thus, in this software, when the software recognized that a pig was feeding or drinking for 1 s, the system captured all of the pictures taken subsequently until it was determined that the pig had not been feeding or drinking for 1 s. Then, all images taken by this system were recognized, the pig with the highest number of recognition results was the final recognition result, and the number of images was the duration of this feeding or drinking behavior. The pig’s feeding or drinking duration was displayed on the front panel (Figure 11) and saved in the database in real time. The operator can change the display content into a daily feeding or drinking duration according to the user’s needs.
The behavior monitoring software based on LabVIEW in this study could be combined with FARS or DARS and applied to group-housed pigs, singly housed pigs, EFS, and FIRE, regardless of feeding conditions. Users can mark the abnormal pigs by recording their individual feeding and drinking behaviors, adjusting the feeding plan in time, and improving the feed utilization rate in combination with the feed line and other equipment. Furthermore, compared with the one-time RFID tags, the camera has a longer service life and is easier to maintain and replace, which means that the system can effectively reduce the cost of ear tags and labor input. In addition, the application of this study was simple, with strong reproducibility. The model training process was relatively simple, and the training speed was fast. LabVIEW is an unusual graphical programming language based on virtual instruments, which can assist nonprogrammer users and researchers in using and reproducing this system [29]. Producers can operate the system only if they have basic computer knowledge. In case of program failure, developers can also debug the program through a remote desktop.

4. Conclusions

In this study, two systems named FARS and DARS were designed to monitor the individual drinking and feeding behaviors of pigs, and a systematic application design was carried out to facilitate their better application in two systems in the future. Specifically, the best model trained by MobileNetV2 achieved good performance. The recall rate of recognizing six pigs was higher than that in previous research with the recall rate higher than 97%. In addition, its estimated RMSE and MAE for drinking duration were 0.60 s and 0.12 s, respectively, and the estimated RMSE and MAE for feeding duration were 0.58 s and 0.21 s, respectively. This method can be applied to group-housed pigs, singly housed pigs, pig insurance registration, pig individual status monitoring, and other occasions with strict requirements for individual identification. Only a small amount of pig data needs to be collected and corrected on the basis of the original mode output.

Author Contributions

Data curation, Y.Z., K.Z., and Z.Z.; investigation, G.T.; methodology, Y.Z. and K.Z.; project administration, G.T.; software, Y.Z.; supervision, G.T.; writing—original draft, Y.Z.; writing—review and editing, K.Z., Z.Z., H.J. and G.T. All authors have read and agreed to the published version of the manuscript.

Funding

This work was funded by the Special Key Project of Chongqing Technology Innovation and Application Development (cstc2021jscx-dxwtBX0006).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

All datasets from the current study are available from the corresponding author upon reasonable request.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Zhang, Y.; Cai, J.; Xiao, D.; Li, Z.; Xiong, B. Real-time sow behavior detection based on deep learning. Comput. Electron. Agric. 2019, 163, 104884. [Google Scholar] [CrossRef]
  2. Chen, C.; Zhu, W.; Steibel, J.; Siegford, J.; Han, J.; Norton, T. Classification of drinking and drinker-playing in pigs by a video-based deep learning method. Biosyst. Eng. 2020, 196, 1–14. [Google Scholar] [CrossRef]
  3. Friend, D.W.; Cunningham, H.M. The effect of water consumption on the growth, feed intake, and carcass composition of suckling piglets. Can. J. Anim. Sci. 1966, 46, 203–209. [Google Scholar] [CrossRef]
  4. Vukmirović, Đ.; Čolović, R.; Rakita, S.; Brlek, T.; Đuragić, O.; Solà-Oriol, D. Importance of feed structure (particle siz-e) and feed form (mash vs. pellets) in pig nutrition–A review. Anim. Feed. Sci. Technol. 2017, 233, 133–144. [Google Scholar] [CrossRef]
  5. Matthews, S.G.; Miller, A.L.; Clapp, J.; Plötz, T.; Kyriazakis, I. Early detection of health and welfare compromises thr-ough automated detection of behavioural changes in pigs. Vet. J. 2016, 217, 43–51. [Google Scholar] [CrossRef] [Green Version]
  6. Brown-Brandl, T.M.; Rohrer, G.A.; Eigenberg, R.A. Analysis of feeding behavior of group housed growing—Finishing pigs. Comput. Electron. Agric. 2013, 96, 246–252. [Google Scholar] [CrossRef] [Green Version]
  7. Ostersen, T.; Cornou, C.; Kristensen, A.R. Detecting oestrus by monitoring sows’ visits to a boar. Comput. Electron. Agric. 2010, 74, 51–58. [Google Scholar] [CrossRef] [Green Version]
  8. Andersen, H.; Dybkjær, L.; Herskin, M.S. Growing pigs’ drinking behaviour: Number of visits, duration, water intake and diurnal variation. Animal 2014, 8, 1881–1888. [Google Scholar] [CrossRef] [Green Version]
  9. Maselyne, J.; Van Nuffel, A.; De Ketelaere, B.; Vangeyte, J.; Hessel, E.F.; Sonck, B.; Saeys, W. Range measurements of a High Frequency Radio Frequency Identification (HF RFID) system for registering feeding patterns of growing-finishing pigs. Comput. Electron. Agric. 2014, 108, 209–220. [Google Scholar] [CrossRef]
  10. Maselyne, J.; Adriaens, I.; Huybrechts, T.; De Ketelaere, B.; Millet, S.; Vangeyte, J.; Van Nuffel, A.; Saeys, W. Measuring the drinking behaviour of individual pigs housed in group using radio frequency identification (RFID). Animal 2016, 10, 1557–1566. [Google Scholar] [CrossRef]
  11. Hoy, S.; Schamun, S.; Weirich, C. Investigations on feed intake and social behaviour of fattening pigs fed at an electronic feeding station. Appl. Anim. Behav. Sci. 2012, 139, 58–64. [Google Scholar] [CrossRef]
  12. Nielsen, B.L.; Lawrence, A.B.; Whittemore, C.T. Feeding behaviour of growing pigs using single or multi-space feeders. Appl. Anim. Behav. Sci. 1996, 47, 235–246. [Google Scholar] [CrossRef]
  13. Alameer, A.; Kyriazakis, I.; Dalton, H.A.; Miller, A.L.; Bacardit, J. Automatic recognition of feeding and foraging behaviour in pigs using deep learning. Biosyst. Eng. 2020, 197, 91–104. [Google Scholar] [CrossRef]
  14. Alameer, A.; Kyriazakis, I.; Bacardit, J. Automated recognition of postures and drinking behaviour for the detection of compromised health in pigs. Sci. Rep.-UK 2020, 10, 1–15. [Google Scholar] [CrossRef]
  15. Hansen, M.E.; Smith, M.L.; Smith, L.N.; Salter, M.G.; Baxter, E.M.; Farish, M.; Grieve, B. Towards on-farm pig face recognition using convolutional neural networks. Comput. Ind. 2018, 98, 145–152. [Google Scholar] [CrossRef]
  16. Zhang, J.; Zhuang, Y.; Ji, H.; Teng, G. Pig Weight and Body Size Estimation Using a Multiple Output Regression Convolutional Neural Network: A Fast and Fully Automatic Method. Sensors 2021, 21, 3218. [Google Scholar] [CrossRef]
  17. Yang, Q.; Xiao, D.; Lin, S. Feeding behavior recognition for group-housed pigs with the Faster R-CNN. Comput. Electron. Agric. 2018, 155, 453–460. [Google Scholar] [CrossRef]
  18. Chen, C.; Zhu, W.; Steibel, J.; Siegford, J.; Han, J.; Norton, T. Recognition of feeding behaviour of pigs and determination of feeding time of each pig by a video-based deep learning method. Comput. Electron. Agric. 2020, 176, 105642. [Google Scholar] [CrossRef]
  19. Yan, L.; Miao, Z.; Zhang, W. Pig face detection method based on improved CenterNet algorithm. In Proceedings of the 2022 3rd International Conference on Electronic Communication and Artificial Intelligence (IWECAI), Sanya, China, 14–16 January 2022; pp. 174–179. [Google Scholar] [CrossRef]
  20. Marsot, M.; Mei, J.; Shan, X.; Ye, L.; Feng, P.; Yan, X.; Li, C.; Zhao, Y. An adaptive pig face recognition approach using Convolutional Neural Networks. Comput. Electron. Agric. 2020, 173, 105386. [Google Scholar] [CrossRef]
  21. Simonyan, K.; Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv 2014, arXiv:1409.1556. [Google Scholar] [CrossRef]
  22. Wang, Z.; Liu, T. Two-stage method based on triplet margin loss for pig face recognition. Comput. Electron. Agric. 2022, 194, 106737. [Google Scholar] [CrossRef]
  23. Szegedy, C.; Vanhoucke, V.; Ioffe, S.; Shlens, J.; Wojna, Z. Rethinking the Inception Architecture for Computer Vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 2818–2826. [Google Scholar]
  24. Chollet, F. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 1251–1258. [Google Scholar] [CrossRef]
  25. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 4510–4520. [Google Scholar] [CrossRef]
  26. Howard, A.G.; Zhu, M.; Chen, B.; Kalenichenko, D.; Wang, W.; Weyand, T.; Andreetto, M.; Adam, H. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv 2017, arXiv:1704.04861. [Google Scholar] [CrossRef]
  27. Focus to learn moreShao, H.; Pu, J.; Mu, J. Pig-posture recognition based on computer vision: Dataset and exploration. Animals 2021, 11, 1295. [Google Scholar] [CrossRef]
  28. Bhoj, S.; Tarafdar, A.; Chauhan, A.; Singh, M.; Gaur, G.K. Image processing strategies for pig liveweight measurement: Updates and challenges. Comput. Electron. Agric. 2022, 193, 106693. [Google Scholar] [CrossRef]
  29. Kodosky, J. LabVIEW. Proc. ACM Program. Lang. 2020, 4, 1–54. [Google Scholar] [CrossRef]
Figure 1. Feeding behavior acquisition and recognition system.
Figure 1. Feeding behavior acquisition and recognition system.
Agriculture 13 00103 g001
Figure 2. Drinking behavior acquisition and recognition system.
Figure 2. Drinking behavior acquisition and recognition system.
Agriculture 13 00103 g002
Figure 3. Pen and the layout of system.
Figure 3. Pen and the layout of system.
Agriculture 13 00103 g003
Figure 4. Image caught by FARS and image cutting. Raw image (a); image after cutting (b).
Figure 4. Image caught by FARS and image cutting. Raw image (a); image after cutting (b).
Agriculture 13 00103 g004
Figure 5. Images of individual pigs at FARS. Nonfeeding (0); numbers of feeding pigs (1~6).
Figure 5. Images of individual pigs at FARS. Nonfeeding (0); numbers of feeding pigs (1~6).
Agriculture 13 00103 g005
Figure 6. Images of individual pigs at DARS. Nondrinking (0); numbers of drinking pigs (1~6).
Figure 6. Images of individual pigs at DARS. Nondrinking (0); numbers of drinking pigs (1~6).
Agriculture 13 00103 g006
Figure 7. The VGG19 architecture.
Figure 7. The VGG19 architecture.
Agriculture 13 00103 g007
Figure 8. The Xception architecture.
Figure 8. The Xception architecture.
Agriculture 13 00103 g008
Figure 9. The MobileNetV2 architecture. Overall architecture (a); the residual bottleneck layer structure when s = 1 × 1 (b); the residual bottleneck layer structure when s = 2 × 2 (c).
Figure 9. The MobileNetV2 architecture. Overall architecture (a); the residual bottleneck layer structure when s = 1 × 1 (b); the residual bottleneck layer structure when s = 2 × 2 (c).
Agriculture 13 00103 g009
Figure 10. The training results of the VGG19, Xception, and MobilenetV2 models. Results of the feeding validation dataset (a); results of the drinking validation dataset (b).
Figure 10. The training results of the VGG19, Xception, and MobilenetV2 models. Results of the feeding validation dataset (a); results of the drinking validation dataset (b).
Agriculture 13 00103 g010
Figure 11. Front panel of the behavior monitoring system.
Figure 11. Front panel of the behavior monitoring system.
Agriculture 13 00103 g011
Table 1. Model information.
Table 1. Model information.
ModelModel Size (MB)Training Duration
VGG19—feeding241132 min 30 s
Xception—feeding269275 min 59 s
MobileNetV2—feeding4256 min 26 s
VGG19—drinking24180 min 03 s
Xception—drinking269190 min 19 s
MobileNetV2—drinking4231 min 53 s
Table 2. Recall rates of the models for the drinking test dataset.
Table 2. Recall rates of the models for the drinking test dataset.
ItemVGG19MobileNetV2Xception
0100.00%100.00%100.00%
198.71%98.33%98.20%
298.58%99.82%98.76%
399.32%100.00%99.78%
497.98%100.00%100.00%
594.31%97.28%94.80%
699.44%99.62%99.44%
RMSE (s)0.860.600.81
MAE (s)0.300.120.26
Table 3. Recall rates of the models for the feeding test dataset.
Table 3. Recall rates of the models for the feeding test dataset.
ItemVGG19MobileNetV2Xception
0100.00%100.00%100.00%
1100.00%99.57%99.57%
299.78%99.78%99.55%
3100.00%99.47%100.00%
497.08%97.92%93.75%
5100.00%100.00%99.26%
698.58%98.58%97.16%
RMSE (s)0.620.581.38
MAE (s)0.210.210.49
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.

Share and Cite

MDPI and ACS Style

Zhuang, Y.; Zhou, K.; Zhou, Z.; Ji, H.; Teng, G. Systems to Monitor the Individual Feeding and Drinking Behaviors of Growing Pigs Based on Machine Vision. Agriculture 2023, 13, 103. https://0-doi-org.brum.beds.ac.uk/10.3390/agriculture13010103

AMA Style

Zhuang Y, Zhou K, Zhou Z, Ji H, Teng G. Systems to Monitor the Individual Feeding and Drinking Behaviors of Growing Pigs Based on Machine Vision. Agriculture. 2023; 13(1):103. https://0-doi-org.brum.beds.ac.uk/10.3390/agriculture13010103

Chicago/Turabian Style

Zhuang, Yanrong, Kang Zhou, Zhenyu Zhou, Hengyi Ji, and Guanghui Teng. 2023. "Systems to Monitor the Individual Feeding and Drinking Behaviors of Growing Pigs Based on Machine Vision" Agriculture 13, no. 1: 103. https://0-doi-org.brum.beds.ac.uk/10.3390/agriculture13010103

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop