Given that the aerial image to scan overhead transmission line contains complex backgrounds and small objects, it is difficult for traditional algorithms to accurately identify the details of power transmission lines, so this paper develops an object detection method based on improved YOLOv5s. To improve the detecting accuracy of small objects, the network structure is optimized by adding a larger scale detection layer and jump connections. Then, a self-attention mechanism is introduced to merge the feature relationships between spatial and channel dimensions. The self-attention mechanism could suppress the interference of complex backgrounds and boost the salience of objects. In addition, this paper proposes a small object enhanced complete intersection-over-union as the loss function of the bounding box regression. This loss function could adjust the derived loss for objects of different sizes automatically, therefore, improving the detection of small samples. The experimental results demonstrate that compared to classic YOLOv5s, the detection accuracy of our algorithm is improved by 4.2%.