# Cattle Weight Estimation Using Fully and Weakly Supervised Segmentation from 2D Images
## 3 Results and Discussion  
Twelve kinds of features were extracted from the segmentation mask; the nine features with correlation coefficients greater than 0.5 were used as input to the weight estimation model, and the actual weight was used as the ground truth. The proposed model has a fully connected layer consisting of an input layer, nine hidden layers, and an output layer. The residual connection of ResNet is used in every two layers. Generally, neural networks can solve multi-dimensional problems as the network deepens; however, this causes the gradient vanishing phenomenon to increase. A residual connection is used in the weight estimation model structure because it solves the gradient vanishing problem using only an addition operation, enabling the network to be deeper. The mean squared error was used as a loss function to handle large errors. Every layer has 32 nodes. The batch size, depth of the model, and number of nodes were set to the values that yielded the best performance in the experiments. Overfitting was prevented by stopping learning when no improvement in the validation results was observed over 20 epochs. For evaluation, we used the mean average error (MAE), which is a commonly used error metric. Of the 43 cattle, 23 (4251 images) were used for learning, and 20 (4765 images) were used for testing. In addition, the results of the proposed method were compared with those obtained using support vector regression (SVR) based on the radial basis function (RBF) kernel and polynomial kernel. Grid search was used to tune the optimal parameters for SVR. The results are shown in Table 4. Our proposed weight estimation system achieved the highest performance for both FSS and WSS. For the FSS mask, the RBF and polynomial kernel SVRs achieved MAPE scores of 7.7% and 11.6%, respectively, and the proposed method achieved a MAPE of 5.5%. For the WSS mask, the RBF and polynomial kernel SVRs achieved MAPE scores of 11.3% and 14.4%, respectively, and our method achieved 10.1%. In SVR, the kernel maps data to higher dimensions, allowing more complex problems to be solved. The Gaussian and polynomial kernels can be respectively expressed as follows. \[\text{K}(\text{x},\text{y})=\exp\Bigl{(}-\gamma\|x-y\|^{2}\Bigr{)} \tag{3}\] \begin{table}
\begin{tabular}{l l l l} \hline \hline  & **Method** & **MAE (kg)** & **MAPE (\%)** \\ \hline \multirow{3}{*}{FSS} & Ours & 17.31 & 5.5 \\  & SVR (RBF) & 27.57 & 7.7 \\  & SVR (Polynomial) & 41.29 & 11.6 \\ \hline \multirow{3}{*}{WSS} & Ours & 35.91 & 10.1 \\  & SVR (RBF) & 40.12 & 11.3 \\ \cline{1-1}  & SVR (Polynomial) & 51.45 & 14.4 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Weight estimation performance of FSS and WSS. \begin{table}
\begin{tabular}{c c} \hline \hline
**Selected Feature** & **Pearson Correlation Coefficient** \\ \hline Area & 0.763 \\ Convex Hull Area & 0.721 \\ Circumscribed Circle & 0.651 \\ Minimum Area Rectangle & 0.644 \\ Major Axis Length & 0.619 \\ Perimeter & 0.576 \\ Minor Axis Length & 0.539 \\ Grid Length (Horizontal) & 0.462 \\ Grid Length (Vertical) & 0.450 \\ Aspect Ratio & 0.316 \\ Eccentricity & 0.141 \\ Solidity & 0.057 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Features selected for the WSS method and their correlation coefficients. \[\text{K}(\text{x},\text{y})=\Big{(}\text{x}^{T}y+c\Big{)}^{d}. \tag{4}\]  
In Equation (3), x-y is the Euclidean distance, and \(\gamma\) is a parameter that controls the area over which the kernel filters. In Equation (4) \(d\) determines the order of the polynomial and \(c\) adjusts the coefficients of the polynomial. We performed additional experiments to determine the optimal features that correlate with cattle weight. The experiments were conducted based on the Pearson correlation coefficients of the features. The results obtained by our model are presented in Table 5 and the results obtained by SVR are presented in Table 6. As can be seen in Table 2, for the FSS mask, two features with correlation coefficients less than 0.5 have very small correlation coefficients, \(-0.029\) and 0.127.