# Design and Implementation of Industrial Accident Detection Model Based on YOLOv4
## 2 Related Works
### Object Detection Model  
Various open object detection models have been proposed. Starting with the region-based convolutional neural network (R-CNN) in 2014, Fast R-CNN, Faster R-CNN, Mask R-CNN, YOLO, and the single-shot detector (SSD) have subsequently been released. These models can be divided into single-stage and two-stage models [26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37]. The two-stage method is a method in which a separate module creates a proposal for a region of interest; it first finds an object in an image and then classifies it. The R-CNN family belongs to this category. In contrast, the single-stage method is a technique for simultaneously proposing a region of interest and organizing an object using a single-shot technique. The YOLO and SSD models belong to this group. Table 2 compares the models' image input size, accuracy, and frames per second (FPS). The accuracy values shown in Table 2 are based on an indicator called the average precision (AP) used in object detection. The AP uses the intersection over union (IoU), i.e., the intersection of the entire union of the correct object and the object observed by the model. If this IoU value is enormous, the model should measure more accurately because the intersection of the valid object and the object followed by the model should be more significant. The IoU value can be adjusted to calculate the precision and recall. The formulas for precision and recall are shown in Equation (1) below:  
\[ \begin{array}{l}Precision=\frac{True\ Positive}{True\ Positive}\\ Recall=\frac{True\ Positive}{True\ Positive+False\ Negative}\end{array}  \tag{1}\]  
The AP is obtained by calculating the precision and recall for each class using the above formulas and taking the average value for all categories. The IoU value of the AP is marked with a subscript; thus, the IoU value of the AP in Table 2 is set to 0.5. Overall, it can be seen that the two-stage model has a high AP but low FPS, whereas the single-stage model shows the opposite tendencies. YOLOv4 was ultimately selected for this study as a model with a high processing rate and high accuracy between the FPS and AP. YOLOv4 refers to the fourth version of the object detection model following the YOLO model. It uses a backbone network combining a cross-stage partial (CSP) technique and the Darknet53 used in previous versions. The CSP technique reduces the number of computations by preventing the reuse of gradient values [38]. In addition, a spatial pyramid pooling (SPP) technique and the PANet technique were mixed. The SPP technique performs more accurate feature extraction by extracting features from an image as a spatial pyramid [39]. The PANet technique up-samples feature extraction filters or images, down \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Year** & **Model** & **Input Size** & **Accuracy** & **FPS** \\ \hline
2014 & R-CNN [26] & 224 & 58.5 & \textless{}0.02 \\
2015 & Fast R-CNN [27] & - & 65.7 & \textless{}0.43 \\
2015 & YOLO [30] & 448 & 57.9 & 45 \\
2016 & Faster R-CNN & - & 67.0 & 5 \\
2016 & SSD [34] & 300 & 41.2 & 46 \\
2016 & YOLOv2 [31] & 352 & 44.0 & 81 \\
2018 & Mask R-CNN & 800 & 62.3 & 5 \\
2018 & YOLOv3 [32] & 320 & 51.5 & 45 \\
2019 & YOLOv4 [33] & 512 & 64.9 & 31 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Compare accuracy and frames per second (FPS) of object detection models, including region-based convolutional neural network (R-CNN) and single-shot detector (SSD). samples them, and then aggregates them [40]. This makes it possible to extract more diverse features. YOLOv4 employs these techniques to overcome the difficulties in detecting small objects in previous versions of YOLO problems. Figure 4 is a simple schematic diagram of the YOLOv4 model. To compare YOLOv4 to other models, we experimented with the performance of SSD + MobileNetV2 and CenterNet [33; 34; 41; 42; 43]. The two models compared are one-stage methods similar to YOLOv4. The one-stage approach simplifies the structure of the model to allow for fast object tracking.