Recognition of individual dairy cattle based on convolutional neural networks
Zhao Kaixuan,He Dongjian
DOI: https://doi.org/10.3969/j.issn.1002-6819.2015.05.026
2015-01-01
Abstract:Video analysis has been widely used to perceive the behavior of animals for precise dairy farming, which is useful to increase the productivity and reduce the disease rate. Using computer vision technique to recognize the individual cow is feasible to improve the efficiency of the automatic milking and feeding system. Effective and accurate recognition of individual dairy cattle is the prerequisite and foundation to record and analyze the animal behavior automatically. As the classic method of individual recognition, the typical electronic identification device, referred to a radio frequency identification device (RFID), must be installed on the neck or another position of the animal. But the available distance is limited and the RFID tags suffer from some shortages such as the loss of tags, tempering, and animal welfare. Besides, it requires extra device and redundant process to recognize the individual cow in a video using RFID method. Therefore, it is necessary to develop an accurate and efficient system for recognizing individual cows in feeding environment utilizing image processing method. In this paper, individual dairy cattle were recognized using the body images based on convolutional neural networks with video analysis method. Side-view images with a resolution of 704 pixels ×576 pixels were recorded when cows passed a narrow aisle to water trough. For target detecting, the frame difference method was implemented to obtain the outline and motion boundary of the cow. By dividing the target image into several same-width sections, the head and tail were removed from the image after checking the distribution of the target in the section. Because the ratio of the body’s depth to cow’s height was fixed at 0.6, the body area was located by drawing a box tangent to the back posture and then zoomed out 0.8 times of it to remove the external redundancy. For tracking the body image, template matching method was used to find the body area in the current frame by calculating the similarity against the target image in the previous frame. A convolutional neural network was built after analyzing the characteristics of the body images of cows. The network consisted of one input layer, two group of convolution- subsampling layers, and one output layer. The size of convolutional kernel was 5×5, and the subsampling size was 2×2. After testing different types of network architecture, the number of the feature maps in the first and third convolution layer were determined as 4 and 6, respectively, and the third convolution layers was partly connected to the second subsampling layer. The output layer was built up with 30 perceptrons, corresponding to the patterns of cows in the herd. After graying, resizing and normalizing, the body image of cow was transferred into a matrix sized 48×48 as the input of the network. 30 cows were captured 12 times for each, and 360 sets of videos were obtained in total, from which 60000 training frames, 21730 testing frames and 90 testing videos were selected randomly. In the tenth training epoch, the cost function was first less than 0.01. The result showed that 90.55% of the testing frames and 93.33% of the testing videos were recognized correctly, respectively. The testing data were captured from 7 a.m. to 6 p.m., so the network presented high robustness to the lightness diversity. The average elapsed time for recognizing one frame was lower than 0.01 s, and the total elapsed time for processing and recognizing one video was about 1 min, which showed a remarkable working efficiency and practicability. It suggested that the methods proposed here are feasible to recognize the individual dairy cattle. This study proves that the image processing technique has a great potential for recognition of animals.