Image recognition of individual cow based on SIFT in Lαβ color space

Using image recognition technology to identify individual dairy cattle with her biological features shows strong stability. This kind of non-contact, high precision and low cost individual recognition methods based on image processing are more and more popular recently to replace the electronic tag and ear mark which can hurt the cattle’s psychology and physical health and can affect cattle’s behavior. By comparing the various color space transformations, he proposed a scale-invariant feature transform algorithm based on the Luminace of Lαβ color space. With this algorithm, a biological features recognition and management system of Holstein cow has been developed. The identification accuracy is higher than 98%, which is the best result than all the similar reports for cows’ identification.


Introduction
The biological characteristics of cows, with strong stability and obvious individual difference, are their intrinsic attributes, which can be used for individual identification of dairy cows.Recently, studies have shown that the back patterns of cows vary from other patterns, and the back patterns will remain stable throughout their lives [1] .The cow's biometric identification is not optional by using the RFID, and the cow's e-ear tag may fall off due to cattle's bite and rubbing for long time.Besides, the e-ear tag can be taken off from one cow and then put on another, so it is not reliable to just use the RFID.As for the cow's life insurance, it is of extreme importance to study the biometrics identification by applying the image processing.
With the rapid development of computer information technology, pattern recognition technology has begun to permeate the animal husbandry, and many researchers have studied animal identification and management using image processing technology.Xia [2] et al. proposed a dairy cow's face description model based on the binary pattern texture feature, which identifies cow's facial features by extracting features, using principle component analysis method, combing with the sparse coding classification.Unfortunately, the recognition system is sensitive to the angle of the face image because of the fixed photo graphing position, which makes it difficult to realize the automatic identification.Wang Rui [3] proposed a matching algorithm based on the combination of pole constraint and edge recognition.However, this method can not deal with object occlusion, angle difference and deformation, and the recognition rate is not high.Jin Yichu [4] proposed a homomorphic filtering algorithm based on wavelet transform in YCbCr color space and a region growing algorithm based on sub block region.The sample data of the experiment was 50 groups, and each cow was composed of four pictures, 200 pictures of cows in total, finally the algorithm recognition rate is 84%.But this algorithm cannot solve the problem of image affine tilt.Liu Jun [5] proposed a dairy image recognition algorithm based on multi-feature fusion.The experiment consists of 23 sets of sample data.Each group of cows is composed of 2-10 different pictures, about 200 cow pictures, and the algorithm recognition rate is 93.33%.The background of the images of the experimental data was removed by photoshop software, causing a large number of workload, while the characteristic points that on the edge of the cow's body will be affected, which may have direct effect on the recognition result.
In view of the above problems, we propose a new SIFT [6] (Scale-invariant feature transform) algorithm based on the Luminace of Lαβ color space to identify individual cow.The scheme took advantage of the local characteristic in scale space of the SIFT algorithm, improved and designed the feature descriptor which is able to rotate, scale and keep brightness, with stable character to view changing, transforming and noise influence.On the other hand, the algorithm process and identification method were given, and the experimental verification and result analysis are carried out.(2) Key point positioning: At each candidate location, the scale and position are determined by fitting the fine model.The choice of key points depends on their stability.
(3) Direction determination: Based on the gradient direction of the local image, one or more directions are assigned to each key point.
(4) Description of Key point: the local gradient of the image is measured at the selected scale within the perimeter of each key point.

Matching method
Image matching in essence is a feature matching.Firstly, the Euclidean distance of feature vectors of critical points is used as the similarity measure of the key points in the two images.Secondly, the error matching points are eliminated to improve robustness.The Brute Force Matcher algorithm always tries all possible matches so that it always finds the best match.In this paper, we use the force matching algorithm to match the features.

Choice of color space
The color of the cow's skin is one of the most distinctive features of the cow's appearance, which is not sensitive to displacement, rotation, and scale changes.Therefore, color features are more stable than other features.As there is a big difference of the dairy cow's colors in different color space clustering [7] , the conclusion of whether there being an optimal color space is still not uniform according to the current conclusions of the various researchers.At present, the common color spaces include RGB, HSV, YUV, YCrCb and Lαβ [8] .Based on this, the color of the dairy cow was changed in each color space, as was shown in Figure 1  In order to study whether there is an optimal color space or spatial component, we first randomly extracted 20 cows' images from the gallery, and each cow randomly selected 6 pictures, a total of 120 pictures as a group, a total of 6 sets of data.Each picture is identified with the other images in different color space components.It is found that GRAY and V components in HSV space, Y components in YUV space, Y components in YCrCb space, and L components in L space can distinguish friesian cow, which is consistent with human visual perception.The results of the experiment are shown in Table 1.Note: The system accuracy is defined as: Accuracy = Identify the correct number of dairy images / Number of cow images that are involved in the identification.
3 Experiment and result analysis

