# A Multidimensional Data Collection and Edge Computing Analysis Method
## 3 Overall System Architecture and Improved Target Detection Model
### Object Detection and Sensing Data Correction
#### 3.2.2 Improved Target Detection Model  
The improved target detection model is based on the original YOLOv4-tiny target detection. First, the U-Net neural network model is introduced in the preprocessing of the dataset to enhance the clarity of the initial image by super-resolution processing, which was introduced in the previous section. Second, the loss function of the YOLOv4-tiny model is modified in the training process. Lastly, in order to extract the public spatial target parameters, the target coordinates, position and height measurement mechanisms are initiated in the model, combined with the introduction of GPS sensors to effectively locate the camera position, and the target parameters are computed through the images captured by the camera. The improved structure is shown in Figure 5.  
Vision systems need to ensure that images captured by cameras can be analyzed in real time, so the YOLO model is well suited. Considering the requirement of lightweight models in edge computing platforms, we choose YOLOv4-Tiny released on 25 June 2020 [34]. Compared with YOLOv3-Tiny [36], it is a huge improvement. Although YOLOv4-tiny is able to recognize the input images in real time, the accuracy is still not high enough, because the installation position of the cameras in public space causes different people and objects to be at different distances from the cameras, so the size and location of the detected  
Figure 4: Comparison of slices before and after treatment: (**a**) Night images; (**b**) Results of U-Net image processing. targets are different. Accordingly, we have improved the model to adapt to the need for accurate real-time detection of images. The YOLOv4-tiny model achieves model optimization by regressing the minimal loss function by means of parameter iteration, where the loss function in turn incorporates classification loss, confidence loss, and complete intersection over union (CIOU) loss. Classification loss is used to extract the classification information of objects in the image. Confidence loss is used to determine whether the target is included. And CIOU loss is used to determine the overlap area, center distance, and aspect ratio of recognized objects. The model structure and loss function of YOLOv4-tiny are provided in Figure 6.  
The classification process is divided into crowds, fitness equipment, bicycles, and vehicles. In the process of classification training, there is a problem that the size of people and fitness equipment are close to each other, leading to indistinguishability. Thus, we insert the binary cross entropy (BCE) loss function in the classification loss function, where the predicted value is denoted by P, which is 0 or 1, respectively. The probabilities of the same type in the same image are estimated on average, as shown in the following equation:  
\[BCE(P_{x})= \begin{cases}-logP_{x},&\text{if }P=1\\ -log(1-P_{x}),&\text{otherwise}\end{cases}  \tag{9}\]  
Figure 5: Improved object detection model. Figure 6: Model structure and loss function of YOLOv4-tiny. In order to increase the classification weight of fitness equipment, we introduce a weight factor a by which the classification loss function is effectively modulated. The improved classification loss function is given in the following equation. \[BCE(P_{x})= \begin{cases}-(1-P_{x})^{a}logP_{x},&\text{if }P=1\\ -log(1-P_{x}),&\text{otherwise}\end{cases}  \tag{10}\]  
The improved classification loss function is:  
\[ \begin{split} Loss_{class}&=-\sum_{i=0}^{S*S}I_{i}^{ obj}\sum_{c\in classes}[\left(\hat{P}_{i}(t)\right)^{a}\\ & P_{i}(t)log\hat{P}_{i}(t)+(1-\hat{P}_{i}(t))log(1-\hat{P}_{i}(t)) \right]\end{split}  \tag{11}\]  
We do not modify the confidence loss function. We enhance the CIOU loss function primarily considering the problem that people and fitness equipment are not well distinguished, and adjust the weight factor k to the central distance of the target detection. This middle distance weight can effectively enhance accuracy.