Electrical drawing detection method and device, medium and electronic equipment

CN122551383APending Publication Date: 2026-08-11GUANGDONG POWER TRANSMISSION & TRANSFORMATION ENG
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-20
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0002]当前,电力工程设计中电气二次图纸的合规性校验主要依赖于人工对照设计规范逐项核查,或采用基于规则匹配的计算机辅助审查系统,前者受限于工程师的经验水平与生理疲劳,难以应对日益复杂的继电保护与控制回路逻辑,且审查周期冗长;后者虽引入了符号识别与拓扑提取技术,但其核心逻辑仍建立在硬编码的专家规则之上,需针对不同类型的变电站接线方式手动编写大量正则表达式与逻辑判断语句,导致系统在面对不同设计院异构的绘图习惯(如符号变形、标注位置漂移、图层命名混乱)时泛化能力极差,极易产生误报或漏报

Benefits of technology

[0025] Understandably, the beneficial effects achieved by the electrical drawing inspection device, electronic equipment, computer-readable storage medium, and computer program product provided above can be referred to the beneficial effects in the first aspect, and will not be repeated here.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122551383A_ABST
    Figure CN122551383A_ABST
Patent Text Reader

Abstract

An electrical drawing inspection method, apparatus, medium, and electronic equipment are disclosed, relating to the field of power engineering; this method enables automatic review and verification of secondary electrical drawings, improving inspection accuracy. The method includes: acquiring images of secondary electrical drawings labeled with error types and images of error-free secondary electrical drawings, constructing a training dataset; inputting the dataset into a target detection model and outputting the detection results; calculating the classification loss, localization loss, and confidence loss of the detection results; calculating a weighted loss based on the classification loss, localization loss, and confidence loss; updating the parameters of the target detection model using the weighted loss to obtain a trained target detection model; and determining the detection result of the secondary electrical drawing to be inspected using the trained target detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electrical engineering, and in particular to a method, apparatus, medium and electronic equipment for inspecting electrical drawings. Background Technology

[0002] Currently, compliance verification of electrical secondary drawings in power engineering design mainly relies on manual item-by-item checking against design specifications, or the use of rule-based computer-aided review systems. The former is limited by engineers' experience and physical fatigue, making it difficult to cope with increasingly complex relay protection and control circuit logic, and the review cycle is lengthy. Although the latter introduces symbol recognition and topology extraction technology, its core logic is still based on hard-coded expert rules. A large number of regular expressions and logical judgment statements need to be manually written for different types of substation wiring methods, resulting in extremely poor generalization ability of the system when facing the heterogeneous drawing habits of different design institutes (such as symbol deformation, label position drift, and chaotic layer naming), which easily leads to false alarms or omissions. Summary of the Invention

[0003] This application provides an electrical drawing inspection method, apparatus, medium, and electronic device, which can realize automatic drawing review, enhance the adaptability to various electrical secondary drawings, and improve the accuracy of error identification.

[0004] In a first aspect, this application provides a method for inspecting electrical drawings, including: Obtain electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and construct a training dataset using positive and negative samples; Images from the training dataset are input into an object detection model, which includes a backbone network, a neck network, and a detection head. The backbone network extracts multi-scale features from the input images, the neck network fuses features from different levels using a feature pyramid structure, and the detection head outputs detection results based on the fused features.

[0005] Where I is the input image and θ is the model parameter. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, Here, K represents the confidence score, and K represents the number of test results. The classification loss, localization loss, and confidence loss of the detection results are calculated. A weighted loss is calculated based on the classification loss, localization loss, and confidence loss. The parameters of the target detection model are updated using the weighted loss to obtain the trained target detection model. The detection results of the electrical secondary drawings to be detected are determined by the trained target detection model, and the detection results are visualized.

[0006] According to the electrical drawing detection method provided in this embodiment, positive samples are formed by annotating electrical secondary drawings with various error types, and error-free electrical secondary drawings are obtained as negative samples to provide training data for the target detection model. The target detection model uses a backbone network to extract multi-scale features and a neck network to fuse information at different scale levels to improve the accuracy of identifying errors at different scales. The detection head outputs multi-dimensional results for each error type, thereby improving the robustness of error detection and reducing the false negative and false positive rates. Furthermore, by optimizing the three dimensions of loss—classification loss, localization loss, and confidence loss—the model parameters are dynamically adjusted so that the trained model can adaptively balance the detection difficulty of different error types and enhance the model's generalization ability to heterogeneous error patterns in electrical secondary drawings.

