Hostname: page-component-74656f9884-j7cmm Total loading time: 0 Render date: 2026-11-07T08:50:20.267Z Has data issue: false hasContentIssue false

Development of automatic surveillance of animal behaviour and welfare using image analysis and machine learned segmentation technique

Published online by Cambridge University Press:  20 July 2015

M. Nilsson
Affiliation:
Lund University, Centre for Mathematical Sciences, PO Box 118, SE-22100 Lund, Sweden
A. H. Herlin*
Affiliation:
Swedish University of Agricultural Sciences, Department of Biosystems and Technology, PO Box 103, SE-23053 Alnarp, Sweden
H. Ardö
Affiliation:
Lund University, Centre for Mathematical Sciences, PO Box 118, SE-22100 Lund, Sweden
O. Guzhva
Affiliation:
Swedish University of Agricultural Sciences, Department of Biosystems and Technology, PO Box 103, SE-23053 Alnarp, Sweden
K. Åström
Affiliation:
Lund University, Centre for Mathematical Sciences, PO Box 118, SE-22100 Lund, Sweden
C. Bergsten
Affiliation:
Swedish University of Agricultural Sciences, Department of Biosystems and Technology, PO Box 103, SE-23053 Alnarp, Sweden
*

Abstract

In this paper the feasibility to extract the proportion of pigs located in different areas of a pig pen by advanced image analysis technique is explored and discussed for possible applications. For example, pigs generally locate themselves in the wet dunging area at high ambient temperatures in order to avoid heat stress, as wetting the body surface is the major path to dissipate the heat by evaporation. Thus, the portion of pigs in the dunging area and resting area, respectively, could be used as an indicator of failure of controlling the climate in the pig environment as pigs are not supposed to rest in the dunging area. The computer vision methodology utilizes a learning based segmentation approach using several features extracted from the image. The learning based approach applied is based on extended state-of-the-art features in combination with a structured prediction framework based on a logistic regression solver using elastic net regularization. In addition, the method is able to produce a probability per pixel rather than form a hard decision. This overcomes some of the limitations found in a setup using grey-scale information only. The pig pen is a difficult imaging environment because of challenging lighting conditions like shadows, poor lighting and poor contrast between pig and background. In order to test practical conditions, a pen containing nine young pigs was filmed from a top view perspective by an Axis M3006 camera with a resolution of 640×480 in three, 10-min sessions under different lighting conditions. The results indicate that a learning based method improves, in comparison with greyscale methods, the possibility to reliable identify proportions of pigs in different areas of the pen. Pigs with a changed behaviour (location) in the pen may indicate changed climate conditions. Changed individual behaviour may also indicate inferior health or acute illness.

Information

Type
Research Article
Copyright
© The Animal Consortium 2015 
Figure 0

Figure 1 (a) Top–down view of pigs in a pen as observed by an overhead camera. (b) Manually marked region of interest for whole pen (lighter grey) and for the dunging area (white).

Figure 1

Figure 2 (a) The region of interest (ROI) extracted from a video image. (b) Manual segmentation showing in white the pixels displaying pigs and in black the pixels displaying floor. (c) Otsu segmentation, which is a previous work trying to automatically produce the manual segmentation in (b). (d) The results from the proposed learning based segmentation. It gives a probabilistic result where pixels close to white/black indicate that the system is fairly certain it displays pigs/floor and grey pixels indicate that the system is uncertain.

Figure 2

Figure 3 Graphical representation of the channel features used by the proposed learning based system for identifying pixels showing pigs as opposed to showing floor. From left to right and top to bottom are CIE-LUV colour space (channels 1 to 3), gradient magnitude (channel 4), six oriented gradients (channels 5 to 10), maximum–minimum filter result (channel 11) and soft Otsu (channel 12).

Figure 3

Figure 4 Receive operation characteristic (ROC) curve for the learning based method used in this paper to detect pig pixels together with soft Otsu and the operation point for Otsu.

Figure 4

Figure 5 Left is input and right is output. In left, the light grey position indicates a vector containing all values of the channels for each pixel. White, indicate a single output value for each pixel which will be a probability. Note how one input patch give rise to outputs equal to the size of the area A. This is a general structure for learning segmentation algorithms that in this paper is applied to segment pigs.

Figure 5

Figure 6 Overview of result from running the proposed automated analytics on a 5-min video clip with the objective of estimating the number of pigs in the dunging area. (d) The raw and calibrated results together with manually produced human estimate. (a–c) Presents three of the frames from the video clip and their segmentations.

Figure 6

Figure 7 Three examples of typical failure cases of the proposed algorithm for estimating the number of pigs in the dunging area. The calibrated estimate, ñdunging(t), is used and no clear pig on the border case. Note that in typical failure cases, the pigs get occluded by the small wall as well as they occlude each other, leading to missing one pig in the dunging area.

Figure 7

Table 1 Errors in % using both raw and calibrated metrics of the proposed automated algorithm for estimating the number of pigs in the dunging area