Insulation pull rod defect detection method and device based on YOLOv5
Through the YOLOv5-based insulation tie rod defect detection method, multi-camera snapshots and deep learning networks are used to achieve efficient and accurate detection of insulation tie rod defects, solving the problems of low detection efficiency and high cost in the existing technology, and meeting the needs of actual production. Quality inspection requirements during the process.
Patent Information
- Application Number
- CN202410762295.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-03
Smart Images

Figure CN118587191A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of insulating material defect detection in a power system, and in particular to a method and a device for detecting insulating rod defects based on YOLOv5. Background Art
[0002] Domestic and foreign researchers have proposed many detection methods for insulating rod defects. Most researchers focus on pulse current partial discharge measurement to detect insulating rod defects. The ultra-high frequency (0.3-3GHz) signal generated by the partial discharge of power equipment is detected by UHF sensor to determine the partial discharge status of the equipment and evaluate the insulation degradation status. The study found that this method is very sensitive to air gap defects, especially those with a diameter greater than 1mm. However, for smaller discharge and ionization processes, this method cannot accurately measure the characteristic signal. In addition, X-ray detection and ultrasonic detection have also been applied by researchers in insulating rod defect detection. The above methods can determine the nature of defects in insulating rods, and accurately give the location and geometric size of defects, while visualizing confirmed defects, and the detection results can also be stored for a long time. However, this method is difficult to detect overlapping defects and small defects in the position area, and the detection process is cumbersome, the detection efficiency is low, and the detection cost is high, which does not meet the quality detection needs in the actual production process.
[0003] In summary, there is currently no efficient and highly sensitive method for detecting insulating rod defects. Although existing research can realize the detection of insulating rod defects to a certain extent, its detection method has certain limitations and cannot achieve accurate detection of various defects (including minor defects). In addition, the detection efficiency is low and the detection process is cumbersome, which does not meet the quality inspection needs in the actual production process. Therefore, it is urgent to explore a highly sensitive method for detecting insulating rod defects. Summary of the invention
[0004] The purpose of the present invention is to provide an insulating rod defect detection method and device based on YOLOv5 to solve the problems faced in insulating rod output detection.
[0005] To achieve the above object, the present invention provides an insulating rod defect detection method based on YOLOv5, comprising:
[0006] Obtain the original defect film of the insulating rod and establish the defect data set of the insulating rod;
[0007] Using the insulating rod defect data set to train an insulating rod defect detection network based on YOLOv5s to obtain an insulating rod defect detection model;
[0008] An image of the insulating rod to be inspected is collected, and the defects of the insulating rod to be inspected are determined in combination with an insulating rod defect detection model.
[0009] Preferably, obtaining the insulating rod defect original piece and establishing the insulating rod defect data set includes:
[0010] Capture images of insulation rod defects to obtain high-resolution insulation rod defect photos;
[0011] Recording position parameter information about the insulating pull rod;
[0012] Defect information is annotated on high-resolution defect photos of insulating rods according to position parameter information;
[0013] The insulating rod defect dataset is established using the annotated insulating rod defect image data, and the insulating rod defect dataset is expanded through model-free data enhancement.
[0014] Preferably, when using the insulating rod defect dataset to train the insulating rod defect detection network based on YOLOv5s, the insulating rod defect dataset is input into the YOLOv5s network and first undergoes the network's image preprocessing stage. At this time, the image is scaled to the network's preset input size through adaptive image scaling, and the image is normalized to convert the pixel value into a floating point number between 0 and 1.
[0015] Preferably, the insulating rod defect detection network includes a backbone feature extraction network, a neck feature fusion network and a head prediction network. When the insulating rod defect detection network based on YOLOv5s is trained using the insulating rod defect data set, the insulating rod defect data set will be first input into the backbone feature extraction network after network preprocessing to extract features from the image and converted into a multi-layer feature map. The feature map output by the backbone feature extraction network will undergo multi-scale feature fusion in the neck feature fusion network, and these features will be passed to the prediction layer, and finally the final regression prediction will be performed through the head prediction network.
[0016] Preferably, the defects of the insulating rod to be inspected are determined specifically by: controlling the insulating rod to complete image acquisition through the "multi-camera capture" of the camera control interface, and performing defect detection on the collected insulating rod image using the insulating rod defect detection model.
[0017] A detection device for an insulating rod defect detection method based on YOLOv5, comprising:
[0018] An acquisition module is used to acquire the original defect sheet of the insulating rod and establish an insulating rod defect data set;
[0019] A model determination module is used to train an insulating rod defect detection network based on YOLOv5s using the insulating rod defect data set to obtain an insulating rod defect detection model;
[0020] The defect determination module is used to collect images of the insulating rod to be inspected, and determine the defects of the insulating rod to be inspected in combination with the insulating rod defect detection model.
[0021] Preferably, the acquisition module is specifically used for:
[0022] Capture images of insulation rod defects to obtain high-resolution insulation rod defect photos;
[0023] Recording position parameter information about the insulating pull rod;
[0024] Defect information is annotated on high-resolution defect photos of insulating rods according to position parameter information;
[0025] The insulating rod defect dataset is established using the annotated insulating rod defect image data, and the insulating rod defect dataset is expanded through model-free data enhancement.
[0026] Preferably, the model determination module is specifically used for: when using the insulating rod defect data set to train the insulating rod defect detection network based on YOLOv5s, after the insulating rod defect data set is input into the YOLOv5s network, it will first pass through the image preprocessing stage of the network. At this time, the image will be scaled to the input size preset by the network through adaptive image scaling, and the image will be normalized at the same time, and the pixel value will be converted into a floating point number between 0-1.
[0027] Therefore, the present invention adopts a YOLOv5-based insulating rod defect detection method and device with the above structure, which has the following beneficial effects:
[0028] (1) The YOLOv5-based insulation rod defect detection makes up for the shortcomings of the traditional insulation rod defect detection method, such as detection difficulty, strong subjectivity, easy misjudgment and missed judgment, and meets the needs of efficient and accurate quality inspection in the actual production process;
[0029] (2) The image acquisition and defect detection of insulating rods are efficiently realized through the integrated development control interface, which provides a new idea for solving the problem of difficult insulating rod defect detection and lays the foundation for optimizing the insulating rod defect detection system in the future.
[0030] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A detailed step diagram of an insulating rod defect detection method embodiment based on YOLOv5 of the present invention;
[0032] Figure 2 This is a flow chart for implementing step S1 in the present invention;
[0033] Figure 3 It is a schematic diagram of the YOLOv5s structure of the present invention;
[0034] Figure 4 It is a schematic diagram of defect detection of insulating pull rods of the present invention;
[0035] Figure 5 A schematic diagram of defects of the insulating pull rod in the present invention;
[0036] Figure 6 This is a schematic diagram of the camera control interface in the present invention;
[0037] Figure 7 It is a schematic diagram of the detection and recording interface in the present invention. DETAILED DESCRIPTION
[0038] Example
[0039] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0040] A YOLOv5-based insulation rod defect detection method, such as Figure 1 As shown, including:
[0041] Obtain the original defect film of the insulating rod and establish the insulating rod defect data set; the specific steps are as follows:
[0042] (1) Capturing images of insulating rod defects to obtain insulating rod defect original images;
[0043] (2) Recording the position parameter information of the camera with respect to the insulating rod during shooting;
[0044] (3) Annotate the acquired image with defect information according to the position parameter information;
[0045] (4) Establish an insulating rod defect dataset and expand the insulating rod defect dataset through model-free data enhancement.
[0046] According to the insulating rods with four common defects of bubbles, cracks, impurities and white spots during production and operation provided by a high-voltage switchgear company in Shandong, 200 insulating rods were selected and imaged using a high-definition industrial camera to obtain 635 insulating rod defect original films. When shooting, the distance between the camera lens and the insulating rod at this time, that is, the shooting distance, is measured and recorded to obtain the shooting distance when the various defects are clearest. At the same time, the field of view of the insulating rod in the captured image is measured and recorded, that is, the length of the insulating rod in the image under actual conditions. Labelimg annotation software is used to annotate the obtained insulating rod defect original films, and model-free data enhancement, i.e. random rotation, random flipping, sharpening, color gamut transformation, and Mosaic data enhancement, is used to expand the data set capacity and enrich the diversity of the data set. After image enhancement, the insulating rod defect original films are used to establish an insulating rod defect data set, where the training set capacity is 3040, the validation set capacity is 200, and the test set capacity is 598. The specific implementation process is as follows: Figure 2 shown.
[0047] The insulating rod defect detection network based on YOLOv5s is trained using the established insulating rod defect dataset to obtain the insulating rod defect detection model; Figure 3 As shown in the figure, the insulating pull rod defect detection network includes a backbone feature extraction network, a neck feature fusion network and a head prediction network. After the image is input into the YOLOv5s network, it will first pass through the image preprocessing stage of the network. At this time, the image will be scaled to the preset input size of the network through adaptive image scaling. At the same time, the image will be normalized and the pixel value will be converted into a floating point number between 0 and 1 for subsequent operations. In order to enrich the diversity of the data set and enhance the robustness of the network, the input image will also undergo data enhancement operations in the image preprocessing stage, such as: Mosaic, Mixup, Copy_paste, random cropping, random rotation, random flipping, and color gamut conversion. After network preprocessing, the input image will first be input into Backbone to extract features from the image and convert it into a multi-layer feature map for subsequent operations. The feature map output by Backbone will be multi-scale feature fused in the neck feature fusion network, and these features will be passed to the prediction layer, and finally the final regression prediction will be performed through the head prediction network.
[0048] The backbone feature extraction network (Backbone) is used to extract image features and convert the input image into a multi-layer feature map for subsequent operations. Secondly, Backbone realizes the extraction and transformation of image features and the deepening of network depth and receptive field through its CBS module, C3 module and SPPF module. The CBS module consists of convolutional layer, BN layer and activation function. The convolutional layer can be regarded as a sliding window. The window slides on the input image and operates the image feature value and convolution kernel in the window area. The feature value distribution of the feature information output by the convolutional layer is normalized through the BN layer, and finally the activation function is used to introduce nonlinear transformation capabilities to the neural network; the C3 module is composed of multiple CBS blocks. The convolutional layer step size in the initial CBS module is 2, which can halve the size of the feature map. The convolutional layer step size in the subsequent CBS module is 1, and the CBS blocks all use 3x3 convolution kernels. Between each CBS block, a BN layer and a LeakyReLU activation function are added to improve the stability and generalization performance of the model. At the same time, a residual structure is introduced in the C3 module through the Bottleneck module to increase the depth and receptive field of the network and improve the network's image feature extraction capability. The SPPF module consists of a CBS module, a maximum pooling downsampling operation, and a Concat module. The input feature map is subjected to different maximum pooling downsampling operations to obtain a set of feature maps of different sizes. The feature maps of different sizes are then connected together through the Concat module. Finally, the connected feature vector is reduced in dimension through the fully connected layer to obtain a feature vector of a fixed size.
[0049] The neck feature fusion network (Neck) realizes the feature fusion of feature maps at different levels through top-down upsampling and bottom-up upsampling operations, generates feature maps with multiple scale information, and obtains richer feature expressions. Among them, Neck realizes the top-down upsampling operation through the FPN structure, upsamples the feature map output by the last layer of the Backbone, and fuses it with the feature map of the same scale in the Backbone to obtain a richer feature expression. The above operation is repeated twice to realize the transfer of deep semantic features to the shallow layer, thereby enhancing the semantic expression at multiple scales; Neck realizes the bottom-up downsampling operation through the PAN structure, downsamples the feature map output by the last layer of the FPN structure, and fuses it with the feature map of the same scale in the FPN, repeats the above operation until it reaches the top layer of the FPN, so as to realize the transfer of the shallow position information layer to the deep layer, thereby enhancing the positioning capability at multiple scales.
[0050] The structure of the head prediction network (Head) is simple, consisting of only three 1*1 convolutions, corresponding to three detection feature layers. The above convolutions are used to increase or decrease the dimensions of the three different scale feature maps of 80*80*256, 40*40*512, and 20*20*1024 output by Backbone and Neck, and three different scale feature maps of 80*80*255, 40*40*255, and 20*20*255 are obtained respectively, which corresponds to dividing the input 640*640 feature map into 80*80, 40*40, and 20*20 grids respectively. The grid on each feature map contains the information of three prior boxes, each prior box contains the coordinates and length and width of the predicted target, the classification probability of the predicted target, and the confidence. The classification probability represents the category information of the predicted target in the grid, and the confidence represents the probability of the detected target in the grid, that is, the higher the confidence, the more likely the target is in the grid. Finally, the network output will output the prediction information of all grids.
[0051] Based on the above-established insulating rod defect detection network, the insulating rod defect dataset is used to train it. During model training, the weight parameters obtained by training the YOLOv5s network on the Pascal VOC public dataset are used to initialize the network parameters. The number of cycles is set to 300, the batch training size is set to 4, and the initial learning rate is set to 0.01. To prevent repeated splicing operations, the Mosaic operation in YOLOv5s is turned off. To verify the feasibility of this method, the detection program under the YOLOv5 model calls the trained insulating rod defect detection model to predict the insulating rod defect original piece under the test set. In order to fully test the performance of the insulating rod defect detection model, the images to be inspected are small, not obvious, and contain multiple defects. The detection results are shown in the figure below. Figure 4 As shown in the figure, it is not difficult to see that all defect areas are accurately framed, including defect overlapping areas and areas where defects are not obvious, and a high confidence level is obtained, which verifies the feasibility of this method.
[0052] Establish an intelligent image acquisition module for insulating pull rods, specifically:
[0053] (1) According to the recorded camera position parameter information about the insulating rod during shooting, the distance between the high-definition industrial camera lens and the insulating rod in the insulating rod intelligent image acquisition device is determined. The actual length of the insulating rod in the acquired insulating rod defect original film is 14-15 cm. Since the insulating rod is 48 cm long and has an inner diameter of 3 cm, at least nine high-definition industrial cameras are required to shoot the entire insulating rod without blind spots. An intelligent image acquisition platform for insulating rod defect detection is built, and an insulating rod image acquisition darkroom is built. Insulating rod defects such as Figure 5 As shown;
[0054] (2) Determine the position parameters between the cameras in the darkroom, the position parameters between the cameras and the insulating rods, the placement of the rods, and the structure of the loading platform that carries the cameras;
[0055] (3) Build an insulating rod detection device, including: a fixed platform and a lamp tube set in the center of the fixed platform and three sets of camera adjustment brackets at the edge. Three loading platforms are set on the three sets of camera adjustment brackets. Each loading platform is set with a camera. The camera is connected to a camera control device. A closed outer cover is set on the top of the fixed platform. A round opening is opened on the top of the closed outer cover, and a cover is set on the round opening. The insulating rod is set on the lamp tube. The camera takes a picture of the insulating rod and transmits it to the camera control device. The camera adopts a high-definition industrial camera. The control interface of multiple cameras is developed based on the control software provided by the high-definition industrial camera. The graphical interface is developed using C++ language. That is, after clicking the control button in the control interface, the corresponding action event will be triggered to realize the parameter adjustment of each camera, the image capture of each camera and the synchronous shooting of multiple cameras. At the same time, the shooting screen of each camera will be displayed in real time in the control interface. The specific interface details are as follows: Figure 6 shown.
[0056] Integrate and develop multiple camera control interfaces and insulating rod defect detection programs, and establish an insulating rod defect detection module to perform insulating rod defect detection, specifically:
[0057] Based on the built multi-camera control interface, it is necessary to integrate the control interface with the YOLOv5 detection program. First, use the Flask framework to build a Web application. By sending a Post request to the Flask route and providing the paths of the input and output folders, that is, the path of the image to be inspected after shooting and the storage path of the detection results after detection, the insulating rod defect detection program is executed by calling the trained insulating rod defect detection model. Therefore, when the storage path of the captured image is entered in the control interface and the "Multi-Camera Capture" button is clicked, two action events will be triggered at the same time. First, the nine industrial cameras in the device will be controlled to operate synchronously. At the same time, the image of the entire insulating rod is captured, and the captured image is stored in the specified folder. Secondly, the flask.py program is triggered to run, and the storage path of the captured image entered before clicking the "Multi-Camera Snapshot" button is sent through the Flask route to send a Post request, so that the detection program receives the path of the image to be inspected and the storage path of the output detection result, and executes the relevant instructions for insulating rod defect detection. Therefore, after clicking the "Multi-Camera Snapshot" button, two sub-files will be generated in the corresponding output image storage folder: original file and detect file, which respectively store the original insulating rod image and the defect detection result image. At the same time, the "Detection Record" event will be additionally developed, that is, after clicking the "Detection Record" button, jump to the corresponding detection record interface to record and save the detection progress, detection results, detection details and detection time of this detection in detail, such as Figure 7 shown.
[0058] Therefore, the present invention adopts an insulating rod defect detection system based on YOLOv5 of the above structure, and after integrating and developing multiple camera control interfaces and insulating rod defect detection programs, an insulating rod defect intelligent detection device is formed. The collected insulating rod image is transmitted to the insulating rod defect detection model, and the insulating rod defect detection model obtained by training is called by the YOLOv5 detection program to perform defect detection on the incoming insulating rod original sheet, thereby realizing the efficient and accurate detection requirements of insulating rod defects and meeting the insulating rod quality inspection requirements in the actual production process.
[0059] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0060] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0061] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0062] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0063] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0064] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for detecting defects in insulating rods based on YOLOv5, characterized in that: include: Obtain the original defect film of the insulating rod and establish the defect data set of the insulating rod; Using the insulating rod defect data set to train an insulating rod defect detection network based on YOLOv5s to obtain an insulating rod defect detection model; An image of the insulating rod to be inspected is collected, and the defects of the insulating rod to be inspected are determined in combination with an insulating rod defect detection model.
2. The insulating rod defect detection method based on YOLOv5 according to claim 1 is characterized in that: Obtain the original film of the insulating rod defect and establish the insulating rod defect data set, including: Capture images of insulation rod defects to obtain high-resolution insulation rod defect photos; Recording position parameter information about the insulating pull rod; Defect information is annotated on high-resolution defect photos of insulating rods according to position parameter information; The insulating rod defect dataset is established using the annotated insulating rod defect image data, and the insulating rod defect dataset is expanded through model-free data enhancement.
3. The insulating pull rod defect detection method based on YOLOv5 according to claim 1, characterized in that: When using the insulating rod defect dataset to train the insulating rod defect detection network based on YOLOv5s, the insulating rod defect dataset will first pass through the image preprocessing stage of the network after being input into the YOLOv5s network. At this time, the image will be scaled to the input size preset by the network through adaptive image scaling, and the image will be normalized to convert the pixel value into a floating point number between 0 and 1.
4. The insulating pull rod defect detection method based on YOLOv5 according to claim 3 is characterized in that: The insulating rod defect detection network includes a backbone feature extraction network, a neck feature fusion network and a head prediction network. When the insulating rod defect detection network based on YOLOv5s is trained using the insulating rod defect data set, the insulating rod defect data set will be first input into the backbone feature extraction network after network preprocessing to extract features of the image and convert it into a multi-layer feature map. The feature map output by the backbone feature extraction network will be subjected to multi-scale feature fusion in the neck feature fusion network, and these features will be passed to the prediction layer, and finally the final regression prediction will be performed through the head prediction network.
5. The insulating rod defect detection method based on YOLOv5 according to claim 1 is characterized in that: Determining the defects of the insulating rod to be inspected is specifically as follows: controlling the insulating rod to complete image acquisition through the "multi-camera capture" of the camera control interface, and performing defect detection on the acquired insulating rod image using the insulating rod defect detection model.
6. A detection device for an insulating rod defect detection method based on YOLOv5, characterized in that: include: An acquisition module is used to acquire the original defect sheet of the insulating rod and establish an insulating rod defect data set; A model determination module is used to train an insulating rod defect detection network based on YOLOv5s using the insulating rod defect data set to obtain an insulating rod defect detection model; The defect determination module is used to collect images of the insulating rod to be inspected, and determine the defects of the insulating rod to be inspected in combination with the insulating rod defect detection model.
7. The detection device of the insulating pull rod defect detection method based on YOLOv5 according to claim 6 is characterized in that: The acquisition module is specifically used for: Capture images of insulation rod defects to obtain high-resolution insulation rod defect photos; Recording position parameter information about the insulating pull rod; Defect information is annotated on high-resolution defect photos of insulating rods according to position parameter information; The insulating rod defect dataset is established using the annotated insulating rod defect image data, and the insulating rod defect dataset is expanded through model-free data enhancement.
8. The detection device of the insulating pull rod defect detection method based on YOLOv5 according to claim 6 is characterized in that: The model determination module is specifically used for: when using the insulating rod defect data set to train the insulating rod defect detection network based on YOLOv5s, after the insulating rod defect data set is input into the YOLOv5s network, it will first pass through the image preprocessing stage of the network. At this time, the image will be scaled to the input size preset by the network through adaptive image scaling, and the image will be normalized at the same time, and the pixel value will be converted into a floating point number between 0 and 1.
Citation Information
Patent Citations
Insulator defect image detection method based on improved YOLOv5 network
CN115861263A
Insulator defect detection method based on FPGA preprocessing and improved YOLOv5
CN116523875A
Insulator defect detection method and system based on improved YOLOv5
CN117218102A
Method and system for detecting defects of GIS (Gas Insulated Switchgear) insulating pull rod
CN117350972A
Cited By
Insulation pull rod defect detection method and device based on image recognition and storage medium
CN119991543A
