# Improved Lightweight YOLOv4 Foreign Object Detection Method for Conveyor Belts Combined with CBAM
## 1 Introduction
The Fast-RCNN model has a high detection accuracy; however, the detection speed is slow, making it difficult to realize the real-time detection task. The pioneering work of one-stage object detection algorithms [8] is the YOLOv1 [9] object detection algorithm, which omits the process of extracting feature candidate boxes and directly divides the input image into regions. The commonly used single-stage target detection algorithms are SSD [10], YOLOv2 [11], YOLOv3 [12], YOLOv4, YOLOv5 [13], YOLOv6 [14], and YOLOv7 [15], DETR [16]. DETR (DETR Transformer) is a Transformer-based end-to-end target detection that was proposed in 2020. It employs a Transformer-based encoder-decoder architecture that greatly simplifies the target detection pipeline. Its effect on the COCO dataset is comparable to that of Faster RCNN, and its structure is simpler than that of Faster RCNN. However, DETR training time is extremely long, the convergence speed is slow, and the required training equipment configuration is high. Especially in the face of high-resolution photos, its recognition of small target objects is poor, and the detection speed does not meet the requirements of real-time detection. Therefore, DETR is not suitable for conveyor belt foreign body detection. Given the defects of image recognition and detection methods, current domestic and foreign scholars have applied deep learning methods to detect foreign objects. To achieve multi-scale fusion, [PERSON] et al. [17] improved the feature pyramid in the Faster-RCNN model to identify foreign objects on the conveyor belt. The recognition effect was better. [PERSON] et al. [18] preprocessed the foreign object images on the conveyor belt and used the improved Faster-RCNN [19; 20] model to achieve foreign object recognition on the conveyor belt. This model was of high accuracy. However, the detection speed was slow, making it challenging to meet the conditions of real-time foreign object detection on the conveyor belt in a complex environment. [PERSON], [PERSON], et al. [21], based on YOLOv3, replace the backbone network, optimizes the loss function, and adds a bidirectional feature pyramid to improve the detection accuracy of the model foreign object recognition. [PERSON] et al. [22] designed a Fast-YOLOv3 algorithm with the addition of a deconvolution network and a Stipic data enhancement method, which improved the detection speed and detection accuracy. [PERSON] et al. [23] used a lightweight network SSD model incorporating a self-attentive mechanism to achieve foreign object detection. The detection accuracy and speed were better than the Faster-RCNN and YOLOv3 models. The above methods are challenging to attain foreign object detection under working conditions regarding detection accuracy and the detection speed of identifying foreign objects. [PERSON] [24] proposed a YOLOv5 target detection algorithm incorporating the CBAM [25; 26; 27; 28] model to solve the problem of the inaccurate detection of foreign objects on the conveyor belt due to its high-speed motion and interference from coal dust and light. The detection accuracy of this method was improved based on YOLOv5; however, it was challenging for the detection speed to accomplish the task of real-time detection, and the problem of small target object detection was ignored. In the industry, it is a challenge to keep updating the algorithms as they iterate. We have to consider low-cost training and deployment devices in industrial applications. In the foreign object detection environment of complex conveyor belts, we need to ensure that the detection method is highly accurate with a high speed. YOLOv4 is a well-balanced single-target detection algorithm with good accuracy and speed. Low complexity, few parameters, and fewer training platform configurations characterize the YOLOv4 model. In order to achieve the goal of real-time detection, we gathered various modules to reduce the parameter quantity while ensuring detection accuracy.