Defective screw detection method and device and electronic equipment

By combining one-stage and two-stage target detection models, using feature map upsampling and fusion feature maps, rapid and accurate detection of defective screws in substation cabinets is achieved, solving the problems of slow detection speed and difficult positioning in the existing technology. .

CN118736465AInactive Publication Date: 2024-10-01ZHUHAI POWER SUPPLY BUREAU GUANGDONG POWER GIRD CO
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410953553.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The defective screw detection method in the prior art has a slow detection speed and is difficult to locate the accurate position of the screw, resulting in low detection efficiency and poor accuracy.

Method used

The one-stage target detection model and the two-stage target detection model are used to analyze the video frame images in the video stream data. The first-stage model is used to identify the position of the transformer cabinet, and the second-stage model is used to accurately locate the defective screw position. Combined with the upper feature map Sampling and fusion of feature maps to improve detection accuracy.

Benefits of technology

It realizes automatic, fast and accurate defective screw detection, improves detection speed and accuracy, and solves the problems of slow detection speed and difficult positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736465A_ABST
    Figure CN118736465A_ABST
Patent Text Reader

Abstract

The invention discloses a defective screw detection method and device and electronic equipment. The method comprises the following steps: acquiring video stream data obtained by performing data acquisition on a power transformation cabinet by acquisition equipment; a first-stage target detection model is adopted to analyze a video frame image in the video stream data to obtain a first detection frame, the first-stage target detection model is used for identifying a power transformation cabinet in the video frame image, and the first detection frame comprises position information of the power transformation cabinet; and a two-stage target detection model is adopted to analyze the power transformation cabinet image corresponding to the first detection frame, position information of the defective screws is obtained, and the two-stage target detection model is used for identifying the defective screws. The technical problems that a defect detection method in the prior art is low in detection speed and the accurate position of the screw is difficult to locate are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular, to a method, device and electronic equipment for detecting defective screws. Background Art

[0002] Against the backdrop of rapid economic development, electricity demand continues to grow, the scale of the power grid is rapidly expanding, and the power grid industry is gradually strengthening the management and control of the safe and stable operation of the power system. The transformer substation is a box that transforms, concentrates and distributes the voltage and current of electric energy in the power system. Its stable operation can ensure that electric energy is safely and reliably transmitted from the power station to the user end to meet the user's electricity needs. However, during the installation of the transformer substation, since most of the verification and acceptance work relies on manual operation, problems such as loose screws and missed connections are prone to occur, which may cause circuit breakage or short circuit, causing electrical equipment to fail to work properly, and even cause fire. Once a fire occurs, it will not only cause great harm to personal safety, but also bring huge economic losses and safety hazards.

[0003] In response to this problem, technical R&D personnel and engineers have invested a lot of research and development work, committed to finding a timely and reliable substation screw defect detection technology. Traditional detection methods based on manual inspections have many problems, such as the risk of fatigue and inattention during manual inspections, which will lead to a serious increase in error rates, thus affecting the overall quality of the project. In addition, inspectors need to work in a small space, with huge work intensity, low work efficiency, lack of automated equipment, and inability to achieve consistent operations and standardized quality control. Therefore, the target detection method using artificial intelligence has been widely used. High-resolution cameras are used to capture images of the inside of the substation in real time, and deep learning algorithms are used to identify screw defects and mark the target location and category, thereby improving the response speed and detection accuracy of the detection system. However, the defect detection method in the related art has a slow detection speed and is difficult to locate the exact position of the screws. In addition, the screws are small in size, large in number and densely distributed, which brings great difficulties to detection.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a method, device and electronic device for detecting defective screws, so as to at least solve the technical problems in the related art that the defect detection method has a slow detection speed and is difficult to locate the exact position of the screw.

[0006] According to one aspect of an embodiment of the present application, a method for detecting defective screws is provided, including: acquiring video stream data obtained by an acquisition device performing data acquisition on a substation; using a first-stage target detection model to analyze a video frame image in the video stream data to obtain a first detection frame, wherein the first-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains location information of the substation; using a second-stage target detection model to analyze the substation image corresponding to the first detection frame to obtain location information of the defective screws, wherein the second-stage target detection model is used to identify the defective screws.

[0007] Optionally, the first-stage target detection model is trained in the following manner: obtaining historical images of the substation collected by the collection device; determining first annotation information and second annotation information in the historical image, wherein the first annotation information includes a first real box in the historical image, and the upper left coordinates and lower right coordinates of the first real box, the first real box is the box where the substation in the historical image is located, and the second annotation information includes a second real box in the historical image, and the upper left coordinates and lower right coordinates of the second real box, the second real box is the box where the defective screw in the historical image is located; inputting the historical image and the first annotation information into the initial first-stage target detection model for training to obtain a first historical prediction box, wherein the first historical prediction box contains the location information of the substation in the historical image; determining a first loss value corresponding to the initial first-stage target detection model based on the first real box and the first historical prediction box; when the first loss value is less than or equal to the first threshold, stopping training the initial first-stage target detection model to obtain a first-stage target detection model.

[0008] Optionally, the historical image and the first annotation information are input into the initial stage target detection model for training to obtain a first historical prediction frame, including: inputting the historical image containing the first annotation information into the convolution module in the initial stage target detection model to obtain a first feature map set, wherein the first feature map set includes a first feature map, a second feature map and a third feature map, the first feature map is a historical image containing the first annotation information obtained by two convolution modules, the second feature map is a historical image containing the first annotation information obtained by three convolution modules, and the third feature map is a historical image containing the first annotation information obtained by four convolution modules; upsampling the second feature map in the first feature map set by a first number to obtain a target second feature map, and upsampling the third feature map in the first feature map set by a second number to obtain a target third feature map, wherein the first number is smaller than the second number; concatenating the first feature map, the target second feature map and the target third feature map to obtain a first fused feature map; upsampling the first fused feature map by a convolution layer and a fully connected layer to obtain a first historical prediction frame.

[0009] Optionally, based on the first real box and the first historical prediction box, a first loss value corresponding to the initial stage target detection model is determined, including: obtaining the first area of ​​the minimum circumscribed rectangle of the first real box, the first historical prediction box, the first real box and the first historical prediction box; determining a first parameter based on the first real box and the first historical prediction box; determining a second parameter based on the first real box, the first historical prediction box, the first area and the first parameter; determining a third parameter based on a preset interval in which the first parameter is located; and determining a first loss value based on the first parameter, the second parameter and the third parameter.

