Abnormality detection method for transmission lines based on video code stream analysis

As the demand for electricity continues to grow, the coverage of transmission lines is getting larger. Despite the continuous improvement of the grid system, transmission lines are still vulnerable to various natural disasters. At the same time, many transmission lines are installed in areas with harsh environments and other places that are difficult for operation and maintenance personnel to reach, which brings huge challenges to the operation and maintenance of transmission lines. Therefore, how to effectively detect the status of the transmission line and ensure the normal operation of the power grid has become an important research topic in the power system. The existing video surveillance-based methods need to decode the video, which has poor real-time performance. Therefore, this paper proposes a transmission line abnormality monitoring method based on video stream analysis. Using the extracted parameters for judgment before decoding the video stream can effectively improve the real-time performance of online monitoring of the transmission line and greatly shorten the time required for abnormal alarms.


Introduction
With the progress of urbanization, the demand for electricity continues to increase, and the coverage of power transmission lines is getting larger. Despite the continuous improvement of the power grid system, the application scenarios of transmission lines are special. Most lines are exposed to unguarded fields without any shielding or protective measures, and are vulnerable to various natural disasters such as thunderstorms and hail. At the same time, transmission lines are erected in places where operation and maintenance personnel are difficult to reach, such as deep mountains and high-altitude areas with harsh environments, which brings huge challenges to the operation and maintenance of transmission lines. Therefore, how to effectively detect the status of the transmission line and ensure the normal operation of the grid system has become an important research in the power system.
At present, there are many methods to detect the status of power transmission lines. Among them, the most used method is to use drones to inspect or install cameras and other methods based on video surveillance. For example, Golightly [1] proposed a method based on helicopter video surveillance, which uses cameras to automatically align the target of interest, thereby realizing the monitoring of transmission lines. This method uses corner point monitoring and matching methods to make the camera's attention always stable during the helicopter flight. The disadvantages of the method of using manned helicopters for video monitoring of transmission lines are the high risk of accidents and the high cost of monitoring, so it is not suitable for the densely distributed and widecovered power grids of my country. With the continuous maturity and upgrading of aircraft technology, the method of using unmanned aerial vehicles to conduct inspections on transmission lines has gradually attracted attention. Based on this method, Larrauri [2] proposed an automatic monitoring system for transmission lines. The system analyzes and processes line monitoring images collected by infrared cameras, identifies poor-quality conductive locations and hot spots in lines, transformers and even substations, and can calculate the distance between the transmission line and nearby vegetation and buildings to ensure The line is not damaged. Compared with helicopters, UAV-based transmission line monitoring systems effectively avoid accidents such as casualties during inspections, and save costs to a large extent, but this type of method still has drawbacks. The UAV video surveillance system uses a round-robin monitoring method. The inspection cycle is long. Real-time long-term monitoring of moving targets in a fixed area cannot be achieved. It is not suitable for monitoring abnormal behaviors in transmission lines, such as illegal construction. Therefore, Wang [3] proposed an AI recognition technology based on pre-edge computing for video detection of transmission lines.
On the whole, the method of installing video cameras on the transmission line is more in line with the actual situation of the wide range of transmission lines in my country. However, the video volume is large and the network bandwidth requirements are very high. If you want to ensure the real-time performance of the video, you need to spend a lot of network resources. Therefore, this article proposes a transmission line abnormality monitoring method based on video stream analysis. Using the extracted parameters to make preliminary judgments before the video code stream is parsed can effectively improve the real-time performance of online monitoring of transmission lines and greatly shorten the time required for abnormal alarms.

