Unmanned aerial vehicle flight path planning method and device, computer equipment, readable storage medium and program product

By generating an undirected graph in the drone operation area and using a mathematical solver and breadth search algorithm to plan the flight path, the problems of high cost and insufficient accuracy in traditional methods are solved, and efficient drone operation path planning is achieved.

CN120403643APending Publication Date: 2025-08-01MACAU UNIV OF SCI & TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510522993.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

Traditional UAV flight path planning methods require a large number of sensors and complex algorithms, which are difficult to adapt to complex and changeable environments, resulting in high costs, insufficient accuracy and waste of resources.

Method used

By generating the target polygonal area based on the coordinate information of the drone operation area, establishing an undirected graph and adding a starting point and end point, using a mathematical solver and breadth search algorithm to plan the initial flight path, and updating the path model when an obstacle is detected, re-planning the flight path.

Benefits of technology

It improves the accuracy and operating efficiency of flight path planning, reduces costs, reduces resource waste, and can adapt to complex and changeable environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120403643A_ABST
    Figure CN120403643A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of unmanned aerial vehicles, and provides an unmanned aerial vehicle flight path planning method and device, computer equipment, a readable storage medium and a program product. The method comprises the following steps: obtaining a target polygonal area according to coordinate information of an unmanned aerial vehicle operation area; determining a scanning direction when the unmanned aerial vehicle works, and filling the target polygonal region with a scanning line to obtain an undirected graph; adding a flight start point and a flight end point in the undirected graph, and establishing a flight path analysis processing model; according to a mathematical solver, solving the flight path analysis processing model to obtain a first flight path; if an obstacle is detected when the unmanned aerial vehicle works according to the first flight path, modeling the obstacle into a polygonal region and adding the polygonal region into the undirected graph so as to update the flight path analysis processing model; and solving the updated flight path analysis processing model again according to the mathematical solver to obtain a second flight path. By adopting the method, the operation efficiency can be improved, and the cost is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of unmanned aerial vehicles, and particularly to a method, device, computer device, computer-readable storage medium, and computer program product for planning the flight path of an unmanned aerial vehicle. Background Art

[0002] In modern agricultural production, more and more intelligent products are being applied. With the development of unmanned aerial vehicle technology, agricultural production has also started to deploy unmanned aerial vehicles for detection or spraying, etc.

[0003] In the traditional technology, sensors can be installed on the spraying unmanned aerial vehicle to collect environmental information, and the flight path of the unmanned aerial vehicle can be planned by combining a predetermined algorithm. However, the method for planning the flight path of an unmanned aerial vehicle based on sensor data and a predetermined algorithm requires a large number of sensors and complex algorithms to implement, and it is difficult to adapt to complex and changeable environments, with insufficient flight path planning accuracy, resulting in high costs and low operation efficiency. Summary of the Invention

[0004] Based on this, it is necessary to provide a method, device, computer device, computer-readable storage medium, and computer program product for planning the flight path of an unmanned aerial vehicle in view of the above technical problems.

[0005] In a first aspect, the present application provides a method for planning the flight path of an unmanned aerial vehicle, including:

[0006] Obtaining a target polygon area according to the coordinate information of the operation area of the unmanned aerial vehicle;

[0007] Determining the scanning direction during the operation of the unmanned aerial vehicle, and filling the target polygon area with scan lines to obtain an undirected graph;

[0008] Adding a flight starting point and a flight ending point to the undirected graph, and establishing a flight path analysis and processing model;

[0009] Solving the flight path analysis and processing model according to a mathematical solver to obtain a first flight path;

[0010] If an obstacle is detected when the unmanned aerial vehicle operates according to the first flight path, modeling the obstacle as a polygon area and adding it to the undirected graph to update the flight path analysis and processing model;

[0011] Re-solving the updated flight path analysis and processing model according to the mathematical solver to obtain a second flight path.

[0012] In one embodiment, the objective function of the flight path analysis processing model is used to minimize the total length of the flight path; the constraint conditions of the flight path analysis processing model include that the total number of flight edges connected to the vertices of each required flight edge is even, select one from the starting edges that have not passed through obstacles, select one from the ending edges that have not passed through obstacles, there is only one flight edge of the obstacle and the connected flight edge, and the flight edge passing through the obstacle is defined as zero.

[0013] In one embodiment, obtaining the target polygon area according to the coordinate information of the UAV operation area includes:

[0014] Obtain the initial polygon area according to the coordinate information of the UAV operation area;

[0015] Take half of the length of the operation range of the UAV as the target length;

[0016] Erode the initial polygon area according to the target length to obtain the target polygon area.

[0017] In one embodiment, solving the flight path analysis processing model according to the mathematical solver to obtain the first flight path includes:

[0018] Solve the flight path analysis processing model according to the mathematical solver to obtain the first flight path edge set;

[0019] Combine the first flight path edges in the first flight path edge set according to the breadth-first search algorithm to obtain the first flight path.

[0020] In one embodiment, the method further includes:

[0021] When the UAV is operating, obtain the image of the front area according to the camera of the UAV;

[0022] Extract features from the front area image according to the backbone network module of the obstacle detection model to obtain the original feature image;

[0023] Perform multi-scale feature fusion on the original feature image according to the cross-scale channel transformer module of the obstacle detection model to obtain the feature fusion image;

[0024] Obtain the obstacle detection result according to the scaled exponential linear unit activation function of the obstacle detection model and the feature fusion image; the obstacle detection result is used to characterize whether an obstacle is detected during the operation of the UAV.

[0025] In one embodiment, the cross-scale channel transformer module according to the obstacle detection model performs multi-scale feature fusion on the original feature image to obtain a feature fusion image, including:

[0026] The channel embedding sub-module in the cross-scale channel transformer module according to the obstacle detection model divides the original feature image into different blocks, and performs a linear transformation on the different blocks to obtain an embedded representation sequence;

[0027] Combines the embedded representation sequence with position information to obtain an embedded feature image;

[0028] According to the attention organization sub-module in the cross-scale channel transformer module, performs multi-head channel attention processing on the embedded feature image to obtain an attention feature image;

[0029] According to the reconstruction sub-module in the cross-scale channel transformer module, reconstructs the size of the attention feature image to the size of the original feature image, and fuses it with the original feature image through a residual connection to obtain a feature fusion image.

[0030] In a second aspect, the present application also provides a device for planning a flight path of a drone, including:

[0031] A target polygon area acquisition module, configured to obtain a target polygon area according to the coordinate information of the drone operation area;

[0032] An undirected graph acquisition module, configured to determine the scanning direction during drone operation, and fill the target polygon area with scan lines to obtain an undirected graph;

[0033] An analysis processing model acquisition module, configured to add a flight start point and a flight end point to the undirected graph, and establish a flight path analysis processing model;