Image acquisition and processing
The video was collected from the dairy farm of Ruifeng garden professional cooperatives in Yongning County, Yinchuan, the Ningxia Hui Autonomous Region.It was collected at 13:00 to 17:00 January 3, 2017, and the healthy Chinese Holstein cows were collected.The cow goes through a fixed narrow road to the barn as it comes out of the milking parlor, where a blue cloth was hung in the wall as shot background meanwhile a SLR camera was placed on a tripod whose mode function was adjusted to take videos and whose visual width is larger than 1 cattle's length.There is a fence foreground mask between the dairy target and the camera, and the grid size is 0.5m×2.0m.The three view of the cow image acquisition is shown in Figure 2. The data acquisition environment for no fog, no haze weather, when individual cows appear in the camera view right at the start of acquisition, continued to collect a number of dairy cows until the last walk to view the left edge of a video segment, the total acquisition gets 5 videos.The video is captured in AVI format and stored in the camera local storage card.The frame rate is 24 fps, the total bit rate is 39813kbps, and the resolution is 1280 pixels (horizontal) x 720 pixels (vertical).The program is written in C++, using MFC as the framework for development.The videos were translated into pictures at a rate of 24 frames per second by Total Video Converter, excluding the ones into which the cow followed, paused or showed less than 50% of body parts, forming about 1500 pictures of 60 cows.Figure 3 shows the changes in the posture, blurred, occlusion, and position of the pictures of some dairy cows, and puts forward some challenges to the recognition algorithm.

Experimental scheme
From the above experiments, it is found that under the same sample and the same conditions, the L component of Lαβ color space has a higher recognition rate.In this paper, the L component of Lαβ color space is used as the best component of cow recognition.Figure 4 is a process flow chart for the experiment of the identification system.

Experimental results and analysis
In the experiment, each cow was selected a complete picture of the cow body as the sample library in the database from 15 to 30 pictures of 60 cows, and each cow was randomly selected 10 pictures (except for a sample picture selected outside) as the test images, a total of 600 test images as a group, the 6 groups randomly the data of experiment, the experimental results are shown in Table 2, the average recognition rate of 98.33%.The results of this paper are compared with other algorithms for detecting local features of the same type, as shown in Table 3. ORB [9] (Oriented FAST and Rotated BRIEF) is a fast feature point extraction and description algorithm.SURF [10] (Speeded-Up Robust Features) is an improvement to the SIFT algorithm, which solves the shortcoming of high complexity and time-consuming.

Conclusion
In view of the special nature of the cow body pattern, this paper proposes a SIFT recognition method based on the L component of Lαβ color space, this method can overcome the posture, position, the unfixed size of the cow in the picture and other issues with a strong detail extraction ability, so it can be easily used for fast matching in large data set.Through the experiment, the recognition rate of 98.33% is obtained by this method.
The research and development of cow image recognition management system can overcome many problems such as the high cost of RFID, non-uniform technical standard as well as the difficulties of large-scale promotion and so on.Therefore, it is necessary to realize the individual cow no contact, high accuracy and low cost identification and to improve the safety of dairy products, dairy modernization, as well as the intelligent optimization management by the image recognition technology.

1 .
Feature extracting steps based on SIFT algorithm (1) Scale Space Extreme Value Detection in Scale Space: Search the image position on all scales, finding out MATEC Web of Conferences 176, 01023 (2018) https://doi.org/10.1051/matecconf/201817601023IFID 2018 potential points of interest for rotation and scale invariance by using the Gaussian differential function.
(a) ~ (r) for the same cow image on different color components.

1 .
H component(e)S component (f)V component (g)YUV (h)Y component (i)U component (j)V component (k)YCrCb (l)Y component(m)Cr component (n)Cb component (o)Lαβ (p)L component (q)α component (r)β component Fig. shows the same cow in different color spaces

Fig. 2 .
Fig. 2. the three view of cow image collection The CPU, Intel(R) Core(TM) I7-2600k,was used as the subsequent video processing platform whose main frequency is 3.4GHz,memory 4GB,hard drive 1TB with Microsoft Visual Stdio 2010 being the development platform.Opencv2.4.11;database for SQL Server 2008;The program is written in C++, using MFC as the framework for development.The videos were translated into pictures at a rate of 24 frames per second by Total Video Converter, excluding the ones into which the cow followed, paused or showed less than 50% of body parts, forming about 1500 pictures of 60 cows.Figure3shows the changes in the posture, blurred, occlusion, and position of the pictures of some dairy cows, and puts forward some challenges to the recognition algorithm.

Fig. 3 .
Fig.3.sample of cow images 60 cows were numbered from 1 to 60, and each cow was about 15~30 pictures.In order to improve the efficiency of the program, all the original image sizes are compressed to 192*108 pixels.

Table 1 .
Accuracy and time consuming in each color space component for SIFT algorithm

Table 2 .
Experimental recognition rate

Table 3 .
Recognition rate of several cow image recognition algorithms