A power grid obstacle cutting reference line determination method, system, device and medium based on Mask R-CNN

CN122821116APending Publication Date: 2026-09-25GUIZHOU POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610860501.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-15
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0005]因此,本发明解决的技术问题是:现有电网障碍物识别方法在复杂环境下精度低、定位模糊,难以为激光清障作业准确提供切割基准线

Benefits of technology

[0016]本发明提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现一种基于Mask R-CNN的电网障碍物切割基准线确定方法的步骤。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122821116A_ABST
    Figure CN122821116A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image recognition, and discloses a power grid obstacle cutting reference line determination method, system, device and medium based on Mask R-CNN, which comprises the following steps: obtaining a data set by marking the type of a cable obstacle in a power grid picture, inputting a Mask R-CNN network model for training and optimization; inputting real-time image information of the power grid into the optimized Mask R-CNN network model, identifying the obstacle and the cable in the power grid picture, and outputting an initial mask contour of the obstacle and a region candidate frame; inputting the obtained initial mask contour of the obstacle and the region candidate frame into a SAM2 segmentation model for fine segmentation, obtaining a fine mask contour of the obstacle; and drawing a cutting reference line on an image corresponding to the fine mask contour of the obstacle, and determining the start and end points of cutting. The application realizes rapid identification and accurate positioning of various obstacles through a deep learning algorithm, and provides reliable environmental sensing capability for subsequent cleaning operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and in particular to a method, system, device and medium for determining the cutting baseline of power grid obstacles based on Mask R-CNN. Background Technology

[0002] As the "last mile" of power transmission, the operational status of distribution network lines directly affects power supply reliability and the safety of electricity use for residents. However, with the expansion of the power grid and environmental changes, obstructions such as foreign objects hanging on the lines and tree branches have become core hidden dangers threatening distribution network safety. These hidden dangers are highly likely to cause short circuits, tripping, and other accidents under severe weather conditions, leading to large-scale power outages and posing a serious threat to social production and public safety.

[0003] Traditional methods for handling obstacles on power distribution lines have significant limitations. While power outages ensure personnel safety, they severely impact power supply reliability; live-line work carries extremely high safety risks and is inefficient. With the deepening of new power system construction and continuous investment in smart grids, intelligent obstacle removal equipment with autonomous operation capabilities will see broad application prospects. Laser obstacle removal technology, which has emerged in recent years, has achieved some success, resulting in equipment such as laser-guided tree-clearing drones and autonomous laser obstacle-clearing robots. These devices identify obstacles on transmission lines through image recognition and then remove them using lasers. However, current methods for identifying obstacles on transmission lines are limited in both speed and accuracy, particularly when dealing with tree branches and obstacles in complex terrain, failing to meet the needs of modern intelligent operation and maintenance of power distribution networks. Summary of the Invention

[0004] In view of the above-mentioned existing problems, the present invention provides a method, system, device and medium for determining the baseline for cutting power grid obstacles based on Mask R-CNN.

[0005] Therefore, the technical problem solved by the present invention is that existing power grid obstacle identification methods have low accuracy and ambiguous positioning in complex environments, making it difficult to accurately provide cutting baselines for laser obstacle removal operations.

