# EnsemblePigDet: Ensemble Deep Learning for Accurate Pig Detection
## 4 Experimental Results
### Evaluation of Detection Performance
\begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Model**} & \multicolumn{3}{c}{**\# Error Frames with Manual Inspection**} \\ \cline{3-4}  & & \multicolumn{2}{c}{**(ACC\({}_{\text{manual\_inspection}}\))**} \\ \cline{3-4}  & & **13,997 Key Frames** & **4193 Hard Frames** \\ \hline \multirow{3}{*}{Single Model} & Baseline YOLOv4 & 3889 (72.21\%) & 1866 (55.49\%) \\  & Model A (proposed) & 1532 (89.05\%) & 808 (80.72\%) \\  & Model B (proposed) & 1757 (87.44\%) & 738 (82.39\%) \\ \hline \multirow{2}{*}{Ensemble Model} & EnsemblePigDet (proposed) & 649 (95.36\%) & 302 (92.79\%) \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Comparison of accuracy ACC\({}_{\text{manual\_inspection}}\) for 13,997 key frames and 4193 hard frames with overexposed regions (obtained during 8:30 a.m. to 10:30 a.m.). Table 6, a trained model that included raw input showed higher accuracy than the trained model that applied image preprocessing. In addition, training all of image preprocessing A, image preprocessing B, and raw input together and dividing them into image preprocessing A + raw input and image preprocessing B + raw input showed higher accuracy. In the case of the model ensemble, the ensemble of two models with high accuracy on a single model is shown to have the best accuracy. Tables 7 and 8 show the combination results of Confidence1 and 2 and Threshold1 and 2 for 13,997 key frames. Table 7 shows the result of setting Confidence1 and Threshold1 conservatively and Confidence2 and Threshold2 aggressively. As the Confidence1 and 2 values increased, accuracy showed a decreasing trend. In addition, unrelated to the values of Confidence1 and 2, the accuracy tended to decrease with the increase of the Threshold1 value. Table 8 shows the results of setting Confidence1 and Threshold1 aggressively and Confidence2 and Threshold2 conservatively, exhibiting similar results to Table 7, where the accuracy was shown to decrease as Confidence1 value increased. Nevertheless, unrelated to the confidence value, the accuracy increased when Threshold1 and 2 values increased. The overall accuracy was shown to increase when Confidence1 and Threshold1 were set aggressively and Confidence2 and Threshold2 were set conservatively. When comparing the ensemble model to the single model in Tables 7 and 8, the accuracy was shown to increase. Therefore, based on the combination of confidence and threshold, the ensemble model displays less accuracy than a single model. \begin{table}
\begin{tabular}{c c c c} \hline  & \multicolumn{3}{c}{**\# Error Frames with max\_pigs**} \\ \cline{3-4}  & **Proposed Models** & \multicolumn{3}{c}{**(ACC\({}_{\text{max\_pigs}}\))**} \\ \cline{3-4}  & & **Test Data with** & **Test Data with** \\  & & **Preprocessing A** & **Preprocessing B** \\ \hline  & Training Data with Preprocessing A & 4111 (70.06\%) & 13,997 (0.00\%) \\ \cline{2-4}  & Training data with Preprocessing B & 6391 (54.34\%) & 3287 (76.51\%) \\ \cline{2-4}  & Training Data with Preprocessing A and Preprocessing B & 3741 (73.27\%) & 4198 (70.00\%) \\ \cline{2-4}  & Training Data with Preprocessing A and Raw Input & 1619 (88.43\%) & 10,743 (23.24\%) \\ \cline{2-4}  & Training Data with Preprocessing B and Raw Input & 3881 (72.27\%) & 1844 (86.83\%) \\ \cline{2-4}  & Training Data with Preprocessing A and Raw Input & 3185 (77.24\%) & 3891 (72.20\%) \\ \hline  & Training Data with Preprocessing A + Preprocessing B & 2498 (82.15\%) & \\ \cline{2-4}  & Training Data with Preprocessing A and Raw Input + Preprocessing B and Raw Input & 621 (95.56\%) & \\ \hline \end{tabular}
\end{table} 
Table 6: Comparison of accuracy ACC\({}_{\text{max\_pigs}}\) for 13,997 key frames with overexposed regions (obtained during 8:30 a.m. to 10:30 a.m.) with different training data.