Keywords

1 Introduction

As the industrialization process progresses, the people’s demand for electricity is also increasing, and their requirements for the reliability, safety, and stability of power lines are also increasing. Since power safety is closely related to people’s well-being, thousands of power towers and ultra-high-voltage power lines have been built in China. Power lines and power towers are the key media for transmitting power [1]. Nevertheless, given that the majority of high-voltage lines are built in the wild and are exposed to the weather for a long time, there are numerous potential security risks, such as bird nests, insulator shedding, garbage on lines, and damper damage [2,3,4]. Electric power sectors are required to regularly inspect and maintain power towers and power lines to ensure that people can use electricity stably. However, there are tens of thousands of kilometers of power lines in China, and if only relying on manual inspection, there will be a large workload and low efficiency, and they are also susceptible to harsh environments. In the “Twelfth Five-Year” smart grid development strategy, the state proposed to improve the intelligence standard of the power grid. Consequently, it is necessary to replace part of the manual inspection with smart algorithms and equipment in order to respond to the national strategy and meet people’s happy lives.

As time goes by, UAV technology is widely used in various aspects of people’s lives, and electric power sectors have also begun to use UAVs to inspect power lines[5]. The combination of UAV technology and existing communication technology can realize automatic cruise. Compared with manual and helicopter inspection schemes, UAV inspection is characterized by low maintenance costs and high inspection efficiency [6, 7]. A large number of photos will be taken when the inspection is conducted by UAVs, and then the detection software will identify these photos to determine whether there are targets to be detected.

To this end, a set of smart power inspection systems based on YOLOv7 was designed to detect whether there are power safety hazard targets in the photos taken by UAVs during inspection. Compared with the traditional detection methods, this system has many advantages, such as high detection accuracy, fast detection speed, and diversified detection targets.

2 YOLOv7 Detection Model

YOLOv7 is one of the target detection algorithms with the best comprehensive performance[8]. The YOLOv7 model was proposed by the former staff of the YOLOv4 team. The network of the YOLOv7 is mainly composed of Input, Backbone, and Head.

The Input reuses the logic of YOLOv5 as a whole. The role of Input is to preprocess the input image and enhance the data. YOLOv7 uses Mosaic data enhancement [9], adaptive anchor frame calculation, and adaptive image scaling. Backbone mainly uses CBS, ELAN, and MP structures. The ELAN structure, designed based on ELAN, uses expand, shuffle, and merge cardinality to realize the ability to continuously enhance network learning ability without destroying the original gradient path. The MP structure is composed of conventional convolution and maxpool dual paths, and it aims to increase the model’s ability to extract and fuse features. The Head is composed of the SPPCSPC module, PAFPN structure, and REP module (Fig. 1).

Fig. 1.
figure 1

Structure of YOLOv7 network

3 Research on Target Detection Algorithm of Hidden Power Safety Hazard

3.1 Experimental Environment and Parameters

The operating system is Windows 10, the processor is Intel(R) Xeon(R) Bronze 3104 CPU @1.70GHZ, the memory is 32G, and the graphics card is NVIDIA GeForce RTX 3060. The CUDA version is 12.1, the torch version is 2.0.1, and the Python version is 3.10. The batch-size is set to 16, the epoch is set to 100, and the remaining parameters are default values.

3.2 Dataset Selection and Processing

During the UAV inspection of a power line in Guangxi, 300 photos of bird nest data were captured, encompassing 290 photos of Insulator defect data, 70 photos of garbage data, and 300 photos of hardware data. Then, the data set was expanded by data enhancement methods such as translation, deformation, random cropping, and random rotation. Finally, there were 1178 pictures in the bird nest picture training set, and 112 were tested; 1157 pictures in the missing insulator picture training set, and 117 were tested; 280 pictures in the garbage picture training set, and 25 were tested; 1153 pictures in the hardware picture training set, and 113 were tested. The LabelImg annotation tool was adopted to label the dataset. Some of the labeled data sets are shown in Fig. 2 below. Where Fig. 2(a) is the bird’s nest, Fig. 2(b) is the insulator, Fig. 2(c) is the hardware, and Fig. 2(d) is garbage.

Fig. 2.
figure 2

Part of labeled data

3.3 Evaluation Indexes

Precision, Recall, and average accuracy mAP@0.5 were used as evaluation indexes to display the model effect[10].

The calculation formula of Precision is as follows:

$$ \Pr ecision = \frac{TP}{{TP + FP}} $$
(1)

The calculation formula of Recall rate is as follows:

$$ {\text{Re}} call = \frac{TP}{{TP + FN}} $$
(2)

When calculating mAP, the average accuracy of a single category should be calculated first, and the calculation formula is as follows:

$$ AP = \int_{0}^{1} {p(r)dr} $$
(3)
$$ mAP = \frac{1}{n}\sum\limits_{k}^{n} {AP_{k} } $$
(4)