[0007] For example, the error types include CT open circuit, PT short circuit, power supply polarity error, missing ground wire, crimping, broken wire, missing wire number, and non-standard drawing; The classification loss of the calculated detection results includes: The error types are classified into risk levels, the weight of each risk level is determined, and the classification loss of the detection results is calculated based on the weight of each risk level.

[0008] For example, inputting images from the training dataset into the object detection model includes: Obtain the pre-trained weights of the YOLO26 model on the target dataset as the initial object detection model, and then adjust the initial object detection model using the training dataset.

[0009] For example, the parameter update of the target detection model using weighted loss is described by the following formula:

[0010] in, For the first Model parameters during training rounds, For learning rate, For first-order momentum, momentum The updated formula is:

[0011] in, The momentum decay coefficient, The weighted loss for the t-th round of training; Learning rate The cosine annealing strategy is used for adjustment, and the formula is:

[0012] in, The initial learning rate, To minimize the learning rate, This is the current training round number. This represents the total number of training rounds.

[0013] Based on the foregoing, after determining the detection result of the electrical secondary drawings to be detected through the trained target detection model, the method further includes: The detection results were subjected to confidence filtering and non-maximum suppression. The confidence filtering formula is:

[0014] in, Let be the detection threshold for the i-th type of error. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, Here, K represents the confidence score, and K is the number of test results, which is set differently according to risk level. Calculate the project score based on the processed test results.

[0015] Based on the foregoing, the method also includes; The project score is calculated using the following formula:

[0016] in, Let i be the number of type i errors. Deduct points for a single instance of a Type i error; If the risk level of the error type detected in the test results is a principle risk, then the electrical secondary drawings to be tested are determined to be unqualified.

[0017] Specifically, the weighted loss calculated based on classification loss, localization loss, and confidence loss includes: The loss function for calculating the weighted loss is:

[0018] in, For classifying losses, To locate the loss, For confidence loss; These are the weighting coefficients; Classification loss The calculation formula is:

[0019] The weight for the type i error is determined based on the risk level. The detection results output by the target detection model. The true category of the input image; Location loss The CIoU loss is calculated using the following formula:

[0020] Where b represents the coordinates and dimensions of the detection box in the detection result. Let be the coordinates and dimensions of the ground truth bounding box, and c be the diagonal length of the smallest rectangle enclosing both the predicted and ground truth bounding boxes. These are the weighting coefficients. This is a penalty term used to measure the shape difference between the predicted bounding box and the ground truth bounding box; This indicates the calculation of the Euclidean distance between the center points of the detection box and the ground truth box.

[0021] Secondly, this application provides an electrical drawing inspection device, comprising: The sample acquisition module is used to acquire electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and construct a training dataset using positive and negative samples. The model construction module is used to input the images in the training dataset into the target detection model, which includes a backbone network, a neck network, and a detection head. The backbone network extracts multi-scale features from the input images, the neck network uses a feature pyramid structure to fuse features from different levels, and the detection head outputs the detection result based on the fused features. Where I is the input image and θ is the model parameters. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, K represents the confidence score, and K represents the number of detection results. The parameter update module is used to calculate the classification loss, localization loss, and confidence loss of the detection results. Based on the classification loss, localization loss, and confidence loss, a weighted loss is calculated. The parameters of the target detection model are updated using the weighted loss to obtain the trained target detection model. The drawing detection module is used to determine the detection results of the electrical secondary drawings to be detected using the trained target detection model and to visualize the detection results.

[0022] Thirdly, this application provides an electronic device including a memory and one or more processors. The memory stores one or more computer programs, each including instructions that, when executed by the processor, cause the electronic device to perform the electrical drawing inspection method as described in the first aspect.

[0023] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the electrical drawing inspection method as described in the first aspect.

[0024] Fifthly, this application provides a computer program product that, when run on an electronic device, causes the electronic device to perform the electrical drawing inspection method as described in the first aspect.

[0025] Understandably, the beneficial effects achieved by the electrical drawing inspection device, electronic equipment, computer-readable storage medium, and computer program product provided above can be referred to the beneficial effects in the first aspect, and will not be repeated here. Attached Figure Description

