# Toward Scalable Video Analytics Using Compressed-Domain Features at the Edge
## 3 Methodology
### Light-Weight Runtime Moving Object Detection in the Video Compressed-Domain
#### 3.2.2 IoU-Based Moving Objects Tracking  
To apply the IoU-based object tracking, the detected clusters are normalized with a rectangle bounding box according to the cluster's size, as shown in Figure 8d,h. The correlated regions are connected into blobs. Each blob is represented by its top-left and bottom-right corners, i.e., \((x_{1},y_{1},x_{2},y_{2})\) may include one or many moving objects. Because the moving object's bounding box size and shape can be different comparatively frame by frame depending on the MV's intensity, to track the moving object, an object matching algorithm based on the overlapped area of bounding boxes is applied. We assume that the existence of the real motion is continuous frame by frame. For each bounding box \(B_{1}\) in the previous frame, we identify a bounding box \(B_{2}\) at the current frame with the highest IoU rate. Note that IoU is attained by:  
\[IoU(B_{1}\bigcap B_{2})=\frac{\|B_{1}\bigcap B_{2}\|}{\|B_{1}\bigcup B_{2}\|} =\frac{\|B_{1}\bigcap B_{2}\|}{\|B_{1}|+|B_{2}|-B_{1}\bigcap B_{2}\|} \tag{3}\]  
By its definition in Equation (3), IoU is invariant to the scale, indicating that the similarity between two arbitrary shapes A and B is independent of the scale of their space. The IoU computation's pseudo-code is given in Algorithm 1. If two bounding boxes do not overlap, the IoU value will be zero, and if the IoU score is greater than a detection score threshold (\(\alpha\)), two bounding boxes are considered in the same account (Figure 10). The detection score threshold is determined through experiments and depends on the object velocity, as well as the distance between objects and the camera. Therefore, the method is run multiple times with different detection score thresholds to tune the best value for each application scenarios. ```
Data: Corners of the two bounding boxes. - First bounding box: \(A1(x_{1},y_{1}),B1(x_{2},y_{1}),C1(x_{2},y_{2}),D1(x_{1},y_{2})\) - Second bounding box: \(A2(x_{1}^{\prime},y_{1}^{\prime}),B2(x_{2}^{\prime},y_{1}^{\prime}),C2(x_{2}^ {\prime},y_{2}^{\prime}),



resource for processing and the skip frame case, respectively. For the conventional method of video analytics server, where \(T=S\) because all frames are processed, the computing resource average is:

\[Comp_{c}=S \tag{4}\]

With our proposed method, the computing resource average during \(N\) frames is calculated as the following equation:

\[Comp_{p}=\frac{(K\times S+(N-K)\times T)}{N} \tag{5}\]

The performance ratio of the two methods is:

\[\frac{Comp_{p}}{Comp_{c}}=\frac{(K\times S+(N-K)\times T)}{N\times S}=\frac{K}{ N}+(1-\frac{K}{N})\times\frac{T}{S} \tag{6}\]

If an object motion always appears in the video (\(K\approx N\)), then:

\[\frac{Comp_{p}}{Comp_{c}}\approx 1. \tag{7}\]

In the case of GPU computing resource, when the VA server skips a frame, then \(T=0\) and:

\[\frac{Comp_{p}}{Comp_{c}}=\frac{K}{N} \tag{8}\]

If the computing resource is CPU utilization and network throughput, \(T\) becomes very small. For example, \(T\) is used only for listening new data or the connection with the networking resource, then:

\[\frac{Comp_{p}}{Comp_{c}}\approx\frac{K}{N} \tag{9}\]

Figure 10: Object matching method. ## 4 Implementation and Performance Evaluation

In this section, the implementation and performance evaluation of the edge-to-cloud system with the proposed method is presented. Furthermore, the information of the video datasets and the scenario setup are provided. In this implementation, the VA server executes the application of intrusion detection. Although the evaluated platform integrates a specific application, it is a general design and can be extended to other applications with few modifications. The workflow of the evaluated platform is represented in Figure 11. It has two main components:

* Edge node implementation: The streaming data from the camera sources are parsed, and the proposed method is applied to detect moving objects in the current frame.