## 3 Materials and Methods
### Dataset Creation  
After completing the segmentation processes in all images, the number of pixels occupied by the animals was calculated in the segmentation maps of the images from the left and right cameras for each animal. The distance of each animal to the camera plane was calculated by stereo calculation technique using segmentation maps. In order to calculate the distance of the animal to the camera plane from the segmentation maps, the position of the left border of the animal in pixels on the X-axis was determined in each of the image pairs. The disparity (\(d\)) value was calculated by subtracting the limit value in the segmentation map from the left camera and the limit value in the segmentation map coming from the right camera. Figure 9 shows the pixel numbers of the areas covered by a sample animal in the stereo image pair and the X-axis value of the left border of the animal in both images. The stereo distance calculation for a single animal is conducted as follows. As seen in Figure 9, if the \(X_{L}\) (Left camera view) and \(X_{R}\) (Right camera view) values are subtracted from each other, the disparity (d) value is found as 23 pixels. Along with this value, the distance value can be easily calculated using the focal length (\(f\)) from the stereo calibration matrices and the shift value (\(T\)) between the cameras from the translation matrix. As a result  
Figure 8: Segmentation results in stereo images taken from the rear: (**a**) Left camera input image; (**b**) Left camera segmentation map; (**c**) Left camera segmentation overlay; (**d**) Right camera input image; (**e**) Right camera segmentation map; (**f**) Right camera segmentation overlay. Figure 9: Disparity value and pixels count of the animal in the image: (**a**) Left camera segmentation map; (**b**) Right camera segmentation map. of the camera calibration processes, the focal length distance was obtained as 646.45 cm. The translation \(T\) value for our setup is 9.92 cm. The stereo distance calculation for the example animal in Figure 8 was obtained as in Equation (2). \[Z=\frac{fT}{d}\rightarrow\frac{646.45\times 9.92}{23}=278.82 \tag{2}\]  
After calculating the distance values for each animal, the number of pixels occupied by the animals in the images was also determined. Using all these values, a dataset consisting of 85 rows was created for a total of 85 animals. The created dataset is shown in Tables 2 and 3, and the distances are written in meters. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline \multirow{2}{*}{**ID**} & **Left Side** & \multirow{2}{*}{\begin{tabular}{c} **Right Side** \\ **Shooting** \\ **(Pixel)** \\ \end{tabular} } & **Side Pixel** & **Side** & **Left Back** & \multirow{2}{*}{\
\begin{tabular}{c} **Right** \\ **Difference** \\ **(Pixel)** \\ \end{tabular} } & **Side** & **Left Back** & \multirow{2}{*}{
\begin{tabular}{c} **Back Pixel** \\ **Shooting** \\ **(Pixel)** \\ \end{tabular} } & **Back** & **Distance** & **Weight** \\  & **(Pixel)** & **(Pixel)** & **(m)** & **(Pixel)** & **(Pixel)** & **(Pixel)** & **(Pixel)** & **(m)** & **(kg)** \\ \hline  
& 5370 & 5 & 12.82 & 389 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Dataset created using semantic segmentation and stereo images.