Extraction and processing of H.264 stream parameters
As we all know, video data is usually transmitted after compression, so this paper extracts and analyzes the parameters of the H.264 code stream to achieve anomaly detection before video decoding, saving processing time. The H.264 standard uses a mixed coding mode of motion estimation/motion compensation [4][5]. Before extracting the code stream parameters, this article conducts an indepth analysis of the H.264 code stream structure. Its encoding and decoding principles and processes are shown in Fig.1 and Fig.2. As shown in Fig. 1, the current frame (Fn) is input in units of macroblocks, and the intra-frame or inter-frame predictive coding method is selected for processing. If intra-frame prediction coding is used, the prediction value P is obtained from a reference picture that has been coded in the current slice through Motion Compensation (MC). The reference image is represented by F'(n-1). If interframe coding is used, the actual reference pictures are selected in the reconstructed and filtered frames for encoding and decoding in the past or in the future (depending on the display order), which can improve the prediction accuracy and thereby increase the compression ratio. The difference between the current block and the predicted value is generated to generate a residual block Dn, which is then transformed and quantized to obtain a set of quantized transform coefficients X. After entropy coding, decoding-related information such as quantization parameters, prediction modes, and motion vectors will form a compressed bitstream together with transform coefficients. Finally, it is handed over to the Network Adaptive Layer (NAL) for transmission and storage.
At the same time, in order to provide reference video frames for subsequent images, the encoder must be able to achieve frame reconstruction. This requires inverse quantization and inverse transformation operations on the encoded and quantized residual image. And the obtained reconstructed frame D'n and the predicted value P are summed to obtain the unfiltered frame uF'n. Considering that noise may occur during the encoding and decoding process, the H.264 encoder sets a loop filter to use the reconstructed frame F'n output after filtering as a reference to improve the image quality of the reference frame, thereby improving the compression performance. At the decoding end, the H.264 decoder processes the NAL unit data packets one by one. Before reading the content of the I and P slices, it is necessary to set the Sequence Parameter Set (SPS) and Picture Parameter Set (PPS) in advance, analyze and obtain important parameters related to the video sequence ,such as the number of pixels in the horizontal direction, the number of pixels in the vertical direction, the number of quantization parameters and the number of reference frames used for inter prediction, etc. After processing SPS and PPS, the decoder will continue to parse the data of I and P slices. After entropy decoding, the variable-length data element will generate a set of quantized transform coefficients, and the residual block can be obtained through its inverse quantization and inverse transform.
On the other path, the decoder constructs a prediction block based on the prediction mode. The residual block and the prediction block are added to form the same reconstructed image as the encoding end. Similarly, the decoder decodes in units of macroblocks to obtain reconstructed frames. The reconstructed video sequence can be obtained by continuously decoding the NAL unit. H.264 adopts deblocking filtering technology, which effectively eliminates the blocking effect caused by macroblock coding and greatly improves the quality of the reconstructed image.

Transmission line abnormality monitoring method based on video stream analysis
In-depth analysis of video coding principles can find that in order to save coding time during video coding, the difference between adjacent frames is often used to transmit each frame that is not completed. For transmission lines located in the wild, most of the video images are static, with little difference between frames. Once the frame-to-frame changes are too large, it means that an abnormal situation is likely to occur. Therefore, the method proposed in this paper makes full use of the characteristics of the difference between frames, and designs a transmission line abnormality monitoring method based on video stream analysis.
MV represents the relative position between the current macro block and the corresponding macro block in the reference frame. It describes the motion of the macro block, so it is often used to describe the difference characteristics of the video. According to experiments, if the MV length of most macroblocks in the frame is very large, very violent motion often occurs in the current video frame. On the contrary, if the MV length of most macroblocks in the frame is very small, or most of the MV length is 0, it is considered that the motion degree in the current picture is very small. Simply using the length of the MV can only determine whether the overall motion of the screen is violent, but it cannot determine the details of the motion pattern. In order to better describe the changes of video content, this paper uses the MV length and MV direction statistical histogram to describe the motion characteristics of the video. First, an index that can evaluate the degree of video change is proposed. The calculation process is as follows.
First of all, this article uses the horizontal and vertical components of the MV extracted from the H.264 bitstream to calculate the MV length MV len . The calculation formula is as follows: (1) The MV len of all macroblocks in a frame is averaged to obtain the overall motion intensity of the frame, expressed by MV str , and the calculation formula is as follows.
Where i represents the macroblock number, N represents the total number of macroblocks in the current frame, and MVx and MVy are the horizontal and vertical components of the MV of the ith macroblock.
This paper calculates the MV direction statistical histogram. First, use the following formula to calculate the direction of the MV: (3) Where MVx and MVy are the horizontal and vertical components of MV, respectively, and fx is used to denote the angle of MV.
The entire plane space is equally divided into twelve direction intervals, that is, every 30° is a direction interval. Then calculate the number of occurrences of MV in each direction interval, and calculate their average and standard deviation, which are represented by MV ave and STD drc , respectively. The calculation formula is as follows.
Where N represents the total number of macroblocks in the current frame, and MV drc_j is the total number of MVs that appear in the jth interval.
Considering that both MV str and STD drc are related to the degree of change of the video, this paper proposes the evaluation index CS of the degree of video change, which is defined as follows.
Since the ranges of CS calculated in different scenarios are quite different, the CS range should be calculated first in the actual application process, and then the alarm threshold should be determined.