[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for determining the cutting baseline of power grid obstacles based on Mask R-CNN, comprising: labeling the categories of cable obstacles in power grid images to obtain a dataset, and inputting the dataset into a Mask R-CNN network model for training and optimization; The real-time image information of the power grid is input into the optimized Mask R-CNN network model to identify obstacles and cables in the power grid image and output the initial mask contour of the obstacles and the candidate bounding boxes of the regions. The obtained initial mask contours of obstacles and region candidate boxes are input into the SAM2 segmentation model for fine segmentation to obtain fine mask contours of obstacles. Draw the cutting baseline on the image corresponding to the fine mask contour of the obstacle to determine the start and end points of the cut.

[0007] As a preferred embodiment of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in this invention, the method of inputting the dataset obtained by labeling the categories of cable obstacles in the power grid image into the Mask R-CNN network model for training and optimization includes: dividing the dataset into a training set, a validation set, and a test set, and training the Mask R-CNN network model using the training set; The input image is processed by a backbone network to extract multi-scale features and construct a feature pyramid. Anchor boxes are preset on the feature maps of each layer of the feature pyramid. Region proposal boxes are generated by a region proposal network and feature alignment is performed by ROI Align. Calculate the intersection-union ratio (IU) between each region's proposed bounding box and the ground truth bounding box, and classify the region's proposed bounding boxes into positive and negative samples based on the relationship between the IU and a preset threshold. The multi-task loss function is calculated based on the positive and negative samples to optimize the network parameters. The precision, recall, and mean precision of the trained model are evaluated using a test set, and the model is optimized based on the evaluation results. The optimized model is then validated using a validation set.

[0008] As a preferred embodiment of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN described in this invention, the step of dividing the region proposal boxes into positive and negative samples according to the relationship between the intersection-union ratio and a preset threshold includes: the region proposal network generating region proposal boxes with different scales and aspect ratios on each feature map of the feature pyramid. For each region suggestion box, calculate the intersection-union ratio (IU) with the ground truth bounding box. Region suggestion boxes with an IU greater than the preset threshold are identified as positive samples, and those with an IU greater than the preset threshold are identified as negative samples. During model training, all positive samples are input into the loss function, and a portion of the negative samples are randomly selected and input into the loss function.

[0009] As a preferred embodiment of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN described in this invention, the multi-task loss function includes a classification loss function, a bounding box regression loss function, and a mask loss function; The classification loss function is used to calculate the accuracy loss of obstacle classification, the bounding box regression loss function is used to calculate the loss of region proposal box position regression, and the mask loss function is used to calculate the loss of pixel-level mask. The mask loss function outputs K binary masks for each region of interest, where K is the number of obstacle categories. The loss is calculated by comparing the binary masks with the real masks. Backpropagation is performed based on the multi-task loss function to optimize the parameters of the backbone network, region proposal network, and head network.

[0010] As a preferred embodiment of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN described in this invention, the fine segmentation includes: performing edge detection on the initial mask contour to obtain a contour coordinate sequence; For each point in the contour coordinate sequence, a preset number of neighboring points are taken before and after it, and the discrete curvature value of the current point is calculated based on the angle between the forward vector and the backward vector. Select three points from all contour points that have the largest discrete curvature value and satisfy that the distance between adjacent key points along the contour is not less than a preset ratio of the perimeter as key points. The three key points are used as foreground cue points, and the region candidate boxes are used as bounding box cue points. They are input into the SAM2 segmentation model. The SAM2 segmentation model generates a fine mask contour of obstacles based on the features extracted by the image encoder and the dual constraints of the foreground cue points and bounding box cue points through the mask decoder.

[0011] As a preferred embodiment of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in this invention, the determination of the start and end points of the cutting includes: determining the cable direction vector; Based on the type of obstacle, a representative point is selected from the fine mask profile of the obstacle: for overhanging obstacles, the point on the obstacle mask profile closest to the cable is selected; For entangled obstacles, select the geometric center of the overlapping area between the obstacle mask and the cable mask; For attached obstacles, select the outer edge point of the maximum protrusion of the obstacle mask contour; For bridging obstacles, select the midpoint of the area where the cable intersects; For near-distance non-contact obstacles, select the extreme point of the obstacle mask profile facing the cable side; A straight line is drawn through the representative point along a direction parallel to the cable direction vector as the cutting baseline, and the two intersection points of the current straight line and the boundary of the fine mask of the obstacle are used as the start and end points of the cutting.

[0012] As a preferred embodiment of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in this invention, the training and optimization of the Mask R-CNN network model further includes: setting the learning rate to an initial value during the warm-up phase; and in the training phase after the warm-up phase, adjusting the learning rate sequentially by first increasing it to a peak value higher than the initial value, and then gradually decreasing it in subsequent phases. The switching of each stage is based on the preset number of iteration steps. When the precision or recall obtained by the test set evaluation does not meet the preset standard, the value of the iteration step or the learning rate of each stage is adjusted and retraining is performed until an optimized Mask R-CNN network model that meets the requirements is obtained.

[0013] This invention provides a system for determining the baseline for cutting obstacles in power grids based on Mask R-CNN.

[0014] As a preferred embodiment of the Mask R-CNN-based power grid obstacle cutting baseline determination system described in this invention, it includes: a data acquisition and annotation module, a Mask R-CNN network training and optimization module, an obstacle preliminary identification module, a SAM2 fine segmentation module, and a cutting baseline generation module; The data acquisition and labeling module is used to acquire images of power grids with obstacles on the cables and label the categories of obstacles to construct a dataset. The Mask R-CNN network training and optimization module is used to construct the Mask R-CNN network model, train, evaluate and validate the Mask R-CNN network model using the dataset, and optimize the network parameters through a multi-task loss function to obtain the optimized Mask R-CNN network model. The obstacle preliminary identification module is used to acquire real-time image information of the power grid, input the real-time image information into the optimized Mask R-CNN network model, identify obstacles and cables, and output the initial mask contour of the obstacle, the region candidate box and the obstacle category. The SAM2 fine segmentation module is used to receive the initial mask contour of the obstacle and the candidate bounding box of the region, extract key points from the initial mask contour as foreground cue points, and input the candidate bounding box of the region as a box cue into the SAM2 segmentation model to generate the fine mask contour of the obstacle. The cutting baseline generation module is used to select representative points from the fine mask contour of the obstacle according to the type of obstacle and cable and the spatial relationship between the obstacle and cable in the fine mask contour of the obstacle, draw a cutting baseline along a direction parallel to the cable direction vector, and determine the two intersection points of the cutting baseline and the boundary of the fine mask contour of the obstacle as the cutting start and end points.

[0015] The present invention provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of a method for determining the baseline for cutting power grid obstacles based on Mask R-CNN.

[0016] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of a method for determining the baseline for cutting power grid obstacles based on Mask R-CNN.

[0017] The beneficial effects of this invention are as follows: Compared with traditional algorithms, this invention focuses on optimizing the feature extraction stage: it constructs multi-scale feature response maps through deep convolutional layers and combines them with instance segmentation operations to achieve integrated detection and segmentation processing. Because feature maps at different levels have different scale ranges and receptive fields, they can specifically capture the feature details of small targets at a distance (such as thin kite strings) and large targets at close range (such as thick tree branches and large hanging objects), thereby achieving accurate detection and contour extraction of obstacles of different sizes. This end-to-end processing effectively overcomes the problems of blurred obstacle boundary positioning and high false negative rates for small targets in complex backgrounds, providing pixel-level spatial information support for the precise planning of laser cutting points (such as the positioning of contact points between foreign objects and wires). Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic flowchart of a method for determining the baseline for cutting power grid obstacles based on Mask R-CNN, provided as an embodiment of the present invention.

[0020] Figure 2 This is a schematic diagram illustrating the detection effect of a kite using a method for determining the cutting baseline of power grid obstacles based on Mask R-CNN, as provided in an embodiment of the present invention.

[0021] Figure 3 This is a schematic diagram illustrating the tree obstacle detection effect of a method for determining the cutting baseline of power grid obstacles based on Mask R-CNN, provided in an embodiment of the present invention. Detailed Implementation

[0022] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0023] Example 1, referring to Figure 1 This is the first embodiment of the present invention. This embodiment provides a method for determining the cutting baseline of power grid obstacles based on Mask R-CNN, including: inputting the dataset obtained by labeling the categories of cable obstacles in the power grid image into the Mask R-CNN network model for training and optimization; The real-time image information of the power grid is input into the optimized Mask R-CNN network model to identify obstacles and cables in the power grid image and output the initial mask contour of the obstacles and the candidate bounding boxes of the regions. The obtained initial mask contours of obstacles and region candidate boxes are input into the SAM2 segmentation model for fine segmentation to obtain fine mask contours of obstacles. Draw the cutting baseline on the image corresponding to the fine mask contour of the obstacle to determine the start and end points of the cut.