[0010] Optionally, the two-stage target detection model is trained in the following manner: obtaining a historical substation image contained in the first historical prediction frame; inputting the historical substation image and the second annotation information into the initial two-stage target detection model for training to obtain a second historical prediction frame, wherein the second historical prediction frame contains the location information of defective screws in the historical substation image; determining a second loss value corresponding to the initial two-stage target detection model based on the second real frame and the second historical prediction frame; when the second loss value is less than or equal to the second threshold, stopping training the initial two-stage target detection model to obtain a two-stage target detection model.

[0011] Optionally, the historical substation image and the second annotation information are input into the initial two-stage target detection model for training to obtain a second historical prediction frame, including: inputting the historical substation image containing the second annotation information into the reversible column module in the initial two-stage target detection model to obtain a second feature map set, wherein the second feature map set includes a fourth feature map, a fifth feature map and a sixth feature map, the fourth feature map is obtained by passing the historical substation image containing the second annotation information through two layers of reversible column modules, the fifth feature map is obtained by passing the historical substation image containing the second annotation information through three layers of reversible column modules, and the sixth feature map is obtained by passing the historical substation image containing the second annotation information through four layers of reversible column modules; upsampling the fifth feature map in the second feature map set a third time to obtain a target fifth feature map, and upsampling the sixth feature map in the second feature map set a fourth time to obtain a target sixth feature map, wherein the third time is less than the fourth time; concatenating the fourth feature map, the target fifth feature map and the target sixth feature map to obtain a second fused feature map; upsampling the second fused feature map through a convolutional layer and a fully connected layer to obtain a second historical prediction frame.

[0012] Optionally, based on the second real box and the second historical prediction box, a second loss value corresponding to the initial two-stage target detection model is determined, including: obtaining the second area of ​​the minimum circumscribed rectangle of the second real box, the second historical prediction box, and the second real box and the second historical prediction box; determining a fourth parameter based on the second real box and the second historical prediction box; determining a fifth parameter based on the second real box, the second historical prediction box, the second area and the fourth parameter; determining a sixth parameter based on a preset interval in which the fourth parameter is located; and determining a second loss value based on the fourth parameter, the fifth parameter and the sixth parameter.

[0013] According to another aspect of an embodiment of the present application, a device for detecting defective screws is also provided, including: an acquisition module, used to acquire video stream data obtained by an acquisition device performing data acquisition on a substation; a first analysis module, used to analyze the video frame image in the video stream data using a one-stage target detection model to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains location information of the substation; a second analysis module, used to analyze the substation image corresponding to the first detection frame using a two-stage target detection model to obtain location information of the defective screws, wherein the two-stage target detection model is used to identify the defective screws.

[0014] According to another aspect of the embodiment of the present application, there is also provided an electronic device, comprising: a memory for storing program instructions; a processor, connected to the memory, for executing program instructions to implement the following functions: obtaining video stream data obtained by an acquisition device for data acquisition of a substation; using a first-stage target detection model to analyze a video frame image in the video stream data to obtain a first detection frame, wherein the first-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains location information of the substation; using a second-stage target detection model to analyze the substation image corresponding to the first detection frame to obtain location information of defective screws, wherein the second-stage target detection model is used to identify defective screws.

[0015] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned defective screw detection method when executed by a processor.

[0016] In an embodiment of the present application, video stream data is obtained by acquiring data from a substation using an acquisition device; a first-stage target detection model is used to analyze a video frame image in the video stream data to obtain a first detection frame, wherein the first-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains position information of the substation; a two-stage target detection model is used to analyze the substation image corresponding to the first detection frame to obtain position information of defective screws, wherein the two-stage target detection model is used to identify defective screws, thereby achieving the purpose of automatically, quickly and accurately detecting defective screws in the substation, thereby realizing the technical effect of fast detection speed and high accuracy, thereby solving the technical problem that the defect detection method in the related art has slow detection speed and difficulty in locating the exact position of the screw. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing a method for detecting defective screws according to an embodiment of the present application;

[0019] Figure 2 is a flow chart of a method for detecting defective screws according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of a training process of a one-stage target detection model according to an embodiment of the present application;

[0021] Figure 4 is a schematic diagram of the structure of a fast convolution module according to an embodiment of the present application;

[0022] Figure 5 is a training flow chart corresponding to a one-stage target detection model according to an embodiment of the present application;

[0023] Figure 6 is a schematic diagram of a training process of a one-stage target detection model according to an embodiment of the present application;

[0024] Figure 7 is a structural schematic diagram of a reversible column module according to an embodiment of the present application;

[0025] Figure 8 is a training flow chart corresponding to a two-stage target detection model according to an embodiment of the present application;

[0026] Fig. 9 It is a structural diagram of a defective screw detection device according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] The one-stage or two-stage target detection algorithm used in the related art for the detection of defective screws cannot strike a balance between detection speed and detection accuracy. For the detection of substation screw defects that needs to capture subtle differences and realize real-time detection, the one-stage target detection algorithm model is not complex enough and is prone to underfitting, resulting in poor detection accuracy and easy missed detection. The two-stage target detection algorithm needs to generate a large number of candidate areas, which has high computational complexity and slow detection speed, and cannot meet the real-time detection scenario. In addition, the existing defect detection method is easily affected by image quality. For images with low resolution and strong interference, the current defect detection algorithm will find it difficult to locate the exact position of the screw due to the relatively small size of the screw, and its recognition accuracy will often decrease, and there is a problem of insufficient robustness. In addition, in order to achieve higher detection accuracy, the defect detection method in the related art needs to use a more complex model, which will increase the model calculation complexity, reduce the detection speed, and make the real-time performance worse. At the same time, more labeled data is required and the model is retrained and fine-tuned. This process is time-consuming and labor-intensive, increasing the complexity of model update and maintenance.

[0030] In order to solve the problems existing in the related art, the present application provides a method for detecting defective screws, which can be run on Figure 1 In the computer terminal shown, the computer terminal is explained below.

