DEVELOPMENT OF A TRANSFER FUNCTION FOR WEIGHT PREDICTION OF LIVE BROILER CHICKEN USING MACHINE VISION

The objective of this study was to process digital images to investigate the possibility of broilers body weight estimation based on the dynamic model. For this experiment, 2440 images were recorded by a top-view camera from 30 birds. An ellipse fitting algorithm was applied to localize chickens within the pen, by using a generalized Hough transform. Chickens’ head and tail were removed efficiently using the Chan-Vese method. After that, using image processing, six body measures were calculated. Next, they were used to design a Transform Function (TF) model with weight measurements as output. Secondorder dynamic models were used to predict the weight of life broiler chicken, without delay, stable and with the highest R were predominantly selected according to the Young Identification Criterion (YIC) criterion chosen models. It was observed that predicted values rigorously follow the real values. Moreover, the relative body weight errors of chickens in the early days of grow-out was much more than last days. The accuracy of TF for body weight prediction from a comparison between measured (absolute) and predicted total life body weights were estimated for all studied broiler chicken (R=0.98).


INTRODUCTION
Many scientific researchers have already practiced the technology of monitoring broilers by camera and image processing since it is non-intrusive and costeffective technology which can work automatically in real-time.Amongst the different features that can be monitored via image analysis, weight is of great importance.Monitoring the broiler's weight is essential for effective animal management in farms.Furthermore, information about body weight offers possibilities in automatic control of the flock, and help supporting farmers in relation to complex biological production processes (e.g., feeding strategies, growth rate control, activity control as proposed by Morag et al. (2001), Halachmi et al. (2002), and Aerts et al. (2003a, b).
It is critical to forecasting the impact of diseases in a flock, and the average weight and weight range at slaughter few days in advance (Lott et al., 1982;Turner et al., 1984;Flood et al., 1992).
The standard method to estimate the animal's weight is laborious, costly, time-consuming, and also require direct contact with the animal's body which is stressful for both animals and farmers.Moreover, direct contact may even cause injury to animal (Brandl & Jørgensen, 1996).Frost et al. (1997) studied a measurement method based on computer-assisted visual images and digital images to avoid direct contact with animals' bodies.De Wet et al. (2003) employed computerassisted image analysis to estimate daily body weight changes of broiler chickens.Some researchers previously studied the ability of machine vision system to relate large numbers of images through statistical analysis to animal weight on a daily basis and determined the changes in measured parameters accurately (Marchant & Schofield, 1993;Brandl & Jørgensen, 1996).Therefore, Computer vision is a robust method to capture and estimate the weight of animal objectively and in real time (Viazzi et al., 2014) and would be an asset to large-scale broiler producers (Mollah et al., 2010).Odone et al. (2001) used a support vector machine to define the relation between fish weight and shape parameters with an error of ± 3% (Wongsriworaphon et al., 2015).The authors employed an approach based on digital image analysis to estimate the live weights of pigs in farm environments with an error rate of less than 3% on average.Viazzi et al. (2014) used single-factor regression equation with the area of the fish (Scortum barcoo) without considering the fin tail to predict the total mass of the body.According to reported results, the coefficient of determination (R 2 = 0.99) and Engenharia Agrícola, Jaboticabal, v.38, n.5, p.776-782, sep./oct. 2018 the mean relative error (6 ± 3%) was obtained compared to the value measured by a weighing scale.In another study, Alonso et al. (2013) used support vector regression to predict carcass weight in beef cattle in advance of the slaughter.According to their results, it was possible to predict carcass weights, 150 days before the slaughter day with an average absolute error of 4.27% of the actual value.The objective of this study was to process digital images to investigate the possibility of estimating body weight of broilers based on a dynamic model.

Birds and housing
The experiment was carried out in a commercial broiler house in the animal husbandry station at Ramin Agriculture and Natural Resources University.The light during the first three days of rearing was 24 hours and after that, until the end of the grow-out period, 23 hours of light and 1-hour darkness were applied.The average air temperature was set at 34°C during the first week, while the temperature was decreased to just under 20°C to the end of the growth period.During the current experiment, thirty number of 1-day-old Ross broiler chickens (mixed sexes) with the weight of 40 ± 5 g were brought to the house, and grew-up during 42 days.The broilers were kept in three pen-sized 1m 1 m (10 birds/ m 2 ), and they had access to water from automatic cup-drinkers.Furthermore, commercial diet was according to NRC (1994).

Experimental design, image, and weight data collection
The chicken broiler images were captured using a SAMSUNG digital camera (SM-N9005, Korea), and image format was JPEG.An assistant device was set up to support the camera, which consisted of a 2.0 m height vertical stand and a horizontal arm mounted at 90° from the top of the upright position (Figure 1).The camera was operated in automatic exposure mode, and the adequate light was prepared to provide a proper balance between the outline containing shadows.Imaging was conducted twice a day between 7 to 8 am and 4 to 6 pm of the local time, also 2440 images were recorded from 30 birds inside the box individually.The box used for the image analysis had a dark floor to provide a high contrast between the chicken and the background, measuring 50 cm×36 cm, and the same camera was installed in the central area above the bird at the height of 0.5 m above the floor.The capturing images, in this stage, were used to develop the dynamic model; after that, all the acquired parameters were calibrated in a way that they were valid for noninvasive weight prediction inside the pen.