[0034] A first flight path acquisition module, configured to solve the flight path analysis processing model according to a mathematical solver to obtain a first flight path;

[0035] An analysis processing model update module, configured to, if an obstacle is detected when the drone operates according to the first flight path, model the obstacle as a polygon area and add it to the undirected graph to update the flight path analysis processing model;

[0036] A second flight path acquisition module, configured to re-solve the updated flight path analysis processing model according to the mathematical solver to obtain a second flight path.

[0037] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the above method.

[0038] In a fourth aspect, the present application also provides a computer-readable storage medium. On the computer-readable storage medium, a computer program is stored, and the computer program is executed by the processor to perform the above method.

[0039] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program, and the computer program is executed by the processor to perform the above method.

[0040] For the above method, device, computer device, computer-readable storage medium, and computer program product for planning the flight path of a drone, based on the coordinate information of the drone operation area, a target polygon area is obtained; the scanning direction during drone operation is determined, and the target polygon area is filled with scan lines to obtain an undirected graph; a flight start point and a flight end point are added to the undirected graph, and a flight path analysis and processing model is established; according to a mathematical solver, the flight path analysis and processing model is solved to obtain a first flight path; if an obstacle is detected when the drone operates according to the first flight path, the obstacle is modeled as a polygon area and added to the undirected graph to update the flight path analysis and processing model; again according to the mathematical solver, the updated flight path analysis and processing model is solved to obtain a second flight path. When an obstacle is detected during the operation of the drone in the present application, the obstacle is modeled as a polygon area and added to the undirected graph to update the flight path analysis and processing model, and then the second flight path is obtained. When an obstacle is detected, a flight path can be quickly regenerated to complete the operation task, which can adapt to complex and changeable environments, improve the accuracy of flight path planning, and then improve the operation efficiency, and does not require a large number of sensors and complex algorithms, and the cost is low. Description of the Drawings

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0042] Figure 1 It is an application environment diagram of the method for planning the flight path of a drone in an embodiment;

[0043] Figure 2 It is a flowchart of the method for planning the flight path of a drone in an embodiment;

[0044] Figure 3 Schematic diagram of the YOLOv8 neural network structure in one embodiment;

[0045] Figure 4 Schematic diagram of the structure of the cross-scale channel transformer module in one embodiment;

[0046] Figure 5 Schematic diagram of the overall operation framework of the method for planning the flight path of an unmanned aerial vehicle in one embodiment;

[0047] Figure 6 Schematic diagram of the process of the method for planning the flight path of an unmanned aerial vehicle in another embodiment;

[0048] Figure 7 Block diagram of the structure of the device for planning the flight path of an unmanned aerial vehicle in one embodiment;

[0049] Figure 8 Internal structure diagram of a computer device in one embodiment. Detailed implementation manners

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0051] The method for planning the flight path of an unmanned aerial vehicle provided by the embodiments of the present application can be applied to an application environment as shown in Figure 1 . Among them, the terminal 102 communicates with the server 104 through a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed in the cloud or other network servers. The terminal 102 can obtain a target polygon area according to the coordinate information of the unmanned aerial vehicle operation area, and then obtain a second flight path. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0052] In an exemplary embodiment, as shown in Figure 2 , a method for planning the flight path of an unmanned aerial vehicle is provided. Taking the method applied to the terminal 102 in Figure 1 as an example, the method includes the following steps S201 to step S206. Among them:

[0053] Step S201, obtain a target polygon area according to the coordinate information of the unmanned aerial vehicle operation area.

[0054] The operation mode of the drone in agriculture is generally to completely scan the required operation area on a specified path. Therefore, the coordinate information of the drone operation area can be read to obtain the initial polygon area that needs to be scanned during the drone operation.

[0055] The above initial polygon area can be subjected to erosion processing to obtain the target polygon area that needs to be scanned during the drone operation, thereby avoiding collisions outside the required operation area range when the drone is operating.

[0056] Step S202: Determine the scanning direction during the drone operation, and fill the target polygon area with scan lines to obtain an undirected graph.

[0057] The scanning direction during the drone operation can be determined according to the rotating calipers algorithm (RCA), and the target polygon area can be filled with scan lines. At this time, the scan lines and the target polygon area can be combined as the undirected graph corresponding to the operation area range of the drone.

[0058] Step S203: Add the flight starting point and the flight ending point to the undirected graph, and establish a flight path analysis and processing model.

[0059] The flight starting point and the flight ending point corresponding to the operation area range of the drone can be added to the undirected graph, and a flight path analysis and processing model can be established according to the Online Analytical Processing (OAP) model.

[0060] Step S204: Solve the flight path analysis and processing model according to the mathematical solver to obtain the first flight path.

[0061] Since the flight path analysis and processing model can be solved in polynomial time and does not belong to the Nondeterministic Polynomial (NP) hard problem, a mathematical solver, such as the CPLEX mathematical solver, can be directly called to quickly solve the flight path analysis and processing model and obtain an exact solution.

[0062] The obtained solution is the set of edges of the first flight path. Then, according to the Breadth First Search (BFS) algorithm, the edges of the first flight path in the set of edges of the first flight path can be connected into a complete path to obtain the first flight path that starts from the flight starting point, traverses each required flight edge in the undirected graph at least once and avoids colliding with obstacles, and finally returns to the flight ending point. The first flight path can also be called the pre-flight path.

[0063] Step S205, when the drone detects an obstacle during operation according to the first flight path, model the obstacle as a polygonal area and add it to the undirected graph to update the flight path analysis and processing model.

[0064] When the drone is operating according to the first flight path, if an obstacle is detected, model the obstacle as a polygonal area (such as a quadrilateral area) and add it to the undirected graph. The flight path analysis and processing model can be updated according to the undirected graph after adding the polygonal area.

[0065] Step S206, solve the updated flight path analysis and processing model again according to the mathematical solver to obtain the second flight path.

[0066] The updated flight path analysis and processing model can be solved again according to the mathematical solver to obtain the second flight path that starts from the flight starting point, traverses each required flight edge in the undirected graph at least once, avoids colliding with obstacles, and finally returns to the flight ending point.

[0067] In the above method for planning the drone flight path, when an obstacle is detected during the drone operation, model the obstacle as a polygonal area and add it to the undirected graph to update the flight path analysis and processing model, and then obtain the second flight path. When an obstacle is detected, the flight path can be quickly regenerated to complete the operation task, which can adapt to the complex and changeable environment, improve the flight path planning accuracy, and then improve the operation efficiency. Moreover, it does not require a large number of sensors and complex algorithms, and the cost is relatively low.