[0031] The defective screw detection method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal for implementing a method for detecting defective screws is shown. Figure 1 As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0032] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0033] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the defective screw detection method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned defective screw detection method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0034] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0035] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0036] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0037] Under the above operating environment, an embodiment of the present application provides an embodiment of a method for detecting defective screws. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0038] Figure 2 is a flow chart of a method for detecting defective screws according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:

[0039] Step S202, obtaining video stream data obtained by collecting data from the transformer cabinet by a collection device.

[0040] In the above step S202, it is necessary to install video acquisition equipment around or inside the substation, such as a network camera (IP camera) or a high-resolution camera, etc. These acquisition equipment can capture video images of the substation and its surrounding environment in real time.

[0041] Step S204, using a one-stage target detection model to analyze the video frame image in the video stream data to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains the location information of the substation.

[0042] In the above step S204, using a one-stage target detection model to analyze the video frame image is an efficient method, which is particularly suitable for scenarios that require rapid identification and positioning of specific targets (such as substations). The one-stage target detection model directly completes the classification and positioning of targets in a single network at the same time, without the need to generate candidate regions (RegionProposals) and then classify them, so it has a faster detection speed.

[0043] One-stage object detection models, such as YOLO (You Only Look Once) and SSD (Single Shot MultiBox Detector), can output the category and location information of all objects in the image through a single forward propagation. These models usually divide the input image into a grid, and each grid is responsible for predicting the object located in it. For each object, the model outputs the probability of it belonging to each category and the coordinates of the bounding box of the object. When a one-stage object detection model is used to analyze video frame images in a video stream, the model receives each frame as input and applies its trained weights to predict the location and category of all substations in the image. This process is automated and can be performed while the video stream is playing in real time, realizing real-time monitoring of substations. After the model completes the prediction, it generates one or more bounding boxes (i.e., the first detection box) for each detected substation. These bounding boxes contain the location information of the substation in the image, usually expressed in the form of the coordinates of the upper left corner and the lower right corner (x_min, y_min, x_max, y_max) or the center point coordinates and width and height (cx, cy, w, h). The accuracy and reliability of the first detection box depends on the training effect of the model, the quality of the input image, and the posture and occlusion of the substation in the image.

[0044] Step S206, using a two-stage target detection model to analyze the substation image corresponding to the first detection frame to obtain location information of defective screws, wherein the two-stage target detection model is used to identify defective screws.

[0045] In the above step S206, a cutting algorithm is first used according to the coordinate information contained in the first detection frame to obtain the substation cabinet image corresponding to the first detection frame, and then a two-stage target detection model is used to analyze the substation cabinet image to obtain the position information of the defective screw.

[0046] In the object detection task, the two-stage object detection model usually refers to a model that first generates candidate regions (Region Proposals), then classifies these candidate regions and fine-tunes the bounding boxes. In the first stage of the two-stage object detection model, the model uses a mechanism (such as selective search, region proposal network RPN, etc.) to generate a series of candidate regions on the substation image. These candidate regions are potential locations that may contain defective screws. For RPN, it slides a small window on the feature map and predicts whether multiple anchors at each location are foregrounds (i.e., they may contain objects) and their bounding box offsets. In the second stage, the model classifies the candidate regions generated in the first stage, determines whether they contain defective screws, and fine-tunes the bounding boxes of the candidate regions containing defective screws. This step usually involves one or more convolutional layers, fully connected layers, and softmax or sigmoid activation functions to calculate the probability that the candidate region belongs to each category (in this scenario, "defective screws" and "non-defective screws"), as well as the offset of the bounding box. After the second stage of classification and bounding box regression, the model will output a series of bounding boxes containing defective screws, which represent the location information of the defective screws in the substation image. Each bounding box will give the approximate location of the defective screw, usually in the form of coordinates of the upper left corner and lower right corner (x_min, y_min, x_max, y_max) or center point coordinates and width and height (cx, cy, w, h).

[0047] Through the above steps S202 to S206, the purpose of automatically, quickly and accurately detecting defective screws in the transformer cabinet can be achieved, thereby achieving the technical effect of fast detection speed and high accuracy, thereby solving the technical problems of the defect detection method in the related art that the detection speed is slow and it is difficult to locate the exact position of the screw. The following is an explanation.

[0048] In the above-mentioned defective screw detection method, the first-stage target detection model is trained in the following manner: obtaining a historical image of the substation cabinet collected by the acquisition device; determining the first annotation information and the second annotation information in the historical image, wherein the first annotation information includes a first real frame in the historical image, and the upper left coordinates and the lower right coordinates of the first real frame, the first real frame is the frame where the substation cabinet in the historical image is located, and the second annotation information includes a second real frame in the historical image, and the upper left coordinates and the lower right coordinates of the second real frame, the second real frame is the frame where the defective screw in the historical image is located; inputting the historical image and the first annotation information into the initial first-stage target detection model for training to obtain a first historical prediction frame, wherein the first historical prediction frame contains the location information of the substation cabinet in the historical image; determining the first loss value corresponding to the initial first-stage target detection model based on the first real frame and the first historical prediction frame; when the first loss value is less than or equal to the first threshold, stopping the training of the initial first-stage target detection model to obtain the first-stage target detection model.

[0049] In an embodiment of the present application, first, historical images of a substation are collected, and the historical images contain the substation and defective screws that may exist therein. The collected historical images are annotated, including two types of annotation information: the first annotation information is used to annotate the position of the substation, for example, it can be completed by drawing a rectangular frame surrounding the substation (i.e., the first real frame), and the upper left coordinate and lower right coordinate of the frame are recorded. The second annotation information is used to annotate the position of the defective screws. Similarly, the defective screws can be annotated by drawing another rectangular frame (i.e., the second real frame), and their coordinates are recorded. An initial one-stage target detection model is selected, which usually includes a fast convolution backbone network (for extracting image features), a neck network (for realizing feature fusion and enhancement), and a detection head (for predicting the position and category of the target). The annotated historical image (including at least the annotation information of the substation, i.e., the first annotation information) is input into the initial first-stage target detection model. The model predicts the location information of the substation, i.e., generates a first historical prediction box. According to the difference between the first true box and the first historical prediction box (for example, by measuring using the Focaler-GloU loss function), the first loss value of the model in predicting the location of the substation is determined. The first loss value reflects the accuracy of the model prediction. The back propagation algorithm is used to optimize the model parameters to minimize the total loss value. If the first loss value is less than or equal to the preset first threshold, it is considered that the model has achieved sufficient accuracy in predicting the location of the substation and the training can be stopped. During the training process, the training process can also be monitored by evaluating the model performance on the validation set to avoid overfitting. After the training is completed, the obtained one-stage target detection model is applied to new substation images to automatically detect the substation.