[0026] Figure 1 A schematic flowchart illustrating the electrical drawing inspection method provided in this application embodiment; Figure 2 This is a schematic diagram illustrating the error type classification in the electrical drawing inspection method provided in this application embodiment; Figure 3 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 1 ; Figure 4 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 2 ; Figure 5 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 3 ; Figure 6 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 4 ; Figure 7 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 5 ; Figure 8 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 6 ; Figure 9 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 7 ; Figure 10 Schematic diagram of the detection results in the electrical drawing inspection method provided in this application embodiment Figure 8 ; Figure 11 Visualization of the electrical drawing inspection method provided in this application embodiment Figure 1 ; Figure 12 Visualization of the electrical drawing inspection method provided in this application embodiment Figure 2 ; Figure 13This is a schematic diagram of the electrical drawing inspection device provided in the embodiments of this application; Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0027] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. For example, "first chip" and "second chip" are only used to distinguish different chips and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" do not necessarily imply that they are different. It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate that they are examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being better or more advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. In the embodiments of this application, "at least one" means one or more, and "more than one" means two or more.

[0028] It should be noted that "at the time of..." in the embodiments of this application can be either at the instant when a certain situation occurs, or for a period of time after the occurrence of a certain situation. The embodiments of this application do not make specific limitations on this.

[0029] The implementation of this embodiment will now be described in detail with reference to the accompanying drawings.

[0030] This embodiment provides an electrical drawing inspection method that can automatically inspect electrical secondary drawings using a model to identify errors that occurred during design or drafting. For example, this electrical drawing inspection method can be applied to various electronic devices such as computers (PCs), tablets, virtual reality / augmented reality devices, wearable devices, and industrial computers; it can also be applied to servers, cloud environments, server clusters, etc., and this embodiment does not impose any special limitations on it.

[0031] Figure 1 A flowchart illustrating the electrical drawing inspection method provided in this application embodiment is shown.

[0032] like Figure 1 As shown, this electrical drawing inspection method may include the following steps: Step 101: Obtain electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and construct a training dataset using positive and negative samples.

[0033] In this embodiment, a certain number of electrical secondary drawing images are collected and these drawing images are annotated. The annotations include the actual category used to indicate the type of error in the electrical secondary drawing images and the actual bounding box used to indicate the location of the error.

[0034] For example, error types include open circuit of CT, short circuit of PT, power supply polarity error, missing ground wire, crimping, broken wire, missing wire number, and non-standard drawing; this embodiment also includes: classifying the error types into risk levels and determining the weight of each risk level.

[0035] To ensure the scientific rigor and operability of the evaluation, the risk level classification of error types is based on industry standards (Power Industry Standard DLT5458 "Specifications for the Depth of Design Content in Construction Drawings for Substation Engineering") and enterprise standards. The probability of risk occurrence is shown in Table 1 below.

[0036] Table 1. Criteria for Classifying the Likelihood of Risk Occurrence

[0037] The severity scores of the risk consequences are shown in Table 2.

[0038] Table 2. Criteria for Classifying the Severity of Risk Consequences

[0039] Based on the above risk classification criteria, a 5×5 risk matrix was constructed, as shown in Table 3, dividing risks into three risk levels: high-risk, medium-risk, and low-risk. The determination of risk level comprehensively considers the risk's position in the matrix and the acceptable risk levels required by power industry risk management practices.

[0040] Table 3. Schematic diagram of electrical secondary design risk matrix

[0041] Based on the risk matrix above, the matrix location of each error type can be determined, as shown in Table 4.

[0042] Table 4 Risk Factor Matrix Location and Level Determination

[0043] In summary, the first layer categorizes risks into three dimensions based on their fundamental nature: principle-based risks, technical risks, and general risks. The second layer further subdivides each dimension into several risk categories. The third layer comprises eight core risk factors. The hierarchical structure is presented in a tree diagram, as follows: Figure 2As shown, there are eight error types: open circuit in the current transformer (CT), short circuit in the power supply (PT), incorrect power polarity, missing grounding wire, crimping, broken wire, missing wire number, and non-standard drawing. Based on the above classification criteria, these are divided into three risk levels: fundamental risks, technical risks, and general risks. Fundamental risks include current loop risks, voltage loop risks, grounding risks, and power supply risks; current loop risks specifically refer to open circuits in the CT, voltage loop risks to short circuits in the PT, grounding risks to missing grounding wires, and power supply risks to incorrect power polarity. Technical risks include wiring risks; wiring risks are specifically divided into crimping and broken wires. General risks include risks related to drawing standards and labeling; drawing standards specifically refer to non-standard drawing, and labeling risks specifically refer to missing wire numbers.

