## 4 Experiments and Results
### Results
#### 4.2.2 Object Detection as Stream Processing  
Figure 6 shows a comparison of the prediction times per frame between edge, fog, and cloud layers for the object detection stream processing application. We deployed the object detection application using both the YOLO V2 and Tiny YOLO models on Apache Flink, and the detailed application parameters are described in Section 4.1.2. We repeated the execution 10 times for each computing paradigm to obtain more accurate average. Although we intended to set the same CPU and memory size for all computing layers, the cloud layer failed to allocate resources for the hosting of object detection models with the same CPU and memory size as the fog layer. Thus, we chose the c3.2 xlarge instance type as a larger instance type in the region. It can be easily concluded that the fog layer outperformed the cloud layer and edge layer. For the YOLO V2 model, the average prediction time per frame was 0.765 s in the cloud layer, 0.367 s in the fog layer, and 2.138 s in the edge layer. For the Tiny YOLO model, the average prediction time was 0.23 s, 0.11 s, and 0.76 s in the cloud, fog, and edge layers, respectively. The observed lower performance in the edge layer, as anticipated, can be attributed to the resource limitations of edge Raspberry devices. Thus, the edge layer may struggle to meet the time-sensitive demands of certain applications. However, if the primary focus is on efficient resource utilization and time is not a critical factor, deploying on-edge devices remains a feasible option. This tradeoff emphasizes the need to carefully consider the specific requirements of an application and choose the computing layer accordingly. In contrast, both the fog and cloud layers, with more robust resources, showcase superior performance. However, for both models, i.e., YOLO V2 and Tiny YOLO, we found that the average prediction time of the cloud layer was approximately two times that of the fog layer, although we deployed the Flink cloud layer with a large number of CPU cores and a large amount of memory. This needs to be explored further in the future, but possible reasons are the actual specifications of the CPU, the CPU architecture, and the instance type. In the fog layer, the specifications of the CPU were as follows: 12 th Gen Intel(R) Core(TM) i7-12700 2.10 GHz. We noticed that although we deployed four worker nodes as a cluster, only one worker node was occupied with jobs because of the single-input video stream. To exploit the full advantages of streaming platforms for object detection cases, multiple video streams that can be distributed and parallelized to nodes in the cluster need to be ingested through the use of a message-queuing platform such as Kafka. Furthermore, to examine the real-time detection rate in the computing layers, we set the frame transition to 200 milliseconds and measured the number of frames that could be successfully detected and predicted from a total of 5792 frames. As shown in Table 2,  
Figure 5: Impact of executor memory size on performance. the fog-layer detection rate was higher than that of the cloud layer, and the edge-layer detection rate was only 4.49%. In the edge layer, the detection rate was significantly lower compared to the fog layer and cloud layer. We observe that in all three computing layers, all frames could not be detected during real-time video playback. In this case, a message-queuing system such as Apache Kafka can be deployed for the temporary storage and processing of video frames. In addition, the speed requirements for object detection from surveillance cameras vary depending on the specific use case and scenario. In real-time applications such as autonomous vehicles, low latency and high processing speeds are critical in making instantaneous decisions. There are also application scenarios that do not require instant decisions, such as environmental monitoring. Without such information, it is unfeasible to conclude whether a given edge or fog deployment is suitable for the use case in absolute terms.