[0050] Specifically, when collecting and annotating historical images, a high-resolution camera can be used to capture images of the environment where the substation is located, and the substation and defective screws on the image can be manually annotated. At the same time, the upper left corner coordinates (x1, y1) and lower right corner coordinates (x2, y2) of the detection frame where the annotated object is located can be annotated. Each original image and the corresponding category, upper left point P1 (x1, y1), and lower right point P2 (x2, y2) are regarded as an image-label pair.

[0051] All image-label pairs are divided into training sets and test sets in a ratio of 4:1 to form a complete data set. All images are subjected to mosaic data enhancement. For example, four images can be spliced ​​by random scaling, random cropping, and random arrangement. The splicing method can be horizontal splicing, vertical splicing, or splicing in a 2×2 format, etc., which is not limited here. The model will be trained on the training set and tested on the test set. The model with the best performance on the test set will be selected as the final first-stage object detection model.

[0052] In the above-mentioned defective screw detection method, the historical image and the first annotation information are input into the initial stage target detection model for training to obtain a first historical prediction frame, including: inputting the historical image containing the first annotation information into the convolution module in the initial stage target detection model to obtain a first feature map set, wherein the first feature map set includes a first feature map, a second feature map and a third feature map, the first feature map is a historical image containing the first annotation information obtained by two convolution modules, the second feature map is a historical image containing the first annotation information obtained by three convolution modules, and the third feature map is a historical image containing the first annotation information obtained by four convolution modules; upsampling the second feature map in the first feature map set by a first number to obtain a target second feature map, and upsampling the third feature map in the first feature map set by a second number to obtain a target third feature map, wherein the first number is smaller than the second number; splicing the first feature map, the target second feature map and the target third feature map to obtain a first fused feature map; upsampling the first fused feature map by a convolution layer and a fully connected layer to obtain a first historical prediction frame.

[0053] In an embodiment of the present application, a historical image containing the first annotation information is input into the initial first-stage target detection model. Although the annotation information is used for supervised learning during the training process, the annotation information is not directly "read" during model training, but the model parameters are optimized by minimizing the difference between the predicted box and the true annotation box. The image is feature extracted by the convolution module in the model to generate three feature maps of different scales (first feature map, second feature map, and third feature map), which correspond to different abstract levels of the image. Specifically, the first feature map is obtained through two convolution modules, retaining more spatial information but less semantic information; the third feature map is obtained through four convolution modules, with less spatial information but rich semantic information; the second feature map is between the two. In order to combine the advantages of feature maps of different scales, the second feature map and the third feature map are upsampled (i.e., enlarged) to match the size of the first feature map. Since the information contained in the feature maps of different levels has different focuses, the number of upsampling is also different. For example, the first number can be 1 and the second number can be 2 to balance the proportion of spatial information and semantic information. The first feature map, the upsampled second feature map (target second feature map) and the upsampled third feature map (target third feature map) are concatenated to generate a fused feature map (first fused feature map) that fuses information at different levels. The first fused feature map is passed through additional convolutional layers and fully connected layers to finally generate a first historical prediction box, which includes the location and category information of the substation.

[0054] Specifically, the one-stage target detection model consists of three parts: a fast convolution backbone network, a neck network, and a detection head. The training process is as follows: Figure 3 As shown. Figure 3 In the example, the historical image containing the first annotation information is input as the overall image of the substation into the fast convolution backbone network in the first-stage target detection model. The backbone network includes multiple fast convolution modules (for example, it may include 4 fast convolution modules). Different numbers of fast convolution modules are used to extract features from the overall image of the substation to obtain different feature maps. Figure 3In the example, the overall image of the substation is subjected to feature extraction by two fast convolution modules to obtain a large-scale feature map (i.e., the first feature map mentioned above), the overall image of the substation is subjected to feature extraction by three fast convolution modules to obtain a medium-scale feature map (i.e., the second feature map mentioned above), and the overall image of the substation is subjected to feature extraction by four fast convolution modules to obtain a small-scale feature map (i.e., the third feature map mentioned above). In the neck network, the small-scale feature map is upsampled a second time (e.g., 2 times), and the medium-scale feature map is upsampled a first time (e.g., 1 time). The two and the large-scale feature map are spliced ​​in the dimensional direction to obtain a multi-level fused feature map (i.e., the first fused feature map mentioned above). Finally, the substation coordinates are obtained after upsampling on the detection head composed of a convolutional layer and a fully connected layer, that is, the first historical prediction frame is obtained, which contains the substation coordinates.

[0055] The structure diagram of each fast convolution module is as follows Figure 4 As shown in the figure, it includes multiple convolutional layers, partial convolutional layers, BatchNorm layers (batch normalization layers) and activation function layers. The fast convolution module performs downsampling and element-by-element addition through convolution to obtain low-level features of the input image, and then upsamples the feature map to obtain high-level features of the input image. During the entire feature extraction process, the output of the front convolutional layer is transmitted to the back layer and element-by-element addition is performed with the feature map of the back layer, so that the convolution operation of the back layer can effectively utilize the feature map information of the front layer. The partial convolution module only performs convolution on a part of the layers of the input feature map, which reduces computing resources and improves computing performance.

[0056] In the above-mentioned defective screw detection method, the first loss value corresponding to the initial stage target detection model is determined based on the first real frame and the first historical prediction frame, including: obtaining the first area of ​​the minimum circumscribed rectangle of the first real frame, the first historical prediction frame, the first real frame and the first historical prediction frame; determining the first parameter based on the first real frame and the first historical prediction frame; determining the second parameter based on the first real frame, the first historical prediction frame, the first area and the first parameter; determining the third parameter based on the preset interval where the first parameter is located; determining the first loss value based on the first parameter, the second parameter and the third parameter.

