A method, device and computer device for obtaining an insulator recognition model
By performing data expansion and deep learning algorithm training on the initial sample image, an insulator element and self-destruction degree recognition model is generated, which solves the self-destruction detection problem under small sample data, improves detection accuracy and patrol efficiency, and ensures the safety of transmission lines.
Patent Information
- Application Number
- CN202110368023.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-06
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-04-06
AI Technical Summary
The prior art lacks effective solutions to the problem of small sample data in insulator self-destruction detection, which makes it difficult to take into account both the accuracy and real-time detection, especially in the drone inspection, the degree of self-destruction identification is not accurate enough.
By acquiring the initial sample image for data expansion, a training sample set containing insulator elements and different degrees of self-destruction is generated, and a deep learning algorithm is used to build an insulator element and self-destruction degree recognition model, and combining data expansion technologies such as chromaticity, brightness and spatial transformation to improve the generalization ability of the model.
Under small sample data, the degree of insulator self-destruction is effectively identified, the efficiency of transmission line inspection is improved, and the safe operation of transmission line is ensured.
Smart Images

Figure CN113065598B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular, to a method, an apparatus, and a computer device for obtaining an insulator recognition model. Background Art
[0002] Electricity, as an important and indispensable energy source at present, plays an important role in people's daily lives. Transmission lines are important carriers for power transportation, and ensuring their normal operation is particularly important for the safety of the entire power transmission network. Insulators are widely used in transmission lines due to their unique electrical insulation performance and the role of supporting and fixing the lines. Glass insulators, with the characteristic of "zero-value self-explosion", are convenient for maintenance personnel to quickly and accurately determine the defect positions of glass insulators, and have become the mainstream type of insulators in use.
[0003] Glass insulators may experience "zero-value self-explosion" due to internal factors such as glass material quality problems or external forces. The self-explosion of glass insulators will affect the safe operation of the entire transmission line, resulting in corresponding transmission line failures. Therefore, identifying the self-explosion degree of glass insulators on transmission lines, that is, the number of self-exploded pieces of glass insulators in a single self-explosion area, is an important maintenance link for maintaining the safe operation of the entire transmission line.
[0004] With the development of unmanned aerial vehicle (UAV) technology, the power inspection department has begun to use UAVs to undertake the task of inspecting transmission lines. At present, among the methods for detecting the self-explosion of insulators based on aerial images, the deep learning method is widely used. From the implementation steps, the deep learning method can be divided into two categories: object detection and semantic segmentation. Object detection algorithms include two-stage methods represented by Faster R-CNN and single-stage methods represented by SSD, YOLO, etc. The two-stage method divides object detection into two steps: feature extraction and classification, with the characteristics of high accuracy but inability to meet real-time requirements; the main idea of the single-stage method is to regard the object detection problem as a regression problem and directly give the predicted position and category, meeting the real-time requirement while ensuring relatively high accuracy; the semantic segmentation algorithm can well obtain the target boundary information and remove background interference. Although it is beneficial for subsequent accurate defect positioning, it cannot ensure the integrity of target segmentation.
[0005] Therefore, the current research on insulators focuses on aspects such as defect detection and real-time performance, and less involves and considers the problems of small sample data and self-explosion degree. Summary of the Invention
[0006] In order to solve the above technical problems, the present invention provides a method and an apparatus for obtaining an insulator recognition model, and the specific solutions are as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for obtaining an insulator recognition model, and the method includes:
[0008] Obtain an initial sample image containing insulator elements;
[0009] Perform data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively, where the first training sample set includes positive sample images containing insulator elements and negative sample images without insulator elements, and the second training sample set includes sample images of insulator elements with different self-explosion degrees;
[0010] Based on the first training sample set, perform model training to obtain an insulator element recognition model, and based on the second training sample set, perform model training to obtain an insulator self-explosion degree recognition model.
[0011] According to a specific implementation manner disclosed in the present application, the step of performing data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively includes:
[0012] Extract insulator sheet elements and porcelain elements of insulator elements from the initial sample image;
[0013] Generate insulator strings with different self-explosion defect positions and self-explosion defect quantities according to the insulator sheet elements and the porcelain elements;
[0014] Adjust the insulator element area of the initial sample image according to the insulator strings with different self-explosion defect positions and self-explosion defect quantities to obtain a preprocessing set, where the preprocessing set contains images of insulator strings with different self-explosion defect positions and quantities;
[0015] Perform data augmentation on the preprocessing set to obtain the first training sample set and the second training sample set.
[0016] According to a specific implementation manner disclosed in the present application, the step of generating insulator strings with different self-explosion defect positions and self-explosion defect quantities according to the insulator sheet elements and the porcelain elements includes:
[0017] Connect N of the porcelain elements in series to form a defective insulator string, where the defective insulator string contains N - 1 defect positions, and N is a positive integer;
[0018] Randomly insert M of the insulator sheet elements into the defect positions to obtain insulator strings with different self-explosion defect positions and quantities, where M is a positive integer and M ≤ N - 1.
[0019] According to a specific implementation manner disclosed in the present application, the step of adjusting the insulator element area of the initial sample image according to the insulator strings with different self-explosion defect positions and self-explosion defect quantities to obtain a preprocessing set includes:
[0020] Adjust the insulator element region of the initial sample image according to the insulator string with different self - explosion defect positions and the number of self - explosion defects, and obtain the self - explosion degree of each adjusted initial sample image, where the number of self - explosion defects is positively correlated with the self - explosion degree;
[0021] Generate a pre - processing set according to all the adjusted initial sample images and the annotation data, where the annotation data of the adjusted initial sample image includes the self - explosion degree, the insulator string region, the self - explosion region, and the self - explosion defect region and the self - explosion degree included in each self - explosion region.
[0022] According to a specific implementation manner disclosed in the present application, the step of obtaining the self - explosion degree of each adjusted initial sample image includes:
[0023] Judge the self - explosion region to which each self - explosion defect belongs according to the ratio of the intersection and union between the self - explosion region and the self - explosion defect region included in the insulator string in the adjusted initial sample image;
[0024] Based on the number of self - explosion defects included in each self - explosion region in each insulator string, calculate the self - explosion degree of the insulators in the adjusted initial sample image.
[0025] According to a specific implementation manner disclosed in the present application, the method of data augmentation for the pre - processing set includes at least one of the following:
[0026] An augmentation method of performing chromaticity value transformation on the pixel points of each image in the pre - processing set;
[0027] An augmentation method of performing brightness transformation on the pixel points of each image in the pre - processing set;
[0028] An augmentation method of performing spatial transformation on each image in the pre - processing set.
[0029] According to a specific implementation manner disclosed in the present application, the training steps of the insulator element recognition model / insulator self - explosion degree recognition model include:
[0030] Construct a basic recognition model based on a deep learning algorithm;
[0031] Train the basic recognition model based on the first / second training sample set, and save the weight file generated by each model training;
[0032] Take the basic recognition model corresponding to the weight file with the highest mean average precision as the insulator element recognition model / insulator self - explosion degree recognition model.
[0033] According to a specific implementation manner disclosed in the present application, the method further includes:
[0034] Input the image to be predicted into the insulator element recognition model to obtain the detection result of the insulator elements in the image to be predicted. The detection result of the insulator elements is at least one of including an insulator string and not including an insulator string, and the insulator string includes at least one insulator element.
[0035] If the detection result is including an insulator string, use the insulator self-explosion degree recognition model to recognize the self-explosion degree of the insulator string in the image to be predicted, and obtain the recognition result of the insulator self-explosion degree of the image to be predicted.
[0036] In a second aspect, an embodiment of the present application provides an acquisition device for an insulator recognition model. The device includes:
[0037] An acquisition module, configured to acquire an initial sample image including insulator elements;
[0038] An expansion module, configured to perform data expansion on the initial sample image to obtain a first training sample set and a second training sample set respectively. The first training sample set includes positive sample images with insulator elements and negative sample images without insulator elements, and the second training sample set includes insulator images with different self-explosion degrees;
[0039] A training module, configured to perform model training based on the first training sample set to obtain an insulator element recognition model, and perform model training based on the second training sample set to obtain an insulator self-explosion degree recognition model.
[0040] In a third aspect, an embodiment of the present application provides a computer device. The computer device includes a processor and a memory. The memory stores a computer program, and when the computer program is executed on the processor, it implements the method described in any one of the embodiments in the first aspect.
[0041] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed on a processor, it implements the method described in any one of the embodiments in the first aspect.
[0042] Compared with the prior art, the present application has the following beneficial effects:
[0043] This application first obtains an initial sample image containing insulator elements, and then performs data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively. Among them, the first training sample set includes positive sample images containing insulator elements and negative sample images without insulator elements, and the second training sample set contains insulator images with different degrees of self-explosion. Then, based on the first training sample set, a model for identifying insulator elements is trained, and based on the second training sample set, a model for identifying the degree of insulator self-explosion is trained. This application can, on the basis of relatively few sample data, obtain a large number and comprehensive training samples by performing data augmentation on the initial sample image. In addition, this application can detect the self-explosion area existing in the insulator string and the number of self-explosion defects contained in the entire insulator string based on the trained insulator element identification model and insulator self-explosion degree identification model, so as to complete the identification of the self-explosion degree of glass insulators. Thus, the self-explosion degree of insulators can be effectively identified under the condition of small sample data, improving the inspection efficiency of transmission lines and ensuring the safe operation of transmission lines. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and thus should not be regarded as limiting the protection scope of the present invention. In each drawing, similar components are numbered similarly.
[0045] Figure 1 It is a schematic flowchart of a method for obtaining an insulator identification model provided by an embodiment of this application;
[0046] Figure 2 It is a schematic structural diagram of an insulator element involved in a method for obtaining an insulator identification model provided by an embodiment of this application;
[0047] Figure 3 It is a schematic diagram of the effect of constructing the self-explosion degree of an insulator string involved in a method for obtaining an insulator identification model provided by an embodiment of this application;
[0048] Figure 4 It is an example diagram of the rotation of image coordinate points involved in a method for obtaining an insulator identification model provided by an embodiment of this application;
[0049] Figure 5 It is a block diagram of a device for obtaining an insulator identification model provided by an embodiment of this application.
[0050] Summary of reference numerals:
[0051] 200 - Insulator element;
[0052] 201 - Insulator sheet element;
[0053] 202 - Porcelain elements;
[0054] 301 - Insulator string with all defects;
[0055] 302 - Randomly embedded insulator discs. Detailed implementation manners
[0056] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.
[0057] Generally, the components of the embodiments of the present invention described and illustrated herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0058] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present invention are only intended to represent specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be construed as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.
[0059] In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0060] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in a general use dictionary) will be construed to have the same meaning as the contextual meaning in the relevant technical field and will not be construed to have an idealized meaning or an overly formal meaning unless clearly defined in various embodiments of the present invention.
[0061] Next, some embodiments of the present application will be described in detail with reference to the accompanying drawings. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0062] See Figure 1 , which is a schematic flowchart of a method for obtaining an insulator recognition model provided by an embodiment of the present application. AsFigure 1 As shown in Figure 1 , the method mainly includes:
[0063] Step S101, obtaining an initial sample image containing insulator elements.
[0064] In recent years, with the development of UAV technology, the power inspection department has begun to use UAVs to undertake the inspection tasks of transmission lines. Specifically, when implementing, UAVs can be used to collect insulator images of transmission lines to form an initial sample image. Among them, the initial sample data may only contain a small number of insulator element images.
[0065] Step S102, performing data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively. Among them, the first training sample set includes positive sample images containing insulator elements and negative sample images without insulator elements, and the second training sample set contains insulator images with different self-explosion degrees.
[0066] Since the images taken by UAVs during the inspection of transmission lines have a high resolution, the self-explosion area is too small, resulting in the inability of the obtained initial sample image to fully represent various self-explosion degrees. Therefore, by augmenting the initial sample image and constructing images of different self-explosion degrees of insulator components for model training, the effective identification of the self-explosion degree of insulators can be realized under a small sample data set, that is, a small sample data set, improving the inspection efficiency of transmission lines and ensuring the safe operation of transmission lines.
[0067] Among them, the first training sample set includes positive sample images containing insulator elements and negative sample images without insulator elements, which are used to train the subsequent basic recognition model to obtain an insulator element recognition model. The second training sample set contains insulator images with different self-explosion degrees, which are used to train the subsequent basic recognition model to obtain an insulator self-explosion degree recognition model.
[0068] Specifically, when implementing, the step of performing data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively includes:
[0069] Extracting insulator sheet elements and porcelain elements of insulator elements from the initial sample image;
[0070] Generating insulator strings with different self-explosion defect positions and quantities according to the insulator sheet elements and the porcelain elements;
[0071] Adjusting the insulator element area of the initial sample image according to the insulator strings with different self-explosion defect positions and quantities to obtain a preprocessing set, where the preprocessing set contains images of insulator strings with different self-explosion defect positions and quantities;
[0072] Augment the preprocessed set to obtain a first training sample set and a second training sample set.
[0073] Since it is impossible to capture and collect the consecutive self - explosion numbers of different insulators during the acquisition of the initial sample images. Therefore, in order to make the capabilities of each trained model more generalized and have higher accuracy, the present invention proposes a method for constructing and generating data based on the self - explosion degree of insulator components. This method makes full use of the component features of insulator elements, connects the insulators in series to form a new insulator string, and fuses the constructed insulator string into the initial sample image through background fusion technology to obtain a preprocessed set, where the preprocessed set contains images of insulator strings with different self - explosion defect positions and quantities.
[0074] Then augment the preprocessed set to obtain a first training sample set for training an insulator element recognition model and a second training sample set for training an insulator self - explosion degree recognition model.
[0075] The image regions of the insulator strings contained in the augmented preprocessed set can be intercepted and saved to obtain a first training sample set, where the image region of the insulator string can contain only one insulator element. Based on the first training sample set, the data of the self - explosion defect positions and the number of self - explosion defects contained in the first training sample set can be transformed to obtain the second training sample set.
[0076] As Figure 2 shown, Figure 2 FIG. is a schematic structural diagram of an insulator element involved in a method for obtaining an insulator recognition model provided by an embodiment of the present application, which respectively describes the porcelain element 201 and the insulator sheet element 202 of the insulator element 200. By performing pixel segmentation on the insulator element 200 included in a certain real - example image collected, an insulator element mask image is obtained.
[0077] Specifically, when implementing, the step of generating insulator strings with different self - explosion defect positions and quantities according to the porcelain element 201 and the insulator sheet element 202 includes:
[0078] Connect N of the porcelain elements in series to form a defective insulator string, the defective insulator string contains N - 1 defective positions, and N is a positive integer;
[0079] Randomly insert M of the insulator sheet elements into the defective positions to obtain insulator strings with different self - explosion defect positions and quantities, where M is a positive integer and M ≤ N - 1.
[0080] As Figure 3 shown, Figure 3Schematic diagram showing the effect of constructing the self - explosion degree of an insulator string involved in a method for obtaining an insulator recognition model provided by an embodiment of the present application. A string of insulators 301 all with defects is formed by connecting multiple insulator porcelain elements 201 in series, and then insulator sheet elements are randomly embedded at the defect - marked positions, thereby simulating the formation of insulator strings 302 with different numbers of continuously self - exploded insulator sheets, and completing the construction of the self - explosion degree based on insulator elements.
[0081] Specifically, when implementing, the step of adjusting the insulator element area of the initial sample image according to the insulator strings with different self - explosion defect positions and quantities to obtain a pre - processing set includes:
[0082] Adjust the insulator element area of the initial sample image according to the insulator strings with different self - explosion defect positions and quantities to obtain the self - explosion degree of each adjusted initial sample image, where the quantity of the self - explosion defects is positively correlated with the self - explosion degree;
[0083] Generate a pre - processing set according to all the adjusted initial sample images and annotation data, where the annotation data of the adjusted initial sample images includes the insulator string area, the self - explosion area, the self - explosion defect area included in the self - explosion area, and the self - explosion degree.
[0084] The obtained small - sample transmission line insulator sample data set, that is, the initial sample image, can be used as the background image. Through the image background fusion technology, the constructed insulator string 302 is fused into a random position of the background image to form a pre - processing set. Insulator annotation is performed on this pre - processing set, and the annotation types include the rectangular position of the insulator, the rectangular position of the overall self - explosion area, and the rectangular positions of the respective self - explosion defects corresponding to the overall self - explosion area. Then, the pre - processing set containing the corresponding annotation files is used as the original data set for data augmentation.
[0085] Specifically, when implementing, the step of obtaining the self - explosion degree of each adjusted initial sample image includes:
[0086] Input the insulator string in the adjusted initial sample image into the insulator self - explosion degree recognition model to obtain the self - explosion area and the self - explosion defect area included in the insulator string;
[0087] Judge the self - explosion area to which each self - explosion defect belongs according to the ratio of the intersection and union between the self - explosion area and the self - explosion defect area;
[0088] Based on the number of self - explosion defects included in each self - explosion area in each insulator string, calculate the self - explosion degree of the insulators in the adjusted initial sample image.
[0089] The intersection over union (IOU) between the self-explosion area and the self-explosion defect area in the insulator string can be used to determine which insulator string the self-explosion defect belongs to. Finally, the number of self-explosion defects in the self-explosion area of each insulator string is counted, and the location of the self-explosion area and the number of self-explosion defects in each insulator string are output, thereby completing the self-explosion degree identification of the glass insulator.
[0090] In a specific implementation, the method of expanding the data of the preprocessing set includes at least one of the following:
[0091] An extended method for transforming the chromaticity values of the pixels of each image in the preprocessing set;
[0092] An extended method for performing brightness transformation on pixels of each image in the preprocessing set;
[0093] An extension to perform spatial transformations on each image in the preprocessing set.
[0094] Among them, the extended method of transforming the chromaticity value of the pixel points of each image in the preprocessing set can adopt the hue, saturation and value (Hue, Saturation, Value, referred to as HSV) color gamut transformation method or principal component analysis (Principal Component Analysis, referred to as PCA).
[0095] The color gamut conversion operation converts the image from RGB to HSV color space, adjusting the values of H, S, and V channels respectively to achieve changes in color, depth, and brightness. The calculation formula for RGB to HSV is:
[0096] R′=R / 255
[0097] G′=G / 255
[0098] B′=B / 255
[0099] C max =max(R′, G′, B′)
[0100] C min =min(R′, G′, B′)
[0101] Δ=C max -C min
[0102] Among them, R′, G′, B′, C max , C min and Δ are intermediate reference quantities for calculating the H, S, and V channel values.
[0103] The calculation formula of H component is as follows:
[0104]
[0105] The calculation formula for the S component is as follows:
[0106]
[0107] The calculation formula for the V component is as follows:
[0108] V = C max
[0109] Then randomly generate three variables hue, sat, and val to modify the converted H, S, and V component values. Among them, the calculation method for the H' component is:
[0110] H' = H + hue × 360
[0111]
[0112] The calculation method for the S' component is:
[0113] S' = S × sat
[0114]
[0115] The calculation method for the V' component is:
[0116] V' = V × val
[0117]
[0118] Convert each component after the color threshold transformation in the above formula back to an RGB image to form new sample data and save it with a new name. Since only relevant changes are made to the image pixels in this step, the annotation information of the previous original data can be directly copied.
[0119] The principal component analysis method first performs PCA on all RGB pixel values to obtain eigenvectors and eigenvalues, and then calculates a set of random values based on the eigenvectors and eigenvalues and adds them as perturbations to the original pixel values. The calculation process is as follows:
[0120] δ = [p1, p2, p3][α1λ1, α2λ2, α3λ3] T
[0121] g(x, y) = f(x, y) + δ
[0122] Among them, δ is the calculated three-dimensional vector, [p1, p2, p3] represents the feature matrix of the image, λ1, λ2, and λ3 are the eigenvalues corresponding to the eigenvectors respectively, and α is a random parameter obeying the normal distribution with a mean of 0 and a variance of 0.1. g(x, y) represents that each R, G, B value of the original image plus the corresponding element of δ to obtain the target image.
[0123] For different positions and different color channels of the same image, α uses the same random variable. Since this step does not change the target position of the image, the annotation information of the previous data can be directly copied.
[0124] The way to expand the pixel points of each image in the preprocessing set by brightness transformation is to change the overall brightness and contrast of the image, adjust the light and dark changes of the image, so as to simulate the images collected under different lighting conditions.
[0125] By brightness transformation, the images collected by the visual system under different lighting conditions can be simply simulated. The implementation method is to change the overall brightness performance of the image for the pixel values of the image. The calculation formula is:
[0126] g(x, y) = max[u(x, y) + Δ, 255]
[0127] Among them, u(x, y) represents the original pixel value of the image, Δ represents the brightness adjustment parameter, and max represents the pixels whose result value is greater than 255, and their pixel values are taken as 255. Since this step only makes relevant changes to the image brightness, the annotation information of the original data can be directly copied.
[0128] The way to expand each image in the preprocessing set by spatial transformation is mainly realized by means of scaling, flipping, translation, cropping, rotation, etc. The present invention adopts the methods of rotation and mirroring to realize the symmetric expansion of the target position in the image, and realizes the target scale transformation by the scaling method. The methods of scaling, translation and cropping do not destroy the original form of the data during the data generation stage, and only provide images with more scales and styles. Mirror flipping can change the position of the target in the image and its local directional features. The present invention adopts the forms of horizontal, vertical and diagonal mirror flipping for data augmentation. In addition, the present invention plans to adopt the method of rotating the image, which can change the direction of the insulator in the image. Since the aspect ratio styles of the bounding boxes of the insulator are different when it is presented horizontally and vertically in the image, the rotation method can greatly enrich the styles of the target detection boxes in the data set, so as to achieve the purpose of enriching the data types.
[0129] Horizontal mirror flipping is to take the vertical central axis of the image as the center, divide the image into left and right parts and exchange them. Let the original width and height of the image be width and height respectively, and the pixel coordinates (x0, y0) after the exchange become (x, y). The calculation formula is as follows:
[0130] x = width - x0 - 1
[0131] y = y0
[0132] Vertical mirror flipping is to divide the image into upper and lower parts with the horizontal central axis of the image as the center and swap them. Suppose the original width and height of the image are width and height respectively, and the pixel coordinates (x0, y0) after swapping become (x, y). The calculation formula is as follows:
[0133] x = x0
[0134] y = height - y0 - 1
[0135] Diagonal mirror flipping is to use the intersection of the horizontal and vertical central axes of the image as the center of mirror swapping. Suppose the original width and height of the image are width and height respectively, and the pixel coordinates (x0, y0) after swapping become (x, y). The calculation formula is as follows:
[0136] x = width - x0 - 1
[0137] y = height - y0 - 1
[0138] The above three flipping methods may change the image coordinates. Therefore, it is necessary to convert the annotation information of the original data according to the coordinate calculation formula and parse the annotation file information of the rotated image according to the flipping method. For example, in the first training sample set obtained after expansion, all the target areas of glass insulators can be intercepted and saved as the relevant insulator target sample data, and then the annotation information of the self-explosion target area and the corresponding self-explosion defect of the insulator string after interception can be converted to form the first training sample set.
[0139] The general process of image rotation is as follows:
[0140] Convert the coordinate system of the original image to a mathematical coordinate system;
[0141] Rotate the image coordinates through the image rotation coordinate conversion formula;
[0142] Convert the rotated mathematical coordinate system to the image coordinate system to obtain the finally rotated image.
[0143] The rotation of a point in the coordinate system requires setting the rotation angle and rotation direction. As Figure 4 shown, the original coordinate point (X0, Y0) in the figure is rotated clockwise by θ angle to obtain the converted coordinate point (X, Y). The rotation coordinate conversion formula is as follows:
[0144] X0 = R cosα
[0145] Y0 = R sinα
[0146] X = R cos(α - θ) = R cosαcosθ + R sinαsinθ = X0cosθ + Y0sinθ
[0147] Y = R sin(α - θ) = R sinαcosθ - R cosαsinθ = Y0cosθ - X0sinθ
[0148] Furthermore, we get:
[0149]
[0150] When performing image rotation, after determining the rotation size of the image, the rotated image area is obtained. At this time, each coordinate point of the rotated image area needs to be mapped to the coordinate point on the original image and the pixel data at this coordinate point on the original image needs to be obtained. At this time, an inverse Y operation needs to be performed, and the calculation formula is as follows:
[0151]
[0152]
[0153] The corresponding inverse operation matrix is:
[0154]
[0155] The above describes the entire process of the image rotation coordinate conversion formula. For the image rotation task, coordinate system conversion also needs to be performed. Since the origin of the image is at the upper left corner, the origin of the image needs to be first transferred to the center of the image, and the Y-axis in the vertical direction needs to be flipped. During the rotation process, a mathematical coordinate system with the rotation center as the coordinate origin is generally used. Assuming the height and width of the image are H and W respectively, the relationship between the image coordinates (X0, Y0) and the mathematical coordinates (X, Y) is:
[0156] X = X0 - 0.5W
[0157] Y = -Y0 + 0.5H
[0158] The corresponding matrix operation is:
[0159]
[0160] The corresponding inverse operation and inverse operation matrix are respectively:
[0161] X0 = X + 0.5W
[0162] Y0 = -Y + 0.5H
[0163]
[0164] After converting the original image coordinates to mathematical coordinates as described above, it is necessary to further convert the mathematical coordinates to the image coordinates of the rotated new image. The conversion formula is as follows:
[0165] X = X0 + 0.5W′
[0166] Y = -Y0 + 0.5H′
[0167] Where W′ and H′ are the width and height of the rotated image respectively, and their calculations can be obtained by analyzing the coordinates of the four vertices after rotation. The corresponding matrix operations are:
[0168]
[0169] The corresponding inverse operations and inverse operation matrices are:
[0170] X0 = X - 0.5W′
[0171] Y0 = -Y + 0.5H′
[0172]
[0173] In summary, the matrix description of image rotation can be obtained as:
[0174]
[0175]
[0176] Correspondingly, to map the coordinate points of the target area to the coordinate points in the original image, the above inverse operations need to be performed, and the calculations are as follows:
[0177]
[0178] By following the above steps, arbitrary-angle rotation of the image can be completed, and the rotated image can be saved. Since the above steps will change the image coordinates, it is necessary to convert the annotation information of the original data according to the coordinate conversion formula and analyze the annotation information of the rotated image based on the rotation angle.
[0179] Image scaling is the process of reducing or enlarging the size of an image, that is, decreasing or increasing the number of pixels in the original image. For an image, generally the same scaling ratio is used in both the horizontal and vertical directions. Assuming that the pixel coordinates (x0, y0) are changed to (x, y) through the scaling factor δ, the coordinate mapping relationship is:
[0180] x = [x0 × δ]
[0181] y = [y0 × δ]
[0182] This step will change the image coordinates. Therefore, it is necessary to convert the annotation information of the original data according to the coordinate mapping relationship and parse the annotation information of the scaled image according to the rotation angle.
[0183] In specific implementation, various expansion methods can be used alone or in combination. For example:
[0184] Color transformation: Perform HSV color gamut transformation 4 times and PCA transformation 4 times;
[0185] Brightness transformation 2 times, with Δ taking values of -75 and 75 respectively;
[0186] Spatial transformation: Perform horizontal, vertical, and diagonal mirror flips once each, rotate the image clockwise by 90 degrees once, and scale the image by 1 / 2 and 1 / 4 times once each.
[0187] Step S103: Train a model based on the first training sample set to obtain an insulator element recognition model, and train a model based on the second training sample set to obtain an insulator self-explosion degree recognition model.
[0188] By training the model based on the first training sample set and the second training sample set, the position and self-explosion degree of the insulator can be detected and recognized in sequence. Finally, it can effectively identify the self-explosion degree of glass insulators in the case of a small sample data set, improve the inspection efficiency of transmission lines, and ensure the safe operation of transmission lines.
[0189] In specific implementation, the training steps of the insulator element recognition model / insulator self-explosion degree recognition model include:
[0190] Construct a basic recognition model based on a deep learning algorithm;
[0191] Train the basic recognition model based on the first / second training sample set and save the weight file generated by each model training;
[0192] Use the basic recognition model corresponding to the weight file with the highest mean average precision as the insulator element recognition model / insulator self-explosion degree recognition model.
[0193] In specific implementation, the training sample set can be divided into a training set and a validation set according to a ratio of 9:1, and then the following steps can be performed in sequence:
[0194] (1) Construct a basic recognition model based on a deep learning algorithm.
[0195] (2) Train the constructed model based on the training sample set and select an appropriate optimization method. Design the loss function for object detection. Set parameters such as the initial learning rate, batch size, and number of iterations.
[0196] (3) Start model training and save the weight files generated in each iteration.
[0197] (4) Model weight evaluation. First, exclude the models with relatively high loss values in the initial stage of training. For example, select the 5 weights with the lowest loss. Then, select the basic recognition model corresponding to the weight file with the highest average precision mean from the remaining models as the insulator element recognition model or the insulator self-explosion degree recognition model for final use.
[0198] In addition to the above model training method, the present application also protects the usage methods corresponding to the above steps. The method further includes:
[0199] Input the image to be predicted into the insulator element recognition model to obtain the insulator element detection result of the image to be predicted. The insulator element detection result is at least one of including an insulator string and not including an insulator string. The insulator string includes at least one insulator element;
[0200] If the detection result is including an insulator string, use the insulator self-explosion degree recognition model to recognize the self-explosion degree of the insulator string in the image to be predicted, and obtain the insulator self-explosion degree recognition result of the image to be predicted.
[0201] The method for obtaining the insulator recognition model provided by the present invention expands the obtained small sample data set, and sequentially detects and recognizes the insulator position and self-explosion degree. Finally, it realizes the effective recognition of the self-explosion degree of glass insulators in the case of a small sample data set, improves the inspection efficiency of transmission lines, and ensures the safe operation of transmission lines.
[0202] Corresponding to the above method embodiment, refer to Figure 5 , the present invention also provides an acquisition device 500 for an insulator recognition model. The acquisition device 500 for the insulator recognition model includes:
[0203] An acquisition module 501, configured to acquire an initial sample image including insulator elements;
[0204] An expansion module 502, configured to expand the initial sample image to obtain a first training sample set and a second training sample set respectively. Among them, the first training sample set includes positive sample images with insulator elements and negative sample images without insulator elements, and the second training sample set includes sample images of insulator elements with different self-explosion degrees;
[0205] A training module 503, configured to perform model training based on the first training sample set to obtain an insulator element recognition model, and perform model training based on the second training sample set to obtain an insulator self-explosion degree recognition model.
[0206] In addition, a computer device is also provided. The computer device includes a processor and a memory. The memory stores a computer program, and when the computer program is executed on the processor, the method for obtaining the above-mentioned insulator recognition model is implemented.
[0207] In addition, a computer-readable storage medium is also provided. The computer-readable storage medium stores a computer program, and when the computer program is executed on the processor, the method for obtaining the above-mentioned insulator recognition model is implemented.
[0208] In several embodiments provided in the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and structure diagrams in the drawings show the possible architectures, functions, and operations of the device, method, and computer program product according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the block may occur in a different order than marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the structure diagram and / or flowchart, as well as the combination of blocks in the structure diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0209] In addition, in each embodiment of the present invention, each functional module or unit may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
[0210] When the above-described functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0211] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention.
Claims
1. A method for obtaining an insulator recognition model, characterized in that, The method includes: Obtaining an initial sample image containing insulator elements; Performing data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively, where the first training sample set includes positive sample images containing insulator elements and negative sample images without insulator elements, and the second training sample set includes sample images of insulator elements with different self-explosion degrees; Based on the first training sample set, performing model training to obtain an insulator element recognition model, and based on the second training sample set, performing model training to obtain an insulator self-explosion degree recognition model; Among them, the step of performing data augmentation on the initial sample image to obtain a first training sample set and a second training sample set respectively includes: Extracting insulator sheet elements and porcelain elements of insulator elements from the initial sample image; Generating insulator strings with different self-explosion defect positions and quantities according to the insulator sheet elements and the porcelain elements; Adjusting the insulator element region of the initial sample image according to the insulator strings with different self-explosion defect positions and self-explosion defect quantities to obtain a preprocessing set, where the preprocessing set contains images of insulator strings with different self-explosion defect positions and quantities; Performing data augmentation on the preprocessing set to obtain the first training sample set and the second training sample set; Among them, the step of generating insulator strings with different self-explosion defect positions and self-explosion defect quantities according to the insulator sheet elements and the porcelain elements includes: Connecting N porcelain elements in series to form a defective insulator string, where the defective insulator string contains N - 1 defective positions, and N is a positive integer; Randomly inserting M insulator sheet elements into the defective positions to obtain insulator strings with different self-explosion defect positions and quantities, where M is a positive integer and M ≤ N - 1.
2. The method according to claim 1, characterized in that, The step of adjusting the insulator element region of the initial sample image according to the insulator strings with different self-explosion defect positions and self-explosion defect quantities to obtain a preprocessing set includes: Adjusting the insulator element region of the initial sample image according to the insulator strings with different self-explosion defect positions and self-explosion defect quantities to obtain the self-explosion degree of each adjusted initial sample image, where the quantity of the self-explosion defect is positively correlated with the self-explosion degree; Generating a preprocessing set according to all the adjusted initial sample images and annotation data, where the annotation data of the adjusted initial sample images includes the self-explosion degree, the insulator string region, the self-explosion region, and the self-explosion defect regions included in each self-explosion region.
3. The method according to claim 2, wherein The step of obtaining the self-explosion degree of each adjusted initial sample image includes: Judging the self-explosion region to which each self-explosion defect belongs according to the ratio of the intersection and union between the self-explosion regions and the respective self-explosion defect regions included in the insulator strings in the adjusted initial sample image; Calculating the self-explosion degree of the insulator in the adjusted initial sample image based on the number of self-explosion defects included in each self-explosion region in each insulator string.
4. The method according to claim 1, wherein The ways of performing data augmentation on the preprocessing set include at least one of the following: An augmentation method for performing chromaticity value transformation on pixel points of each image in the preprocessing set; An augmentation method for performing brightness transformation on pixel points of each image in the preprocessing set; An augmentation method for performing spatial transformation on each image in the preprocessing set.
5. The method according to claim 1, wherein The training steps of the insulator element recognition model / insulator self-explosion degree recognition model include: Constructing a basic recognition model based on a deep learning algorithm; Training the basic recognition model based on the first / second training sample set and saving the weight file generated by each model training; Taking the basic recognition model corresponding to the weight file with the highest mean average precision as the insulator element recognition model / insulator self-explosion degree recognition model.
6. The method according to any one of claims 1 to 5, characterized in that The method further includes: Inputting the image to be predicted into the insulator element recognition model to obtain the insulator element detection result of the image to be predicted, where the insulator element detection result is at least one of including an insulator string and not including an insulator string, and the insulator string includes at least one insulator element; If the detection result is including an insulator string, using the insulator self-explosion degree recognition model to recognize the self-explosion degree of the insulator string in the image to be predicted to obtain the insulator self-explosion degree recognition result of the image to be predicted.
7. An apparatus for obtaining an insulator recognition model, characterized in that, For implementing the method for obtaining the insulator recognition model according to claim 1, the device includes: An acquisition module for acquiring an initial sample image containing insulator elements; An augmentation module for augmenting the initial sample image to obtain a first training sample set and a second training sample set respectively, where the first training sample set includes positive sample images with insulator elements and negative sample images without insulator elements, and the second training sample set contains insulator images with different self-explosion degrees; A training module for performing model training based on the first training sample set to obtain an insulator element recognition model and performing model training based on the second training sample set to obtain an insulator self-explosion degree recognition model.
8. A computer device, characterized in that, The computer device includes a processor and a memory, and the memory stores a computer program, and when the computer program is executed on the processor, it implements the method for obtaining the insulator recognition model according to any one of claims 1 to 6.
Citation Information
Patent Citations
Power transmission line insulator burst identification method and device
CN111914720A