[0044] Based on the eight error types mentioned above, the LabelImg annotation tool was used to perform refined annotation of key verification elements in the images. During the annotation process, tilted or rotated drawing images were automatically corrected using OpenCV's perspective transformation algorithm. An oversampling annotation strategy was implemented for frequently occurring "error, omission, and collision" areas in the review sheets; this involved multiple annotation boxes covering the error-concentrated areas within the same drawing to enhance the model's sensitivity to these features. Finally, the large number of PDF drawing files generated from the annotation were parsed and converted into the YAML format required for model training. A YAML configuration file containing paths to the training set, validation set, and test set was written in an 8:1:1 ratio, establishing a standardized data pipeline for model training.

[0045] This implementation also includes preprocessing the acquired drawing images, including size normalization, grayscale conversion, and histogram equalization. The preprocessing formula is as follows:

[0046] in, σ represents the pixel values ​​of the original image, μ represents the mean pixel value of the image, and σ represents the standard deviation.

[0047] This implementation also includes: expanding the training samples using data augmentation strategies, including random rotation, random scaling, random cropping, brightness and contrast adjustment, and Mosaic stitching. The formula for random rotation is:

[0048] Where (x,y) are the original coordinates of the electrical secondary drawing image, (x′,y′) are the coordinates after rotation, and θ is the rotation angle.

[0049] Positive samples were obtained from the labeled electrical secondary drawing image data. The training dataset includes positive and negative samples. Positive samples are drawings with eight types of error annotations, while negative samples are drawings without errors. The eight types of errors are: open circuit in the current transformer (CT), short circuit in the current transformer (PT), crimping, incorrect power polarity, broken wire, missing grounding wire, missing wire number, and non-standard drawing. The training dataset is then preprocessed and augmented to obtain the final training dataset.

[0050] Step 102: Input the images from the training dataset into the object detection model, which includes a backbone network, a neck network, and a detection head.

[0051] The backbone network extracts multi-scale features from the input image, the neck network uses a feature pyramid structure to fuse features from different levels, and the detection head outputs detection results based on the fused features. Where I is the input image and θ is the model parameters. Let the coordinates and dimensions of the k-th detection box be given. As coordinates, Width and height, For class probability vectors, K represents the confidence score, and K represents the number of test results.

[0052] The training dataset was divided into training, validation, and test sets in an 8:1:1 ratio. Images from the training set were input into the object detection model in batches for training. For each batch of input images, based on the risk decomposition structure analysis, eight types of errors were differentiated into three dimensions: fundamental risk, technical risk, and general risk. Fundamental risks (CT open circuit, PT short circuit, power polarity error, missing ground wire) received the most samples, followed by technical risks (crimping, broken wire), and general risks (missing wire number, improper drawing) received the fewest. The formula for calculating the sample allocation weights is as follows:

[0053] in, Assign weights to samples with type i errors. Let λ be the risk priority score for the i-th type of error, and λ be the scaling factor.

[0054] This implementation employs a transfer learning strategy to construct an object detection model. It loads the pre-trained weights of the YOLO26 model on the public COCO dataset as initial parameters, and then fine-tunes them on the training dataset. Specifically, it involves: obtaining the pre-trained weights of the YOLO26 model on the target dataset as the initial object detection model, and then adjusting the initial object detection model using the training dataset.

[0055] The YOLO26 object detection model's network structure includes: a backbone network (extracting multi-scale image features); a neck network (fusing features from different levels using a feature pyramid structure); and a head network (employing a one-to-one end-to-end detection head, eliminating the need for non-maximum suppression post-processing). The detection output of the YOLO26 object detection model can be represented as:

[0056] Where I is the input image and θ is the model parameter. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, K represents the confidence score, and K represents the number of test results.

[0057] The loss is calculated by comparing the detection results of each batch of input images with the actual data labeled in that input image.

[0058] Step 103: Calculate the classification loss, localization loss, and confidence loss of the detection results. Calculate the weighted loss based on the classification loss, localization loss, and confidence loss. Update the parameters of the target detection model using the weighted loss to obtain the trained target detection model.