[0057] In the embodiment of the present application, the loss function is calculated based on the first historical prediction box output by the first-stage target detection model and the first real box of the input image. The loss function uses Focaler-GloU, and the loss calculation method is as follows:

[0058]

[0059] L Focaler-GIoU =L GIoU +IoU-IoU Focaler

[0060] When training a one-stage target detection model, the IoU in the above formula represents the intersection-over-union ratio (i.e., the first parameter above), and GIoU (i.e., the second parameter above) adds an item after IoU to solve the problem that the gradient is zero when there is no intersection between two targets. focaler (i.e., the third parameter mentioned above) uses the linear interval mapping method to reconstruct the IoU loss and balance the distribution of difficult and easy samples in all samples. B represents the first historical prediction box, B gt represents the first real box, C represents the area of ​​the minimum circumscribed rectangle of the two boxes (the first historical prediction box and the first real box) (i.e., the first area mentioned above), d and u represent values ​​in [0,1]. In an optional embodiment, d is 0.3 and u is 0.7. Focaler-GloU The loss calculation result (i.e. the first loss value) is back-propagated to update the model parameters. The extracted image features are optimized by optimizing the model, and the distance between the predicted frame and the real frame is shortened by reducing the loss value. After sufficient training, the optimized first-stage target detection model is obtained.

[0061] The training process corresponding to the one-stage target detection model is as follows Figure 5 As shown in the figure, the overall image of the substation is input into the one-stage target detection model to obtain the coordinates of the substation. The difference between the coordinates of the substation and the real coordinates of the substation in the overall image of the substation is determined by the loss function Focaler-GloU to adjust the parameters of the one-stage target detection model.

[0062] In the above-mentioned defective screw detection method, the two-stage target detection model is trained in the following manner: obtaining the historical substation image contained in the first historical prediction frame; inputting the historical substation image and the second annotation information into the initial two-stage target detection model for training to obtain the second historical prediction frame, wherein the second historical prediction frame contains the location information of the defective screws in the historical substation image; determining the second loss value corresponding to the initial two-stage target detection model based on the second real frame and the second historical prediction frame; when the second loss value is less than or equal to the second threshold, stopping the training of the initial two-stage target detection model to obtain the two-stage target detection model.

[0063] In an embodiment of the present application, the location of the substation is directly cut out using the position information in the first historical prediction frame obtained by the one-stage target detection model, thereby obtaining a historical substation image. Specifically, in terms of the width and height of the historical image, the principle of top-to-bottom and left-to-right is followed, and the corresponding pixels are cut each time they are moved. Taking 640 as an example, when moving from top to bottom or from left to right, if the last movement is less than 640 pixels, an image of 640x640 is selected from the lower or right boundary in reverse for cutting to ensure that the substation location information is not missed.

[0064] When training the two-stage target detection model, the historical substation cabinet image and the second annotation information are input into the initial two-stage target detection model. In the first stage, the model can generate candidate areas through RPN, for example, which may contain defective screws, and classify each candidate area (determine whether it is a defective screw) and adjust the position (fine-tune the bounding box to more accurately locate the defective screw) in the second stage. After the second stage of processing, the model outputs the prediction result of each candidate area, that is, the second historical prediction box is obtained, which contains the location information of the defective screw. According to the second real box (the marked defective screw position) and the second historical prediction box, the second loss value is calculated. Using optimization methods such as back propagation algorithm and gradient descent, the model parameters are adjusted according to the second loss value to reduce the loss value. When the second loss value is less than or equal to the preset second threshold, it is considered that the model has learned how to identify and locate defective screws well enough, and the training process stops. After the above training process, the obtained model is a two-stage target detection model that can accurately identify and locate defective screws in substation cabinet images.

[0065] In the above-mentioned defective screw detection method, the historical substation image and the second annotation information are input into the initial two-stage target detection model for training to obtain a second historical prediction frame, including: inputting the historical substation image containing the second annotation information into the reversible column module in the initial two-stage target detection model to obtain a second feature map set, wherein the second feature map set includes a fourth feature map, a fifth feature map and a sixth feature map, the fourth feature map is obtained by passing the historical substation image containing the second annotation information through two layers of reversible column modules, and the fifth feature map is obtained by passing the historical substation image containing the second annotation information through three layers of reversible column modules. The sixth feature map is obtained by passing the historical substation image containing the second annotation information through four layers of reversible column modules; the fifth feature map in the second feature map set is upsampled for the third time to obtain the target fifth feature map, and the sixth feature map in the second feature map set is upsampled for the fourth time to obtain the target sixth feature map, wherein the third time is less than the fourth time; the fourth feature map, the target fifth feature map and the target sixth feature map are concatenated to obtain the second fused feature map; the second fused feature map is upsampled through the convolution layer and the fully connected layer to obtain the second historical prediction box.

[0066] In an embodiment of the present application, the historical substation image containing the second annotation information is input into the reversible column module in the initial two-stage target detection model, so as to convert the historical substation image into feature maps of different levels (i.e., the fourth feature map, the fifth feature map, and the sixth feature map), which contain information at different abstract levels in the image. Since feature maps at different levels have different spatial resolutions (usually decreasing with increasing depth), in order to fuse them for subsequent processing, it is necessary to upsample the feature maps with lower resolution to increase their spatial size. For example, the fifth feature map is upsampled a third time (e.g., 1 time) to obtain the target fifth feature map; the sixth feature map is upsampled a fourth time (e.g., 2 times) to obtain the target sixth feature map. Then the original fourth feature map (not upsampled), the target fifth feature map, and the target sixth feature map are spliced ​​(or fused) to combine feature information at different levels to obtain a second fused feature map. This fusion helps the model capture more comprehensive image features, thereby improving detection performance. The fused second fused feature map is input into the convolutional layer and the fully connected layer. After being processed by these layers, the model finally outputs the second historical prediction box, which contains the location information (such as the coordinates of the bounding box) and category information (whether it is a defective screw) of the potential defective screws in the image.

