基于头尾定位的群养猪运动轨迹追踪

    Trajectory tracking for group housed pigs based on locations of head/tail

    • 摘要: 猪的头/尾位置直观反映了猪的进食、饮水、争斗、追逐等日常活动。从群养猪俯视视频中有效分割粘连的猪个体,找出猪的头/尾部,并以头/尾坐标实现较精准的运动轨迹追踪有着较大的难度。该研究采用改进分水岭分割算法分割视频图像帧中的粘连猪个体;对分割后的猪体提取头/尾轮廓,分别用类Hough聚类和圆度识别算法识别每头猪的头/尾,用运动趋势算法修正头/尾识别的误差,生成以头/尾部为定位坐标的运动轨迹。运算结果和人工标记对比证明类Hough聚类和圆度识别算法的头尾识别正确率分别为71.79%和79.67%;经过运动趋势修正后,以头部为定位坐标生成的运动轨迹与人工标记生成运动轨迹吻合良好;对比头/尾轨迹和质心轨迹可以发现,头/尾轨迹能够更多获取猪个体和群体活动、运动信息。该研究对于实现自动记录和分析猪个体和群体的活动行为提供新的思路和方法。

       

      Abstract: Abstract: Observing animal's individual and social behaviors is the most effective way to assess animal welfare and healthy. Automated trajectory tracking based on head/tail locations is supposed to be extremely helpful for the realization of pig behavior recognition, especially for group housed pigs in the commercial pig facility. The methods of trajectory tracking for group housed pigs based on head/tail location were described in this paper. The video of group housed nurseries was taken in a commercial pig breeding farm of Hubei Jinlin Original Breeding Swine Co. Ltd. on January 12th, 2016. A high resolution camera (Woshida CL03) was used to record 15 min video. Afterwards, image frames were extracted from the original video in a one-second time interval. Image frames were processed in a computer (configured with IntelCore i7-4790 CPU (central processing unit), 3.6 GHz, 8 G memory) with MATLAB software platform. The image processing for each image frame included 4 steps: background removal, pigs division, head/tail identification and trajectory tracking modification. The background removal was based on the RGB (red, green, blue) color space, from which a vector of RGB mean values of the pig's body was calculated. If the Euclidean distance between the RGB values of one pixel and the RGB mean values vector was less than a small threshold of 100, the pixel was involved in a pig body area and set as 1. Otherwise, it was outside any pig body area and set as 0. When all pixels of the image frame were scanned and calculated by this method, a binary image was acquired. The white area referred to pig's body area, while the black area referred to the background. After that, the morphology erosion and expansion were utilized before the watershed segmentation algorithm to improve the dividing effect for the pigs with adhesion. Pigs division was implemented on the binary images with the improved watershed segmentation algorithm. To discriminate each pig in each image frame, a video tracking and marking method was necessary to be implemented in the video. After being manually marked with the identify number in the first frame, each pig had a unique number and was labelled automatically throughout the video. Abstracting image frames from the video with a very short time interval (1 s), the distance of 2 centroids of the identical pig between 2 continuous image frames would be sufficiently small. Therefore, the video tracking was to find the pig with the closest distance in the next image frame and mark it with the same identify number of the current pig until all the pigs were marked. After each pig was marked throughout the video, using the head/tail location as the coordinates of the pig, the trajectory of each pig in herd could be tracked by the trajectory calculation. Extracting the outline of each pig in frames, the head and the tail outlines were divided from the whole outline, after a sixth of whole outline distance was moved along the outline in 2 opposite directions from the 2 intersection points of the outline and short axis of the minimum bounding rectangle. After the head/tail outline curve was gained from each pig outline, 2 recognition algorithms, the analogous Hough clustering recognition algorithm and the roundness recognition algorithm, were employed to identify the head/tail of each pig. Thus the location of the pig's head/tail could be spotted by locating the centroid of the heat/tail curve. Then the trajectory tracking of the pigs was calculated based on the location of head/tail, and corrected by the motion trends of pigs. Experiment showed that the background was successfully removed from each image frame using the Euclidean distance of RGB values between the pixels and the mean value vector. The improved watershed segmentation algorithm has been verified as an effective tool to divide the pigs with adhesion. The identify number of each pig was tracked from the first frame to the end. The average recognition rate of analogous Hough clustering algorithm was 71.79% for the identification of pig's heads/tails, while the roundness algorithm was 79.67%, which was less sensitive to the distortion of head outline curve. If not including the pigs outside the camera range, the recognition rates would be up to 75% and 85.7% respectively. The roundness algorithm shows an obvious advantage in comparison. The modified trajectory of each pig shows a high agreement with the manually labelled trajectory. More understanding for pigs' behaviors can be acquired from the trajectory of head/tail locations. This trajectory tracking method provides a good reference for further research of behavior recognition.

       

    /

    返回文章
    返回