[0024] S1: Label the categories of cable obstacles in the power grid images to obtain the dataset, and input it into the Mask R-CNN network model for training and optimization.

[0025] S2: Input the real-time image information of the power grid into the optimized Mask R-CNN network model to identify obstacles and cables in the power grid image, and output the initial mask contour of the obstacles and the candidate bounding boxes of the regions.

[0026] S3: Input the obtained initial mask contour of the obstacle and the candidate region into the SAM2 segmentation model for fine segmentation to obtain the fine mask contour of the obstacle.

[0027] S4: Draw the cutting baseline on the image corresponding to the fine mask contour of the obstacle to determine the start and end points of the cut.

[0028] It should be noted that this embodiment is proposed to meet the needs of autonomous laser obstacle removal robots based on AI vision technology for accurate identification and laser operation control of obstacles on high-voltage power lines, specifically for scenarios involving the identification of hanging objects and the localization of laser cutting points. The core idea is to employ a lightweight deep learning network architecture, using a multi-scale feature extraction mechanism to capture key features of obstacles of different sizes from images, automatically generating candidate region proposal boxes. After non-maximum suppression optimization, the system accurately outputs the category information and pixel-level region contours of tree obstacles, various hanging objects, and foreign objects, providing core decision-making basis for power adjustment and aiming control in laser obstacle removal.

[0029] Example 2 is an embodiment of the present invention. Based on the above embodiment, a method for determining the cutting baseline of power grid obstacles based on Mask R-CNN is provided.

[0030] Furthermore, in this embodiment of the application, the dataset obtained by labeling the categories of cable obstacles in the power grid image in step S1 is input into the Mask R-CNN network model for training and optimization. Specific steps include: S101: Divide the dataset into a training set, a validation set, and a test set, and train the Mask R-CNN network model using the training set; The dataset is divided into training, validation, and test sets in a 7:2:1 ratio; The Mask R-CNN network model was trained using the training set. During training, the learning rate was set in stages: 0.0005 was used in the warm-up stage, and then adjusted to 0.00125, 0.000125, and 0.0000125 respectively in stages 1-12500, 12501-17230, and 17231-19000. This dynamic adjustment of the learning rate balanced the rapid convergence in the early stages of training with the finer optimization in later stages. S102: Input the dataset into the Mask R-CNN network model for training and optimization to obtain the optimized Mask R-CNN network model. Specific steps include: During the warm-up phase, the learning rate is set to an initial value; during the training phase following the warm-up phase, the learning rate is adjusted sequentially by first increasing it to a peak value higher than the initial value, and then gradually decreasing it in subsequent phases. The switching of each stage is based on the preset number of iteration steps. When the precision or recall obtained by the test set evaluation does not meet the preset standard, the value of the iteration step or the learning rate of each stage is adjusted and retraining is performed until an optimized Mask R-CNN network model that meets the requirements is obtained.