[0068] In one embodiment, the objective function of the flight path analysis and processing model is used to minimize the total length of the flight path; the constraint conditions of the flight path analysis and processing model include that the total number of flight edges connected to the vertices of each required flight edge is even, select one from the starting edges that have not passed through obstacles, select one from the ending edges that have not passed through obstacles, there is only one flight edge of the obstacle and the connected flight edge, and the flight edge passing through the obstacle is defined as zero.

[0069] The objective function of the flight path analysis and processing model is used to minimize the total length of the flight path, as shown in Equation (1).

[0070] (1)

[0071] In the formula, V represents the set of vertices of the required flight edges, x ij represents the flight edge from point i to point j, and C ij represents the Euclidean distance of the flight edge from point i to point j.

[0072] The constraints of the flight path analysis processing model include that the total number of flight edges connected to the vertex of each required flight edge is an even number, one edge is selected from the starting edge that does not pass through the obstacle, one edge is selected from the ending edge that does not pass through the obstacle, there is only one flight edge of the obstacle and the flight edge connected, and the flight edge passing through the obstacle is defined as zero, as shown in Equations (2) to (6).

[0073] (2)

[0074] (3)

[0075] (4)

[0076] (5)

[0077] (6)

[0078] Where x ij represents the flying edge from point i to point j, E R (i) represents the required flight edge connected to point i, V represents the vertex set of the required flight edge, w i is an auxiliary variable, V S Represents the set of legal edges that can connect the starting points, V E It represents the set of legal edges that can be connected to the endpoints, E O represents the edge set of obstacles, V R Represents the set of required flight edges, V O The vertex set representing the obstacle, E illegal (i) represents the flight edge passing through obstacle point i.

[0079] In one embodiment, a target polygonal area is obtained based on the coordinate information of the drone's operating area. The specific steps are as follows: an initial polygonal area is obtained based on the coordinate information of the drone's operating area; half the length of the drone's operating range is used as the target length; and the initial polygonal area is corroded based on the target length to obtain the target polygonal area.

[0080] The operation form of drones in agriculture is generally to completely scan the required operation area on a specified path. Therefore, the coordinate information of the drone's operation area can be read to obtain the initial polygonal area that needs to be scanned during the drone operation.

[0081] Half the length of the UAV's operating range can be used as the target length; according to the target length, the initial polygonal area can be eroded to obtain the target polygonal area.

[0082] In this embodiment, an initial polygonal area is obtained based on the coordinate information of the drone's operating area; the initial polygonal area is corroded according to half the length of the drone's operating range to obtain a target polygonal area, which can avoid collisions outside the required operating area when the drone is operating.

[0083] In one embodiment, a flight path analysis and processing model is solved according to a mathematical solver to obtain a first flight path. The specific steps are as follows: according to a mathematical solver, the flight path analysis and processing model is solved to obtain a first flight path edge set; according to a breadth search algorithm, the first flight path edges in the first flight path edge set are combined to obtain the first flight path.

[0084] Because the flight path analysis processing model can be solved in polynomial time and is not a nondeterministic polynomial (NP) hard problem, a mathematical solver, such as the CPLEX mathematical solver, can be directly called to solve the flight path analysis processing model to obtain the first flight path edge set.

[0085] The first flight path edges in the first flight path edge set can be combined according to a breadth search algorithm to obtain a first flight path that starts from the flight starting point, traverses each required flight edge in the undirected graph at least once and avoids collision with obstacles, and finally returns to the flight end point.

[0086] In this embodiment, the flight path analysis and processing model is solved according to the mathematical solver, so that a more accurate first flight path edge set can be quickly obtained; and the first flight path edges in the first flight path edge set are combined according to the breadth search algorithm, so that a more accurate first flight path can be quickly obtained.

[0087] In one embodiment, the method provided in the present application also includes: when the drone is operating, obtaining an image of the front area according to the camera of the drone; performing feature extraction on the image of the front area according to the backbone network module of the obstacle detection model to obtain an original feature image; performing multi-scale feature fusion on the original feature image according to the cross-scale channel converter module of the obstacle detection model to obtain a feature fusion image; obtaining an obstacle detection result according to the scaled exponential linear unit activation function of the obstacle detection model and the feature fusion image; the obstacle detection result is used to characterize whether an obstacle is detected during the drone operation.

[0088] Drones generally have built-in camera equipment, so when a drone is operating, images of the area in front of the drone can be obtained based on the drone's camera.

[0089] YOLOv8 (You Only Look Once Version 8) is a deep learning model in the field of object detection. With its efficient real-time detection capabilities and high accuracy, it has quickly become an important tool in the field of computer vision. YOLOv8 has made several improvements based on previous generations of models, aiming to further enhance performance and user experience. The neural network structure diagram of YOLOv8 is shown in Figure 3As shown. Among them, Conv represents convolution, and its full English name is Convolution; Split represents splitting; Bottleneck represents the bottleneck structure; shortcut connection represents the shortcut connection, and shortcut=true means using the shortcut connection in the network to strengthen feature transmission; MaxPool2d represents 2D max pooling, and its full English name is Max Pooling 2D; Concat represents concatenation, and its full English name is Concatenate; C2f represents the cross-scale feature fusion network, and its full English name is Cross-Scale Feature Fusion; shortcut=False means not using the shortcut connection; Upsample represents upsampling; SPPF represents spatial pyramid pooling followed, and its full English name is Spatial Pyramid Pooling Followed; Stride represents the stride, Conv2d represents 2D convolution, and its full English name is Convolution 2D; BatchNorm2d represents 2D batch normalization, and its full English name is Batch Normalization 2D; Detect represents detection; Backbone represents the backbone network, Head represents the output layer, and Stride represents the stride. YOLOv8 can perform object detection at high frame rates and is suitable for real-time applications such as surveillance cameras, autonomous driving, and drones. Its efficient architecture enables the model to achieve fast inference on ordinary graphics processing units (GPUs). This makes it more widely applicable in multiple application fields and capable of handling multiple visual tasks simultaneously. YOLOv8 adopts the convolutional neural network (CNN) architecture and combines some techniques in deep learning, such as the attention mechanism and residual connections. As a classic version of the YOLO series, YOLOv8 performs excellently in terms of speed, accuracy, and versatility, becoming an important tool in the field of object detection. Its efficient real-time processing ability and extensive application potential make YOLOv8 of great value in various computer vision tasks. With the continuous progress of technology, YOLOv8 will undoubtedly continue to promote the development of object detection technology and bring more innovation and applications to all walks of life. The YOLOv8 series provides five different scale models for users to choose from, including YOLOv8n, YOLOv8s, YOLOv8m, YOLOv8l, and YOLOv8x.Compared with other models, YOLOv8n achieves the highest cost performance among accuracy, detection rate, and model complexity. Therefore, in this embodiment, a Cross-Scale Channel Transformer (CSCT) module and a Scaled Exponential Linear Unit (SELU) activation function are added to the YOLOv8n model to train an obstacle detection model with better performance, realizing obstacle detection on the image of the front area of the drone, obtaining an obstacle detection result, which is used to characterize whether an obstacle is detected during the operation of the drone.

