Recognition of Individual Holstein Cattle by Imaging Body Patterns

: A computer vision system was designed and validated to recognize an individual Holstein cattle by processing images of their body patterns. This system involves image capture, image pre-processing, algorithm processing, and an artificial neural network recognition algorithm. Optimum management of individuals is one of the most important factors in keeping cattle healthy and productive. In this study, an image-processing system was used to recognize individual Holstein cattle by identifying the body-pattern images captured by a charge-coupled device (CCD). A recognition system was developed and applied to acquire images of 49 cattles. The pixel values of the body images were transformed into input data comprising binary signals for the neural network. Images of the 49 cattle were analyzed to learn input layer elements, and ten cattles were used to verify the output layer elements in the neural network by using an individual recognition program. The system proved to be reliable for the individual recognition of cattles in natural light. (Asian-Aust. J. Anim. Sci. 2005. Vol 18, No. 8: 1194-1198)


INTRODUCTION
Dairy farmers seek to minimize labor in dairy production.Automation of milking and individual recognition systems have been extensively studied and developed for effective management of dairy cattle.In 1998, an automated robotic milking system was designed and manufactured by the National Livestock Research Institute of Korea (NLRI), in cooperation with Lee et al. (2001).The device used a computer vision system with two cameras to recognize four cattle teats.Using both a computer vision system and an individual recognition system would have increased the effectiveness of the robot in recognizing the cattle teats.
Several researchers have investigated the applicability of an individual recognition system for the management of Holstein cattle.Hoshiba et al. (1996Hoshiba et al. ( , 1998) ) developed a device that used a light source to recognize individual Holstein cattle for an automated milking system.Han et al. (1996) designed and manufactured a transponder and receiver circuit for an electronic recognition system to recognize and feed individual Holstein cows.While each receiving system was theoretically capable of managing 2 12 (4096) head of cattle, the researchers used a multiple of three to reduce the error in transmitting and receiving data.
In practice, 1,365 head could be handled by one receiving system.
Several other researchers have developed individual recognition devices for automated milking.However, the electronic identification devices used most commonly on dairy farms for automated milking have a serious problem.They have a range of only 0.3 m and must be attached to the neck of the cow or to the feeding unit to maintain the stability of the transmitting and receiving system.
The typical electronic identification device, referred to as a radio frequency Identification device (RFID), must be placed on the neck or on another part of the body.This restriction can result in different outcomes depending on the recognition distance and movements of the cow.Camera image processing can overcome these drawbacks for precision livestock farming.In 1995, the International Committee for Animal Recording (ICAR) imposed a set of requirements on the reading distance and reading speed (Geers et al., 1997) of RFIDs.Error-free reading of the RFID could be made at a maximum distance of 0.4 m and a moving speed of 3 m/s.However, modern transponders can read up to 0.8 m and at a speed of 4 m/s, as demonstrated by Klindtworth (1998).Therefore, a system that can recognize individual information from a cow using a noncontact sensor is needed.In this paper, the development of an individual recognition system was reported using computer vision instead of an electronic device to capture individual data on Holstein dairy cattle for more precise livestock farming.individual characteristics at the NLRI in Suwon, South Korea.The values of the input parameters for training were calculated by using the black and white body patterns of the 49 animals.Ten individuals were then used to validate the recognition system.The test to obtain and analyze the image data by image processing was performed August 1-10, 2000.

Experimental equipment
A CCD camera was used to capture a side image of each Holstein cow.The CCD camera was positioned on a pole to obtain an image ranging from 230-265 cm in width from the centerline of the experimental system (Figure 1).The image-processing system was located in a site where the diffusion of light and shadow could be minimized in order to produce clear images without noise (Figure 2).The system was installed near a passageway without artificial light, through which the cattle passed several times a day.The side-view camera was placed 250 cm from the centerline of the experimental system.
The image-processing system consisted of a Pentium III-450 MHz PC for data storage, a CCD digital-matrix camera (see Table 1 for specifications) and a TV frame grabber card (see Table 2 for specifications).The frame grabber board can digitize, display, and process multiple images with a spatial resolution of 640×480 pixels and with intensity levels of 0 to 255 for each color.However, the computer monitor screen only had a spatial resolution of 320×240 pixels.