[0059] The weighted loss, calculated based on classification loss, localization loss, and confidence loss, specifically includes: The loss function for calculating the weighted loss is:

[0060] in, For classifying losses, To locate the loss, For confidence loss; These are the weighting coefficients.

[0061] When calculating the classification loss, the weights of the risk levels of the error types are considered, and the classification loss of the detection results is calculated based on the weights of each risk level. Classification Loss The calculation formula is:

[0062] The weight for the type i error is determined based on the risk level. The detection results output by the target detection model. The true category of the input image.

[0063] Location loss The CIoU loss is calculated using the following formula:

[0064] Where b represents the coordinates and dimensions of the detection box in the detection result. Let be the coordinates and dimensions of the ground truth bounding box, and c be the diagonal length of the smallest rectangle enclosing both the predicted and ground truth bounding boxes. These are the weighting coefficients. This is a penalty term used to measure the shape difference between the predicted bounding box and the ground truth bounding box; This indicates the calculation of the Euclidean distance between the center points of the detection box and the ground truth box.

[0065] Confidence loss This is used to measure the accuracy of the model's judgment on "whether the target exists". For electrical secondary drawing inspection tasks, the confidence loss uses binary cross-entropy loss:

[0066] in, The feature map grid size (in YOLO26, there are three scales: 80×80, 40×40, and 20×20). The number of anchor boxes predicted for each grid (usually 1 in YOLO26). The confidence score (between 0 and 1) for the model prediction. For indicator functions, it means the first... The first grid Does each anchor box contain a target? (1 if there is a target, 0 otherwise) This is an indicator function that indicates whether the target is not included (0 if the target is present, 1 otherwise). This is the loss weight for the region without a target, usually set to 0.5, used to balance positive and negative samples.

[0067] After calculating the weighted loss, the parameters of the object detection model are updated using the weighted loss. Then, the next round of training is carried out based on the updated parameters until the weighted loss meets the preset conditions, and the training is completed.

[0068] The object detection model's parameters are updated using a weighted loss algorithm. The parameter update employs the MuSGD optimizer, a hybrid optimizer combining SGD and Muan. The parameter update formula is as follows:

[0069] in, For the first Model parameters during training rounds, For learning rate, For first-order momentum, momentum The updated formula is:

[0070] in, The momentum decay coefficient, The weighted loss for the t-th round of training; Learning rate The cosine annealing strategy is used for adjustment, and the formula is:

[0071] in, The initial learning rate, To minimize the learning rate, This is the current training round number. This represents the total number of training rounds.

[0072] In this embodiment, the aforementioned hybrid optimizer is used for parameter updates, which unifies the gradient scale across different network layers, preventing gradient explosion or vanishing. This allows the model to maintain excellent generalization ability while achieving fast convergence, thus improving training efficiency.

[0073] Step 104: Determine the detection results of the electrical secondary drawings to be detected using the trained target detection model, and visualize the detection results.

[0074] The electrical secondary drawings to be inspected are input into the trained target detection model to obtain the inspection results. These results can include the error type and the location and size of the error, thus enabling automatic review of the electrical secondary drawings. After obtaining the inspection results, they can be visualized, for example, displaying the detected error type and marking the error location in the image. This visualization allows users to view the inspection results.

[0075] After determining the detection results of the electrical secondary drawings to be detected through the trained target detection model, the process also includes: performing confidence filtering and non-maximum suppression processing on the detection results; calculating the item score on the processed detection results; and visualizing the item score together with the detection results to prompt the user whether the electrical secondary drawings to be detected are qualified.

[0076] If the risk level of the error type detected in the test results is a principle risk, then the electrical secondary drawing to be tested is determined to be unqualified, and an unqualified prompt message is output to remind the user that there are high-risk errors in the drawing.

[0077] The confidence filtering formula is:

[0078] in, Let be the detection threshold for the i-th type of error. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, K represents the confidence score, and K is the number of test results, which is set according to the risk level.

[0079] The number of errors of various types is counted based on the test results, and the project score is calculated according to the differentiated deduction standard. The project score is calculated using the following formula:

[0080] in, Let i be the number of type i errors. Deduct points for a single instance of a Type i error.

[0081] When a fundamental risk is detected, a veto is triggered, and the score is directly judged as unqualified.