[0067] Specifically, the two-stage target detection model consists of three parts: a reversible column backbone network, a neck network, and a detection head. The training process is as follows: Figure 6 As shown. Figure 6 In the example, the historical substation cabinet image containing the second annotation information is input as a defective screw image into the reversible column backbone network in the initial two-stage target detection model. The reversible column backbone network includes multiple reversible column modules (for example, it may include 4 layers of reversible column modules, each layer includes 3 reversible column modules). The structure diagram of each reversible column module is as follows: Figure 7 As shown in FIG. 1 , it includes multiple convolutional layers, Layer Norm layers (normalization layers) and activation function layers, and extracts features from defective screw images through different numbers of reversible column modules to obtain different feature maps. Figure 6In the above, the defective screw image passes through two layers of reversible column modules to obtain a large-scale feature map (i.e., the fourth feature map mentioned above), the defective screw image passes through three layers of reversible column modules to obtain a medium-scale feature map (i.e., the fifth feature map mentioned above), and the defective screw image passes through four layers of reversible column modules to obtain a small-scale feature map (i.e., the sixth feature map mentioned above). In the neck network, the small-scale feature map is upsampled a fourth time (e.g., 2 times), and the medium-scale feature map is upsampled a third time (e.g., 1 time). The two and the large-scale feature map are spliced ​​in the dimensional direction to obtain a multi-level fused feature map (i.e., the second fused feature map mentioned above). Finally, the defective screw coordinates are obtained after upsampling on the detection head composed of a convolutional layer and a fully connected layer, that is, the second historical prediction frame is obtained, which contains the defective screw coordinates.

[0068] In the above-mentioned defective screw detection method, the second loss value corresponding to the initial two-stage target detection model is determined based on the second real frame and the second historical prediction frame, including: obtaining the second area of ​​the minimum circumscribed rectangle of the second real frame, the second historical prediction frame, and the second real frame and the second historical prediction frame; determining the fourth parameter based on the second real frame, the second historical prediction frame, the second area and the fourth parameter; determining the fifth parameter based on the second real frame, the second historical prediction frame, the second area and the fourth parameter; determining the sixth parameter based on the preset interval where the fourth parameter is located; and determining the second loss value based on the fourth parameter, the fifth parameter and the sixth parameter.

[0069] In the embodiment of the present application, the loss function used by the two-stage target detection model is the same as the loss function used by the one-stage target detection model, both of which are Focaler-GloU, as follows:

[0070]

[0071] L Focaler-GIoU =L GIoU +IoU-IoU Focaler

[0072] When training a two-stage target detection model, the IoU in the above formula represents the intersection-over-union ratio (i.e., the fourth parameter above), GIoU is the fifth parameter above, and IoU focaler is the sixth parameter mentioned above, B represents the second historical prediction box, and B gt represents the second real box, C represents the area of ​​the minimum circumscribed rectangle of the two boxes (the second historical prediction box and the second real box) (i.e., the second area mentioned above), according to L Focaler-GloU The loss calculation result (i.e. the second loss value) is back-propagated to update the model parameters. The extracted image features are optimized by optimizing the model, and the distance between the predicted frame and the real frame is shortened by reducing the loss value. After sufficient training, the optimized two-stage object detection model is obtained.

[0073] The training process corresponding to the two-stage target detection model is as follows Figure 8 As shown, the defective screw image is input into the two-stage target detection model to obtain the defective screw coordinates. The difference between the defective screw coordinates and the actual defective screw coordinates in the defective screw image is determined by the loss function Focaler-GloU to adjust the parameters of the two-stage target detection model.

[0074] In the process of real-time prediction using the trained first-stage target detection model and the second-stage target detection model, the substation is photographed by a camera connected to a handheld anti-shake gimbal device, and the real-time video stream data is framed as input. The first-stage target detection algorithm is used to detect and obtain the overall image of the substation. Then, the cutting algorithm is used to cut the overall image of the substation, and the local image of the substation is obtained as the input of the second-stage target detection module. Finally, the coordinates of the defective screws are obtained.

[0075] The defect screw detection method provided by the embodiment of the present application first uses a one-stage target detection model to locate the defect area in the image (for example, determine the area where the transformer cabinet is located), and then uses a two-stage target detection model to detect the specific location of the defect, and guides the detection location of the two-stage target detection model through the key area located by the one-stage target detection model, thereby realizing a transformer cabinet screw defect detection method based on a grading strategy. The method has the following advantages: 1. Based on the two-stage target detection mode, this makes it more convenient for the algorithm to extract image features, the search for image feature points is clearer, and the image information can be better extracted in depth, effectively reducing the impact of factors such as image noise, occlusion and illumination changes on the detection results, thereby reducing the high requirements for image quality and improving the reliability of detection; 2. The model complexity is optimized through the grading strategy, the resource consumption problem in the single-stage detection is solved, which not only improves the detection efficiency, but also reduces the resource occupation during system operation, making the detection system more economical and efficient; 3. The target detection algorithm based on the grading strategy can identify defects more accurately, while enhancing the real-time performance of the detection process, meeting the dual requirements of speed and accuracy for transformer cabinet screw defect detection.

[0076] Fig. 9 is a structural diagram of a defective screw detection device according to an embodiment of the present application, such as Fig. 9 As shown, the device comprises:

[0077] An acquisition module 40 is used to acquire video stream data obtained by a collection device through data collection on a transformer cabinet;

[0078] A first analysis module 42 is used to analyze the video frame image in the video stream data using a one-stage target detection model to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame includes the location information of the substation;

[0079] The second analysis module 44 is used to analyze the substation image corresponding to the first detection frame using a two-stage target detection model to obtain the position information of the defective screws, wherein the two-stage target detection model is used to identify the defective screws.

[0080] Through the acquisition module 40, the first analysis module 42 and the second analysis module 44 in the above-mentioned defective screw detection device, the purpose of automatically, quickly and accurately detecting defective screws in the substation cabinet can be achieved, thereby achieving the technical effect of fast detection speed and high accuracy, and further solving the technical problems of slow detection speed and difficulty in locating the exact position of the screws in the defect detection method in the related art.