[0031] S103: The input image is processed by a backbone network to extract multi-scale features and construct a feature pyramid. Anchor boxes are preset on the feature maps of each layer of the feature pyramid. Region proposal boxes are generated by a region proposal network and feature alignment is performed by ROI Align. The region proposal network generates region proposal boxes with different scales and aspect ratios on each layer of the feature pyramid feature map. For each region suggestion box, calculate the intersection-union ratio (IU) with the ground truth bounding box. Region suggestion boxes with an IU greater than the preset threshold are identified as positive samples, and those with an IU greater than the preset threshold are identified as negative samples. During model training, all positive samples are input into the loss function, and a portion of the negative samples are randomly selected and input into the loss function.

[0032] S104: Calculate the intersection-union ratio (IU) between each region's proposed bounding box and the ground truth bounding box, and divide the region's proposed bounding boxes into positive and negative samples based on the relationship between the IU and a preset threshold. With an intersection-over-union (IoU) threshold of 0.5, calculate the IoU: in, For intersection, union, and comparison; This is the area of ​​the overlapping portion between the domain suggestion box and the actual annotation box; The area is the sum of the suggested area and the actual area bounding box.

[0033] S105: Calculate the multi-task loss function based on the positive and negative samples to optimize the network parameters; evaluate the precision, recall, and mean precision of the trained model using the test set, optimize the model based on the evaluation results, and validate the optimized model using the validation set.

[0034] Precision is the percentage of samples that were both actually positive and predicted as positive out of all samples that were predicted as positive. It is calculated as follows: in, Precision is TP; TP is the number of samples that are actually positive and predicted to be positive; FP is the number of samples that are actually negative and predicted to be positive. Recall is the percentage of samples that were both positive and predicted to be positive out of all samples that were actually positive. It is calculated as follows: In the formula, Recall rate; This represents the number of samples that were actually positive but were predicted to be negative. The mean precision is the average of all precision rates under different recall rates; the mean of the mean precision is the weighted average of the mean precision rates for different categories of obstacle detection.

[0035] The multi-task loss function is: in, Softmax is the loss function used to calculate the classification accuracy of the algorithm; Smooth L1 Loss is the location loss function used to regress the location loss. Let be the loss function for Mask. For each ROI, the mask branch has a Km*m dimension output, which encodes K masks of size m*m, i.e. K binary masks with resolution m*m.

[0036] Furthermore, in this embodiment, step S2 inputs real-time power grid image information into the optimized Mask R-CNN network model to identify obstacles and cables in the power grid image, and outputs initial mask contours of obstacles and candidate bounding boxes for regions. Specific steps include: S201: Input the power grid image into the optimized Mask R-CNN network model. Multiple region proposals are obtained through the optimized backbone network and region proposal network. After the features are precisely aligned by ROI Align, they are fed into the optimized head network to obtain the class probability of each region proposal, the refined bounding box coordinates, and the pixel-level mask.

[0037] S202: By using the non-maximum suppression algorithm, redundant candidate boxes for identifying the same target are removed, thus obtaining the region candidate boxes, outputting the category of the obstacle, and the initial mask contour.

[0038] For each obstacle category, the region proposals are sorted from highest to lowest probability, and the region proposal with the highest probability is selected as the baseline. The intersection-union ratio (IUR) of the remaining region proposals with the baseline is calculated sequentially, and region proposals with an IUR greater than a preset threshold are discarded as redundant boxes. The above selection, calculation, and elimination process is repeated from the remaining region proposals until all region proposals have been processed. The final region proposals are the region candidate boxes. At the same time, the pixel-level mask corresponding to each region candidate box is extracted as the initial mask contour, and the obstacle category is output.

[0039] While Mask R-CNN can effectively detect and segment obstacles, its mask resolution is limited by the fixed 28×28 pixel mask head in the network structure, resulting in some edge blurring and jagged edges in the output contour, especially for irregularly shaped tree-like obstacles. SAM2 (Segment Anything Model 2) is a general image segmentation model proposed by Meta, which has extremely high edge segmentation accuracy.

[0040] Furthermore, in this embodiment, step S3 inputs the obtained initial obstacle mask contour and region candidate box into the SAM2 segmentation model for fine segmentation to obtain the fine obstacle mask contour. Specific steps include: S301: Perform edge detection on the initial mask contour to obtain a contour coordinate sequence; For each point in the contour coordinate sequence, a preset number of neighboring points are taken before and after it, and the discrete curvature value of the current point is calculated based on the angle between the forward vector and the backward vector. Select three points from all contour points that have the largest discrete curvature value and satisfy that the distance between adjacent key points along the contour is not less than a preset ratio of the perimeter as key points. The three key points are used as foreground cue points, and the region candidate boxes are used as bounding box cue points. They are input into the SAM2 segmentation model. The SAM2 segmentation model generates a fine mask contour of obstacles based on the features extracted by the image encoder and the dual constraints of the foreground cue points and bounding box cue points through the mask decoder.