[0090] The original feature image can be obtained by extracting features from the image of the front area according to the backbone network module of the obstacle detection model.

[0091] The original feature image can be subjected to multi-scale feature fusion according to the cross-scale channel transformer module of the obstacle detection model to obtain a feature fusion image. Among them, the structural diagram of the cross-scale channel transformer module is as Figure 4As shown in the figure. Among them, relu represents the rectified linear unit, and its full English name is Rectified Linear Unit; avg pool represents average pooling, and its full English name is Average Pooling; C2f_EMBC represents C2f Convolution Enhanced Multi-Branch Convolution, a multi-branch convolutional network; Multi-channel header attention represents a multi-channel head attention mechanism; K represents the key vector, and its full English name is Key; Q represents the query vector, and its full English name is Query; V represents the value vector, and its full English name is Value; MLP represents the multi-layer perceptron, and its full English name is Multi-Layer Perceptron; LN represents layer normalization, and its full English name is Layer Normalization; Channel Embeddings represents channel embedding; Offset represents offset; Index represents index; Normalize represents normalization; Reconstruct represents reconstruction; Linear represents linear transformation; Sigmoid represents the sigmoid activation function; GAP represents global average pooling, and its full English name is Global Average Pooling; UpSample represents upsampling; Tokens represents tokens; SPPF_LSKA represents the Spatial Pyramid Pooling Fast Large Separable Kernel Attention module, and its full English name is Spatial Pyramid Pooling Fast Large Separable Kernel Attention; Detect_DyHead represents the detection dynamic head.

[0092] The cross-scale channel transformer module utilizes the high perception field of the Transformer to effectively fuse feature maps from different scales by introducing a channel-level attention mechanism, reducing the information inconsistency problem between multi-scale features and improving the accuracy and robustness of object detection. Different from the traditional feature splicing method, the cross-scale channel transformer module uses the multi-head attention mechanism to model the channel dependence of features, which is particularly suitable for feature extraction in small object detection and low-contrast scenarios, and can improve the performance of the YOLOv8 model in multi-scale feature fusion.

[0093] In summary, the introduction of the cross-scale channel transformer module provides the obstacle detection model with stronger feature representation capabilities, especially showing remarkable performance when dealing with complex scenarios and multi-scale targets. Compared with the original Path Aggregation Network (PANet) neck structure of the YOLOv8 model, the cross-scale channel transformer module selectively enhances useful features through a channel-level attention mechanism while retaining the original information, further improving the detection effect for small targets and low-contrast targets. Specifically, the combination of the multi-head channel attention mechanism and residual connections enables the cross-scale channel transformer module to establish stronger correlations and consistencies between features at different scales, thereby enhancing the detection accuracy and robustness of the obstacle detection model in complex scenarios. Overall, the cross-scale channel transformer module not only maintains the efficiency and real-time performance of the YOLOv8 model but also provides higher detection accuracy and robustness in complex scenarios, offering a more effective solution for the detection of small targets and multi-scale targets.

[0094] The traditional YOLOv8n model uses the Sigmoid-Weighted Linear Unit (SiLU) activation function, also known as the Swish function. When the Sigmoid linear unit processes negative input values, both its output value and gradient approach zero. This property may lead to the vanishing gradient problem in deep networks, affecting the training effect of the model. Especially when it is necessary to accurately distinguish small targets and process difficult samples, the vanishing gradient will cause the model to be unable to effectively capture these detailed information. To solve this problem and improve the numerical stability and generalization ability of the model, this embodiment introduces the Scaled Exponential Linear Unit (SELU) activation function to replace the original Sigmoid linear unit activation function.

[0095] Specifically, the Scaled Exponential Linear Unit activation function can be placed after the convolutional layer of the obstacle detection model to introduce non-linearity, enabling the obstacle detection model to process complex image data and solve non-linearity problems. For some small target detection tasks, an appropriate activation function can significantly improve the detection speed and accuracy while eliminating redundant information to improve the confidence quality (Cq).

[0096] The feature fusion image can be input into the Scaled Exponential Linear Unit activation function of the obstacle detection model to obtain the obstacle detection result.

[0097] Among them, the mathematical expression of the Scaled Exponential Linear Unit (SELU) activation function is shown in Equation (7).

[0098] (7)

[0099] In the formula, x represents the input value; represents the scaling factor, usually taking the value of ≈1.0507, which is used to ensure that the expected value of the output of the activation function remains consistent between layers and helps the network to perform better training; represents a constant, usually taking the value of ≈1.6733, which is used to adjust the performance of the activation value on the negative axis to help the network capture non-linear features; e represents the natural constant.

[0100] Since the core advantage of the scaled exponential linear unit activation function lies in its self-normalizing property, introducing the scaled exponential linear unit activation function to replace the original Sigmoid linear unit activation function in the obstacle detection model can maintain the numerical stability during the network training process. By weakening the gradient explosion and vanishing phenomena, the scaled exponential linear unit activation function ensures that when dealing with small target samples, complex samples, and extracting useful features from complex background information, the gradient information can be effectively transmitted, enabling the obstacle detection model to achieve automatic normalization, better focus on details, and accurately classify and locate.

[0101] In this embodiment, when the drone is operating, according to the camera of the drone, the image of the front area is obtained; according to the backbone network module, the cross-scale channel transformer module, and the scaled exponential linear unit activation function of the obstacle detection model, the obstacle detection result that is relatively accurate and used to represent whether an obstacle is detected during the operation of the drone can be quickly obtained.

[0102] In one of the embodiments, according to the cross-scale channel transformer module of the obstacle detection model, multi-scale feature fusion is performed on the original feature image to obtain a feature fusion image. The specific steps are as follows: According to the channel embedding sub-module in the cross-scale channel transformer module of the obstacle detection model, the original feature image is divided into different blocks, and linear transformation is performed on different blocks to obtain an embedded representation sequence; the embedded representation sequence and the position information are combined to obtain an embedded feature image; according to the attention organization sub-module in the cross-scale channel transformer module, multi-head channel attention processing is performed on the embedded feature image to obtain an attention feature image; according to the reconstruction sub-module in the cross-scale channel transformer module, the size of the attention feature image is reconstructed to the size of the original feature image and fused with the original feature image through a residual connection to obtain a feature fusion image.

