In the tanker loading and unloading area in a chemical plant area, preventing the generation and harm of static electricity in the tanker is an important means to avoid the combustion and explosion of the tanker. The static electricity induced by the tanker can be conducted away by the electrostatic grounding line to avoid sparkover with external substances. How to ensure that the grounding line is correctly installed during the loading and unloading process and will not be accidentally disassembled or disassembled in advance is an urgent problem to be solved in a plant area. To ensure that real-time images can be detected in real time when explosion-proof cameras are used in the explosion-proof area, this study gives due consideration to the characteristics, including different connection angles and thinning under stretching, of grounding lines and proposes a deep learning you only look once version 5 (YOLOv5) target detection algorithm by introducing the self-attention mechanism CotNet. The detection speed and detection accuracy of the proposed algorithm are compared on a self-made grounding line dataset. The experimental results show that the improved YOLOv5 algorithm, increasing the detection accuracy by 5% at the cost of a slight decrease in speed, can meet the needs of on-site grounding line detection.