[0041] Specifically, firstly, edge detection is performed on the initial mask output by Mask R-CNN to obtain the contour coordinate sequence P={p1,p2,...,pn} of the obstacle. Then, the discrete curvature ki of each point pi on the contour is calculated. The curvature is estimated by taking the m neighboring points before and after pi and calculating the angle between the forward and backward vectors. The curvature values ​​are sorted from largest to smallest, and a minimum distance constraint is applied (the distance between adjacent keypoints is not less than 15% of the contour perimeter). Finally, three curvature extreme points that meet the conditions are selected as keypoints. These three keypoints represent the main morphological features of the obstacle contour and can provide effective foreground indication for SAM2.

[0042] S302: The three extracted keypoints are used as positive point prompts, and the minimum bounding rectangle of the initial Mask R-CNN mask is used as a box prompt, which is then input into the SAM2 model. SAM2 extracts high-resolution features based on its image encoder and, combined with the dual constraints of the positive point prompts and the box prompts, generates a refined pixel-level binary mask through the mask decoder. Compared to Mask R-CNN's 28×28 low-resolution mask upsampling method, SAM2 performs segmentation directly at the original image resolution, capturing finer boundary details.

[0043] Furthermore, in this embodiment, step S4 involves drawing a cutting baseline on the image corresponding to the fine mask contour of the obstacle to determine the start and end points of the cutting. Specific steps include: S401: Determine the cable direction vector, fit the cable centerline through the cable mask profile (or skeleton line), and calculate its direction vector d⃗.

[0044] S402: Select representative points from the fine mask contour of the obstacle, based on the obstacle type: A. For suspended obstacles, select the point on the obstacle mask contour that is closest to the cable; specifically, this includes obstacles with a clear contact point or suspension point with the cable, and the main body located on one side of the cable; select the point on the obstacle mask contour that is closest to the cable, or the point on which the contact point is projected into the obstacle along the cable direction as a representative point, and draw a straight line parallel to the cable direction through this point as the cutting reference line, so that the cutting line is close to the cable and avoids damage to the cable itself.

[0045] B. For entangled obstacles, select the geometric center of the overlapping area between the obstacle mask and the cable mask; specifically, this includes obstacles that wrap around the cable axis and have a large overlapping area with the cable; select the geometric center of the overlapping area between the obstacle mask and the cable mask as a representative point, and draw a cutting baseline parallel to the cable direction through this point to cut along the axial direction of the entangled section, which facilitates subsequent rotational stripping.

[0046] C. For attached obstacles, select the outer edge point of the largest protrusion on the obstacle mask contour; specifically, for such obstacles that are close to the outer surface of the cable and have a small protrusion height; select the outermost point on the obstacle mask contour along the cable normal as a representative point, draw a cutting reference line parallel to the cable direction through this point, and cut from the highest point to protect the cable surface.

[0047] D. For bridging obstacles, select the midpoint of the area where the obstacle intersects with the cable; specifically, this includes situations where the main body of the obstacle is located above the cable and there are one or more intersections with the cable; select the midpoint of the area where the obstacle intersects with the cable as a representative point, and draw a cutting baseline parallel to the cable direction through this point, so that the cutting line is located at the intersection, which facilitates the separation of the bridging obstacle.

[0048] E. For near-distance non-contact obstacles, select the extreme point of the obstacle mask profile facing the cable side; specifically, this includes obstacles that do not directly contact the cable but are very close; select the extreme point of the obstacle mask profile facing the cable side as a representative point, and draw a cutting baseline parallel to the cable direction through this point as a safety boundary or cutting starting point.

[0049] S503: Draw a straight line through the representative point along the direction parallel to the cable direction vector as the cutting reference line, and take the two intersection points of the current straight line and the boundary of the fine mask of the obstacle as the starting and ending points of the cutting.

[0050] Extract the contour point set from the cable mask, and obtain the cable route through skeleton extraction or least squares fitting; for curved cables, calculate the local direction for each segment of the piecewise fitted straight line. Based on the segment where the obstacle's projection location is located, select the corresponding... As a baseline direction.

[0051] Based on the representative point P0 determined according to the obstacle type and the direction vector, the cutting baseline is parameterized into a straight line equation. The closed contour polygon of the obstacle fine mask is traversed, and the intersection parameters of the straight line and the edge are solved. The intersection point corresponding to the two effective parameters is selected as the cutting start and end point. If there are fewer than two intersection points, P0 is slightly adjusted along the direction normal vector and the intersection is recalculated. In special cases: when an obstacle completely encloses the cable, a representative point is taken on each side of the cable centerline to generate two parallel cutting baselines; when the obstacle is extremely small, no cutting lines are generated or only markings are made; when the cable is severely bent, a curved cutting baseline is used, with the local tangent as the reference direction for "parallelism"; when multiple obstacles overlap, each instance is processed separately, and cutting lines are generated in the order of priority: wrapped, suspended, and attached.

[0052] S404: In case of special circumstances, take corresponding measures.