[0081] The above-mentioned defective screw detection device also includes a training module 46, which is used to train a first-stage target detection model. Specifically, the training module is used to obtain historical images of the substation cabinet collected by the collection device; determine the first annotation information and the second annotation information in the historical image, wherein the first annotation information includes a first real frame in the historical image, and the upper left coordinates and lower right coordinates of the first real frame, the first real frame is the frame where the substation cabinet in the historical image is located, and the second annotation information includes a second real frame in the historical image, and the upper left coordinates and lower right coordinates of the second real frame, the second real frame is the frame where the defective screw in the historical image is located; input the historical image and the first annotation information into the initial first-stage target detection model for training to obtain a first historical prediction frame, wherein the first historical prediction frame contains the location information of the substation cabinet in the historical image; determine the first loss value corresponding to the initial first-stage target detection model based on the first real frame and the first historical prediction frame; when the first loss value is less than or equal to the first threshold, stop training the initial first-stage target detection model to obtain a first-stage target detection model.

[0082] In the training module in the above-mentioned defective screw detection device, the training module is also used to input the historical image containing the first annotation information into the convolution module in the initial stage target detection model to obtain a first feature map set, wherein the first feature map set includes a first feature map, a second feature map and a third feature map, the first feature map is a historical image containing the first annotation information obtained by two convolution modules, the second feature map is a historical image containing the first annotation information obtained by three convolution modules, and the third feature map is a historical image containing the first annotation information obtained by four convolution modules; the second feature map in the first feature map set is upsampled by a first number to obtain a target second feature map, and the third feature map in the first feature map set is upsampled by a second number to obtain a target third feature map, wherein the first number is smaller than the second number; the first feature map, the target second feature map and the target third feature map are concatenated to obtain a first fused feature map; after upsampling the first fused feature map through the convolution layer and the fully connected layer, a first historical prediction frame is obtained.

[0083] In the training module in the above-mentioned defective screw detection device, the training module is also used to obtain the first area of ​​the minimum circumscribed rectangle of the first real frame, the first historical prediction frame, the first real frame and the first historical prediction frame; determine the first parameter based on the first real frame and the first historical prediction frame; determine the second parameter based on the first real frame, the first historical prediction frame, the first area and the first parameter; determine the third parameter based on the preset interval where the first parameter is located; determine the first loss value based on the first parameter, the second parameter and the third parameter.

[0084] In the training module in the above-mentioned defective screw detection device, the training module is also used to train a two-stage target detection model. Specifically, the training module is used to obtain the historical substation image contained in the first historical prediction frame; input the historical substation image and the second annotation information into the initial two-stage target detection model for training to obtain the second historical prediction frame, wherein the second historical prediction frame contains the location information of the defective screws in the historical substation image; determine the second loss value corresponding to the initial two-stage target detection model based on the second real frame and the second historical prediction frame; when the second loss value is less than or equal to the second threshold, stop training the initial two-stage target detection model to obtain the two-stage target detection model.

[0085] In the training module in the above-mentioned defective screw detection device, the training module is also used to input the historical substation image containing the second annotation information into the reversible column module in the initial two-stage target detection model to obtain a second feature map set, wherein the second feature map set includes a fourth feature map, a fifth feature map and a sixth feature map, the fourth feature map is the historical substation image containing the second annotation information obtained by two layers of reversible column modules, the fifth feature map is the historical substation image containing the second annotation information obtained by three layers of reversible column modules, and the sixth feature map is the historical substation image containing the second annotation information obtained by four layers of reversible column modules; the fifth feature map in the second feature map set is upsampled a third time to obtain a target fifth feature map, and the sixth feature map in the second feature map set is upsampled a fourth time to obtain a target sixth feature map, wherein the third time is less than the fourth time; the fourth feature map, the target fifth feature map and the target sixth feature map are concatenated to obtain a second fused feature map; the second fused feature map is upsampled by the convolution layer and the fully connected layer to obtain a second historical prediction box.

[0086] In the training module in the above-mentioned defective screw detection device, the training module is also used to obtain the second area of ​​the minimum circumscribed rectangle of the second real frame, the second historical prediction frame, the second real frame and the second historical prediction frame; determine the fourth parameter based on the second real frame and the second historical prediction frame; determine the fifth parameter based on the second real frame, the second historical prediction frame, the second area and the fourth parameter; determine the sixth parameter based on the preset interval where the fourth parameter is located; determine the second loss value based on the fourth parameter, the fifth parameter and the sixth parameter.

[0087] It should be noted that Fig. 9 The defective screw detection device shown is used to perform Figure 2 The defective screw detection method shown in the figure, therefore the relevant explanations in the above-mentioned defective screw detection method are also applicable to the defective screw detection device, and will not be repeated here.

[0088] An embodiment of the present application also provides an electronic device, including: a memory, for storing program instructions; a processor, connected to the memory, for executing program instructions to implement the following functions: obtaining video stream data obtained by an acquisition device performing data acquisition on a substation; using a one-stage target detection model to analyze a video frame image in the video stream data to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains location information of the substation; using a two-stage target detection model to analyze the substation image corresponding to the first detection frame to obtain location information of defective screws, wherein the two-stage target detection model is used to identify defective screws.

[0089] It should be noted that the above electronic equipment is used to execute Figure 2 The defective screw detection method shown in the figure, therefore the relevant explanations and instructions in the above-mentioned defective screw detection method are also applicable to the electronic device and will not be repeated here.

[0090] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the following defective screw detection method by running the computer program: obtaining video stream data obtained by an acquisition device performing data acquisition on a substation; using a first-stage target detection model to analyze a video frame image in the video stream data to obtain a first detection frame, wherein the first-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains location information of the substation; using a second-stage target detection model to analyze the substation image corresponding to the first detection frame to obtain location information of the defective screws, wherein the second-stage target detection model is used to identify the defective screws.

[0091] It should be noted that the above non-volatile storage medium is used to execute Figure 2 The defective screw detection method shown in the figure, therefore the relevant explanations in the above defective screw detection method are also applicable to the non-volatile storage medium, and will not be repeated here.

[0092] The embodiments of the present application also provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the defective screw detection method in each embodiment of the present application.

[0093] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0094] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0095] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0097] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0099] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for detecting defective screws, characterized in that: include: Acquire video stream data obtained by acquiring data from the substation cabinet by the acquisition device; A one-stage target detection model is used to analyze the video frame image in the video stream data to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame includes the location information of the substation; A two-stage target detection model is used to analyze the substation cabinet image corresponding to the first detection frame to obtain location information of defective screws, wherein the two-stage target detection model is used to identify defective screws.

