Insulator fast recognition and monocular ranging method in unmanned aerial vehicle inspection image based on YOLOv5 algorithm
Patent Information
- Application Number
- CN202311046291.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-18
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-08-18
AI Technical Summary
Existing monocular ranging methods cannot measure the distance from the drone to the insulator in real time, and are not applicable to the ranging of insulators during drone inspections.
A deep learning method based on the YOLOv5 algorithm is used for insulator identification, and a highly adaptable monocular ranging model is designed. Through training dataset and model parameter configuration, fast identification and real-time ranging of insulator images are achieved.
It enables efficient and accurate identification and ranging of insulators during UAV inspections, is highly adaptable, and is suitable for economical and practical auxiliary ranging of power transmission lines.
Smart Images

Figure CN117333782B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power transmission line insulator detection technology, specifically to a method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm. Background Technology
[0002] Transmission lines are a crucial component of the power system, and their inspection and maintenance are vital for ensuring system stability. With the construction of transmission lines, the workload for manual inspections has increased, highlighting the shortcomings of traditional methods. These outdated methods are no longer adequate for the demands of modern power grid construction and development. Compared to traditional manual line inspections, drones offer advantages such as high efficiency, lack of terrain limitations, flexible scheduling, real-time information transmission, and safety, and are gradually replacing manual inspections. However, drone line inspections still present some challenges. During operation, transmission lines generate electromagnetic fields that interfere with drone signals and may even cause electric field breakdowns of the drone's electronic components, leading to crashes or threatening the safety of the transmission lines. Therefore, during drone inspections, the impact of the transmission line's electromagnetic fields on the drone must be considered, and a reasonable safe distance must be maintained.
[0003] Among current methods for measuring safe distances using drones, monocular vision ranging is considered to have the most advantages and promising future. Most existing monocular ranging methods are designed for calculating the distance between a car and the vehicle in front, requiring the monocular camera to be fixed and its height pre-measured. However, during drone inspections of power transmission lines, it's impossible to obtain the actual height of the drone's monocular camera above the horizontal plane where the insulator is located in real time. Therefore, existing monocular ranging models cannot be applied to insulator ranging. Summary of the Invention
[0004] To measure the distance from a drone to an insulator in real time, this invention provides a method for rapid insulator identification and monocular ranging in drone inspection images based on the YOLOv5 algorithm. The method utilizes YOLOv5's deep learning algorithm to identify insulators, then imports a designed ranging model into the detection code. Finally, based on the insulator detection results, camera and insulator parameters are input to achieve real-time ranging of the insulator images. This method is efficient, accurate, and adaptable, providing an economical and practical auxiliary ranging tool for drone-based power transmission line inspections.
[0005] The technical solution adopted in this invention is as follows:
[0006] A method for fast insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm includes the following steps:
[0007] Step 1: Label the insulator images and create an insulator dataset according to a certain ratio of training set, test set, and validation set;
[0008] Step 2: Configure YOLOv5 model parameters and perform deep learning training;
[0009] Step 3: Input an insulator image to verify the deep learning training results;
[0010] Step 4: Establish a monocular ranging model for the UAV and add the design code of this ranging model to the detection code to achieve detection and ranging.
[0011] Step 1 includes the following steps:
[0012] S1.1: Obtain the China Transmission Line Insulator Dataset (CPLID), which contains 600 defect-free insulator images. Combine this with insulator images taken by drones during line inspections in the project to expand the insulator images to 1235.
[0013] S1.2: The insulator images were labeled using the open-source image annotation tool LabelImg, and all insulator images and labels were divided into training, testing and validation sets in an 8:1:1 ratio using Python code to create the YOLO dataset.
[0014] In step 2, the training parameters of the YOLOv5 model are configured: the initial weights are yolov5s.pt, the training model is yolov5s.yaml, the dataset parameters are coco.yaml, the training rounds are 300, and the image size is uniformly modified to 640×640.
[0015] In step 3, the accuracy of the training results is verified by the parameters P, R, and mAP. P is precision, R is recall, and mAP is the average precision, which is the area enclosed by the P and R curves. The closer the area is to 1, the better the result.
[0016] The specific calculation formula is as follows:
[0017] Wherein: TP classifies positive examples as positive examples, FP classifies positive examples as negative examples, TN classifies negative examples as negative examples, and FP classifies negative examples as positive examples;
[0018] The expression for precision P is:
[0019]
[0020] The expression for recall R is:
[0021]
[0022] The expression for accuracy (AP) is:
[0023]
[0024] The expression for mean accuracy (mAP) is:
[0025]
[0026] AP i Let $\frac{i}{i}$ represent the average precision of the $i$-th class; $K$ represents the total number of classes in the dataset; and $i$ is the index, representing the class number.
[0027] After training, insulator images are randomly selected, and the `detect` file in the YOLOv5 model is configured to detect insulators, thus verifying the accuracy of the trained model. Specifically, the parameters of the `detect` file are adjusted: the path to the weight file is modified to use the trained weight file, and the location of the file to be detected is changed. The detection file can be an image, video, or camera feed. Other parameters are the same as in the `train` file, as detailed below:
[0028]
[0029] In step 4, the accuracy and applicability of the two ranging models are compared, and the ranging model with higher accuracy is selected for ranging: a monocular ranging model is designed for UAV to transmission line insulators, and ranging is performed using single-piece insulators and double-piece insulators respectively. The ranging model for single-piece insulators is shown in Figure 7(a). The ranging is performed based on the length and width of a single insulator, and the specific calculation formula is as follows:
[0030]
[0031] The ranging model for a double-insulator is shown in Figure 7(b). The ranging is based on the width and distance between the two insulators. The specific calculation formula is as follows:
[0032]
[0033] The ranging model was designed as Python code and added to the detection code;
[0034] The specific code for the calculation part is as follows (the ranging model is designed in Python code):
[0035]
[0036] The embedded part is as follows (ranging code is embedded in detection code):
[0037]
[0038] The calculation results are displayed above the recognition box.
[0039] First, a coordinate system transformation must be performed to obtain the relationship between the world coordinate system and pixel coordinates. The final formula for transforming from world coordinate system to pixel coordinate system is:
[0040]
[0041] Where: f x f is the lateral focal length. y For the longitudinal focal length, (X) W ,Y W Z W (u,v) is a point in the world coordinate system; (u,v) is a point in the pixel coordinate system; Z C Let be the object's depth relative to the camera; u be the horizontal coordinate in the pixel coordinate system; v be the vertical coordinate in the pixel coordinate system; u0 is the pixel coordinate of the principal point in the horizontal direction; v0 is the pixel coordinate of the principal point in the vertical direction; R is the rotation matrix; T is the translation vector; M1 is the camera intrinsic parameter matrix; M2 is the extrinsic parameter matrix; X W Y W Z W These are the three-dimensional coordinates of a point in the world coordinate system.
[0042] Camera distortion generated during visual ranging also needs to be corrected. The formula for correcting camera distortion is:
[0043]
[0044]
[0045] in: , , and y are the horizontal and vertical coordinates of the image after distortion correction, respectively; x and y are the horizontal and vertical coordinates of the image before distortion correction, respectively; r is the distance on the image plane; k1 and k2 are the radial distortion coefficients.
[0046] The final formula for calculating distance D is:
[0047]
[0048] Where: a is the width of the insulator, b is the length of the insulator, A is the pixel width of the insulator, and B is the pixel length of the insulator. Step 5 is also included: exploring the influence of different external conditions on ranging error.
[0049] ①. Measure the error caused by changing the type of the insulator being measured, and explore the ranging error of different types of insulators;
[0050] ②. Measure changes in camera shooting posture to explore the impact of camera shooting posture on distance measurement results;
[0051] ③. Weather conditions also affect the ranging results. Adjusting the brightness simulates changes in weather conditions, thus reducing measurement errors. This invention presents a method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm. The technical effects are as follows:
[0052] 1) Steps 1, 2, and 3 of this invention expand upon the existing open-source dataset by adding actual drone inspection photos taken during the State Grid Corporation's power line inspection process. Deep learning technology is used to train a highly adaptable and reliable drone image recognition model. This model, trained on a large amount of image data, can automatically extract key features from the input drone inspection photos and accurately identify various types of insulators.
[0053] 2) In step 4 of this invention, considering the limitation that traditional monocular ranging models require obtaining the height of the monocular camera when calculating distance, this invention designs two monocular ranging models based on the size of the insulator, compares them, and selects the ranging model with higher accuracy, so that monocular ranging is suitable for ranging during UAV line inspection and has higher accuracy.
[0054] 3) Step 5 of this invention explores the effects of insulator type, camera shooting posture and external light intensity on the accuracy of the algorithm and model, and verifies the accuracy and robustness of the model under different environments and conditions. Attached Figure Description
[0055] Figure 1 This is a flowchart illustrating the method of the present invention.
[0056] Figure 2 Photographs showing the calibration of insulators.
[0057] Figure 3 This is a diagram of the deep learning training process.
[0058] Figure 4(a) shows the training results of deep learning P parameters;
[0059] Figure 4(b) shows the training results of the R parameters in deep learning;
[0060] Figure 4(c) shows the training results of deep learning mAP parameters.
[0061] Figure 5(a) shows the insulator ranging effect. Figure 1 ;
[0062] Figure 5(b) shows the insulator ranging effect. Figure 2 .
[0063] Figure 6 Camera calibration diagram.
[0064] Figure 7(a) is a monocular ranging model based on the characteristic dimensions of a single insulator;
[0065] Figure 7(b) is a monocular ranging model based on two adjacent insulators.
[0066] Figure 8 Error bar diagrams for different types of insulators.
[0067] Figure 9 This is a graph showing the relationship between pitch angle and error.
[0068] Figure 10 Image showing the effect of brightness changes
[0069] Figure 11 To change the brightness error comparison chart. Detailed Implementation
[0070] To address the issue of measuring safe distances for power transmission lines using drones, this invention provides a method for rapid insulator identification and monocular ranging in drone inspection images based on the YOLOv5 algorithm. By analyzing the relationship between object size and pixel size, the actual distance from the camera to the insulator is obtained. The invention also considers internal and external factors that affect the ranging results in practical engineering applications, conducts experimental verification of these factors, and analyzes the error impact of these internal and external factors.
[0071] like Figure 1 This is a flowchart illustrating the method of the present invention. The monocular ranging method based on a UAV for power transmission lines provided by the present invention includes the following steps:
[0072] S1. Label the insulator photos and create an insulator dataset with a training set: test set: validation set ratio of 8:1:1;
[0073] S2. Configure YOLOv5 model parameters and perform deep learning training;
[0074] S3. Verify the deep learning training results by inputting insulator photos for detection experiments;
[0075] S4. Establish a monocular ranging model for the UAV and add the design code of this ranging model to the detection code to achieve detection and ranging;
[0076] S5. Verify the accuracy and applicability of the ranging model.
[0077] In step S1, the China Transmission Line Insulator Dataset (CPLID) is obtained. This dataset contains 600 defect-free insulator images. Combined with insulator images taken by drones during line inspections, the insulator image dataset is expanded to 1235 images. The insulator images are labeled using the open-source image annotation tool LabelImg, and Python code is used to divide all images and labels into training, testing, and validation sets in an 8:1:1 ratio to create the YOLO dataset.
[0078] In step S2, the training parameters of YOLOv5 are configured: the initial weights are yolov5s.pt, the training model is yolov5s.yaml, the dataset parameters are coco.yaml, the training rounds are 300, and the image size is uniformly modified to 640×640.
[0079] In step S3, the accuracy of the training results is verified using parameters such as P, R, and mAP. P represents precision, R represents recall, and mAP represents average precision, which is the area enclosed by the P and R curves; the closer the area is to 1, the better the result. box_loss is the mean of the loss function GIoU; obj_loss is the mean of the object detection loss; cls_loss is the mean of the classification loss. For all three, smaller values indicate greater accuracy. The specific calculation formulas are as follows: TP classifies positive examples as positive examples, FP classifies positive examples as negative examples, TN classifies negative examples as negative examples, and FP classifies negative examples as positive examples.
[0080] The expression for precision P is:
[0081]
[0082] The expression for recall R is:
[0083]
[0084] The expression for accuracy (AP) is:
[0085]
[0086] The expression for mean accuracy (mAP) is:
[0087]
[0088] After training, insulator images are randomly selected, and the detect file in YOLOv5 is configured to detect insulators, which is used to test the accuracy of the trained model.
[0089] In step S4, a monocular ranging model is designed for the UAV to the insulator of the transmission line, and ranging is performed using a single insulator. The ranging model is designed as Python code and added to the detection code.
[0090] First, a coordinate system transformation is required to obtain the relationship between real-world coordinates and pixel coordinates. The final formula for transforming from world coordinates to pixel coordinates is:
[0091]
[0092] Among them, f x f is the lateral focal length. y For the longitudinal focal length, (X) W ,Y W Z W Let (u,v) be a point in the world coordinate system, and (u,v) be a point in the pixel coordinate system.
[0093] Camera distortion generated during visual ranging also needs to be corrected. The formula for correcting camera distortion is:
[0094]
[0095]
[0096] in: denoted as x and y, respectively, are the horizontal and vertical coordinates of the image after distortion correction, while x and y are the horizontal and vertical coordinates of the image before distortion correction. r is the distance on the image plane, and k1 and k2 are the radial distortion coefficients.
[0097] Therefore, the final formula for calculating distance D is:
[0098]
[0099] Step S5 includes measuring the error caused by changing the type of the insulator being measured, exploring the ranging error of different types of insulators; measuring the effect of changing the camera shooting posture on the ranging results; and considering that weather also affects the ranging results, the measurement error is simulated by changing the brightness to reflect changes in the weather environment.
[0100] The specific implementation process includes the following steps:
[0101] Step 1: In this embodiment, taking transmission line insulator ranging as an example, LabelImg is used to calibrate the insulator. The calibration format is YOLO, and the calibration photo of the insulator is shown below. Figure 2As shown, select the outline of a single insulator and label it as `insulator_single`. After calibration, use Python code to create an insulator dataset by combining the calibrated files and photos in a training set:test set:validation set ratio of 8:1:1. The created dataset is shown below:
[0102]
[0103] Step 2: Configure YOLOv5 training parameters. Set the training weights to yolov5s.pt, the training model to yolov5s.yaml, and configure the parameters in the yolov5s.yaml file, specifying the types of training data. Then, set the training dataset path to coco.yaml, configure the parameters in the coco.yaml file, and specify the address and location of the training dataset on your computer. After modifying the training parameters, change the training epochs in train.py to 300 epochs. The modified training parameters in train.py are shown below:
[0104]
[0105] The configuration parameters for the above files are shown in Table 1.
[0106] Table 1 lists all parameter files set in train.py.
[0107] category parameter Weight yolov5s.pt Model yolov5s.yaml Dataset path coco.yaml Rounds 300
[0108] Training was performed on the insulator dataset. Considering computer performance limitations, training with a low-performance GPU would be very slow; therefore, AutoDL's cloud computing power was used for deep learning training. First, the labeled and classified insulator dataset was compressed into a single compressed file. This compressed file was then uploaded via AutoDL's cloud storage. After uploading, training began using a rented AutoDL GPU. The operating system for this deep learning training was Linux, the GPU was an NVIDIA RTX 3090, the RAM was 24GB, and the deep learning environment was PyTorch 1.8.1 + Python 3.8 + CUDA 11.1. The deep learning process is as follows: Figure 3 As shown.
[0109] Step 3: After deep learning training is complete, the training results need to be checked.
[0110] Import the trained files into the `detect.py` file for detection. After training, a `run` folder will be generated, containing the automatically generated detection results. Various parameters used to measure the training results will be automatically generated during training, such as... Figure 6As shown, it also contains two .pt files, which are the result storage files for insulator testing: best.pt and last.pt. Setting the .pt files in the detect function allows for direct insulator testing.
[0111] The detection results are shown in Figures 5(a) and 5(b). The insulator is identified and selected. The distance is calculated based on the pixel width of the identification box and the size of the insulator, and the calculation result is displayed above the identification box. The identification image has been replaced, and the distance measurement result is displayed more clearly after magnification.
[0112] Step 4: Design the monocular ranging model for the insulator and import the code into the detection file:
[0113] First, coordinate system transformation is required to determine the relationship between the coordinates of a real-world object and its pixel coordinates. Coordinate system transformation involves using rigid body transformations, perspective projections, and secondary and tertiary transformations to project objects from the three-dimensional world coordinate system into pixels on a two-dimensional plane. W -X W Y W Z W For the world coordinate system, O C -X C Y C Z C Let O be the camera coordinate system, O-XY be the image coordinate system, uv be the pixel coordinate system, P be a point on the insulator in the real world, and P be the image point of P.
[0114] According to the formula for converting from the world coordinate system to the pixel coordinate system, to calculate the distance, we need to obtain the camera's focal length (lateral focal length f). x and longitudinal focal length f y The camera calibration steps are as follows:
[0115] The camera calibration plate is fixed in place, and then the camera is used to take several pictures of the calibration plate from different angles. The pictures are then analyzed and calculated using MATLAB software to obtain the specific parameters of the camera. Figure 6 Image calibration for the camera.
[0116] Camera distortion refers to the image distortion caused by factors such as lens shape and position when a camera projects real-world objects onto an imaging plane. Camera distortion can generally be divided into radial distortion and tangential distortion. Since the distortion of more expensive industrial cameras is very small, tangential distortion will not be considered here.
[0117] Through the above steps, the relationship between the target insulator in the real world and the insulator in the image plane was determined. Considering that during line inspection, it is difficult for the UAV to directly obtain the vertical height from the UAV to the plane where the insulator is located; and that changing the UAV's shooting attitude will also change the camera's attitude angle, thus changing the measured distance and causing significant errors, distance correction is necessary. The camera's attitude angle is divided into pitch angle, yaw angle, and roll angle. Generally, the influence of all three angles on ranging needs to be considered. However, the shape of the insulator can be compared to a cylinder. Changing the yaw angle has no effect on the ranging of the insulator, and the pixel width of the insulator will not change. Since the camera's roll angle is generally considered to have a small impact on monocular ranging, this invention only considers the influence of the camera's pitch angle on ranging. Therefore, this invention designs two monocular ranging models that do not require altitude measurement and consider the UAV's flight attitude. The designed monocular ranging models are shown in Figures 7(a) and 7(b). Figure 7(a) is a monocular ranging model based on the characteristic dimensions of a single insulator. The pitch angle and distance of the insulator are calculated based on the length and width of the single insulator being measured, thus obtaining the actual distance from the UAV to the insulator. Figure 7(b) is a monocular ranging model based on two adjacent insulators. The distance and angle are calculated based on the height between the two insulators being measured and the width of the insulator.
[0118] Step 5: Verify the ranging effect of the ranging model:
[0119] After the ranging system is completed, the following experiments need to be conducted to verify its feasibility and practicality: the influence of the type of insulator being measured on the ranging error; the average error caused by the camera's shooting posture; and the influence of weather conditions on the ranging accuracy.
[0120] Firstly, the type of insulator being measured affects the ranging error. In transmission line design, selecting suitable insulators requires consideration of rated voltage, environmental conditions, line type, and economic factors. Furthermore, deep learning performs differently in recognizing and extracting contours from different types of insulators. Different types of insulators may differ in shape, material, and surface texture, which can affect the accuracy of deep learning algorithms. Therefore, to improve the universality of this ranging program, experiments were conducted on the three most commonly used insulators in transmission lines: composite insulators, glass insulators, and porcelain insulators. The ranging accuracy of this program for different types of insulators was analyzed based on the monocular ranging results. The experiments were conducted at distances of 1m, 3m, and 5m for the three types of insulators without changing other conditions. The ranging results for different types of insulators are shown in Table 2. Figure 8As shown in the figure, the results indicate that the ranging errors vary among different types of insulators. The average ranging error for composite insulators is 4.76%, for glass insulators it is 8.4%, and for porcelain insulators it is 7.11%. Therefore, the ranging results of composite insulators are better than those of glass and porcelain insulators. However, composite insulators exhibit larger errors when measuring at a distance of 5m, while glass and composite insulators show larger measurement errors at closer distances.
[0121] Table 2 shows the distance measurement results for three types of insulators at 1m, 3m, and 5m.
[0122]
[0123] The average error caused by the camera's shooting attitude is considered. In power transmission line UAV inspections, shooting is required under various complex conditions, so the UAV's flight attitude is usually not level with the insulator. Therefore, this invention proposes a modified ranging model to optimize the ranging results with attitude angles and to verify the accuracy of the proposed ranging model. The experiment was conducted at a distance of 3m from the composite insulator, with the ranging camera at pitch angles of +15° and -15°. The error of the ranging model was measured under different pitch angles. The ranging results are as follows: Figure 9 And Table 3. (For example...) Figure 9 As shown, the camera's pitch angle affects the ranging results. The error is minimal when the camera's pitch angle is 0. As the pitch angle increases, the error also increases, and the error becomes even greater with increasing distance. Within the ranging distance range of -15° to 15°, the maximum error is 6%. Therefore, changing the camera's pitch angle has a certain impact on the ranging results, and the greater the distance and the larger the pitch angle, the greater the ranging error. However, the ranging model proposed in this invention provides excellent ranging results even when the camera's pitch angle is changed, and it can adapt to ranging under different camera postures.
[0124] Table 3. Errors and ranging results of the ranging model under different pitch angles.
[0125]
[0126] The influence of weather conditions on ranging accuracy: Different weather conditions also affect ranging accuracy. Since monocular ranging is a visual method, the brightness of the insulator images taken in sunny or cloudy conditions will affect the recognition effect, which in turn affects the selection of the insulator frame and directly impacts the ranging accuracy. Therefore, this experiment aims to verify the ranging accuracy under different weather conditions. However, weather changes are uncontrollable, so the experiment will simulate ranging conditions under different weather by changing the image brightness. Brightness +100% corresponds to sunny days, while -100% corresponds to cloudy days. Without changing external factors such as distance, elevation angle, and insulator type, ranging was performed at 3m on a composite insulator, and the error was calculated. The results are as follows: Figure 11 And Table 4. (For example...) Figure 10 As shown, the error increases with both decreasing and increasing brightness, reaching a larger error of 12.3% under high brightness conditions, while the error is relatively smaller under low brightness conditions. Therefore, weather conditions have a certain impact on this ranging model, and the error is greater under bright, clear weather.
[0127] Table 4 shows the calculation error for distance measurement at 3m for composite insulators.
[0128]
[0129]
[0130] In summary, this invention presents a method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm. This method involves expanding and calibrating existing open-source insulator datasets, then training, validating, and testing using the YOLOv5 model to establish a ranging model for insulator strings. The code is then incorporated into the detection module to achieve insulator identification and ranging. Experimental results show that the model can accurately identify different types of insulators on transmission lines and perform precise ranging, with an average ranging error of 4.76%. The model performs best in identifying and ranging composite insulators; changing the pitch angle and relative distance reduces the maximum ranging error to 6%. Under different weather conditions, the greater the change in brightness, the greater the error in insulator identification and ranging; when the brightness increases to 100%, the error can reach a maximum of 12.3%. The average ranging time is 0.2984 s, achieving efficient and high-precision ranging. This method provides a fast and reliable solution for intelligent inspection of transmission lines and measurement of safe distances, and has practical value.
Claims
1. A method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm, characterized in that... Includes the following steps: Step 1: Label the insulator images and create an insulator dataset according to a certain ratio of training set, test set, and validation set; Step 2: Configure YOLOv5 model parameters and perform deep learning training; Step 3: Input an insulator image to verify the deep learning training results; Step 4: Establish a monocular ranging model for the UAV and add the design code of this ranging model to the detection code to achieve detection and ranging; In step 4, a monocular ranging model for the UAV to the insulators of the transmission line is designed. Ranging is performed using both single-piece and double-piece insulators. The ranging is based on the length and width of a single insulator. The specific calculation formula is as follows: ; Distance is measured based on the width and distance between the two insulators. The specific calculation formula is as follows: ; The ranging model was designed as Python code and added to the detection code; First, a coordinate system transformation is performed to obtain the relationship between the world coordinate system and pixel coordinates; the final formula for the world coordinate system to pixel coordinate system transformation is: ; in: It is the lateral focal length; For the vertical focal length, A point in the world coordinate system; It is a point in the pixel coordinate system; The depth of the object relative to the camera; These are the horizontal coordinates in the pixel coordinate system. These are the coordinates in the vertical direction within the pixel coordinate system. The pixel coordinates in the horizontal direction of the main point; The pixel coordinates in the vertical direction of the main point; It is a rotation matrix; It is a translation vector; This is the camera intrinsic parameter matrix; This is the extrinsic parameter matrix; , , These are the three-dimensional coordinates of a point in the world coordinate system. Camera distortion generated during visual ranging is corrected using the following formula: ; ; in: , These are the horizontal and vertical coordinates of the image after camera distortion correction; , The x and y coordinates of the image before distortion correction are shown. The distance on the image plane; , Radial distortion coefficient; distance The final calculation formula is: ; in: For the width of the insulator, For the length of the insulator, The pixel width of the insulator The pixel length of the insulator.
2. The method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm according to claim 1, characterized in that: Step 1 includes the following steps: S1.1: Obtain the Chinese transmission line insulator dataset, which contains 600 defect-free insulator images. Combined with insulator images taken by drones during line inspections in the project, the insulator images are expanded to 1235 images. S1.2: The insulator images were labeled using the open-source image annotation tool LabelImg, and all insulator images and labels were divided into training, testing and validation sets in an 8:1:1 ratio using Python code to create the YOLO dataset.
3. The method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm according to claim 1, characterized in that: In step 2, the training parameters of the YOLOv5 model are configured: the initial weights are yolov5s.pt, the training model is yolov5s.yaml, the dataset parameters are coco.yaml, the training rounds are 300, and the image size is uniformly modified to 640×640.
4. The method for rapid insulator identification and monocular ranging in UAV inspection images based on the YOLOv5 algorithm according to claim 1, characterized in that: In step 3, the training results are... P , R , mAP Parameters are used to verify the accuracy of the training results. P For accuracy, R For recall rate, mAP The specific formula for calculating the average accuracy is as follows: in: TP To classify positive examples as positive examples, FP To classify positive examples as negative examples, TN To classify negative examples as negative examples, FP To classify negative examples as positive examples; accuracy P The expression is: ; Recall rate R The expression is: ; accuracy AP The expression is: ; Average accuracy mAP The expression is: ; This represents the average precision of the i-th category; This represents the total number of categories in the dataset; For indexing, indicating the category number; After training, insulator images are randomly selected, and the detect file in the YOLOv5 model is configured to detect insulators, which is used to test the accuracy of the trained model.