where TP represents true positive; FP represents false positive; FN represents false negative; P (r) represents the curve drawn with recall rate and accuracy; n represents the total number of classes for target detection; mAP @ 0.5 is the average mAP when the intersection ratio is 0.5.

3.4 Analysis of Experimental Results

The test data sets in different detection targets were taken to verify the model. The accuracy-recall curves of different detection targets are shown in Fig. 3 below.

Fig. 3.
figure 3

Recall rate-precision curve of different detection targets

From Fig. 3, a and b, it can be seen that the model has high detection accuracy for large targets such as bird nests and garbage, with the detection accuracy of map@.5 for bird nests reaching 97.9% and map@.5 for garbage detection reaching 98.7%. From Fig. 3, c and d, it can be seen that the detection accuracy of the model for dense small targets such as insulator and hardware is slightly lower. The detection rate of all types of insulators map@.5 was 95.3%, and that of all types of hardware map@.5 was 91.9%.

To compare the effect of the model, the YOLOv7 and YOLOv5 models were used to compare the test sets of different detection target data sets, respectively. The comparison results are shown in Table 1.

Table 1. Comparative experiment of YOLOv5 and YOLOv7

The comparison shows that the average accuracy of YOLOv7 is 3.3% higher than that of YOLOv5, and the average recall rate is 1.5% higher than that of YOLOv5. The average mAP@.5% of all detection targets is up to 95.9%, which is 1.1% higher than that of YOLOv5, proving that the detection method used in this paper has better detection ability.

4 System Design and Implementation

4.1 Overall Design of System

The design of the smart power inspection system based on YOLOv7 aims to design a set of safe, efficient, convenient, and concise systems that can allow users to find bird nests, hardware, missing insulators, garbage, and other power safety hazards more quickly.

The system interface was developed and designed by Python language combined with PyQt5. The smart power inspection system based on YOLOv7 mainly includes the inspection target detection module, the search and detection result display module, and the detection report generation module. It mainly consists of an interaction layer, a logic processing layer, and a data layer. The interaction layer is open to users and can operate relevant data, freely select detection targets, and display relevant information to users. The logic processing layer receives the request from the interaction layer and completes the corresponding business logic processing operation. The operation performed by users must be processed by the business logic layer before it can be displayed to the users, including the function implementation in the target detection module, file searching and detection result statistics, and detection report generation. The data layer includes the processing of the data to be detected, the data generation after detection, and the storage of the detection report. The system architecture is shown below (Fig. 4).

Fig. 4.
figure 4

System architecture

4.2 Function Module Design and Effect Display

The function module mainly includes the target detection module, the search and detection result display module, and the detection report generation module. The specific design of the system module is as follows (Fig. 5):

Fig. 5.
figure 5

Structure of system module function

  1. (1)

    Target detection module: It mainly detects various common power safety hazards such as bird nests, hardware, garbage, and insulators in power inspection. During the detection, statistics and detection will be performed according to different lines and different power towers. The system will call sub-threads to query and receive the running status of the program and update the front-end progress bar in real time. After the detection starts, the system will call the YOLOv7 target detection algorithm trained in the back end to automatically mark the targets contained in the photo, including bird nests, hardware, garbage, and insulator defect, and then save the photos containing the targets in the specified folder.

  2. (2)

    Search and detection result display module: It counts the number of photos detected and the number of power towers containing targets, and display the photos containing the detection targets on the front-end interface so that users can view the photos freely.

  3. (3)

    Detection report generation module: It mainly realizes report generation, counts the detection results and the photos with targets, and summarizes the statistical results to generate the report documents.

4.3 System Operation Effect

Running the program, after entering the system, target detection categories and the target to be detected, such as bird nest detection, and hardware detection can be chosen freely. After the selection, the folder of photos to be detected and the output path of the detection result can be chosen. The running effect is as follows (Fig. 6):

Fig. 6.
figure 6

Operation interface display of target detection module

After completing the detection, the detection results will be output to the front end, and the number of photos detected and the number of fault power towers, including target photos, will be automatically counted. The specific effect is as follows (Fig. 7):

Fig. 7.
figure 7

Display of detection results interface

After completing the detection or when there has already been local data containing the detection results, report generation can be selected, and the report generation module can freely choose to generate what kind of detection target report. The specific effect is as follows (Fig. 8).

Fig. 8.
figure 8

Display of detection report generation interface

Taking the detection of bird nests as an example, the following diagram displays the style of the generated report, including line information, date information, fault details, and list (Fig. 9).

Fig. 9.
figure 9

Detection report display

5 Conclusion

In this paper, a set of smart power inspection systems based on YOLOv7 was designed to rapidly detect various power safety hazards, including but not limited to multiple bird nests, insulator defect, garbage, and hardware. The average accuracy of all detection targets is 93.9%, and the mAP @.5% is up to 95.9%. Upon the completion of the detection, a detection report can be generated directly. The design of the smart inspection system can significantly improve the detection efficiency of power line targets and guarantee the safe and stable power consumption of the people.