Safety helmet detection is a research hotspot in the field of object detection in industrial production op-erations in recent years.In view of the problems such as misdetection and missed detection of small-scale objects that are prone to occur in the process of safety helmet detection,this paper proposes a context fusion and attention based method for safety helmet detection.This method enhances feature extraction by emphasizing the target key feature in-formation by using mixed-domain attention;At the same time,a context information fusion structure based on a non-local attention module is constructed,and the underlying global context information is introduced into the deep features to further refine the deep semantic information;In addition,the receptive field module is used to capture multi-scale features and increase the receptive field to reduce the loss of feature information in the feature fusion process of small-scale targets and the insensitivity to small-scale targets in the prediction process.The experimental results show that the AP value of the method in this paper for safety helmet detection on the safety helmet wearing dataset reaches 93.10%,which is 2.12% higher than the original YOLOv4,and the mAP reaches 93.07%,which is 1.39% higher than the original YOLOv4.