# Depth-Oriented Gray Image for Unseen Pig Detection in Real Time
## 4 Experiment Results
For instance, if the Inference Time is 10 ms, the model can process 100 images per second. Table 2 presents the results of testing models trained on grayscale images when the test image types were grayscale, Depth Anything, and the proposed method (DOG). For real-time detection, the smallest model variants, whereby the model ending with n is nano and t is tiny, were employed. The results showed that testing with depth images overall improved AP50 from 3% up to 9.5% compared to testing with the grayscale images of unseen data from Jochiwon. Additionally, the accuracy of all detection models improved compared to that of the baseline, demonstrating more stable detection performance in unseen environments when using depth images. This indicated that depth images can resolve difficulties in object detection when there is a distinction between the foreground and background. Comparing the test results of grayscale and DOG images revealed that even without training on DOG images, detection of unseen data using DOG images overall improved AP50 from 2.7% up to 6.4% over grayscale image detection. For test images with a resolution of 640 \(\times\) 640, the Inference Time for Depth Anything using the Depth Anything small model on a GPU was 193.7 ms. In contrast, the proposed DOG image transformation took 3.6 ms on a CPU, demonstrating a 53.8-times increase in processing speed. Furthermore, the results emphasized the practicality of the proposed method for real-time applications. Unlike Depth Anything, which relied on computationally expensive GPU-based processing, the proposed method achieved significant speed improvements by \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Train** & **Test** & **Detection** & **TP** & **FP** & **FN** & **AP50** & **Inference Time** \\
**Image Type** & **Image Type** & **Model** & **Model** & **Model** & **Model** & **Model** & **Model** \\ \hline \multirow{8}{*}{Gray} & Gray & YOLOv8n [48] & 3838 & 493 & 760 & 90.4 & 5.8 \\  & Gray & YOLOv9t [49] & 3845 & 657 & 753 & 88.8 & 10.6 \\  & (Baseline) & YOLOv10n [50] & 3723 & 555 & 875 & 88.3 & 6.6 \\  & & YOLOv11n [10] & 3972 & 433 & 626 & 93.2 & 5.9 \\ \cline{2-7}  & \multirow{4}{*}{Depth} & YOLOv8n [48] & 4383 & 185 & 215 & 97.0 & 199.5 \\  & & YOLOv9t [49] & 4440 & 54 & 158 & 98.2 & 204.3 \\  & & YOLOv10n [50] & 4333 & 217 & 265 & 96.4 & 200.3 \\  & & YOLOv11n [10] & 4236 & 127 & 362 & 96.2 & 199.6 \\ \cline{2-7}  & \multirow{4}{*}{DOG} & YOLOv8n [48] & 4283 & 226 & 315 & 96.8 & 9.4 \\  & & YOLOv9t [49] & 4184 & 386 & 414 & 91.8 & 14.2 \\ (Proposed) & YOLOv10n [50] & 4140 & 351 & 458 & 94.1 & 10.2 \\  & & YOLOv11n [10] & 4370 & 423 & 228 & 95.9 & 9.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance of each different YOLO model versions tested with unseen environment data. utilizing lightweight CPU-based operations. This efficiency made it particularly suitable for deployment in low-resource environments, such as farms, where high-performance computing infrastructure was not readily available. Figure 7 illustrates the object detection results according to the test image types. The detection results of the object detection model varied based on the test image type. In the enlarged prediction results, green boxes represent TP, blue boxes represent FP, and yellow boxes represent FN. As shown, FP and FN occurred due to the ambiguity between the foreground and background in unseen environments, negatively impacting the accuracy of the object detection model. The Depth Anything and DOG Image detection results successfully detected all 23 pigs. However, errors still occurred in detecting the feeding troughs. These errors are attributed to the feeding troughs having a different shape from those in the training environment and having a depth similar to that of pigs. This issue can be resolved by setting the RoI as a red-highlighted area, as in the DOG Image with the RoI approach. Figure 8 shows the results of applying the proposed method across various environments.