# Depth-Oriented Gray Image for Unseen Pig Detection in Real Time
## 4 Experiment Results  
This study was conducted in the following hardware and software environments. The experiments were conducted on an Intel Core i7-7700K @ 4.20 GHz processor (Intel Corporation, Santa Clara, CA, USA) and a GeForce GTX 1660 GPU (NVIDIA Corporation, Santa Clara, CA, USA). The software environment was based on the Ubuntu 22.04 LTS operating system (Canonical Ltd, London, UK), with the deep learning models implemented and tested using PyTorch 2.0.1 (Meta Platforms, Inc. Menlo Park, CA, USA) and CUDA 11.7 (NVIDIA Corporation, Santa Clara, CA, USA). Figure 6 presents the data and training setup used in this study. The training dataset was sourced from the German pig dataset [13] and consisted of 985 images, divided into  
788 images for training and 197 for validation. The test dataset consisted of 200 images derived from videos acquired in Korea. Accuracy measurements were specifically conducted using data filmed at a pigsty on a farm located in Jochiwon-up, Sejong-si, Chungcheongnam-do, South Korea, involving 23 pigs. The test dataset additionally included images of another Korean pig, Belgian pigs, and Chinese pigs, specifically utilized to evaluate the generalization performance of the proposed method. The model was trained for 300 epochs with a batch size of 16 and a resolution of 640 \(\times\) 640. The dataset involving 23 pigs presented challenges such as indistinguishable separation between pigs and the background due to flooring materials and object overlap caused by feeding troughs located at the top. Additionally, the top-right area of the image was darker than other regions, which could result in detection errors. In contrast, the single image of another Korean pig exhibited clear separation between objects and the background but was prone to errors caused by sunlight. The Belgian pig image faced challenges in the central area, where objects and the background could not be distinctly separated, similarly to the 23-pig dataset. Lastly, the Chinese pig image included a black pig, which was absent in the training dataset (German pig dataset), and objects with dark colors that closely resembled the background, both contributing to potential detection errors. * True Positive (TP): TP represents the number of instances where the model correctly detects existing objects. For example, if an image in a real farm environment contains 23 pigs, and the model accurately detects 20 out of these 23 pigs, the TP value would be 20. A high TP value indicates that the model demonstrates excellent detection performance. * False Positive (FP): FP represents the instances where the model incorrectly detects an object in locations where no object exists. For example, if the model mistakenly identifies an area without a pig containing a pig, it counts as an FP. A lower FP value indicates higher reliability in the model's detection performance. * False Positive (FN): FN refers to the number of instances where the model fails to detect existing objects. For example, if a pig is present but the model does not detect it, it counts as an FN. A lower FN value indicates that the model detects objects without missing them. Figure 6: Examples of sample images from train and test datasets showing differences in seen and unseen environment. * Average Precision (AP): AP50 refers to the Average Precision at an Intersection over a Union (IoU) threshold of 50% or higher and is a metric used to evaluate the overall performance of object detection models. An IoU measures the overlap ratio between the detected bounding box and the ground truth bounding box, while AP represents the area under the Precision-Recall curve. AP50 clearly indicates how well a model can accurately detect objects with at least 50% overlap between predicted and actual boundaries. \[IOU=\frac{Area\ of\ Overlap}{Area\ of\ Union}\] \[AP=\int_{0}^{1}Precision(Recall)\ dr\]
* Inference Time: Inference Time represents the time (in milliseconds) a model takes to process a single image. It is a key metric for evaluating the model's real-time processing capability.