[0103] According to the Channel_Embeddings sub-module in the cross-scale channel transformer module of the obstacle detection model, the original feature image can be divided into different patches, and different patches are linearly transformed to obtain an embedded representation sequence; to preserve spatial information, the Channel_Embeddings sub-module introduces position embeddings, combines the embedded representation sequence with the position information to obtain an embedded feature image, thereby enhancing the perception ability of different-scale features. This step not only maintains the spatial structure of the original feature image but also provides more comprehensive context information for subsequent attention calculation.

[0104] According to the Attention Organization (Attention_org) sub-module in the cross-scale channel transformer module, multi-head channel attention processing can be performed on the embedded feature image to obtain an attention feature image. The Attention Organization sub-module uses the multi-head attention mechanism to interactively model features at different scales, thereby capturing the channel-level dependencies between embedded feature images. In the Attention Organization sub-module, each channel feature interacts with all other channels through the calculation of query, key, and value to determine which features are more important in the obstacle detection task. This channel-level self-attention mechanism enables the Attention Organization sub-module to adaptively enhance important features and suppress irrelevant features, especially in dealing with complex multi-scale scenarios, which can effectively improve the accuracy and robustness of obstacle detection.

[0105] According to the Reconstruct sub-module in the cross-scale channel transformer module, convolutional layers and upsampling operations can be used to reconstruct the size of the attention feature image to the size of the original feature image, so as to restore to the shape of the original feature image and adapt to the requirements of subsequent network layers, and fuse with the original feature image through a residual connection to obtain a feature fusion image, which helps to maintain the integrity of the original information and also enhances the expression ability of important features through the residual path, making the obstacle detection model perform more prominently in small target and low-contrast scenarios.

[0106] In this embodiment, according to the Channel_Embeddings sub-module, Attention Organization sub-module, and Reconstruct sub-module in the cross-scale channel transformer module of the obstacle detection model, multi-scale feature fusion, channel embedding, and reconstruction processing are performed on the original feature image to obtain a feature fusion image, which can effectively improve the accuracy and robustness of obstacle detection.

[0107] To better understand the above method, the following elaborates in detail an application embodiment of the method for planning the flight path of the drone in this application.

[0108] In modern agricultural production, more and more intelligent products are being applied. With the development of drone technology, agricultural production has also started to deploy drones for tasks such as detection or spraying. Traditional spraying drones usually operate along a pre-determined path or through manual control. This approach has some drawbacks, such as low operation efficiency and resource waste. With the continuous development of artificial intelligence and drone technology, intelligent path planning methods have become a research hotspot, aiming to improve operation efficiency, reduce costs, and minimize resource waste.

[0109] Currently, a common technical solution is the path planning method based on sensor data and pre-determined algorithms. This method involves installing sensors on the spraying drone to collect environmental information and then performing path planning in combination with pre-determined algorithms. However, this method usually requires a large number of sensors and complex algorithms to implement, and it is difficult to adapt to complex and changing environments.

[0110] In addition, there is also a path planning method based on Global Positioning System (GPS) positioning and map data. This method locates the position of the spraying drone through the Global Positioning System and performs path planning in combination with map data. However, due to the possible instability of the Global Positioning System signal in certain environments and the potential inaccuracy of map data, this method has certain limitations in practical applications.

[0111] In summary, the traditional methods for planning the flight paths of drones have the following problems:

[0112] (1) High cost: Traditional path planning methods may involve a large number of sensor devices and complex algorithms, which will increase the manufacturing and operation costs of spraying drones.

[0113] (2) Resource waste: Since traditional path planning methods cannot effectively plan the operation path, it may cause the spraying drone to turn repeatedly during operation, resulting in resource waste.

[0114] (3) Insufficient accuracy: The path planning method based on Global Positioning System positioning and map data is limited by the signal stability of the Global Positioning System and the accuracy of map data, which may lead to an inaccurate operation path and affect operation efficiency.

[0115] (4) Collision and damage of drones: Due to the inaccuracy of the path planning of traditional path planning methods, drones cannot completely cover the required area during operation or fly out of the required area to collide with some obstacles in order to achieve complete coverage, resulting in a certain degree of damage to the drones.

[0116] To address the above problems, this embodiment provides an intelligent method for planning the flight path of a drone. Its purpose is to improve the efficiency of spraying drone operations, reduce costs, and minimize resource waste. The technical method provided in this embodiment can intelligently plan the flight path of the operation based on the coordinates of each vertex of the required operation area, improve the operation accuracy, thereby achieving the goal of saving resources and reducing costs. At the same time, the YOLOv8-CS model is used to identify obstacles such as utility poles and wires, re-model the obstacles into the original map, and then re-search and set the flight path. When the camera detects an obstacle, it can quickly regenerate the optimal second flight path to complete the operation task, effectively improving the operation efficiency and reducing the production cost.

[0117] The overall operation framework diagram of the drone flight path planning method provided in this embodiment is as Figure 5 shown, and the overall operation flow chart is as Figure 6 shown. The operation form of the drone in agriculture is generally to completely scan the required operation area on a specified path. Therefore, the coordinate information of the drone operation area can be read to obtain the initial polygon area that needs to be scanned during the drone operation (generally, the scene where drone spraying operation is required is a polygon area). The half length of the operation range of the drone can be used as the target length. According to the target length, the initial polygon area can be eroded to obtain the target polygon area, thus avoiding collisions outside the required operation area range when the drone is operating.

[0118] The scanning direction during the drone operation can be determined according to the rotating calipers algorithm (RCA), and the target polygon area can be filled with scan lines. The scan lines and the target polygon area at this time can be combined as the undirected graph corresponding to the operation area range of the drone. The flight starting point and flight ending point corresponding to the operation area range of the drone can be added to the undirected graph, and a flight path analysis and processing model can be established according to the Online Analytical Processing (OAP) model.

[0119] Since the flight path analysis and processing model can be solved within polynomial time and does not belong to the non-deterministic polynomial (NP) hard problem, a mathematical solver, such as the CPLEX mathematical solver, can be directly invoked to quickly solve the flight path analysis and processing model and obtain an exact solution. The obtained solution is the first flight path edge set. Then, according to the breadth first search (BFS) algorithm, the first flight path edges in the first flight path edge set can be connected into a complete path to obtain a first flight path that starts from the flight starting point, traverses each required flight edge in the undirected graph at least once, avoids colliding with obstacles, and finally returns to the flight ending point. The first flight path can also be referred to as the pre-flight path.

[0120] The drone can operate according to the first flight path. When the obstacle detection model in the drone's camera detects an obstacle while the drone is operating according to the first flight path, the obstacle is modeled as a polygon area and added to the undirected graph to update the flight path analysis and processing model. The updated flight path analysis and processing model can be re-solved according to the mathematical solver to obtain a new second flight path edge set that can avoid collisions. Then, according to the breadth first search algorithm, the second flight path edges in the first flight path edge set are connected into a complete path to obtain the second flight path.

