In the process of power grid construction, safety helmet is of great significance for protecting the personal health, ensuring the smooth operation of project and even the safety of power grid. Considering the external risk factors caused by incorrect wearing of safety helmets of operators, we design an online detection and identification system for safety helmets wearing based on YOLOv7 model. We first analyze the structure and application of YOLOv7 model based on the online detection system architecture of smart grid helmet wearing, and then, analyze and verify the performance and effect of the proposed method using an improved data set. The experiment results show that compared with the previous generation models, YOLOv7 has a more accurate detection rate and faster detection speed, which can better meet the real-time detection requirements of external risk factors for safety helmets wearing in smart grid.