[0053] When the obstacle completely encloses the cable, take one representative point on each side of the cable's center line to generate two parallel cutting lines (double-line cutting). When the obstacle is extremely small (such as a small stain), no cutting line is generated (it has no actual cutting meaning) or it is recorded as a marker. When the cable is severely bent, a local direction is used instead of a global straight line, and even curves are allowed to cut the baseline (in this case, "parallel" refers to the local tangential direction). When multiple obstacles overlap, each instance is processed separately, and cutting lines are generated sequentially according to priority (entanglement > overhang > attachment).

[0054] Example 3 is the third embodiment of the present invention, which differs from the previous two embodiments in that: This embodiment also provides a power grid obstacle cutting baseline determination system based on Mask R-CNN, including: a data acquisition and annotation module, a Mask R-CNN network training and optimization module, an obstacle preliminary recognition module, a SAM2 fine segmentation module, and a cutting baseline generation module; The data acquisition and labeling module is used to acquire images of power grids with obstacles on the cables and label the categories of obstacles to construct a dataset. The Mask R-CNN network training and optimization module is used to construct the Mask R-CNN network model, train, evaluate and validate the Mask R-CNN network model using the dataset, and optimize the network parameters through a multi-task loss function to obtain the optimized Mask R-CNN network model. The obstacle preliminary identification module is used to acquire real-time image information of the power grid, input the real-time image information into the optimized Mask R-CNN network model, identify obstacles and cables, and output the initial mask contour of the obstacle, the region candidate box and the obstacle category. The SAM2 fine segmentation module is used to receive the initial mask contour of the obstacle and the candidate bounding box of the region, extract key points from the initial mask contour as foreground cue points, and input the candidate bounding box of the region as a box cue into the SAM2 segmentation model to generate the fine mask contour of the obstacle. The cutting baseline generation module is used to select representative points from the fine mask contour of the obstacle according to the type of obstacle and cable and the spatial relationship between the obstacle and cable in the fine mask contour of the obstacle, draw a cutting baseline along a direction parallel to the cable direction vector, and determine the two intersection points of the cutting baseline and the boundary of the fine mask contour of the obstacle as the cutting start and end points.

[0055] This embodiment also provides an electronic device, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN proposed in the above embodiment.

[0056] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as proposed in the above embodiment.

[0057] The storage medium proposed in this embodiment belongs to the same inventive concept as the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN proposed in the above embodiments. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0058] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0059] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

[0060] Example 4, refer to Figure 2 and Figure 3 This is an embodiment of the present invention. Based on the above embodiment, it is used to verify a method for determining the baseline for cutting power grid obstacles based on Mask R-CNN.

[0061] Step 1: After reading the image, it first goes through multiple convolutions to generate a series of feature maps with different depths. On these feature maps, a series of region proposal boxes of the same size but different depths are generated using ROI Align technology. Finally, the region proposal boxes are obtained through non-maximum suppression algorithm.

[0062] Step 2: Within the default bounding box with varying scales and aspect ratios, a small number of samples will partially overlap with the GroundTruth value. In this case, the overlapping samples are designated as positive samples, while the remaining samples are treated as negative samples. The overlap between the default bounding box and the GroundTruth value is measured using the intersection-over-union ratio (IoU).

[0063] If boxes A and B exist, their intersection-union ratio is calculated as follows: This algorithm uses an intersection-union (IU) threshold of 0.5 for positive and negative sample determination. That is, all default bounding boxes with an IU exceeding 0.5 with the Ground Truth are considered positive samples, and those with an IU exceeding 0.5 are considered negative samples. During training, all positive samples participate in the training process. Since the number of negative samples far exceeds that of positive samples, and too many negative samples are detrimental to network training, a random ratio of 3:1 is used to select negative samples to positive samples.

[0064] Step 3: Extract the region proposal boxes of positive samples, generate feature maps through ROI Align and one deconv process, and perform sigmoid processing on each category to finally generate the mask results of the region proposal boxes.

[0065] Step 4: After selecting positive and negative samples, these samples are input into the loss function for calculation, providing a basis for network parameter tuning. Mask R-CNN is an end-to-end deep learning network, and its final output includes the location information of the candidate boxes, the category represented by the candidate boxes, and the mask information of the foreign objects. SSD incorporates the location information, category information, and mask information into the same loss function, which is: It is a Softmax loss function, which works in the same way as commonly used image classification networks. Here it is used to calculate the classification accuracy of the algorithm.

[0066] It is the location loss function, Smooth L1 Loss, which is responsible for the loss during location regression.

[0067] This is the loss function for the Mask branch. For each ROI, the Mask branch has a Km*m dimension output, which encodes K masks of size m*m, i.e., K binary masks with an m*m resolution. After calculating the loss function, backpropagation can begin to update the algorithm's parameters.

[0068] Step 5: The main role of region proposal boxes in the recognition process is to provide an initial value to the deep neural network. This is because convolutional neural networks themselves cannot generate corresponding detection boxes through operations such as convolution and pooling without anchor boxes providing initial values.