[0121] The two main modules of the drone flight path planning method provided in this embodiment are as follows:

[0122] (1) Flight path analysis and processing model:

[0123] After the undirected graph, the flight starting point, and the flight ending point are constructed, at this time, a path that starts from the flight starting point, traverses each required flight edge in the undirected graph at least once, avoids colliding with obstacles, and finally returns to the flight ending point needs to be obtained. An online analytical processing (OAP) model can be used to establish a flight path analysis and processing model, as shown in equations (1)-(6).

[0124] (1)

[0125] (2)

[0126] (3) [[ID=2,6]]

[0127] (4)

[0128] (5)

[0129] (6)

[0130] Equation (1) is the objective function of the flight path analysis and processing model, which is used to minimize the total length of the flight path. Among them, V represents the set of vertices of the required flight edges, and x ij represents the flight edge from point i to point j, and C ij represents the Euclidean distance of the flight edge from point i to point j.

[0131] Equations (2)-(6) are the constraint conditions. Among them, x ij represents the flight edge from point i to point j, E R (i) represents the required flight edges connected to point i, V represents the set of vertices of the required flight edges, w i is an auxiliary variable, V S represents the set of legal edges that can connect to the starting point, V E represents the set of legal edges that can connect to the ending point, E O represents the set of edges of the obstacle, V R represents the set of required flight edges, V O represents the set of vertices of the obstacle, E illegal (i) represents the flight edge passing through the obstacle point i.

[0132] Since the flight path analysis and processing model can be solved within polynomial time and does not belong to the non-deterministic polynomial (NP) hard problem, a mathematical solver, such as the CPLEX mathematical solver, can be directly called to quickly solve the flight path analysis and processing model and obtain an accurate solution. The obtained solution is the set of flight path edges. Then, according to the breadth first search (BFS) algorithm, the flight path edges in this set of flight path edges can be connected into a complete path to obtain the flight path. The unmanned aerial vehicle can follow this flight path, that is, it can complete the tasks of the required operation area with the shortest flight path and prevent the collision of the unmanned aerial vehicle.

[0133] (2) Obstacle detection model

[0134] YOLOv8 (You Only Look Once Version 8) is a deep learning model in the field of object detection. With its efficient real-time detection ability and high accuracy, it has quickly become an important tool in the field of computer vision. YOLOv8 has made several improvements on the basis of previous generations of models, aiming to further improve performance and user experience. The neural network structure diagram of YOLOv8 is as Figure 3As shown in the figure. Among them, Conv represents convolution, and its full English name is Convolution; Split represents splitting; Bottleneck represents the bottleneck structure; shortcut connection represents the shortcut connection, and shortcut=true means using the shortcut connection in the network to strengthen feature transmission; MaxPool2d represents two-dimensional max pooling, and its full English name is Max Pooling 2D; Concat represents concatenation, and its full English name is Concatenate; C2f represents the feature pyramid network, and its full English name is Cross-ScaleFeature Fusion; shortcut=False means not using the shortcut connection; Upsample represents upsampling; SPPF represents spatial pyramid pooling, and its full English name is Spatial Pyramid Pooling Followed; Stride represents the stride, Conv2d represents two-dimensional convolution, and its full English name is Convolution 2D; BatchNorm2d represents two-dimensional batch normalization, and its full English name is Batch Normalization 2D; Detect represents detection; Backbone represents the backbone network, Head represents the output layer, and Stride represents the stride.

[0135] YOLOv8 can perform object detection at high frame rates and is suitable for real-time applications such as surveillance cameras, autonomous driving, and drones. Its efficient architecture enables the model to achieve fast inference on ordinary Graphics Processing Units (GPUs). This makes it more widely applicable in multiple application fields and capable of handling multiple vision tasks simultaneously. YOLOv8 adopts the Convolutional Neural Networks (CNN) architecture and combines some techniques in deep learning, such as attention mechanisms and residual connections. As a classic version of the YOLO series, YOLOv8 performs excellently in terms of speed, accuracy, and versatility, becoming an important tool in the field of object detection. Its efficient real-time processing ability and broad application potential make YOLOv8 of great value in various computer vision tasks. With the continuous progress of technology, YOLOv8 will undoubtedly continue to promote the development of object detection technology and bring more innovation and applications to all walks of life. The YOLOv8 series provides five different scale models for users to choose from, including YOLOv8n, YOLOv8s, YOLOv8m, YOLOv8l, and YOLOv8x. Compared with other models, YOLOv8n achieves the highest cost performance among accuracy, detection rate, and model complexity. Therefore, in this embodiment, a Cross-Scale Channel Transformer (CSCT) module and a Scaled Exponential Linear Unit (SELU) activation function are added to the YOLOv8n model to train a better-performing obstacle detection model, realize obstacle detection for the image of the front area of the drone, and obtain the obstacle detection result, which is used to characterize whether an obstacle is detected during the operation of the drone.

[0136] Generally, drones are equipped with camera devices. By adding a Cross-Scale Channel Transformer (CSCT) module and a Scaled Exponential Linear Unit (SELU) activation function to the YOLOv8n model, it can better adapt to real-time fast detection to achieve the effect of redesigned flight paths for obstacle avoidance.

[0137] The structural diagram of the cross-scale channel transformer module is as Figure 4As shown. Among them, relu represents the Rectified Linear Unit; avg pool represents the Average Pooling; C2f_EMBC represents the C2f Convolution Enhanced Multi-Branch Convolution; Multi-channel header attention represents the multi-channel head attention mechanism; K represents the Key; Q represents the Query; V represents the Value; MLP represents the Multi-Layer Perceptron; LN represents the Layer Normalization; Channel Embeddings represents the channel embedding; Offset represents the offset; Index represents the index; Normalize represents the normalization; Reconstruct represents the reconstruction; Linear represents the linear transformation; Sigmoid represents the Sigmoid activation function; GAP represents the Global Average Pooling; UpSample represents the upsampling; Tokens represents the tokens; SPPF_LSKA represents the Spatial Pyramid Pooling Fast Large Separable Kernel Attention; Detect_DyHead represents the detection dynamic head.

[0138] The cross-scale channel transformer module utilizes the high perception field of the Transformer. By introducing a channel-level attention mechanism, it effectively fuses feature maps from different scales, reduces the information inconsistency problem between multi-scale features, and improves the accuracy and robustness of object detection. Different from the traditional feature splicing method, the cross-scale channel transformer module uses the multi-head attention mechanism to model the channel dependence of features, which is particularly suitable for feature extraction in small object detection and low-contrast scenarios, and can improve the performance of the YOLOv8 model in multi-scale feature fusion.