[0082] Figures 3 to 10 The inspection results for the electrical secondary drawings to be inspected are shown separately. For example... Figure 3 As shown, for the primary and secondary drawings, the target detection model identifies the error type as CT open circuit (principle risk) and marks the error detection box. Figure 4 The secondary drawing identified the error type as PT short circuit; Figure 5 The drawing shown indicates that the error type is a missing grounding wire; Figure 6 The error type in the Chinese drawing is a power supply level error; Figure 7 The error type in the drawing is crimping; Figure 8 The error type in the Chinese drawing is broken line; Figure 9 The error type on the Chinese drawing is missing line number; Figure 10 The error type in the Chinese drawing is non-standard drawing.

[0083] When the system receives the electrical secondary drawings to be inspected, it can determine the inspection results of the drawings through the target inspection model, and mark the types and locations of errors that exist in the drawings. Figure 11 and Figure 12 Each of these displays a visualization effect, such as Figure 11 As shown in the visualization, the drawing has issues with its drawing specifications; for example... Figure 12 As shown, the information displayed confirms that there is a crimping problem in the drawing.

[0084] This implementation method uses a target detection model to inspect electrical secondary drawings, identify potential problems in the drawings, and visualize them for the user, automatically completing the drawing review. Furthermore, the target detection model can simultaneously detect eight different error types, improving detection accuracy and reducing missed or false detections.

[0085] Furthermore, this embodiment also provides an electrical drawing inspection device, which can be used to perform the above-described electrical drawing inspection method. For example... Figure 13As shown, the electrical drawing inspection device 400 specifically includes: a sample acquisition module 401, used to acquire electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and construct a training dataset using positive and negative samples; a model construction module 402, used to input the images in the training dataset into a target detection model to obtain detection results, wherein the target detection model includes a backbone network, a neck network, and a detection head; the backbone network extracts multi-scale features from the input image, the neck network uses a feature pyramid structure to fuse features at different levels, and the detection head outputs detection results based on the fused features. Where I is the input image and θ is the model parameters. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, K represents the confidence score, and K represents the number of detection results. The parameter update module 403 is used to calculate the classification loss, localization loss, and confidence loss of the detection results. Based on the classification loss, localization loss, and confidence loss, a weighted loss is calculated. The parameters of the target detection model are updated using the weighted loss to obtain the trained target detection model. The drawing detection module 404 is used to determine the detection results of the electrical secondary drawings to be detected using the trained target detection model and to visualize the detection results.

[0086] The specific details of each module or unit in the aforementioned electrical drawing inspection device have been described in detail in the corresponding electrical drawing inspection method, so they will not be repeated here.

[0087] This application also provides an electronic device. Figure 14 A schematic diagram of the structure of an electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 14 The electronic device 600 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0088] like Figure 14 As shown, the electronic device 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. The RAM 603 also stores various programs and data required for system operation. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0089] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0090] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined in the embodiments of this application.

[0091] For example, when the computer program is executed by the central processing unit (CPU) 601, it can perform the following: acquire electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and construct a training dataset using the positive and negative samples; input the images in the training dataset into a target detection model to obtain detection results, wherein the target detection model includes a backbone network, a neck network, and a detection head; the backbone network extracts multi-scale features from the input images, the neck network uses a feature pyramid structure to fuse features at different levels, and the detection head outputs detection results based on the fused features. Where I is the input image and θ is the model parameters. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, Let K be the confidence score and K be the number of detection results. Calculate the classification loss, localization loss, and confidence loss of the detection results. Based on the classification loss, localization loss, and confidence loss, calculate the weighted loss. Update the parameters of the target detection model using the weighted loss to obtain the trained target detection model. Determine the detection results of the electrical secondary drawings to be detected using the trained target detection model and visualize the detection results.

[0092] It should be noted that the computer-readable medium disclosed herein may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0093] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0094] The units described in the embodiments of this disclosure can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the unit itself.

[0095] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which include instructions that, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.

[0096] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0097] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for inspecting electrical drawings, characterized in that, include: Obtain electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and construct a training dataset using positive and negative samples; Images from the training dataset are input into the object detection model, which includes a backbone network, a neck network, and a detection head. The backbone network extracts multi-scale features from the input image, the neck network uses a feature pyramid structure to fuse features from different levels, and the detection head outputs detection results based on the fused features. Where I is the input image and θ is the model parameters. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, Here, K represents the confidence score, and K represents the number of test results. The classification loss, localization loss, and confidence loss of the detection results are calculated. A weighted loss is calculated based on the classification loss, localization loss, and confidence loss. The parameters of the target detection model are updated using the weighted loss to obtain the trained target detection model. The detection results of the electrical secondary drawings to be detected are determined by the trained target detection model, and the detection results are visualized.