Results and Analysis
In order to verify whether the indicator proposed in this article can accurately describe the characteristics of frame changing, we compared CS with the most commonly used measure of motion characteristics at present-the index time information, Temporal perceptual Information (TI). TI expresses the intensity of video movement by calculating the difference between adjacent frames. The classic method is to calculate the TI value frame by frame for the video sequence, and take the maximum value as the overall measurement result of the video sequence. However, Ostaszewska [6] believe that the overall TI values of a video sequence can be better expressed by taking the quartile value instead of the maximum value. This processing method can eliminate the impact on the peak caused by scene switching and other factors. The TI value calculation formula is as follows.
This paper selects nine videos with different motion complexity and texture richness from the ECVQ data set for testing [7], respectively uses the motion complexity index and TI index proposed in this paper to measure, and ranks them according to the numerical value from high to low. The comparison results are shown in Table 1. Observing Table 1, it can be seen that the index proposed in this article is exactly the same as the trend of TI in measuring the motion attributes of different videos. However, since this article is directly processed based on the H.264 code stream, no decoding is required. TI is a pixel-domain-based measurement method that needs to be decoded before measurement. Therefore, the measurement index proposed in this paper can save a lot of processing time and reduce the consumption of system resources.
In addition, this article counts the histogram of the motion direction of each video to further analyze the motion characteristics of the video, as shown in Fig.3.   Fig.3. Statistical histograms of motion direction Combining Fig.3 with the actual viewing experience, it can be seen that the more scattered the MV directions in the video are in different sections, the more complex the motion in the video; if the MV directions in the video are mainly concentrated in a few sections, then Indicates that a target moving in a certain direction appears in the video. This provides theoretical support for us to set the CS threshold for different scenarios. Before actual application, it is possible to analyze the most tolerable types of transmission line abnormalities in the current scene through testing, and add the judgment of these types of abnormalities before the alarm to improve the accuracy of the alarm.

Conclusion
The scope of online monitoring of transmission lines is large and real-time requirements are high. Although video-based detection methods can achieve full detection coverage, due to the large video volume, decoding takes a lot of time, and the effect in practical applications is not satisfactory. Aiming at the above problems, this paper proposes a transmission line abnormality monitoring method based on video code stream analysis. Using the extracted parameters to make preliminary judgments before the video code stream is parsed can effectively improve the real-time performance of online monitoring of transmission lines and greatly shorten the time required for abnormal alarms. The test results show that, compared with the existing methods, the method in this paper has an excellent performance in saving computational time and cost, and the expression of video content is more detailed. In the actual application process, the alarm threshold can be fine-tuned according to specific scenarios. Thereby, the abnormalities on the transmission line can be found more accurately and quickly to ensure the safe operation of the power grid system.