[0139] Specifically, according to the Channel_Embeddings sub-module in the cross-scale channel transformer module of the obstacle detection model, the original feature image can be divided into different patches, and different patches are linearly transformed to obtain an embedded representation sequence. To preserve spatial information, the Channel_Embeddings sub-module introduces position embeddings, combines the embedded representation sequence with the position information to obtain an embedded feature image, thereby enhancing the perception ability of different-scale features. This step not only maintains the spatial structure of the original feature image but also provides more comprehensive context information for subsequent attention calculations.

[0140] According to the Attention Organization (Attention_org) sub-module in the cross-scale channel transformer module, multi-head channel attention processing can be performed on the embedded feature image to obtain an attention feature image. The Attention Organization sub-module uses the multi-head attention mechanism to interactively model features at different scales, thereby capturing the channel-level dependencies between embedded feature images. In the Attention Organization sub-module, each channel feature interacts with all other channels through the calculation of query, key, and value to determine which features are more important in the obstacle detection task. This channel-level self-attention mechanism enables the Attention Organization sub-module to adaptively enhance important features and suppress irrelevant features. Especially when dealing with complex multi-scale scenarios, it can effectively improve the accuracy and robustness of obstacle detection.

[0141] According to the Reconstruct sub-module in the cross-scale channel transformer module, convolutional layers and upsampling operations can be used to reconstruct the size of the attention feature image to the size of the original feature image, so as to restore to the shape of the original feature image and adapt to the requirements of subsequent network layers. It is fused with the original feature image through a residual connection to obtain a feature fusion image, which helps to maintain the integrity of the original information and also enhances the expression ability of important features through the residual path, making the obstacle detection model perform more prominently in small target and low-contrast scenarios.

[0142] In summary, the introduction of the cross-scale channel transformer module provides the obstacle detection model with stronger feature representation capabilities, especially showing remarkable performance when dealing with complex scenarios and multi-scale targets. Compared with the neck structure of the original Path Aggregation Network (PANet) in the YOLOv8 model, the cross-scale channel transformer module selectively enhances useful features through a channel-level attention mechanism while retaining the original information, further improving the detection effect for small targets and low-contrast targets. Specifically, the combination of the multi-head channel attention mechanism and residual connections enables the cross-scale channel transformer module to establish stronger correlations and consistencies between features at different scales, thereby enhancing the detection accuracy and robustness of the obstacle detection model in complex scenarios. Overall, the cross-scale channel transformer module not only maintains the efficiency and real-time performance of the YOLOv8 model but also provides higher detection accuracy and robustness in complex scenarios, offering a more effective solution for the detection of small targets and multi-scale targets.

[0143] The traditional YOLOv8n model uses the Sigmoid-Weighted Linear Unit (SiLU) activation function, also known as the Swish function. When the Sigmoid linear unit processes negative input values, both its output value and gradient approach zero. This characteristic may lead to the vanishing gradient problem in deep networks, affecting the training effect of the model. Especially when it is necessary to accurately distinguish small targets and process difficult samples, the vanishing gradient will cause the model to be unable to effectively capture these detailed information. To solve this problem and improve the numerical stability and generalization ability of the model, this embodiment introduces the scaled exponential linear unit activation function to replace the original Sigmoid linear unit activation function.

[0144] Specifically, the scaled exponential linear unit activation function can be placed after the convolutional layer of the obstacle detection model to introduce non-linearity, enabling the obstacle detection model to process complex image data and solve non-linearity problems. For some small target detection tasks, an appropriate activation function can significantly improve the detection speed and accuracy while eliminating redundant information to improve the confidence quality (Cq).

[0145] Among them, the mathematical expression of the Scaled Exponential Linear Unit (SELU) activation function is shown in Equation (7).

[0146] (7)

[0147] In the formula, x represents the input value; represents the scaling factor, usually taking the value of ≈1.0507, which is used to ensure that the expected value of the activation function output remains consistent between layers, helping the network to perform better training; represents a constant, usually taking a value of ≈1.6733, which is used to adjust the performance of the activation value on the negative axis to help the network capture non-linear features; e represents the natural constant.

[0148] Since the core advantage of the scaled exponential linear unit activation function lies in its self-normalizing property, replacing the original Sigmoid linear unit activation function with the scaled exponential linear unit activation function in the obstacle detection model can maintain numerical stability during network training. By weakening the gradient explosion and vanishing phenomena, the scaled exponential linear unit activation function ensures that gradient information can be effectively transmitted when dealing with small target samples, complex samples, and extracting useful features from complex background information, enabling the obstacle detection model to achieve automatic normalization, better focus on details, and accurately classify and locate.

[0149] Since traditional agricultural drones usually operate along a predetermined path or are manually controlled, this method is not efficient and easily causes waste of resources. At the same time, it is very difficult to avoid obstacles in real time, which may lead to crashing of the drone, increasing costs and extending the operation cycle. Therefore, this embodiment provides an intelligent real-time obstacle avoidance method for planning the flight path of a drone to maximize operation efficiency, reduce waste of resources, and avoid cost increase. Among them, a flight path analysis and processing model adapted to solve the flight path in the area with obstacles is proposed, which can effectively avoid the collision of the drone; a modified obstacle detection model based on the YOLOv8 framework is proposed, which can effectively adapt to the obstacle detection in real-time flight; the effective combination of the flight path analysis and processing model and the obstacle detection model can achieve obstacle avoidance and optimal path planning in the drone operation task. This embodiment provides an intelligent real-time obstacle avoidance method for planning the flight path of a drone, which can be applied to the operation task of agricultural drones to cover a specified area during flight, and can autonomously detect obstacles and regenerate the optimal flight path during flight to maximize operation efficiency, reduce waste of resources, and avoid cost increase.

[0150] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0151] Based on the same inventive concept, an embodiment of the present application also provides a device for planning a drone flight path for implementing the above-mentioned method for planning a drone flight path. The solution provided by the device for solving the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the device for planning a drone flight path provided below can refer to the limitations on the method for planning a drone flight path in the above text, and will not be repeated here.

[0152] In an exemplary embodiment, as Figure 7 shown, a device for planning a drone flight path is provided, wherein:

[0153] A target polygon area acquisition module 701, configured to obtain a target polygon area according to the coordinate information of the drone operation area;

[0154] An undirected graph acquisition module 702, configured to determine the scanning direction during drone operation, and fill the target polygon area with scan lines to obtain an undirected graph;

[0155] An analysis processing model acquisition module 703, configured to add a flight start point and a flight end point to the undirected graph, and establish a flight path analysis processing model;

[0156] A first flight path acquisition module 704, configured to solve the flight path analysis processing model according to a mathematical solver to obtain a first flight path;

[0157] An analysis processing model update module 705, configured to, if an obstacle is detected when the drone operates according to the first flight path, model the obstacle as a polygon area and add it to the undirected graph to update the flight path analysis processing model;