2. The electrical drawing inspection method according to claim 1, characterized in that, The error types include open circuit of CT, short circuit of PT, incorrect power supply polarity, missing ground wire, crimping, broken wire, missing wire number, and non-standard drawing; The classification loss of the calculated detection results includes: The error types are classified into risk levels, the weight of each risk level is determined, and the classification loss of the detection results is calculated based on the weight of each risk level.

3. The electrical drawing inspection method according to claim 1, characterized in that, The step of inputting images from the training dataset into the object detection model includes: Obtain the pre-trained weights of the YOLO26 model on the target dataset as the initial object detection model, and then adjust the initial object detection model using the training dataset.

4. The electrical drawing inspection method according to claim 1, characterized in that, The target detection model is updated using a weighted loss algorithm, and the parameter update formula is as follows: in, For the first Model parameters during training rounds, For learning rate, For first-order momentum, momentum The updated formula is: in, The momentum decay coefficient, The weighted loss for the t-th round of training; Learning rate The cosine annealing strategy is used for adjustment, and the formula is: in, The initial learning rate, To minimize the learning rate, This is the current training round number. This represents the total number of training rounds.

5. The electrical drawing inspection method according to claim 1, characterized in that, After determining the detection result of the electrical secondary drawings to be detected through the trained target detection model, the method further includes: The detection results were subjected to confidence filtering and non-maximum suppression. The confidence filtering formula is: in, Let be the detection threshold for the i-th type of error. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, Here, K represents the confidence score, and K is the number of test results, which is set differently according to risk level. Calculate the project score based on the processed test results.

6. The electrical drawing inspection method according to claim 5, characterized in that, Also includes; The project score is calculated using the following formula: in, Let i be the number of type i errors. Deduct points for a single instance of a Type i error; If the risk level of the error type detected in the test results is a principle risk, then the electrical secondary drawings to be tested are determined to be unqualified.

7. The electrical drawing inspection method according to claim 1, characterized in that, The weighted loss calculated based on classification loss, localization loss, and confidence loss includes: The loss function for calculating the weighted loss is: in, For classifying losses, To locate the loss, For confidence loss; These are the weighting coefficients; Classification loss The calculation formula is: The weight for the type i error is determined based on the risk level. The detection results output by the target detection model. The true category of the input image; Location loss The CIoU loss is calculated using the following formula: Where b represents the coordinates and dimensions of the detection box in the detection result. Let be the coordinates and dimensions of the ground truth bounding box, and c be the diagonal length of the smallest rectangle enclosing both the predicted and ground truth bounding boxes. These are the weighting coefficients. This is a penalty term used to measure the shape difference between the predicted bounding box and the ground truth bounding box; This indicates the calculation of the Euclidean distance between the center points of the detection box and the ground truth box.

8. An electrical drawing inspection device, characterized in that, include: The sample acquisition module is used to acquire electrical secondary drawing images labeled with error types as positive samples and electrical secondary drawing images without errors as negative samples, and to construct a training dataset using positive and negative samples. The model building module is used to input images from the training dataset into the object detection model, which includes a backbone network, a neck network, and a detection head. The backbone network extracts multi-scale features from the input image, the neck network uses a feature pyramid structure to fuse features from different levels, and the detection head outputs detection results based on the fused features. Where I is the input image and θ is the model parameters. Let the coordinates and dimensions of the k-th detection box be given. For class probability vectors, Here, K represents the confidence score, and K represents the number of test results. The parameter update module is used to calculate the classification loss, localization loss, and confidence loss of the detection results. Based on the classification loss, localization loss, and confidence loss, a weighted loss is calculated. The parameters of the target detection model are updated using the weighted loss to obtain the trained target detection model. The drawing inspection module is used to determine the inspection results of electrical secondary drawings to be inspected through a trained target inspection model, and to visualize the inspection results.

9. A computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the electrical drawing inspection method as described in any one of claims 1 to 7.

10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing one or more computer programs, the one or more computer programs including instructions that, when executed by the electronic device, cause the electronic device to perform the electrical drawing inspection method according to any one of claims 1-7.