[0069] Step 6: After obtaining initial values, the convolutional network predicts the category and location of the default boxes. Since the default boxes are simply boxes of different sizes and aspect ratios generated at fixed positions, they cannot accurately predict targets at different locations and scales. Therefore, the algorithm needs to predict the offset of the region proposal boxes from their actual locations. This offset includes four values, corresponding to the horizontal and vertical coordinates of the top-left corner of the box, as well as the width and height of the box.

[0070] Step 7: Remove redundant candidate boxes for identifying the same target by non-maximum suppression. The remaining candidate boxes are used as the target to be identified, and the classification and pixel region information of foreign objects and cables are output.

[0071] Step 8: Based on the results output in Step 7, draw a cutting baseline parallel to the cable and passing through the foreign object area on the image corresponding to the candidate box, and use the two intersection points of the cutting baseline and the foreign object boundary as the start and end points of the cutting.

[0072] Step 9: After starting the cutting, repeat steps one through seven to obtain updated foreign object areas and cutting points until the foreign object is removed and the cutting is completed.

[0073] The training and evaluation of the model specifically includes: 1) Based on the pre-trained model on the COCO dataset, a custom dataset including tree obstacles and various hanging objects was used for training in the power grid obstacle detection scenario. The training set, validation set, and test set were divided in a 7:2:1 ratio, and image data was used in the training process to provide sufficient samples to support the model in learning the features of different types and scales of obstacles.

[0074] The GTX4070Ti was selected as the training hardware platform. Based on the model's convergence characteristics and task requirements, the learning rate was set in stages: the learning rate was set to 0.0005 in the warm-up stage, and then adjusted to 0.00125, 0.000125, and 0.0000125 in the subsequent stages of step 1 - 12500, step 12501 - 17230, and step 17231 - 19000, respectively. By dynamically adjusting the learning rate, the rapid convergence in the early stage of model training was balanced with the fine optimization in the later stage.

[0075] 2) The detection performance of the algorithm is evaluated by the mean of its precision, recall, and average precision on the test set images.

[0076] 3) Model evaluation and further optimization After the model training is completed, an independent test set with the same sample distribution as the training and validation sets will be used to comprehensively evaluate the model using metrics such as precision, recall, and mean average precision (mAP). The focus will be on the detection performance of key categories such as plastic, cloth, banner, wire, and kite, analyzing the model's strengths and weaknesses in obstacle detection across different categories and scales. Based on the evaluation results, optimization will be implemented by increasing the number and diversity of samples in low-performance categories, introducing targeted data augmentation techniques, adjusting hyperparameters, and improving the network structure. This will ensure that the final model accuracy reaches over 98%, meeting the needs of accurate and efficient identification of power grid obstacles in practical applications.

[0077] 4) Algorithm's predicted detection performance The detection performance of the Mask R-CNN power grid foreign object detection algorithm on the test set will be presented through illustrations, using a kite as an example. Figure 2 ) and tree barriers ( Figure 3 For example, Figure 2 and Figure 3 In the image, the left side shows the images labeled in the dataset, and the right side shows the images predicted by the model.

Claims

1. A method for determining the baseline for cutting obstacles in an electrical grid based on Mask R-CNN, characterized in that, include: The dataset is obtained by labeling the categories of cable obstacles in power grid images, and then inputting it into the Mask R-CNN network model for training and optimization. The real-time image information of the power grid is input into the optimized Mask R-CNN network model to identify obstacles and cables in the power grid image and output the initial mask contour of the obstacles and the candidate bounding boxes of the regions. The obtained initial mask contours of obstacles and region candidate boxes are input into the SAM2 segmentation model for fine segmentation to obtain fine mask contours of obstacles. Draw the cutting baseline on the image corresponding to the fine mask contour of the obstacle to determine the start and end points of the cut.

2. The method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in claim 1, characterized in that, The process of obtaining a dataset by labeling the categories of cable obstacles in the power grid images and inputting it into the Mask R-CNN network model for training and optimization includes: dividing the dataset into a training set, a validation set, and a test set, and training the Mask R-CNN network model using the training set; The input image is processed by a backbone network to extract multi-scale features and construct a feature pyramid. Anchor boxes are preset on the feature maps of each layer of the feature pyramid. Region proposal boxes are generated by a region proposal network and feature alignment is performed by ROI Align. Calculate the intersection-union ratio (IU) between each region's proposed bounding box and the ground truth bounding box, and classify the region's proposed bounding boxes into positive and negative samples based on the relationship between the IU and a preset threshold. The multi-task loss function is calculated based on the positive and negative samples to optimize the network parameters. The precision, recall, and mean precision of the trained model are evaluated using a test set, and the model is optimized based on the evaluation results. The optimized model is then validated using a validation set.