Image processing
The objective of the first part of the image processing, image segmentation, is to obtain a binary image in which '1' represents broiler chicken, and '0' represents ground.An image processing algorithm was developed in this research to extract six features including area, convex area, perimeter, eccentricity, major and minor axis length using the Image Process Toolbox (Wang et al., 2008).For the first step, images were smoothed using histogram equalization.The second step of the image processing was image segmentation, which is probably the most critical stage in ensuring the high success of an image processing algorithm (Gonzalez et al., 2004;Zhang et al., 2011).After segmenting the broiler from the background, erosion and dilation commands with a disc structure were used for eliminating the shadows surrounding the broiler (Gonzalez et al., 2004).After segmentation, a white area corresponding to the exact shape of the animal on a black background was acquired.Finally, the head of the chicken was removed using the Chen-Vase model since it represents less than 4% of the body area, as suggested by Gao et al. (2014).

Weight estimation using the TF model
Transfer function model is one of the dynamic databased modeling approaches which is used for describing dynamic responses of systems; it relates the output(s) of the system to the input(s).In the case of a linear, timeinvariant, single-input, single-output system, the utilized model structure could be described by [eq.( 1)] (Young, 2011).
Engenharia Agrícola,Jaboticabal,v.38,n.5  Also, it is used in evaluation, the standard regression error (SRE), which is the average accuracy of prediction of the average weight (Equation 2), and the relative accuracy value (RAV), which indicates the relative accuracy (Brownlee & Brownlee, 1965), defined as follows: Where, xi and yi are input and the output vector values for i th input, i y is real weigh, ˆi y is predicted weigh, and n is sample's number.

RESULTS AND DISCUSSION
The first step of image processing was image segmentation and determination of the broiler chickens' location.To this end, images were binarized to remove the background using the adaptive thresholding method (Yang, 1994).After that, for localizing the chickens within the pen, an ellipse fitting algorithm by using a generalized Hough transform was performed (Davies, 1989).The model captures the shape variations due to some specific behaviors of the animal (e.g., bending the body) and frequent changes of the head position (De Wet et al., 2003).Schofield (1990) has indicated that removing the head and neck from the top view of the area of the pig resulted in the strongest correlation with body weight.Therefore, the Chen-Vese algorithm was applied on segmented images.Figure 2 shows the results of the different steps of image processing within the pen.It can be seen the chickens' head, and tail were effectively removed using the Chan-Vase method.Next, six body measures were calculated by the image processing.According to statistical analysis, there was no high correlation coefficient between eccentricity and body weight.Therefore, the other five features (area, convex area, perimeter, major and minor axis length) were used to design a TF model with weight measurements as output.To predict the weight of live broiler chicken predominantly second order dynamic models without delay, stable (namely all poles within the unit circle) and with the highest R 2 were selected according to the YIC criterion selected models.The optimal model structure is shown in Figure 3.A summary of the calculated relative errors for four birds is given in Figure 3.The accuracy of TF for body weight prediction was estimated from a comparison between absolute and predicted body weights over all broiler chicken averages with R 2 =0.98.Results are graphically presented in Figure 5.Moreover, MAPE, RMSE, SRE and RAV respectively calculated: 21.465, 102.97, 0.240 and 0.0578.The R 2 value of broiler weight in this research was delicately better than that reported by Kashiha et al. (2014) who estimated pig weight of 97.5% at the group level (error of 0.82 kg) and 96.2% individually (error of 1.23 kg) by computer-assisted digital image analysis.In Amraei et al. (2017a) study, Bayesian regulation ANN technique with an R 2 value of 0.98 as the best network was used for prediction of broiler weight and the most errors were less than 50 g.Other research for body weight broiler using support vector regression estimated R 2 = 0.98 as well (Amraei et al., 2017b).As it can be seen in the results, both studies present similar results.This research is also n are the orders of the respective polynomials.To build the model, different combinations for na, nbd and ntd were calculated.The resulting models using the coefficient of determination and a detection method to determine the most suitable model based on minimizing the measure of the Young Identification Criterion (YI) was studied(Young & Lees,  1993).To develop the dynamic model two-third of the total experimental data (1627 data) was used and the remaining data (813) was used to test it.The performance of a function f was measured by MAPE (mean absolute percentage error) and RMSE (root mean square error).

FIGURE 2 .
FIGURE 2. The image processing steps were: (a) the ellipses fitted to chickens' body; the segmented image (b) before and (c) after applying the Chan-Vese method which removes the areas that are not significant; and (d) the overlaying of the segmented chickens' body from the step (c) on the gray level image of the broiler chicken.

FIGURE 3 .
FIGURE 3. The TF model adapted to estimate broiler body weight (g) using body six feature (pixels) as inputs.

Figure
Figure4a, b, c, and dprove that predicted values rigorously follow the real values.Moreover, according to Figure4 e, f, g, and hthe relative body weight errors of the chickens in the early days of breeding were much more than last days.The relative errors in the initial stage of grow-out could be explained by the time the broilers spent resting on the floor.Resting on the litter could increase the body size of the broiler chicken and therefore would increase calculation errors.However, this result was better than those obtained byMollah et al. (2010) with higher errors in the last days of grow-out.

FIGURE 4 .
FIGURE 4. Broiler weight predictions from the first day to the 42 nd day of growth using TF.The horizontal axis represents the sample number; samples were ordered according to their predictions.Solid squares () are the predictions, and solid diamonds () are real values.
FIGURE 5.The found relationship between the chicken weight and the surface-area pixel value.
, p.776-782, sep./oct.2018In the above equation BW(t) is the body weight, t represents the discrete-time increments for weight estimation and measurement;