[0158] A second flight path acquisition module 706, configured to re-solve the updated flight path analysis processing model according to the mathematical solver to obtain a second flight path.

[0159] In one embodiment, the objective function of the flight path analysis processing model is used to minimize the total length of the flight path; the constraint conditions of the flight path analysis processing model include that the total number of flight edges connected to the vertices of each required flight edge is even, select one from the starting edges that have not passed through obstacles, select one from the ending edges that have not passed through obstacles, there is only one flight edge of the obstacle and the connected flight edge, and the flight edge passing through the obstacle is defined as zero.

[0160] In one embodiment, the target polygon area acquisition module 701 is further configured to: obtain an initial polygon area according to the coordinate information of the UAV operation area; use half of the length of the UAV operation range as the target length; perform erosion processing on the initial polygon area according to the target length to obtain the target polygon area.

[0161] In one embodiment, the first flight path acquisition module 704 is further configured to: solve the flight path analysis processing model according to a mathematical solver to obtain a first flight path edge set; combine the first flight path edges in the first flight path edge set according to a breadth-first search algorithm to obtain a first flight path.

[0162] In one embodiment, the device further includes an obstacle detection module, configured to: when the UAV is operating, obtain an image of the front area according to the camera of the UAV; extract features from the image of the front area according to the backbone network module of the obstacle detection model to obtain an original feature image; perform multi-scale feature fusion on the original feature image according to the cross-scale channel transformer module of the obstacle detection model to obtain a feature fusion image; obtain an obstacle detection result according to the scaled exponential linear unit activation function of the obstacle detection model and the feature fusion image; the obstacle detection result is used to characterize whether an obstacle is detected when the UAV is operating.

[0163] In one embodiment, the obstacle detection module is further configured to: divide the original feature image into different blocks according to the channel embedding sub-module in the cross-scale channel transformer module of the obstacle detection model, and perform linear transformation on the different blocks to obtain an embedded representation sequence; combine the embedded representation sequence and position information to obtain an embedded feature image; perform multi-head channel attention processing on the embedded feature image according to the attention organization sub-module in the cross-scale channel transformer module to obtain an attention feature image; reconstruct the size of the attention feature image to the size of the original feature image according to the reconstruction sub-module in the cross-scale channel transformer module, and fuse it with the original feature image through a residual connection to obtain a feature fusion image.

[0164] Each module in the above-mentioned UAV flight path planning device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of a computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.

[0165] In an exemplary embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 8 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data of embodiments of the UAV flight path planning method. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a UAV flight path planning method.

[0166] Those skilled in the art can understand that Figure 8 the structure shown in

[0167] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0168] In an embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, it implements the steps in the above method embodiments.

[0169] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the steps in the above method embodiments.

[0170] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0171] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.

[0172] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this application.

[0173] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application should be subject to the appended claims.

Claims

1. A method for planning a flight path of a drone, characterized in that, The method includes: Obtaining a target polygon area according to the coordinate information of the UAV operation area; Determining the scanning direction during UAV operation, and filling the target polygon area with scan lines to obtain an undirected graph; Adding a flight starting point and a flight ending point to the undirected graph, and establishing a flight path analysis and processing model; Solving the flight path analysis and processing model according to a mathematical solver to obtain a first flight path; If an obstacle is detected when the UAV operates according to the first flight path, modeling the obstacle as a polygon area and adding it to the undirected graph to update the flight path analysis and processing model; Re-solving the updated flight path analysis and processing model according to the mathematical solver to obtain a second flight path.

2. The method according to claim 1, characterized in that, The objective function of the flight path analysis and processing model is used to minimize the total length of the flight path; the constraint conditions of the flight path analysis and processing model include that the total number of flight edges connected to the vertices of each required flight edge is even, selecting one from the starting edges that have not passed through obstacles, selecting one from the ending edges that have not passed through obstacles, only one of the flight edges of the obstacle and the connected flight edges exists, and the flight edges passing through the obstacle are defined as zero.

3. The method according to claim 1, characterized in that The obtaining of the target polygon area according to the coordinate information of the UAV operation area includes: Obtaining an initial polygon area according to the coordinate information of the UAV operation area; Taking half of the length of the UAV operation range as the target length; Performing erosion processing on the initial polygon area according to the target length to obtain the target polygon area.

4. The method according to claim 1, wherein The solving of the flight path analysis and processing model according to a mathematical solver to obtain a first flight path includes: Solving the flight path analysis and processing model according to a mathematical solver to obtain a first flight path edge set; Combining the first flight path edges in the first flight path edge set according to the breadth-first search algorithm to obtain a first flight path.

5. The method according to claim 1, wherein The method further includes: When the UAV operates, obtaining an image of the front area according to the camera of the UAV; Performing feature extraction on the image of the front area according to the backbone network module of the obstacle detection model to obtain an original feature image; Performing multi-scale feature fusion on the original feature image according to the cross-scale channel transformer module of the obstacle detection model to obtain a feature fusion image; Obtaining an obstacle detection result according to the scaled exponential linear unit activation function of the obstacle detection model and the feature fusion image; the obstacle detection result is used to characterize whether an obstacle is detected when the UAV operates.

6. The method according to claim 5, characterized in that, The performing of multi-scale feature fusion on the original feature image according to the cross-scale channel transformer module of the obstacle detection model to obtain a feature fusion image includes: Dividing the original feature image into different blocks according to the channel embedding sub-module in the cross-scale channel transformer module of the obstacle detection model, and performing linear transformation on the different blocks to obtain an embedded representation sequence; Combining the embedded representation sequence and position information to obtain an embedded feature image; Perform multi - head channel attention processing on the embedded feature image according to the attention organization sub - module in the cross - scale channel transformer module to obtain an attention feature image; According to the reconstruction sub - module in the cross - scale channel transformer module, reconstruct the size of the attention feature image to the size of the original feature image and fuse it with the original feature image through residual connection to obtain a feature fusion image.

7. A device for planning the flight path of a drone, characterized in that, The device includes: A target polygon area acquisition module, configured to obtain a target polygon area according to the coordinate information of the UAV operation area; An undirected graph acquisition module, configured to determine the scanning direction during UAV operation and fill the target polygon area with scan lines to obtain an undirected graph; An analysis processing model acquisition module, configured to add a flight start point and a flight end point to the undirected graph and establish a flight path analysis processing model; A first flight path acquisition module, configured to solve the flight path analysis processing model according to a mathematical solver to obtain a first flight path; An analysis processing model update module, configured to, if an obstacle is detected when the UAV operates according to the first flight path, model the obstacle as a polygon area and add it to the undirected graph to update the flight path analysis processing model; A second flight path acquisition module, configured to re - solve the updated flight path analysis processing model according to the mathematical solver to obtain a second flight path.

8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.