2. The method according to claim 1, characterized in that: The first-stage target detection model is trained in the following way: Acquire the historical image of the substation collected by the collection device; Determine first annotation information and second annotation information in the historical image, wherein the first annotation information includes a first real frame in the historical image, and upper left coordinates and lower right coordinates of the first real frame, the first real frame is a frame where the transformer cabinet in the historical image is located, and the second annotation information includes a second real frame in the historical image, and upper left coordinates and lower right coordinates of the second real frame, the second real frame is a frame where the defective screw in the historical image is located; Inputting the historical image and the first annotation information into an initial stage target detection model for training to obtain a first historical prediction frame, wherein the first historical prediction frame includes location information of the substation in the historical image; Determine a first loss value corresponding to the initial stage object detection model according to the first real frame and the first historical prediction frame; When the first loss value is less than or equal to a first threshold, stop training the initial one-stage target detection model to obtain the one-stage target detection model.

3. The method according to claim 2, characterized in that Inputting the historical image and the first annotation information into an initial stage target detection model for training to obtain a first historical prediction frame includes: Inputting the historical image containing the first annotation information into the convolution module in the initial stage target detection model to obtain a first feature map set, wherein the first feature map set includes a first feature map, a second feature map, and a third feature map, the first feature map is obtained by passing the historical image containing the first annotation information through two convolution modules, the second feature map is obtained by passing the historical image containing the first annotation information through three convolution modules, and the third feature map is obtained by passing the historical image containing the first annotation information through four convolution modules; Upsampling the second feature map in the first feature map set by a first number of times to obtain a target second feature map, and upsampling the third feature map in the first feature map set by a second number of times to obtain a target third feature map, wherein the first number of times is less than the second number of times; Concatenating the first feature map, the target second feature map, and the target third feature map to obtain a first fused feature map; After upsampling the first fusion feature map through a convolutional layer and a fully connected layer, the first historical prediction frame is obtained.

4. The method according to claim 2, characterized in that: Determining a first loss value corresponding to the initial stage object detection model according to the first real frame and the first historical prediction frame includes: Obtaining a first area of ​​a minimum bounding rectangle of the first real box, the first historical prediction box, and the first real box and the first historical prediction box; Determining a first parameter according to the first real frame and the first historical prediction frame; Determine a second parameter according to the first real frame, the first historical prediction frame, the first area and the first parameter; Determining a third parameter according to the preset interval in which the first parameter is located; The first loss value is determined according to the first parameter, the second parameter and the third parameter.

5. The method according to claim 2, characterized in that: The two-stage target detection model is trained in the following way: Acquire the historical substation cabinet image included in the first historical prediction frame; Inputting the historical substation cabinet image and the second annotation information into an initial two-stage target detection model for training to obtain a second historical prediction frame, wherein the second historical prediction frame includes the location information of the defective screws in the historical substation cabinet image; Determine a second loss value corresponding to the initial two-stage object detection model according to the second real frame and the second historical prediction frame; When the second loss value is less than or equal to a second threshold, stop training the initial two-stage target detection model to obtain the two-stage target detection model.

6. The method according to claim 5, characterized in that Inputting the historical substation cabinet image and the second annotation information into the initial two-stage target detection model for training to obtain a second historical prediction frame, including: Input the historical substation image containing the second annotation information into the reversible column module in the initial two-stage target detection model to obtain a second feature map set, wherein the second feature map set includes a fourth feature map, a fifth feature map and a sixth feature map, the fourth feature map is obtained by passing the historical substation image containing the second annotation information through two layers of reversible column modules, the fifth feature map is obtained by passing the historical substation image containing the second annotation information through three layers of reversible column modules, and the sixth feature map is obtained by passing the historical substation image containing the second annotation information through four layers of reversible column modules; Upsampling the fifth feature map in the second feature map set a third number of times to obtain a target fifth feature map, and upsampling the sixth feature map in the second feature map set a fourth number of times to obtain a target sixth feature map, wherein the third number of times is less than the fourth number of times; splicing the fourth feature map, the target fifth feature map and the target sixth feature map to obtain a second fused feature map; After upsampling the second fused feature map through a convolutional layer and a fully connected layer, the second historical prediction box is obtained.

7. The method according to claim 5, characterized in that Determining a second loss value corresponding to the initial two-stage object detection model according to the second real frame and the second historical prediction frame includes: Obtaining a second area of ​​a minimum bounding rectangle of the second real box, the second historical prediction box, the second real box, and the second historical prediction box; Determine a fourth parameter according to the second real frame and the second historical prediction frame; Determine a fifth parameter according to the second real frame, the second historical prediction frame, the second area and the fourth parameter; Determining a sixth parameter according to the preset interval in which the fourth parameter is located; The second loss value is determined according to the fourth parameter, the fifth parameter and the sixth parameter.

8. A defective screw detection device, characterized in that: include: An acquisition module is used to acquire video stream data obtained by the acquisition device through data acquisition of the substation cabinet; A first analysis module is used to analyze the video frame image in the video stream data using a one-stage target detection model to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame includes the location information of the substation; The second analysis module is used to analyze the substation image corresponding to the first detection frame using a two-stage target detection model to obtain location information of defective screws, wherein the two-stage target detection model is used to identify defective screws.

9. An electronic device, characterized in that: include: A memory for storing program instructions; A processor, connected to the memory, is used to execute program instructions to implement the following functions: obtaining video stream data obtained by an acquisition device performing data acquisition on a substation; using a one-stage target detection model to analyze a video frame image in the video stream data to obtain a first detection frame, wherein the one-stage target detection model is used to identify the substation in the video frame image, and the first detection frame contains location information of the substation; using a two-stage target detection model to analyze the substation image corresponding to the first detection frame to obtain location information of defective screws, wherein the two-stage target detection model is used to identify defective screws.

10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by the processor, the defective screw detection method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Hot-rolled steel plate surface defect detection method

    CN113822889A

  • Cotton foreign fiber online detection method and system

    CN114419011A

  • Method and system for detecting small target defects of power transmission line

    CN114612742A

  • Defect detection method and device

    CN115861282A

  • Lightweight unmanned aerial vehicle intrusion detection method

    CN118196426A