3. The method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in claim 2, characterized in that, The step of dividing the region proposal boxes into positive and negative samples based on the relationship between the intersection-union ratio and a preset threshold includes: the region proposal network generates region proposal boxes with different scales and aspect ratios on each layer of the feature map of the feature pyramid; For each region suggestion box, calculate the intersection-union ratio (IU) with the ground truth bounding box. Region suggestion boxes with an IU greater than the preset threshold are identified as positive samples, and those with an IU greater than the preset threshold are identified as negative samples. During model training, all positive samples are input into the loss function, and a portion of the negative samples are randomly selected and input into the loss function.

4. The method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in claim 3, characterized in that, The multi-task loss function includes a classification loss function, a bounding box regression loss function, and a mask loss function; The classification loss function is used to calculate the accuracy loss of obstacle classification, the bounding box regression loss function is used to calculate the loss of region proposal box position regression, and the mask loss function is used to calculate the loss of pixel-level mask. The mask loss function outputs K binary masks for each region of interest, where K is the number of obstacle categories. The loss is calculated by comparing the binary masks with the real masks. Backpropagation is performed based on the multi-task loss function to optimize the parameters of the backbone network, region proposal network, and head network.

5. The method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in claim 4, characterized in that, The fine segmentation includes: performing edge detection on the initial mask contour to obtain a contour coordinate sequence; For each point in the contour coordinate sequence, a preset number of neighboring points are taken before and after it, and the discrete curvature value of the current point is calculated based on the angle between the forward vector and the backward vector. Select three points from all contour points that have the largest discrete curvature value and satisfy that the distance between adjacent key points along the contour is not less than a preset ratio of the perimeter as key points. The three key points are used as foreground cue points, and the region candidate boxes are used as bounding box cue points. They are input into the SAM2 segmentation model. The SAM2 segmentation model generates a fine mask contour of obstacles based on the features extracted by the image encoder and the dual constraints of the foreground cue points and bounding box cue points through the mask decoder.

6. The method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in claim 5, characterized in that, Determining the start and end points of the cut includes: determining the cable direction vector; Based on the type of obstacle, a representative point is selected from the fine mask profile of the obstacle: for overhanging obstacles, the point on the obstacle mask profile closest to the cable is selected; For entangled obstacles, select the geometric center of the overlapping area between the obstacle mask and the cable mask; For attached obstacles, select the outer edge point of the maximum protrusion of the obstacle mask contour; For bridging obstacles, select the midpoint of the area where the cable intersects; For near-distance non-contact obstacles, select the extreme point of the obstacle mask profile facing the cable side; A straight line is drawn through the representative point along a direction parallel to the cable direction vector as the cutting baseline, and the two intersection points of the current straight line and the boundary of the fine mask of the obstacle are used as the start and end points of the cut.

7. The method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in claim 6, characterized in that, The training and optimization of the Mask R-CNN network model also includes: setting the learning rate to an initial value during the warm-up phase; and in the training phase after the warm-up phase, adjusting the learning rate sequentially by first increasing it to a peak value higher than the initial value, and then gradually decreasing it in subsequent phases. The switching of each stage is based on the preset number of iteration steps. When the precision or recall obtained by the test set evaluation does not meet the preset standard, the value of the iteration step or the learning rate of each stage is adjusted and retraining is performed until an optimized Mask R-CNN network model that meets the requirements is obtained.

8. A system for determining the baseline for cutting power grid obstacles based on Mask R-CNN, employing the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in any one of claims 1 to 7, characterized in that, include: The module includes a data acquisition and annotation module, a Mask R-CNN network training and optimization module, a preliminary obstacle recognition module, a SAM2 fine segmentation module, and a cutting baseline generation module. The data acquisition and labeling module is used to acquire images of power grids with obstacles on the cables and label the categories of obstacles to construct a dataset. The Mask R-CNN network training and optimization module is used to construct the Mask R-CNN network model, train, evaluate and validate the Mask R-CNN network model using the dataset, and optimize the network parameters through a multi-task loss function to obtain the optimized Mask R-CNN network model. The obstacle preliminary identification module is used to acquire real-time image information of the power grid, input the real-time image information into the optimized Mask R-CNN network model, identify obstacles and cables, and output the initial mask contour of the obstacle, the region candidate box and the obstacle category. The SAM2 fine segmentation module is used to receive the initial mask contour of the obstacle and the candidate bounding box of the region, extract key points from the initial mask contour as foreground cue points, and input the candidate bounding box of the region as a box cue into the SAM2 segmentation model to generate the fine mask contour of the obstacle. The cutting baseline generation module is used to select representative points from the fine mask contour of the obstacle according to the type of obstacle and cable and the spatial relationship between the obstacle and cable in the fine mask contour of the obstacle, draw a cutting baseline along a direction parallel to the cable direction vector, and determine the two intersection points of the cutting baseline and the boundary of the fine mask contour of the obstacle as the cutting start and end points.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method for determining the baseline for cutting power grid obstacles based on Mask R-CNN, as described in any one of claims 1 to 7.

10. 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 for determining the baseline for cutting power grid obstacles based on Mask R-CNN as described in any one of claims 1 to 7.