A method for measuring the distance of a line crossing of a UAV based on a reinforcement learning algorithm
By employing a reinforcement learning-based method for measuring the crossing distance of UAV routes, and utilizing image distortion correction and iterative optimization techniques, the problems of hardware dependence and insufficient accuracy in existing technologies are solved, achieving efficient and high-precision crossing distance measurement.
Patent Information
- Application Number
- CN202611694546.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-30
- Publication Date
- 2026-11-27
AI Technical Summary
Existing UAV route ranging solutions rely excessively on complex sensing hardware, resulting in wasted computing resources. Furthermore, in the absence of prior data on intersection points, it is difficult to accurately locate the true shortest intersection point, leading to insufficient measurement accuracy.
A reinforcement learning-based approach is adopted to acquire images at different altitudes using a multi-rotor UAV. Distortion correction is performed by combining the camera intrinsic parameter matrix, a pixel coordinate system is established and a second-order parabolic model is fitted, and iterative optimization is performed using the probability density distribution function and penalty factor to calculate the three-dimensional spatial distance of the transmission line.
It reduces reliance on complex hardware and improves measurement efficiency and accuracy, especially enabling high-precision cross-span distance measurement even in the absence of prior data on intersections.
Smart Images

Figure CN123175228A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power transmission line measurement technology, specifically to a method for measuring the crossing distance of power transmission lines using a UAV based on a reinforcement learning algorithm. Background Technology
[0002] With the continuous expansion of power grid construction, there are numerous instances of overhead lines crossing each other at different voltage levels. To ensure the safe operation of the power grid, it is necessary to measure the three-dimensional spatial distance between crossing transmission lines to prevent discharge faults caused by insufficient distance. Drones, with their maneuverability and flexibility, have become the primary vehicle for power transmission line inspection and spatial ranging operations.
[0003] In existing line ranging schemes, operators direct drones to fly to the area where power lines cross, using onboard binocular vision cameras or LiDAR to scan and photograph the transmission lines. After acquiring relevant images or 3D point cloud data, the processing system performs full-range pixel matching on the images using underlying algorithms, or reconstructs a 3D model of the transmission lines in virtual space. Subsequently, relying on previously imported baseline feature data or manually selected reference coordinates, the system applies spatial geometric relationships to calculate the relative distance between the two lines.
[0004] The aforementioned measurement methods have revealed some technical limitations in practical operations. Relying on binocular vision or radar equipment increases the procurement cost of inspection hardware and the difficulty of initial calibration. At the data processing level, when the system performs a large-scale matching search on the full-frame image, it reads a large number of blank background pixels, unnecessarily increasing the processor's computational burden and slowing down the analysis process. Furthermore, because overhead transmission lines exhibit a non-planar curved distribution in space, without prior data supporting the intersection points, existing calculation models struggle to directly locate the true spatial position where the distance between two lines is shortest. The lack of a dynamic error correction and convergence mathematical optimization system leads to inaccuracies in the final output of the crossing distance measurement results. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a method for measuring the crossing distance of UAV routes based on reinforcement learning algorithms. This method solves the problems of existing UAV route ranging schemes that rely excessively on complex sensing hardware, waste of computational resources due to full-frame image matching, and insufficient measurement accuracy due to the difficulty in accurately locating the true shortest crossing point when prior data is lacking.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm includes the following steps: Control the multi-rotor drone F to acquire original image 1 and original image 2, and generate corrected image image 1 and corrected image image 2 based on the original image 1 and the original image 2; Establish a pixel coordinate system, select the feature point coordinates of transmission line M and transmission line N of the corrected image image 1 and the corrected image image 2, combine them with a second-order parabolic model to complete the fitting and generate coefficients, and determine the range of variation of the horizontal coordinate parameter. Calculate the initial probability density distribution function, and randomly select points on the transmission line M within the range of variation of the abscissa parameter based on the initial probability density distribution function. and the point of the transmission line N The initial sample overhead transmission line distance was calculated. Initialize the minimum and average error values, regenerate the horizontal axis parameters according to the probability density distribution function, calculate the distance of the sample overhead transmission line to generate the current iteration error value, determine the relationship between the current iteration error value and the minimum and average error values to generate a penalty factor, update the probability density distribution function in combination with the penalty factor, and independently update the average error value, and output the cross-span distance measurement value.
[0007] Preferably, the step of generating corrected image 1 and corrected image 2 includes: Control the multi-rotor drone F to hover at a height h1 to capture the original image 1 of the intersecting area, and record the flight altitude of the multi-rotor drone F and the position G1 of the lens optical center; The horizontal position and shooting angle of the multi-rotor drone F are fixed, and it is moved vertically to a height h2 to hover and shoot the cross-distance to obtain the original image 2. The flight altitude of the multi-rotor drone F and the position of the lens optical center G2 are recorded. Based on the original image 1 and the original image 2, the camera is calibrated, distortion is corrected, and perspective is corrected to generate corrected image image 1 and corrected image image 2.
[0008] Preferably, the step of establishing the pixel coordinate system includes: The system receives the corrected image image 1 and the corrected image image 2, reads the resolution parameters to extract the number of pixels in the image width and the number of pixels in the image height, and divides the image into a two-dimensional discrete grid matrix according to the resolution parameters, assigning each grid node an independent pixel unit encoding. The pixel at the lower left edge of the two-dimensional discrete grid matrix is selected as the origin of the coordinate system, and a mutually perpendicular horizontal axis and vertical axis are established based on the origin of the coordinate system. By combining the encoding of all pixel units within the two-dimensional discrete grid matrix through the positive directions of the horizontal and vertical axes, the number of grid nodes that each pixel unit differs from the origin is calculated to generate horizontal and vertical axis coordinate values. These values are then combined to determine the pixel coordinates of each point on the corrected image 1 and the corrected image 2.
[0009] Preferably, the step of determining the range of variation of the abscissa parameter includes: Read the width boundary parameters of the pixel coordinate system and identify the pixel range laterally covered by the curve trajectory of the transmission line M within the pixel coordinate system; Extract the x-coordinate values of the starting endpoints of the curve trajectory of the transmission line M to generate the lower limit boundary, extract the x-coordinate values of the ending endpoints to generate the upper limit boundary, and combine them to establish the variation range of the x-coordinate parameters of the transmission line M. Scan the curve trajectory of transmission line N in the direction of increasing horizontal axis coordinate values, locate the lower boundary of the left edge pixel point of transmission line N in the pixel coordinate system, locate the upper boundary of the right edge pixel point, and combine them to establish the range of changes of the horizontal coordinate parameters of transmission line N.
[0010] Preferably, the step of calculating the initial probability density distribution function includes: Read the range of changes in the horizontal coordinate parameter and set it as the learning range for the reinforcement learning algorithm; The initial probability values of all horizontal coordinates within the learning interval being selected as intersection points are set to be equal. A probabilistic analytical relationship is established based on the uniform distribution model. The upper and lower boundaries of the learning interval are substituted into the equations for calculation, and the initial probability density distribution functions corresponding to the first iteration are calculated for transmission line M and transmission line N respectively.
[0011] Preferably, the point of the transmission line M is randomly selected within the range of variation of the abscissa parameter according to the initial probability density distribution function. and the point of the transmission line N The steps include: Random sampling is performed within the coordinate interval based on the calculated initial probability density distribution function. Randomly generate x-coordinate values within the variation range of the x-coordinate parameters corresponding to transmission line M. Substituting the values into the corresponding second-order parabolic model's analytical expression, the ordinate values are calculated to determine the points of transmission line M. ; Randomly generate x-coordinate values within the variation range of the x-coordinate parameters corresponding to transmission line N. Substituting the values into the corresponding second-order parabolic model's analytical expression, the vertical coordinate is calculated to determine the point N of the transmission line. ; The combined sampling of the horizontal and vertical coordinate values completes the initial state definition of the starting point for the optimization algorithm.
[0012] Preferably, the step of calculating the initial sample overhead transmission line distance includes: Extraction point and points Using the coordinates in the corrected images 1 and 2 respectively, and combining the ordinate values of these coordinates with similar triangle mapping logic, the points are calculated respectively. The horizontal distance and point corresponding to the optical center G1 of the F-lens of the multi-rotor drone The horizontal distance corresponding to the optical center G2 of the F-lens of a multi-rotor drone; utilization point With point The horizontal distances are subtracted and their absolute values are taken to obtain the relative distance between the two in the horizontal direction; Junction point and points The image projection distance is calculated using the horizontal and vertical coordinates in the corrected image image 1, and then based on the image projection distance, the pre-acquired camera focal length, and the point... The horizontal distance is calculated to obtain the actual projected distance between the two points on the vertical plane; Substituting the relative distance in the horizontal direction and the actual projected distance in the vertical plane into the hypotenuse calculation relationship of a spatial right triangle, the three-dimensional spatial straight-line distance is obtained, and the sample overhead transmission line distance is output.
[0013] Preferably, the steps of initializing the minimum and average error values include: Establish a target error function to record the distance measurement values generated in each loop iteration; The initially calculated sample overhead transmission line distance is directly assigned to the minimum error value in the environmental parameters, which is used to filter the minimum value in subsequent iterations. Simultaneously, the initial sample overhead transmission line distance is assigned to the average error value and initial error parameter in the environmental parameters, thus completing the initial state construction for reinforcement learning to find the shortest crossing distance.
[0014] Preferably, the step of determining the relationship between the current iteration error value and the minimum and average error values to generate a penalty factor includes: Extract the current iteration error value and the minimum error value to perform a numerical comparison; when it is determined that the current iteration error value is less than the minimum error value, set the penalty factor for the current output to 1, and replace the original minimum error value with the current iteration error value; When it is determined that the current iteration error value is not less than the minimum error value, the current iteration error value is extracted and compared with the average error value to perform a second-level numerical comparison. When the current iteration error value is determined to be greater than the average error value, a discard mechanism is triggered, and the penalty factor for the current output is set to 0. When it is determined that the current iteration error value is not greater than the average error value, a linear interpolation normalization operation is performed by combining the current iteration error value, the minimum error value, and the average error value to generate a dynamic value between 0 and 1, which is then assigned to the penalty factor.
[0015] Preferably, the step of outputting the cross-span distance measurement value includes: Set and extract the maximum number of iterations for the reinforcement learning algorithm; An iteration count counter is set up to record the total number of iterations that have been performed so far, and the total number of iterations that have been performed so far is compared with the extracted maximum number of iterations. When the maximum number of iterations has not been reached, the iteration count counter is incremented by 1, the probability density distribution function that has been independently updated is called to randomly generate the specific value of the horizontal axis parameter, and the system is driven to return to a new loop process to execute the calculation of the overhead transmission line distance of the sample to generate the current iteration error value. When the maximum number of iterations is reached, the random sampling and probability update operations are stopped, and the record of the minimum error value saved by the system is locked. The optimal parameter combination that produces the minimum error is retrieved, and the optimal abscissa calculation value corresponding to the transmission line M is output. And the calculated optimal abscissa value of the corresponding transmission line N As the basis for the coordinates of the actual intersection and crossing points; The minimum error recorded at this time is output as the shortest three-dimensional crossing distance between transmission line M and transmission line N.
[0016] This invention provides a method for measuring the crossing distance of UAV routes based on reinforcement learning algorithms, which has the following advantages: 1. This invention acquires two original images at different heights by controlling a multi-rotor UAV to move vertically from a fixed horizontal position. It then combines the camera's intrinsic parameter matrix and distortion coefficient matrix to perform image distortion and perspective correction. This acquisition method, combined with similar triangle mapping logic, derives the horizontal distance from the feature points of the transmission line to the lens's optical center and the actual projected distance on the vertical plane, thereby calculating the straight-line distance in three-dimensional space. This reduces the dependence of the measurement task on complex binocular vision hardware and ensures the objectivity and accuracy of the basic ranging data.
[0017] 2. This invention extracts the feature point coordinates of the pixel contours of transmission line images, substitutes them into a second-order parabolic model to perform fitting operations to generate corresponding coefficients, and extracts the abscissa values of the start and end points of the curve trajectory to establish the range of abscissa parameter variation. This processing method reduces the image-level matching process of finding the crossing points of transmission lines to a numerical optimization problem for a one-dimensional abscissa range, avoiding the algorithm from traversing blank pixel areas of the image, saving system computing resources and improving overall processing efficiency.
[0018] 3. This invention introduces a parameter iterative optimization mechanism based on reinforcement learning. It compares the sample distance error generated in each sampling iteration with the minimum and average errors recorded by the system, dynamically generating a penalty factor. The system uses this penalty factor to independently update the probability density distribution function of the abscissa parameter, guiding the random sampling process to gradually converge towards the shortest actual crossing point within a defined search interval. This achieves high-precision measurement of transmission line crossing distances even in the absence of prior data on crossing points. Attached Figure Description
[0019] Figure 1 A framework diagram of a UAV route crossing distance measurement system based on reinforcement learning algorithm provided by the present invention; Figure 2 A flowchart of a method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm is provided for this invention; Figure 3 This is a flowchart of step S100 in the present invention; Figure 4 This is a flowchart of step S200 in the present invention; Figure 5 This is a flowchart of step S300 in the present invention; Figure 6 This is a flowchart of step S400 in the present invention. Detailed Implementation
[0020] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] See Figure 1 This invention provides a UAV line crossing distance measurement system based on reinforcement learning algorithm, including power transmission line M, power transmission line N, multi-rotor UAV F with hovering function and ground remote control device.
[0022] The measurement system is divided into an image acquisition and preprocessing module, an overhead line mathematical model construction module, a crossing point distance calculation module, and a parameter iteration and optimization module according to the macroscopic workflow. The multi-rotor UAV F maintains a constant horizontal position and shooting angle and moves vertically to the corresponding height and hovers. The image acquisition and preprocessing module controls the multi-rotor UAV F to hover at height h1 to shoot the crossing area and obtain the original image 1. The image acquisition and preprocessing module controls the multi-rotor UAV F to hover at height h2 to shoot the crossing distance and obtain the original image 2. The image acquisition and preprocessing module records the height value and the position of the lens optical center. Based on the original image 1 and the original image 2, the image acquisition and preprocessing module performs camera calibration, distortion correction, and perspective correction to generate corrected images image 1 and image 2.
[0023] The overhead line mathematical model construction module establishes a pixel coordinate system based on the captured images and performs curve fitting on the corrected images (Image 1 and Image 2). This module sets the horizontal and vertical axes to determine the pixel coordinates on the images. It selects the coordinates of multiple feature points crossing overhead lines M and N from Images 1 and 2 and applies a second-order parabolic model to complete the fitting and obtain coefficients. The crossing point distance calculation module determines the range of coordinate parameter changes and calculates the initial probability density distribution function to complete environmental initialization. Finally, based on the probability density distribution function, the crossing point distance calculation module randomly selects points on transmission line M within the coordinate range. Point N of the transmission line The distance calculation module for crossing points combines the vertical movement characteristics of the multi-rotor UAV F to calculate the points. and points The distance of the transmission line is determined by the horizontal distance from the optical center and the projected distance.
[0024] The parameter iteration optimization module initializes the minimum and average error values of the iteration environment parameters, randomly generates the horizontal coordinate parameters according to the probability density distribution function, and calculates the distance of the sample overhead transmission line. The parameter iteration optimization module judges the relationship between the distance error and the minimum and average error values during the iteration process and gives a penalty factor. The parameter iteration optimization module independently updates the average value of the parameter probability density distribution function and the target error function, judges whether the number of iterations has reached the maximum number of iterations, and outputs the calculated value of the optimal parameter calculation coordinates and the measured value of the crossing distance when the judgment condition is met.
[0025] See Figure 2 Based on the aforementioned UAV route crossing distance measurement system based on reinforcement learning algorithm, this invention also provides a UAV route crossing distance measurement method based on reinforcement learning algorithm, which includes the following steps: S100, the image acquisition and preprocessing module controls the multi-rotor drone F to hover at height h1 to capture the cross-over area and obtain the original image 1, and records the flight height of the multi-rotor drone F and the position of the lens optical center G1. The image acquisition and preprocessing module fixes the horizontal position and shooting angle of the multi-rotor drone F and moves vertically to height h2 to hover and capture the cross-over distance to obtain the original image 2, and records the flight height of the multi-rotor drone F and the position of the lens optical center G2. The image acquisition and preprocessing module performs calibration, distortion correction and perspective correction on the camera based on the original image 1 and the original image 2 to generate corrected images image 1 and image 2. S200, the overhead line mathematical model construction module establishes a pixel coordinate system to perform curve fitting on the corrected images 1 and 2. The overhead line mathematical model construction module sets the horizontal and vertical axes to determine the pixel coordinates on the image. The overhead line mathematical model construction module selects the feature point coordinates of transmission line M and transmission line N in the corrected images 1 and 2, combines them with the second-order parabolic model to complete the fitting, generate coefficients, and determine the range of variation of the horizontal coordinate parameters. S300, the crossing point distance calculation module calculates the initial probability density distribution function to complete the environment initialization. Based on the probability density distribution function, the crossing point distance calculation module randomly selects points on transmission line M within the range of the horizontal coordinate parameter variation. Point N of the transmission line The distance calculation module for crossing points is combined with the numerical calculation of the vertical movement of the multi-rotor UAV F. and points The distance of the sample overhead power transmission line is obtained from the horizontal distance from the optical center of the lens and the vertical projection distance. S400, the parameter iteration optimization module initializes the minimum and average error values of the iteration environment parameters. The parameter iteration optimization module re-randomly generates the horizontal coordinate parameters according to the probability density distribution function and calculates the distance of the sample overhead transmission line to generate the distance error. The parameter iteration optimization module judges the relationship between the distance error and the minimum and average error values during the iteration process and generates a penalty factor. The parameter iteration optimization module independently updates the average value of the horizontal coordinate parameter probability density distribution function and the target error function in combination with the penalty factor. The parameter iteration optimization module judges whether the number of iterations has reached the maximum number of iterations and outputs the calculated value of the optimal parameter calculation coordinates and the measured value of the crossing distance when the judgment condition is met.
[0026] The technical solution for measuring the distance of UAV route crossings based on reinforcement learning algorithms will be described in detail below.
[0027] See Figure 3 In one specific implementation, step S100 includes the following sub-steps: S101, the image acquisition and preprocessing module sends a command to adjust the rotor speed of the multi-rotor drone F to enter a stationary hovering state. The multi-rotor drone F remains at altitude h1. The image acquisition and preprocessing module controls the gimbal mounted on the multi-rotor drone F to adjust the camera angle, setting the camera's field of view to completely cover the intersection area of power transmission lines M and N. The image acquisition and preprocessing module triggers the camera to perform an exposure operation to acquire the original image 1. The image acquisition and preprocessing module reads the spatial coordinate data generated by the multi-rotor drone F's positioning system, extracts the altitude value from the spatial coordinate data, and records the multi-rotor drone F's flight altitude h1. The image acquisition and preprocessing module calculates and records the position G1 of the lens optical center corresponding to the altitude h1 position, based on the displacement relationship of the camera coordinate system relative to the origin.
[0028] S102, the image acquisition and preprocessing module locks the horizontal latitude and longitude coordinates, gimbal pitch angle, and yaw angle of the multi-rotor UAV F, keeping its horizontal position and shooting angle constant. The module then controls the multi-rotor UAV F to change its rotor output speed, driving it to move vertically along the vertical line. Upon reaching altitude h2, the multi-rotor UAV F re-enters a hovering state. At altitude h2, the module triggers the camera to perform an exposure operation on the same span distance, acquiring the original image 2. The module reads the spatial coordinate data of the positioning system corresponding to altitude h2, extracts the altitude data, and records the flight altitude h2 of the multi-rotor UAV F. Finally, the module calculates and records the position G2 of the lens optical center when the multi-rotor UAV F is at altitude h2 through coordinate transformation.
[0029] S103, the image acquisition preprocessing module retrieves preset lens parameter information from the camera and extracts the camera intrinsic parameter matrix and distortion coefficient matrix. The intrinsic parameter matrix represents the mapping relationship between the pixel coordinate system and the camera coordinate system, and records the camera focal length and optical center coordinates. The distortion coefficient matrix records the radial distortion coefficient caused by the difference in lens refractive index and the tangential distortion coefficient caused by lens assembly errors.
[0030] S104, the image acquisition and preprocessing module reads original image 1 and original image 2 to establish a two-dimensional pixel grid system. The module traverses the grid nodes to extract the two-dimensional coordinates of the pixels, and performs coordinate mapping calculations using the intrinsic parameter matrix and distortion coefficient matrix to generate the ideal pixel coordinates corresponding to the elimination of lens nonlinear distortion. The module then uses a bilinear interpolation algorithm to refill the corresponding color grayscale values of the original images to the ideal pixel coordinate positions, outputting a distortion-corrected image with optical distortion removed.
[0031] S105, the image acquisition and preprocessing module retrieves the pitch and yaw angle values from the multi-rotor UAV F gimbal to calculate and generate a spatial homography transformation matrix. This matrix defines the mapping rules from the three-dimensional spatial plane to the two-dimensional sensor plane. The module then uses this matrix to perform matrix multiplication on the two-dimensional coordinates of all pixels in the distortion-corrected image, eliminating trapezoidal perspective distortion caused by the different hovering shooting angles of the multi-rotor UAV F, and reconstructing the tilted image into a front-view projection. The module outputs corrected image image 1 and corrected image image 2, corresponding to the completion of all processing steps, unifying the scale and viewing angle references of the two sets of images.
[0032] See Figure 4 In one specific implementation, step S200 includes the following sub-steps: S201, the overhead line mathematical model construction module receives the corrected images Image 1 and Image 2 output by the image acquisition and preprocessing module. The module reads the resolution parameters of Image 1 and Image 2 to extract the number of pixels in the image width and height. Based on the resolution parameters, the module divides the image into a two-dimensional discrete grid matrix and assigns an independent pixel unit code to each grid node.
[0033] S202, the overhead line mathematical model construction module selects the pixel at the lower left edge of the two-dimensional discrete grid matrix as the origin of the coordinate system. Based on the origin, the module establishes mutually perpendicular horizontal and vertical axes. The horizontal axis is defined as the x-axis, indicating the horizontal direction, and the direction extending to the right is set as the positive direction. The vertical axis is defined as the y-axis, indicating the vertical direction, and the direction extending upwards is set as the positive direction.
[0034] S203, the overhead line mathematical model construction module combines the positive horizontal and vertical axes to traverse the encoding of all pixel units within a two-dimensional discrete grid matrix. This module calculates the difference in the number of grid nodes between each pixel unit and the origin in the horizontal and vertical directions, generating horizontal and vertical coordinate values. Finally, the module combines these horizontal and vertical coordinate values to determine the pixel coordinates of each point in the corrected images (Image 1 and Image 2).
[0035] S204, the overhead line mathematical model construction module uses the Canny edge detection algorithm to identify the image pixel contour of transmission line M in the corrected image 1, and extracts three or more feature point coordinates on this image pixel contour. The same Canny edge detection algorithm is used to identify the image pixel contour of transmission line N in the corrected image 1, and extracts three or more feature point coordinates on this image pixel contour. Using the same pixel contour recognition and feature point coordinate extraction mechanism, the overhead line mathematical model construction module extracts three or more feature point coordinates for both transmission lines M and N in the corrected image 2. Transmission lines exhibit a single texture in the image, making it difficult to determine intersection points by directly matching pixels. Therefore, the overhead line mathematical model construction module establishes a discrete data sample set by extracting a small number of feature point coordinates.
[0036] S205, the overhead line mathematical model construction module substitutes the obtained feature point coordinates into the second-order parabolic model to perform curve fitting calculation; the expression of the second-order parabolic model is: ; In the formula, Represents the pixel values along the vertical axis; Represents the pixel values on the horizontal axis; The coefficient of the quadratic term of the parabola; The coefficient of the first-order term of the parabola; The constant coefficient represents the parabola.
[0037] S206, the overhead line mathematical model construction module, using the least squares method, performs a fitting operation on the feature point coordinates of transmission line M in the corrected image 1 based on a second-order parabolic model, generating the corresponding coefficients a11, b11, and c11 for transmission line M. The overhead line mathematical model construction module also performs a fitting operation on the feature point coordinates of transmission line N in the corrected image 1 based on a second-order parabolic model, generating the corresponding coefficients a12, b12, and c12 for transmission line N. Similarly, the overhead line mathematical model construction module performs a fitting operation on the feature point coordinates of transmission line M in the corrected image 2 based on a second-order parabolic model, generating the corresponding coefficients a21, b21, and c21 for transmission line M. Finally, the overhead line mathematical model construction module performs a fitting operation on the feature point coordinates of transmission line N in the corrected image 2 based on a second-order parabolic model, generating the corresponding coefficients a22, b22, and c22 for transmission line N. By extracting the coordinates of local feature points and substituting them into a second-order parabolic model to fit and generate the corresponding mathematical expression coefficients, the overhead line mathematical model construction module reduces the dimensionality of the image-level matching operation process for finding the crossing points of transmission lines into a numerical optimization problem for the range of changes in the horizontal coordinate parameters.
[0038] S207, the overhead line mathematical model construction module reads the width boundary parameters of the pixel coordinate system. The module identifies the pixel range laterally covered by the curved trajectory of transmission line M within the image grid system. It extracts the abscissa values of the starting endpoints of the transmission line M's curved trajectory to generate the lower boundary. It also extracts the abscissa values of the ending endpoints of the transmission line M's curved trajectory to generate the upper boundary. Finally, the module combines the lower and upper boundaries to establish the variation range of the abscissa parameters of transmission line M.
[0039] S208, the overhead line mathematical model construction module scans the curve trajectory of transmission line N in an increasing direction according to the horizontal axis coordinate value. The module locates the left edge pixels of transmission line N in the pixel coordinate system, generating a lower boundary. It also locates the right edge pixels of transmission line N in the pixel coordinate system, generating an upper boundary. The module combines the lower and upper boundaries to establish the range of horizontal axis parameter variation for transmission line N. By defining this range, the module confines the distance calculation of the infinitely extending line to a limited two-dimensional search space, avoiding the waste of computational resources caused by iterative algorithms traversing blank pixel areas.
[0040] See Figure 5 In one specific implementation, step S300 includes the following sub-steps: S301, the crossing point distance calculation module reads the range of changes in the horizontal coordinate parameters output by the overhead line mathematical model construction module. This range is then set as the learning interval for the reinforcement learning algorithm. In the absence of prior data on crossing points, the module ensures that the probability of all horizontal coordinates within the learning interval being selected as crossing points is equal.
[0041] S302, the crossing point distance calculation module establishes a probabilistic analytical relationship according to the uniform distribution model. The crossing point distance calculation module substitutes the upper and lower boundaries of the learning interval for calculation. The crossing point distance calculation module calculates the initial probability density distribution function corresponding to the first iteration for both transmission line M and transmission line N; the expression of the initial probability density distribution function is: ; In the formula, This represents the probability density value generated in the first iteration; Represents the horizontal axis of the transmission line; Represents the learning interval; Represents the upper limit of the learning range; This represents the lower limit of the learning interval.
[0042] S303, the cross-point distance calculation module sets the maximum number of iterations for the reinforcement learning algorithm. The cross-point distance calculation module uses the maximum number of iterations as the termination boundary condition for the optimization calculation process. The cross-point distance calculation module prevents the system from getting stuck in an infinite loop when searching for the shortest distance by limiting the upper limit of the number of loop executions.
[0043] S304, the crossing point distance calculation module performs random sampling within the coordinate interval based on the calculated initial probability density distribution function. The crossing point distance calculation module randomly generates abscissa values within the variation range of the abscissa parameters corresponding to transmission line M. The distance calculation module across points will calculate the x-coordinate value. Substituting the values into the analytical expression of the second-order parabola model corresponding to transmission line M, the corresponding ordinate values are calculated to determine the points of transmission line M. The distance calculation module for crossing points randomly generates horizontal coordinate values within the range of changes in the horizontal coordinate parameters corresponding to transmission line N. The distance calculation module across points will calculate the x-coordinate value. Substituting the values into the analytical expression of the second-order parabola model corresponding to transmission line N, the corresponding ordinate values are calculated to determine the points of transmission line N. The cross-point distance calculation module combines the sampled horizontal and vertical coordinate values to define the initial state of the starting point for the optimization algorithm.
[0044] S305, the crossing point distance calculation module extracts points on transmission line M. The coordinates in the corrected image 1 and the coordinates in the corrected image 2. Since the multi-rotor UAV F only performs purely vertical movement, the point... The x-coordinates remain equal in both images. The distance calculation module across points extracts the y-coordinate values to calculate the points. The horizontal distance corresponding to the optical center G1 of the F-lens of the multi-rotor drone. The crossing point distance calculation module extracts points on the power transmission line N. The coordinates in the corrected image 1 and the coordinates in the corrected image 2. The cross-point distance calculation module uses the same similar triangle mapping logic to calculate the points. The horizontal distance corresponding to the optical center G1 of the F-lens of the multi-rotor UAV; the analytical expression for the horizontal distance is: ; ; In the formula, Representative point The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone; Representative point The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone; Represents the camera's focal length; The flight altitude of image 1 taken by the multi-rotor UAV F during the correction process; The flight altitude of image 2 taken by the multi-rotor drone F during the correction process; Representative point The ordinate in the corrected image image 1; Representative point The vertical coordinate in the corrected image, picture 2; Representative point The ordinate in the corrected image image 1; Representative point The vertical axis in the corrected image, picture 2.
[0045] S306, Cross-point distance calculation module utilizes points The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone to the point The point is obtained by subtracting the horizontal distance from the optical center G1 of the multi-rotor drone's lens F and taking the absolute value. and points The relative distance in the horizontal direction; the analytical expression for the relative horizontal distance is: ; In the formula, Representative point and points Horizontal distance; Representative point The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone; Representative point The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone.
[0046] S307, Cross-point distance calculation module junction point In the corrected image 1, the horizontal and vertical coordinates and points In the corrected image 1, the horizontal and vertical coordinates are used to calculate the points using the Euclidean distance formula. and points The image projection distance on the corrected image image 1. The cross-point distance calculation module calculates the distance based on the image projection distance, camera focal length, and point. The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone is calculated to obtain the point. and points The actual projected distance in the vertical plane; the analytical expression for the projected distance is: ; ; In the formula, Representative point and points Projection distance on the corrected image image 1; Representative point The x-coordinate; Representative point The x-coordinate; Representative point The ordinate in the corrected image image 1; Representative point The ordinate in the corrected image image 1; Representative point and points The actual projected distance in the vertical plane; Represents the camera's focal length; Representative point The horizontal distance from the optical center G1 of the F-lens of the multi-rotor drone.
[0047] S308, the crossing point distance calculation module substitutes the horizontal distance and the actual projected distance on the vertical plane into the hypotenuse calculation relationship of a spatial right triangle to complete the three-dimensional spatial straight-line distance calculation operation, and outputs the sample overhead transmission line distance corresponding to the current sampling parameters; the analytical expression for the sample overhead transmission line distance is: ; In the formula, Representative point and points The actual distance in three-dimensional space, i.e., the distance of the sample overhead power transmission line; Representative point and points The actual projected distance in the vertical plane; Representative point and points The horizontal distance.
[0048] See Figure 6 In one specific implementation, step S400 includes the following sub-steps: S401, the parameter iterative optimization module receives the initial sample overhead transmission line distance output by the crossing point distance calculation module. The parameter iterative optimization module establishes a target error function to record the distance measurement values generated in each iteration. The parameter iterative optimization module uses the initially calculated sample overhead transmission line distance as a comparison benchmark for subsequent reinforcement learning iterations, providing basic evaluation data for assessing the distances of randomly generated transmission line feature points.
[0049] S402, the parameter iterative optimization module performs data assignment operations to set the initial iterative environment. The module directly assigns the initial sample overhead transmission line distance to the minimum error value in the environment parameters, which is used to filter for the minimum value in subsequent iterations. Simultaneously, the module assigns the initial sample overhead transmission line distance to the average error value and the initial error parameter in the environment parameters, completing the initial state construction for reinforcement learning to find the shortest crossing distance; the analytical expression for initializing the iterative environment parameters is: ; In the formula, This represents the minimum error among the iterative environment parameters; This represents the average error in the iterative environment parameters; Represents the initial error parameter; This represents the distance of the sample overhead transmission line obtained from the initial calculation.
[0050] S403, the parameter iteration optimization module re-executes the random sampling operation based on the probability density distribution function. The parameter iteration optimization module generates the first [sample] sample within the variation range of the abscissa parameters of transmission lines M and N. The x-coordinate value of the next iteration and x-axis values The parameter iteration optimization module will use the x-axis values... and x-axis values Substituting into the corresponding second-order parabola model's analytical expression, we obtain the... The points selected in the next iteration and points Spatial location parameters.
[0051] S404, the parameter iteration optimization module calls the spatial distance calculation logic, combines the vertical movement value of the multi-rotor UAV F with the pixel deviation parameter, and calculates the point. and points The actual three-dimensional spatial distance between them is defined as the first... The sample overhead transmission line distance for the next iteration. The parameter iterative optimization module will then... The distance of the sample overhead transmission line in the next iteration is assigned to the target error function to generate the current iteration error value; the analytical expression for this assignment process is: ; In the formula, Representing the The target error value generated in the next iteration; Representing the The distance of the sample overhead transmission line is calculated in the next iteration.
[0052] S405, the parameter iterative optimization module establishes an error evaluation and comparison mechanism. The module extracts the current iteration error value and compares it with the minimum error value in the iteration environment parameters to determine their magnitude. When the current iteration error value is determined to be less than the minimum error value, the module confirms that the current sampled parameters are closer to the actual line crossing point. The module assigns the highest weight to this sampling result and sets the penalty factor for the current output to 1. The module then replaces the original minimum error value with the current iteration error value, completing the update of the globally optimal record.
[0053] S406, when the current iteration error value is determined to be not less than the minimum error value, the parameter iteration optimization module extracts the current iteration error value and performs a second-level numerical comparison with the average error value in the iteration environment parameters. When the current iteration error value is determined to be greater than the average error value, the parameter iteration optimization module confirms that the current sampled parameter belongs to a poor solution and deviates from the true crossover point. The parameter iteration optimization module triggers a discard mechanism, setting the penalty factor of the current output to 0 to prevent the poor solution from having a negative impact on the subsequent probability distribution.
[0054] S407, when the current iteration error value is determined to be no greater than the average error value, the parameter iteration optimization module confirms that the current sampled parameter is between the minimum error value and the average error value, possessing reference value for optimization convergence. The parameter iteration optimization module combines the current iteration error value, the minimum error value, and the average error value to perform linear interpolation normalization, generating a dynamic value between 0 and 1 to be assigned to the penalty factor; the analytical expression of the dynamic penalty factor is: ; In the formula, Representing the The penalty factor for the output of the next calculation; Representing the The target error value generated in the next iteration; This represents the minimum error currently recorded by the system. This represents the average error recorded by the current system.
[0055] To avoid calculation overflow errors where the average error value equals the minimum error value in the early stages of iteration or under special circumstances, resulting in a zero denominator in the formula, the parameter iteration optimization module includes a denominator term ( An additional preset minimum normal value is added to the calculation as a fallback for error prevention; or, when the denominator is determined to be zero, a protection mechanism is directly triggered, assigning the current dynamic penalty factor. Default value.
[0056] S408, the parameter iterative optimization module extracts the penalty factor generated in the current iteration and constructs a probability update term by combining it with a Gaussian distribution model. The module then uses a normalization factor to perform a weighted summation of the historical probability density distribution and the probability update term to generate the probability density distribution function for the next iteration. By independently updating the probability density distribution functions of each parameter, the module increases the probability that the abscissa parameter, which produces a smaller distance error, will be selected in subsequent sampling, guiding the optimization algorithm to converge towards the intersection / crossing points. The analytical expression for independently updating the probability density distribution function is: ; In the formula, Representing the The probability density distribution values for the next iteration; The horizontal axis represents the transmission line; This represents the current iteration number; Represents the learning interval; Representative parameters In the Normalization factor at the next iteration; Representative parameters In the The probability density distribution values for the next iteration; The penalty factor represents the output of the current iteration; Represents the current learning parameter value Centered on (mathematical expectation), with a preset search radius The standard deviation is a Gaussian distribution function. Furthermore, the aforementioned normalization factor... This is used to ensure that the probability integral of the updated probability density distribution function is always equal to 1 throughout the entire learning interval, thus guaranteeing the mathematical rigor of the probability model.
[0057] S409, the parameter iterative optimization module collects the target error values generated in all previous iterative calculations. The module calculates all target error values using a cumulative summation method, and divides the sum by the total number of iterations performed to derive the updated target error function average. The module replaces the initial or old average data recorded by the system with the updated target error function average, ensuring the benchmark comparison parameters in the penalty factor calculation process are dynamically adaptable. The analytical expression for updating the target error function average is: ; In the formula, This represents the average value of the updated target error function; Represents the total number of iterations that have been performed so far; The sequence number representing the historical iteration calculation; Representing the The target error value generated in the next iteration.
[0058] S410, the parameter iteration optimization module sets up an iteration count counter to record the total number of iterations currently executed. The parameter iteration optimization module extracts the maximum number of iterations set in the system environment initialization step and compares the current total number of iterations with the maximum number of iterations.
[0059] S411, when the comparison result shows that the total number of iterations performed so far has not reached the maximum number of iterations, the parameter iteration optimization module increments the iteration counter by 1. The parameter iteration optimization module calls the independently updated probability density distribution function and jumps to step S403, where it randomly generates specific parameter values again within the variation range of the abscissa parameters of transmission line M and transmission line N, driving the system to return to the loop process of performing a new round of spatial distance calculation and target error comparison.
[0060] S412, when the comparison result shows that the total number of iterations performed so far equals the maximum number of iterations, the parameter iteration optimization module determines that the probability density distribution function has reached the convergence requirement, and the system automatically triggers the loop termination command. The parameter iteration optimization module stops the random sampling and probability update operation of the horizontal axis parameter and locks the record of the minimum error value saved by the system in each iteration.
[0061] S413, the parameter iteration optimization module retrieves the optimal parameter combination that generates the current minimum error. The parameter iteration optimization module then analyzes the optimal parameter combination and outputs the calculated optimal abscissa value for the corresponding transmission line M. And the calculated optimal abscissa value of the corresponding transmission line N The parameter iteration optimization module calculates the optimal x-coordinate value. and calculated value This serves as the coordinate basis for the actual crossing point between two intersecting overhead transmission lines. Finally, the parameter iteration optimization module takes the minimum error recorded at this point as the shortest crossing distance in three-dimensional space between transmission line M and transmission line N and outputs it, thus completing the line safety ranging task based on UAV vision and reinforcement learning algorithms.
Claims
1. A method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm, characterized in that, Includes the following steps: Control the multi-rotor drone F to acquire original image 1 and original image 2, and generate corrected image image 1 and corrected image image 2 based on the original image 1 and the original image 2; Establish a pixel coordinate system, select the feature point coordinates of transmission line M and transmission line N of the corrected image image 1 and the corrected image image 2, combine them with a second-order parabolic model to complete the fitting and generate coefficients, and determine the range of variation of the horizontal coordinate parameter. Calculate the initial probability density distribution function, and randomly select points on the transmission line M within the range of variation of the abscissa parameter based on the initial probability density distribution function. and the point of the transmission line N The initial sample overhead transmission line distance was calculated. Initialize the minimum and average error values, regenerate the horizontal axis parameters according to the probability density distribution function, calculate the distance of the sample overhead transmission line to generate the current iteration error value, determine the relationship between the current iteration error value and the minimum and average error values to generate a penalty factor, update the probability density distribution function in combination with the penalty factor, and independently update the average error value, and output the cross-span distance measurement value.
2. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 1, characterized in that, The steps for generating corrected image 1 and corrected image 2 include: Control the multi-rotor drone F to hover at a height h1 to capture the original image 1 of the intersecting area, and record the flight altitude of the multi-rotor drone F and the position G1 of the lens optical center; The horizontal position and shooting angle of the multi-rotor drone F are fixed, and it is moved vertically to a height h2 to hover and shoot the cross-distance to obtain the original image 2. The flight altitude of the multi-rotor drone F and the position of the lens optical center G2 are recorded. Based on the original image 1 and the original image 2, the camera is calibrated, distortion is corrected, and perspective is corrected to generate corrected image image 1 and corrected image image 2.
3. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 1, characterized in that, The steps for establishing the pixel coordinate system include: The system receives the corrected image image 1 and the corrected image image 2, reads the resolution parameters to extract the number of pixels in the image width and the number of pixels in the image height, and divides the image into a two-dimensional discrete grid matrix according to the resolution parameters, assigning each grid node an independent pixel unit encoding. The pixel at the lower left edge of the two-dimensional discrete grid matrix is selected as the origin of the coordinate system, and a mutually perpendicular horizontal axis and vertical axis are established based on the origin of the coordinate system. By combining the encoding of all pixel units within the two-dimensional discrete grid matrix through the positive directions of the horizontal and vertical axes, the number of grid nodes that each pixel unit differs from the origin is calculated to generate horizontal and vertical axis coordinate values. These values are then combined to determine the pixel coordinates of each point on the corrected image 1 and the corrected image 2.
4. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 1, characterized in that, The step of determining the range of variation of the horizontal coordinate parameter includes: Read the width boundary parameters of the pixel coordinate system and identify the pixel range laterally covered by the curve trajectory of the transmission line M within the pixel coordinate system; Extract the x-coordinate values of the starting endpoints of the curve trajectory of the transmission line M to generate the lower limit boundary, extract the x-coordinate values of the ending endpoints to generate the upper limit boundary, and combine them to establish the variation range of the x-coordinate parameters of the transmission line M. Scan the curve trajectory of transmission line N in the direction of increasing horizontal axis coordinate values, locate the lower boundary of the left edge pixel point of transmission line N in the pixel coordinate system, locate the upper boundary of the right edge pixel point, and combine them to establish the range of changes of the horizontal coordinate parameters of transmission line N.
5. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 1, characterized in that, The steps for calculating the initial probability density distribution function include: Read the range of changes in the horizontal coordinate parameter and set it as the learning range for the reinforcement learning algorithm; The initial probability values of all horizontal coordinates within the learning interval being selected as intersection points are set to be equal. A probabilistic analytical relationship is established based on the uniform distribution model. The upper and lower boundaries of the learning interval are substituted into the equations for calculation, and the initial probability density distribution functions corresponding to the first iteration are calculated for transmission line M and transmission line N respectively.
6. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 1, characterized in that, The point of the transmission line M is randomly selected within the range of variation of the abscissa parameter according to the initial probability density distribution function. and the point of the transmission line N The steps include: Random sampling is performed within the coordinate interval based on the calculated initial probability density distribution function. Randomly generate x-coordinate values within the variation range of the x-coordinate parameters corresponding to transmission line M. Substituting the values into the corresponding second-order parabolic model's analytical expression, the vertical coordinate is calculated to determine the point of transmission line M. ; Randomly generate x-coordinate values within the variation range of the x-coordinate parameters corresponding to transmission line N. Substituting the values into the corresponding second-order parabolic model's analytical expression, the vertical coordinate is calculated to determine the point N of the transmission line. ; The combined sampling of the horizontal and vertical coordinate values completes the initial state definition of the starting point for the optimization algorithm.
7. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 2, characterized in that, The steps for calculating the initial sample overhead transmission line distance include: Extraction point and points Using the coordinates in the corrected images 1 and 2 respectively, and combining the ordinate values of these coordinates with similar triangle mapping logic, the points are calculated respectively. The horizontal distance and point corresponding to the optical center G1 of the F-lens of the multi-rotor drone The horizontal distance corresponding to the optical center G2 of the F-lens of a multi-rotor drone; utilization point With point The horizontal distances are subtracted and their absolute values are taken to obtain the relative distance between the two in the horizontal direction; Junction point and points The image projection distance is calculated using the horizontal and vertical coordinates in the corrected image image 1, and then based on the image projection distance, the pre-acquired camera focal length, and the point... The horizontal distance is calculated to obtain the actual projected distance between the two points on the vertical plane; Substituting the relative distance in the horizontal direction and the actual projected distance in the vertical plane into the hypotenuse calculation relationship of a spatial right triangle, the three-dimensional spatial straight-line distance is obtained, and the sample overhead transmission line distance is output.
8. The method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 1, characterized in that, The steps for initializing the minimum and average error values include: Establish a target error function to record the distance measurement values generated in each loop iteration; The initially calculated sample overhead transmission line distance is directly assigned to the minimum error value in the environmental parameters, which is used to filter the minimum value in subsequent iterations. Simultaneously, the initial sample overhead transmission line distance is assigned to the average error value and initial error parameter in the environmental parameters, thus completing the initial state construction for reinforcement learning to find the shortest crossing distance.
9. A method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 8, characterized in that, The step of determining the relationship between the current iteration error value and the minimum and average error values to generate a penalty factor includes: Extract the current iteration error value and the minimum error value to perform a numerical comparison; when it is determined that the current iteration error value is less than the minimum error value, set the penalty factor for the current output to 1, and replace the original minimum error value with the current iteration error value; When it is determined that the current iteration error value is not less than the minimum error value, the current iteration error value is extracted and compared with the average error value to perform a second-level numerical comparison. When the current iteration error value is determined to be greater than the average error value, a discard mechanism is triggered, and the penalty factor for the current output is set to 0. When it is determined that the current iteration error value is not greater than the average error value, a linear interpolation normalization operation is performed by combining the current iteration error value, the minimum error value, and the average error value to generate a dynamic value between 0 and 1, which is then assigned to the penalty factor.
10. A method for measuring the crossing distance of a UAV route based on a reinforcement learning algorithm according to claim 9, characterized in that, The steps for outputting the cross-distance measurement value include: Set and extract the maximum number of iterations for the reinforcement learning algorithm; An iteration count counter is set up to record the total number of iterations that have been performed so far, and the total number of iterations that have been performed so far is compared with the extracted maximum number of iterations. When the maximum number of iterations has not been reached, the iteration count counter is incremented by 1, the probability density distribution function that has been independently updated is called to randomly generate the specific value of the horizontal axis parameter, and the system is driven to return to a new loop process to execute the calculation of the overhead transmission line distance of the sample to generate the current iteration error value. When the maximum number of iterations is reached, the random sampling and probability update operations are stopped, and the record of the minimum error value saved by the system is locked. The optimal parameter combination that produces the minimum error is retrieved, and the optimal abscissa calculation value corresponding to the transmission line M is output. And the calculated optimal abscissa value of the corresponding transmission line N As the basis for the coordinates of the actual intersection and crossing points; The minimum error recorded at this time is output as the shortest three-dimensional crossing distance between transmission line M and transmission line N.