Image processing
Pre-processing of images : To analyze an individual Holstein cow, the boundary line of the body must be isolated in the image of the cow.Since the images were not evenly illuminated, it was necessary to compensate their intensity values.To do this, the camera first captured an image of the background and then immediately captured a second image of both the cow and the background.Subtracting the second image from the first isolated the object.However, the subtracted image of the cow also contained the noise image, and subtraction can remove the background image.Because the subtracted image contained the object image and the noise image, component labeling and thinning transferring methods were used to detect the LG International Corp.  boundary line of the cow body.The boundary line is a profile line between the body shape and the background.The Sobel operator was used to define the boundary line, as this operator is less affected by the light intensity and the direction of outside illumination and also controls the range of pixels more easily than other operators do.Because the time of day and the intensity of the light could change several pixel positions, each image did not carry the same intensity value at the same pixel position.Therefore, the calculation of the boundary line created noise in the image data.
The component labeling and thinning transfer methods were used to reduce the noise.An element analysis method reduced the finer cells in the image, which included the boundary lines and the noise from the whole image.
Component labeling was used to reduce a very small region, which included the boundary lines and noise.After the boundary line was detected by this method, all pixels inside the line were fixed at constant intensity values.The values of the pixels outside the boundary line differed from those inside of it.Although the boundary line was calculated and the noise was removed, it was difficult in practice to detect the boundary line of a cow.
To overcome the limitations of the element analysis method, the thinning transferring method was applied.In this method, the inside or outside pixels are replaced by special pixels if the difference between the inside and outside values is >10 in duplicate calculations.The inside vertical value is then replaced by outside component pixels in a horizontal component pixel, in one horizontal line (Figure 4).All horizontal lines underwent this method.Figure 3 summarizes the shape detection method used.
Algorithm for image processing : The gray scale intensity values of the background images ranged from 100 to 150 depending on the body surface colors of the cows.For the whole image, the threshold value of the pixels was fixed at 128.The binary value was 1 for intensities exceeding the threshold value of 128 and 0 for intensities below the threshold value.The threshold value was very important, because it could be changed with illumination and noise.
To identify the individual characteristics of a cow, a whole image of each animal was obtained.A predefined rectangular area was then enlarged as shown in Figure 5(a) and (b).The rectangular window was separated from the whole image and converted into 240×320 pixels, as shown in Figure 5(b), where the x-axis represents body length and the y-axis is chest girth.The rectangle excluded the neck and legs, because it was difficult to obtain identical images of each cow.Moreover, including appendages could affect the success rate of the individuality-recognition trials.
After enlarging the rectangle, the second image was subtracted from the first, and the intensity value of the image was transformed into binary values based on the threshold value.Figure 6 shows the binary image of a cow.cows allow for individual identification, because the patterns do not change with growth (reference: www.ilovemilk.or.kr).Therefore, the patterns can be used as the values of the input layer in the neural network algorithm.
The learning input layer program was developed to determine values for use an input layer for learning in the neural network.The computer monitor screen had a spatial resolution of 320×240 pixels for the body area, with intensity levels ranging from 0 (black) to 255 (white).The spatial resolution of 320×240 pixels was transferred to 10×10 cells, where each cell represented an input unit of 32×24 pixels and a modified binary value from the body pattern in the image.For the learning input layer, the program displayed either "1" or "0" in the cells on the computer screen, as shown in Figure 7.The input factors were 100 units for the neural network learning structure.Figure 8 shows a neural network learning structure with 100 units plus bais 1 unit input layer elements, 16 hidden layer elements, and eight output layer elements.
One input layer contained 101 units, one hidden layer had 16 units, and one output layer had eight units.The one hidden layer in this algorithm could be detected independently within a separate linear interval.The hidden layer used 16 units, and the output layer used eight units to recognize individuals.The binary value of the output layer unit was 1 or 0. Table 3 displays the input data for training the back-propagation algorithm.

RESULTS AND DISCUSSION
The black and white body patterns of Holstein cattle were used to recognize individual cows by using learning input layer units in a neural network algorithm.49 Holstein cattle were used to test the individual-recognition method at the NLRI in S. Korea.Ten cattles were used to validate the recognition tests.
After imaging the 49 Holstein cattle to learn the input layer elements, ten cows were used to verify the output layer elements in the neural network by using an individual recognition program.Table 4 gives the binary values of both input layer elements and output layer elements for the ten cows.
49 Holstein cattles were evaluated to determine if the system could recognize individuals.The neural network algorithm was then used to validate the identity of ten cattles.Table 5 shows the decision values, which were obtained from both the target result and the output result.
Images of the ten cows were tested and validated for exact recognition of individuals.Although the vision system was located in the unlit passage of the livestock house, it was able to capture adequate data to recognize individual Holstein cows, based on their body patterns.

Figure 1 .
Figure 1.Dimensional sketch of the system for recognizing individual cattle.

Figure 2 .
Figure 2. Photograph of the system for recognizing individual cattle.

Figure 3 .
Figure 3. Flowchart of pre-processing for shape detection.

Figure 6 .
Figure 6.Binary images of the body patterns.

Figure 8 .
Figure 8. Structure of neural network learning for pattern recognition.

Figure 7 .
Figure 7. Input binary values in the neural network.

Table 1 .
Specifications of the CCD camera and lens

Table 2 .
Specifications of the grabber card

Table 3 .
Learning parameters of the network structure for body

Table 4 .
Relationships of the learning pattern values and the verification pattern values for ten Holstein cowsTraining units

Table 5 .
Individual recognition by using the learning pattern No.