Substation secondary drawing terminal strip character intelligent identification and automatic error correction method
By combining object detection and spatial clustering with an electrical engineering terminology recognition model, the problem of low accuracy and insufficient error correction capability in the recognition of terminal block text on substation secondary drawings was solved. This achieved efficient intelligent recognition and automatic error correction, improving the accuracy and adaptability of drawing digitization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-05
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies for recognizing terminal block text on substation secondary drawings suffer from insufficient recognition accuracy, lack of semantic understanding, and weak error correction mechanisms, resulting in low accuracy and poor adaptability of recognition results, and an inability to effectively utilize electrical expertise for intelligent error correction.
The terminal symbols are identified using an object detection algorithm, the text recognition range is defined by a spatial clustering algorithm, and the text detection is performed by combining a recognition model that integrates electrical professional terminology. Character-level, semantic-level, and topological-level error correction are performed in sequence, and the recognition accuracy is improved by incremental learning to optimize the model.
It significantly improves the recognition accuracy and adaptability of terminal block text, can distinguish different types of text, conforms to electrical professional standards, reduces reliance on manual verification, and improves the quality and efficiency of drawing digitization.
Smart Images

Figure CN121768013A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of automatic drawing, specifically relating to a method for intelligent recognition and automatic error correction of terminal block text in substation secondary drawings. Background Technology
[0002] Digitizing substation secondary drawings is a fundamental task in the intelligent transformation of the power industry, and terminal block text recognition is a core component of drawing digitization. Terminal block areas have high text density, small font size (24mm), dense arrangement, and diverse formats, and are often subject to interference from factors such as scanning tilt, uneven lighting, dirt obscuring text, and handwritten annotations, placing extremely high demands on recognition technology. Existing technologies suffer from the following problems: Insufficient recognition accuracy: General-purpose OCR tools (such as Baidu OCR and Tencent OCR) are optimized for natural scene text and have poor adaptability to electrical drawings, with terminal block text recognition accuracy at only 60-75%. Common errors include: confusion of similar characters ("0" and "O", "1" and "I", "8" and "B"), incorrect recognition of alphanumeric combinations ("A12" recognized as "A1Z"), loss of special symbols ("", " / ", ":"), and overlapping or broken text across multiple lines. Traditional OCR is based on single-character segmentation and classification, lacking the ability to understand the format rules of terminal numbering (such as "1KK:01", "2TA3"), and cannot utilize semantic constraints to improve accuracy.
[0003] The lack of semantic understanding means that existing methods treat terminal block text recognition as a purely visual task, outputting isolated strings without any understanding of electrical semantics. They cannot distinguish between different types of text, such as terminal numbers, equipment names, circuit numbers, and technical parameters, and cannot determine whether the recognition results conform to electrical naming standards. Furthermore, the recognition results are not associated with terminal symbols, connecting lines, or equipment graphics in drawings, resulting in a 1525% mismatch rate between terminal numbers and actual terminal positions.
[0004] The error correction mechanism is weak; errors cannot be automatically detected and corrected, relying entirely on manual full-scale verification. Manually verifying a single drawing takes 20-30 minutes, with an error omission rate of 510%. Low-confidence identification results cannot be automatically marked with warnings, and there is a lack of error correction rule base based on electrical expertise, making it impossible to utilize prior knowledge such as terminal number continuity, circuit number correspondence, and equipment model standards for intelligent error correction.
[0005] The model suffers from insufficient adaptability and robustness, is sensitive to drawing styles, scanning quality, and local interference, and its recognition accuracy can drop below 60% when using new drawing styles. There are significant differences in drawing formats across different substations, design firms, and eras, resulting in weak model generalization ability. Furthermore, the lack of a standardized preprocessing workflow tailored to the characteristics of electrical drawings leads to a sharp decline in recognition accuracy at scanning resolutions below 300 dpi. Cross-scenario migration requires re-annotation and retraining, resulting in high deployment costs. Summary of the Invention
[0006] The purpose of this invention is to provide a method for intelligent recognition and automatic error correction of terminal block text in substation secondary drawings, so as to solve the problems mentioned in the background art.
[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution: A method for intelligent recognition and automatic error correction of terminal block text in substation secondary drawings, comprising the following steps: The substation secondary drawings were subjected to tilt correction, contrast enhancement and noise removal operations. Low-resolution images were reconstructed using super-resolution reconstruction and the image quality was improved through standardization. The target detection algorithm is used to identify terminal symbols in the drawings, and the spatial clustering algorithm is used to aggregate the terminal symbols into terminal block areas, automatically defining the text recognition range; Based on a recognition model that integrates electrical engineering terminology, the system detects text within the terminal block area, adopts a corresponding recognition strategy according to the text size, and outputs the text sequence and confidence level. The pre-trained model is used to classify the recognized text into different types, analyze the legality of the number format, and establish the spatial association between the text and terminal symbols. The system sequentially performs character-level obfuscation correction, semantic-level specification verification, and topology-level connection rationality verification, then calculates the confidence score and marks low-confidence recognition results. Low-confidence results are manually reviewed, and the corrected data is used as training samples. The model is optimized through incremental learning to continuously improve recognition accuracy and adaptability.
[0008] Furthermore, the operation of tilt correction, contrast enhancement, and noise removal on the substation secondary drawings specifically involves using Hough transform to detect the feature lines of the drawing frame to determine the transformation matrix, automatically correcting the tilt of the drawings, performing histogram equalization to enhance contrast in blocks using the CLAHE algorithm, and applying bilateral filtering to remove image noise while preserving text edge details.
[0009] Furthermore, the super-resolution reconstruction of low-resolution images and the standardization to improve image quality specifically involves first determining the image resolution, then processing the low-resolution image using a super-resolution reconstruction network, and improving the text details and clarity of the reconstructed image through multi-type loss collaborative optimization, and standardizing the output to meet the subsequent recognition requirements of a high-quality image.
[0010] Furthermore, the method involves using an object detection algorithm to identify terminal symbols in the drawings, and using a spatial clustering algorithm to aggregate the terminal symbols into terminal block regions, automatically defining the text recognition range. Specifically, an improved object detection model is used to identify various types of terminal symbols in the drawings, outputting bounding boxes, confidence scores, and category information. After extracting the center points of the terminal symbols, a spatial clustering algorithm is used to aggregate terminal symbols with similar spatial positions, automatically filtering isolated noise points, calculating the minimum bounding rectangle after clustering, and expanding the boundary to define the text recognition range. Priority scores are calculated based on the relevant information of the terminal blocks, and key areas are processed first.
[0011] Furthermore, the recognition model based on the fusion of electrical engineering terminology detects text within the terminal block area. Specifically, it uses the DBNet algorithm to detect text areas within the terminal block area and outputs relevant information, accurately segmenting densely arranged and multi-line superimposed text. It performs text recognition through an improved SRN algorithm, extracts visual features using a related network, encodes them, and inputs them into the semantic reasoning module. It incorporates an embedding layer including electrical engineering terminology, fuses the visual features and semantic embedding vectors, and inputs them into the decoder for processing. It uses a character confusion matrix to perform secondary discrimination of similar characters based on contextual semantics and adjusts the recognition results.
[0012] Furthermore, the step of adopting a corresponding recognition strategy based on the font size to output the text sequence and confidence score involves obtaining the actual font size through the text bounding box height output by DBNet, classifying the font size and adopting a corresponding processing strategy: small font sizes are enlarged while maintaining clear edges, while large font sizes are not scaled. The processed image is input into the improved SRN model, and the initial confidence score of the character is output. The confidence score is adjusted based on the character confusion matrix for secondary discrimination, and the comprehensive confidence score of the text sequence is calculated. Finally, the text sequence, the confidence score of each character, and the comprehensive confidence score of the sequence are output.
[0013] Furthermore, the process of classifying the identified text into different types using a pre-trained model, parsing the legality of the number format, and establishing spatial association between the text and terminal symbols involves: classifying the identified text by type using a pre-trained model; establishing a rule base related to terminal number parsing, equipment model, and circuit number; parsing the legality of the number format and identifying the equipment and circuit types; calculating the spatial distance between the identified text and terminal symbols; establishing association using the nearest neighbor matching principle; and determining text exceeding the distance threshold as circuit labels or equipment names.
[0014] Furthermore, the process involves sequentially performing character-level obfuscation correction, semantic-level specification verification, and topology-level connection rationality verification. Specifically, at the character level, similar characters are corrected based on the obfuscation matrix and confidence level, and character sequences that do not conform to the format are adjusted. At the semantic level, the number format, equipment matching degree, and circuit type are verified based on the electrical professional corpus and specification rule base, and the optimal replacement result that conforms to the specification is generated. At the topology level, terminal pair type, circuit, and equipment information are extracted to verify the connection rationality and provide correction suggestions for abnormal results.
[0015] Furthermore, the comprehensive confidence calculation and marking of low-confidence recognition results specifically involves calculating the scores after character-level, semantic-level, and topological-level error correction, dynamically adjusting the weights of the three levels based on historical correction data, weighted summing to obtain the comprehensive confidence score, setting a confidence score threshold, marking recognition results below the threshold as low-confidence, and overlaying relevant information in the corresponding area of the original drawing.
[0016] Furthermore, the process involves manually reviewing low-confidence results, using the corrected data as training samples, and optimizing the model through incremental learning to continuously improve recognition accuracy and adaptability. Specifically, low-confidence recognition-related information is overlaid on the original drawing, the corrected data is automatically labeled as training samples, active learning and experience replay strategies are used to select samples, the model is optimized through incremental learning, and a new model that meets the standards is deployed after performance evaluation.
[0017] This application also discloses an electronic device, including: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the above-described method for intelligent recognition and automatic error correction of terminal block text in substation secondary drawings according to the present invention.
[0018] Beneficial effects: Significantly improved recognition accuracy; the recognition network integrating electrical expertise and a three-level error correction mechanism greatly reduces problems such as character confusion and formatting errors; the overall recognition accuracy and the accuracy of professional terminology recognition are significantly better than existing technologies; it has semantic understanding and classification capabilities, can distinguish different types of terminal block text, establish the association between text and drawing elements, and comply with electrical professional standards. Attached Figure Description
[0019] Figure 1 This is a flowchart of a method for intelligent recognition and automatic error correction of terminal block text in substation secondary drawings according to the present invention; Figure 2 This is a flowchart of the image preprocessing and quality enhancement module of the present invention; Figure 3This is a schematic diagram of the intelligent positioning of the terminal block area according to the present invention; Figure 4 This is a diagram of the text recognition network structure based on the SRN algorithm of the present invention; Figure 5 This is a schematic diagram illustrating the working principle of the semantic understanding and classification module of this invention. Detailed Implementation
[0020] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0021] First, the technical terms used in this application are explained as follows: Secondary drawings: Electrical schematic diagrams showing the connection relationships of secondary equipment in a substation, including terminal block diagrams, wiring diagrams, and schematic diagrams; Terminal blocks: Wiring terminal assemblies used in electrical equipment to connect external cables, arranged according to rules and labeled with information such as number and function; Terminal block text: Text markings within the terminal block area, including terminal number, cable identification, circuit number, equipment name, technical parameters, etc. SRN algorithm: Semantic Reasoning Network, is a text recognition algorithm that integrates visual features and semantic information, and has a strong ability to recognize irregular text such as occluded and blurred text; OCR: Optical Character Recognition; Semantic error correction: Based on the electrical engineering knowledge base and contextual semantic relationships, the recognition results are verified for reasonableness and automatically corrected; Confidence: A quantitative evaluation index of the accuracy of the recognition results of the algorithm, with a value range of 0-1. The higher the value, the higher the confidence. This invention provides a method for intelligent recognition and automatic error correction of terminal block text in substation secondary drawings, such as... Figures 1-5 As shown, the steps include: The substation secondary drawings were subjected to tilt correction, contrast enhancement and noise removal operations. Low-resolution images were reconstructed using super-resolution reconstruction and the image quality was improved through standardization. The target detection algorithm is used to identify terminal symbols in the drawings, and the spatial clustering algorithm is used to aggregate the terminal symbols into terminal block areas, automatically defining the text recognition range; Based on a recognition model that integrates electrical engineering terminology, the system detects text within the terminal block area, adopts a corresponding recognition strategy according to the text size, and outputs the text sequence and confidence level. The pre-trained model is used to classify the recognized text into different types, analyze the legality of the number format, and establish the spatial association between the text and terminal symbols. The system sequentially performs character-level obfuscation correction, semantic-level specification verification, and topology-level connection rationality verification, then calculates the confidence score and marks low-confidence recognition results. Low-confidence results are manually reviewed, and the corrected data is used as training samples. The model is optimized through incremental learning to continuously improve recognition accuracy and adaptability.
[0022] The process of performing tilt correction, contrast enhancement, and noise removal on the substation secondary drawings involves the following steps: Hough transform is used to detect the feature lines of the drawing frame, the tilt angle is calculated, and the cosine, sine, and translation parameters of the rotation angle are calculated using the image center point to determine the affine transformation matrix. The tilted drawing is then corrected to a standard rectangle, supporting automatic correction within a tilt angle range of ±15 degrees. Contrast enhancement is performed using the CLAHE algorithm, the image is divided into a grid, histogram equalization is performed on each grid, the upper limit of contrast gain is limited, a contrast limit threshold and grayscale levels are set, and bilateral filtering is applied to remove image noise while preserving text edge details.
[0023] The proposed super-resolution reconstruction for low-resolution images, aimed at standardizing and improving image quality, is implemented by first determining whether the image resolution is below 300 dpi. For images below this resolution, an ESRGAN network is used for super-resolution reconstruction, increasing the original image resolution by a factor of 2. The network loss function includes perceptual loss, adversarial loss, and L1 loss. The perceptual loss weight coefficient is set to 1.0, the adversarial loss weight coefficient is set to 0.005, and the L1 loss weight coefficient is set to 0.01. The perceptual loss is constructed based on VGG19 features. Through multi-loss collaborative optimization, the text details and clarity of the reconstructed image are improved, and a high-quality image that meets the requirements is output in a standardized manner.
[0024] The method employs an object detection algorithm to identify terminal symbols in the drawings. A spatial clustering algorithm is used to aggregate these symbols into terminal block regions, automatically defining the text recognition range. Specifically, an improved YOLOv8 object detection model is used to identify terminal symbols in the drawings. These symbols include screw terminals, plug-in terminals, test terminals, and grounding terminals. The YOLOv8 network input size is set to 640 x 640 pixels, and CSPDarknet53 is used as the backbone network. The detection loss function includes classification loss, localization loss, and confidence loss, with a weight ratio of 1:5:1. The localization loss is calculated using CIoU. The output is the bounding box and confidence level for each terminal symbol. The algorithm extracts the center point coordinates of the detected terminal symbols based on degree and category information, and performs spatial clustering using the DBSCAN algorithm. The clustering uses Euclidean distance to calculate the distance between the center points of the terminal symbols, with a neighborhood radius of 50 pixels and a minimum number of points of 3. The core point determination condition is that the number of terminal symbols included in the neighborhood of a certain terminal symbol center point is not less than the minimum number of points. By clustering, terminal symbols with similar spatial positions are grouped together, and isolated noise points are filtered out. The minimum bounding rectangle is calculated for each group of terminal symbols formed by the clustering, and the rectangle boundary is extended outward by 15 pixels to define the text recognition range. Priority scores are calculated based on the area, number of terminals, and location information of each terminal bar, and key areas are processed first according to the scores.
[0025] The recognition model based on the fusion of electrical engineering terminology detects text within the terminal block area. Specifically, it employs the DBNet algorithm to detect text regions within the terminal block area, outputting text bounding boxes and segmentation masks. Segmentation includes densely packed text and multi-line superimposed text. The SRN algorithm is used for text recognition. The visual feature extraction module uses ResNet50 as the backbone network to extract image features and output feature maps. These feature maps are then input into a Transformer encoder after positional encoding using sine and cosine functions. The semantic reasoning module uses a TransformerEncoder structure, including a 6-layer multi-head self-attention mechanism with 8 attention heads per layer. Attention weights are calculated using a lookup matrix key-value matrix to construct an embedding layer for electrical engineering terminology, including common equipment names, circuit numbering rules, and cable models. Visual features are fused with semantic embedding vectors and input into a decoder for processing. The decoder uses an LSTM structure, with CTC loss function used during training. The input sequence and output labels are aligned, a character confusion matrix is established, and similar characters are further discriminated against. The recognition results are adjusted based on the contextual semantics.
[0026] The process involves employing a corresponding recognition strategy based on the font size of the text, outputting a text sequence and its confidence level. Specifically, this is achieved by calculating the actual font size using the text bounding box height output by the DBNet algorithm, dividing the actual font size into small and large font sizes. Small font sizes are enlarged while maintaining the clarity of the text edges, while large font sizes are not scaled. The processed text image is then input into an improved SRN model, which outputs the initial confidence level for each character. A secondary discrimination is performed based on the character confusion matrix, and the character confidence levels are adjusted according to the secondary discrimination results. The overall confidence level of the entire text sequence is calculated, with weighting coefficients set according to the importance of characters in electrical terminology. Finally, the text sequence is output, along with the confidence level for each character and the overall confidence level of the entire text sequence.
[0027] The process involves classifying recognized text into different types using a pre-trained model, parsing the legality of number formats, and establishing spatial associations between text and terminal symbols. Specifically, a BERT pre-trained model is used for text type classification. Classification probabilities are calculated through fully connected layers, and the softmax function is used to output the classification results. Recognized text is divided into six categories: terminal number, equipment name, loop number, cable identifier, technical parameters, and remarks. A terminal number parsing rule base is established, using regular expressions to match number formats, extracting prefix, sequence number, and suffix structured fields, and calculating the continuity score of adjacent numbers. The continuity score is the proportion of adjacent numbers with a numerical difference of 1, used to determine the legality of the number. An equipment model database is established, and fuzzy matching using an edit distance algorithm is used to identify equipment types. A loop number rule base is established, calculating the spatial distance between recognized text and terminal symbols based on the prefix to identify the loop type. The distance calculation uses Euclidean distance, and the nearest neighbor matching principle is used to establish associations. Text exceeding a distance threshold is determined to be a loop label or equipment name.
[0028] The comprehensive calculation of confidence levels and the marking of low-confidence identification results specifically involves: calculating the score after character-level error correction: this score is the weighted average of the corrected character confidence levels, with weighting coefficients set according to the importance of characters in electrical terminology, ranging from 0.8 to 1.2; calculating the score after semantic-level error correction: this score is based on the probability of the character sequence appearing in the N-gram language model, which uses the Kneser-Ney smoothing method with a smoothing discount parameter set to 0.75; and calculating the score after topology-level error correction: this score is a combination of terminal type matching, loop consistency, and equipment associativity. The weighted sum is calculated as follows: terminal type matching score has a weight of 0.4, loop consistency score has a weight of 0.35, and device correlation score has a weight of 0.25. The effectiveness of each level of error correction is statistically analyzed based on historical correction data. Effectiveness is quantified by the error correction accuracy. The weights of the three levels of scores are dynamically adjusted based on effectiveness to form adaptive weight coefficients. The overall confidence score is the sum of the three levels of scores multiplied by their respective adaptive weights. A comprehensive confidence score threshold of 0.85 is set. When the comprehensive confidence score is below 0.85, the identification result is marked as low confidence, and a yellow border is overlaid on the corresponding text area in the original drawing. The comprehensive confidence score value and anomaly level information are also displayed. This facilitates quick problem location during manual review.
[0029] The process involves manual review of low-confidence results, using the corrected data as training samples. Incremental learning is used to optimize the model, continuously improving recognition accuracy and adaptability. Specifically, this involves overlaying information related to low-confidence recognition results onto the original drawing, including terminal bounding boxes, text bounding boxes, recognized text, overall confidence level, and anomaly level information. Zooming, panning, and rotating operations are supported to view details. Low-confidence recognition results are marked with a yellow border. Users can select recognition results with the mouse to modify text content, drag to adjust the position and size of text bounding boxes, delete false positives, and manually add missed text and corresponding bounding boxes. All corrections are automatically saved in real time. The manually corrected complete data is automatically labeled as training samples, including the original image, corrected text labels, bounding box coordinates, and text type classification information. An active learning strategy is used to select training samples. The sample selection score consists of two parts: the first part is for items with insufficient confidence (coefficient set to 0.6), and the second part is the normalized correction frequency (coefficient set to 0.4). Samples with higher scores are prioritized. The difficulty coefficient is calculated for the selected samples. This coefficient is derived from the initial recognition confidence and the edit distance between the predicted result and the true label, with a normalization coefficient set to 0.1. Higher difficulty coefficients indicate higher learning value. An experience replay mechanism is used to construct the training set, which consists of newly labeled samples and historical difficult samples. Samples are taken from the historical sample library according to the difficulty coefficient, with the sampling probability proportional to the square of the difficulty coefficient. The incremental learning loss function includes cross-entropy loss and knowledge distillation loss, with the knowledge distillation weight set to 0.5 and the temperature coefficient set to 4.0. Each incremental learning iteration uses 50 to 100 labeled samples, and the model's recognition accuracy is automatically evaluated after training. Performance metrics are compared before and after the update. If the accuracy improvement exceeds 2%, a new model is deployed; otherwise, the original model is retained to continue accumulating samples. The incremental learning process is triggered periodically to continuously iterate and optimize model parameters, thereby improving the model's adaptability to complex interference scenarios with different drawing styles and continuously increasing recognition accuracy.
[0030] The present invention will now be described in detail with reference to specific embodiments.
[0031] like Figures 1-5 As shown, this invention proposes a method and system for intelligent recognition and automatic error correction of terminal block text on substation secondary drawings. It constructs a complete technology chain of "image preprocessing—terminal block area localization—text detection and recognition—semantic understanding and classification—multi-level error correction—manual review and incremental learning," forming a closed-loop technology of "visual recognition + semantic reasoning + rule constraints + automatic error correction," including: (1) Image preprocessing and quality enhancement module To address the characteristics of substation secondary drawings, a standardized preprocessing workflow was established. Hough transform was used to detect feature lines in the drawing frame, and the perspective transformation matrix was calculated to correct tilted drawings into standard rectangles, supporting automatic correction within a tilt angle range of ±15 degrees. A contrast-limited adaptive histogram equalization (CLAHE) algorithm was employed, dividing the image into an 8×8 grid and performing histogram equalization on each grid, limiting the contrast gain to an upper limit of 2.0 to improve local contrast. Bilateral filtering was applied to remove noise while preserving edge details. Super-resolution reconstruction was performed on low-resolution images (below 300 dpi), using the ESRGAN model to double the resolution.
[0032] (2) Terminal block area intelligent positioning module A terminal block area detection algorithm was established to narrow the recognition range and improve recognition efficiency. An improved YOLOv8 target detection model was used to identify terminal symbols (more than 20 types, including screw terminals, plug-in terminals, test terminals, and grounding terminals), outputting terminal bounding boxes, confidence scores, and categories, achieving a detection accuracy of over 95%. Spatial clustering was performed on the detected terminal symbols, using the DBSCAN algorithm to aggregate them into terminal block regions based on distance and density, setting a neighborhood radius of 50 pixels and a minimum of 3 points. The minimum bounding rectangle of each terminal block was calculated, and the boundary was extended by 15 pixels as the text recognition range. Priority scores were calculated based on the terminal block area, number of terminals, and location, prioritizing the processing of key areas.
[0033] (3) Text detection and recognition module based on SRN algorithm A text recognition engine integrating visual features and semantic information was established. The DBNet algorithm was used to detect text regions within terminal block areas, outputting text bounding boxes and segmentation masks, accurately segmenting densely arranged and multi-line superimposed text. An improved SRN (Semantic Reasoning Network) algorithm was employed for text recognition, comprising three core modules: a visual feature extraction module using ResNet50 as the backbone to extract image features, outputting feature maps of size H / 8×W / 8×512; a semantic reasoning module employing a Transformer Encoder structure, including a 6-layer multi-head self-attention mechanism to model long-distance dependencies between characters, with the multi-head self-attention mechanism calculating attention weights through the query matrix Q, key matrix K, and value matrix V, where the key vector dimension dk is used for normalization; and an electrical engineering terminology embedding vector was introduced to fuse visual features with semantic priors; the decoding module used an attention mechanism decoder to generate recognition results character by character, outputting character sequences and confidence scores. A multi-scale input strategy was adopted for text of different sizes: small-sized text (2-3mm) was magnified by 2 times for recognition, while large-sized text (5-8mm) was directly recognized. A character confusion matrix is established, and similar characters ("0" and "O", "1" and "I", "8" and "B") are further distinguished. The recognition results are adjusted according to the contextual semantics.
[0034] (4) Semantic understanding and classification module Semantic analysis and type classification are performed on the recognition results. A text classification model is established and fine-tuned using a BERT pre-trained language model, classifying the recognized text into six categories: terminal number, equipment name, loop number, cable identification, technical parameters, and remarks, with a classification accuracy of over 92%. A terminal number parsing rule base is established, supporting over 20 common number formats (such as "1KK:01", "2TA-3", "X1:1", "A12", etc.). Regular expressions are used to match the number format, extracting structured fields such as prefixes, serial numbers, and suffixes to determine the legality of the number. An equipment model database is established, including over 500 common secondary equipment models and names. Fuzzy matching is performed on the recognized text, and an edit distance algorithm is used to identify the equipment type. A loop number rule base is established, identifying the loop type based on the prefix ("KK" corresponds to switch control, "TW" corresponds to position signal, "YC" corresponds to telemetry, and "YX" corresponds to remote signaling).
[0035] (5) Multi-level automatic error correction module A three-level error correction mechanism is established to automatically detect and correct identification errors. Character-level error correction is performed based on the character confusion matrix and confidence threshold. Characters with a confidence score below 0.85 are re-evaluated based on contextual semantics. For character sequences that do not conform to the terminal number format, attempts are made to replace the confused characters to generate candidate results, and the result with the highest format validity is selected.
[0036] Semantic error correction is performed based on an electrical professional knowledge base. An electrical specification rule base is established, including standard entries such as the "Installation Process Specification for Secondary Circuits of State Grid Corporation of China" and "Design Specification for Power Engineering Cables" GB 50217. Compliance testing of specifications is performed, including terminal numbering format specifications, grounding terminal requirements, pairing of test terminals, safety distance requirements, etc. Non-compliant identification results are marked as abnormal and correction suggestions are provided.
[0037] (6) Manual review and incremental learning module Establish a human-machine collaborative review mechanism to improve recognition quality and continuously optimize the model. Overlay recognition results onto the original drawings, including terminal bounding boxes, text bounding boxes, recognized text, confidence levels, and anomaly markers, supporting zooming, panning, and rotation to view details. Anomaly recognition results are highlighted (red border), and recognition results awaiting review are marked (yellow border). Mouse clicks are supported for selecting and modifying recognition results, dragging to adjust the position and size of bounding boxes, deleting false positives, adding missed positives, and saving corrections in real time.
[0038] Manually corrected data is automatically labeled as training samples, triggering incremental model learning periodically. An active learning strategy is employed, prioritizing training with samples exhibiting low confidence and high correction frequency. The sample selection score consists of two parts: the first part represents insufficient confidence (coefficient α = 0.6); the second part represents the normalized correction frequency (Freqcorrection) (coefficient β = 0.4). After model updates, performance improvements are automatically evaluated. If the accuracy improvement exceeds 2%, a new model is deployed, achieving continuous model optimization and enhanced adaptive capabilities.
[0039] This invention integrates technologies such as deep learning, semantic reasoning, rule constraints, and automatic error correction to achieve high-accuracy intelligent recognition and automatic error correction of terminal block text in substation secondary drawings, significantly improving the quality and efficiency of drawing digitization.
[0040] Example 1: Image Preprocessing and Quality Enhancement Step 1.1 Image tilt correction Hough transform is used to detect straight line features in the drawing, and the tilt angle θ is calculated. Rotation correction is performed using an affine transformation matrix M, which includes rotation angles cosθ and sinθ, and translation parameters tx and ty, calculated from the image center point.
[0041] θ = arctan(∑sin(2αi) / ∑cos(2αi)) × 1 / 2 Step 1.2 Adaptive Contrast Enhancement The CLAHE (Contrast Limiting Adaptive Histogram Equalization) algorithm was used to process the image into 8×8 blocks. The contrast limit threshold was set to 3.0, and the number of gray levels was 256, effectively enhancing the text contrast in the terminal block area.
[0042] Step 1.3 Super-resolution reconstruction The ESRGAN network is used for image super-resolution reconstruction, which improves the resolution of the original image by a factor of 2. The network loss function consists of three parts: perceptual loss, adversarial loss, and L1 loss, with weight coefficients of 1.0, 0.005, and 0.01, respectively.
[0043] LG = Lpercep + λ1·Ladv + λ2·L1 The perceptual loss Lpercep is based on VGG19 features, and the weight coefficients for the adversarial loss and L1 loss are λ1=0.005 and λ2=0.01, respectively.
[0044] Example 2: Intelligent positioning of terminal block area Step 2.1 YOLOv8 Terminal Symbol Detection The YOLOv8 network has an input size of 640×640 pixels and uses CSPDarknet53 as its backbone network. The detection loss function includes classification loss, localization loss, and confidence loss, with a weight ratio of 1:5:1. The localization loss is calculated using the CIoU method, taking into account the overlap area, center point distance, and aspect ratio consistency.
[0045] Ltotal = λcls·Lcls + λbox·Lbox + λobj·Lobj The weighting ratio is 1:5:1. The localization loss is calculated using CIoU. Lbox = 1 - IoU + ρ 2 (b, bgt) / c 2 + αv Where ρ is the Euclidean distance between the center points of the predicted bounding box b and the ground truth bounding box bgt, c is the diagonal distance of the minimum bounding rectangle, and v is the aspect ratio consistency parameter. v = (4 / π 2 ) × (arctan(wgt / hgt) - arctan(w / h)) 2 Weighting coefficient α = v / ((1-IoU)+v).
[0046] Step 2.2 DBSCAN Spatial Clustering DBSCAN clustering is performed on the center points of the detected terminal symbols. The neighborhood radius ε is set to 50 pixels, and the minimum number of points MinPts is set to 3. Terminal symbols within the same terminal block are clustered together, and isolated noise points are automatically filtered out.
[0047] DBSCAN clustering is performed on the center points of the detected terminal symbols. The ε-neighborhood of point pi is defined as: Nε(pi) = {pj ∈ P | dist(pi, pj) ≤ ε} The distance function uses Euclidean distance: dist(pi, pj) = √((xi-xj) 2 + (yi-yj) 2 ) The neighborhood radius ε is set to 50 pixels, and the minimum number of points MinPts is set to 3. The core point determination condition is |Nε(pi)|≥MinPts.
[0048] Step 2.3 Determining the boundary of the terminal block For each cluster, calculate the minimum bounding rectangle and extend it outward by 15 pixels as the boundary of the terminal block area, ensuring that all relevant text annotation information is included.
[0049] Example 3: SRN-based character recognition Step 3.1 Visual Feature Extraction ResNet50 is used as the backbone network to extract feature maps, with an output size of H / 8×W / 8×512. The feature maps are then input into a Transformer encoder after positional encoding. Positional encoding uses sine and cosine functions, with a feature dimension d=512. The positional encoding formula is: (pos,2i) = sin(pos / 10000^(2i / d)) (pos,2i+1) = cos(pos / 10000^(2i / d)) Where pos is the position index, i is the dimension index, and the feature dimension d=512.
[0050] Step 3.2 Semantic Reasoning Module The Transformer Encoder consists of 6 layers, each employing 8 attention heads. The key vector dimension dk=64, and the value vector dimension dv=64. The multi-head self-attention mechanism calculates the attention weights using the query matrix Q, the key matrix K, and the value matrix V, and then scales them by dividing by the square root of dk.
[0051] Step 3.3 Embedding Technical Terms An embedding layer containing over 10,000 electrical engineering terms was constructed, including common equipment names (circuit breakers, disconnect switches, current transformers, etc.), circuit numbering rules, cable types, etc. The embedding vector of these technical terms has a dimension of 256, and is input into the decoder after being fused with visual features.
[0052] Step 3.4 Decoding and Recognition The decoder uses an LSTM architecture with 512 hidden layers. At each time step t, the current character probability distribution is generated based on the character embedding and attention context vector from the previous time step. Training uses the CTC loss function to automatically align the input sequence and output label.
[0053] Example 4: Semantic Understanding and Classification Step 4.1 Text Type Classification The BERT model is used for text semantic understanding, classifying the recognized text into six categories: terminal number, device name, loop number, cable identification, technical parameters, and remarks. The BERT model consists of 12 Transformer layers with 768 hidden layers. Classification probabilities are calculated through fully connected layers. P(c|X) = softmax(Wc·hCLS + bc) Where hCLS is the vector representation of the [CLS] label output by BERT.
[0054] Step 4.2 Terminal Number Analysis Terminal numbers typically follow an "alphanumeric" pattern, such as X1, X2, KA101, etc. Regular expressions are used to extract the numbering pattern and calculate the continuity score for adjacent numbers. For m number sequences, the continuity score is the proportion of adjacent numbers whose numerical difference is equal to 1.
[0055] Step 4.3 Text-Terminal Space Association The spatial distance between the identified text and terminal symbols is calculated, and the nearest neighbor matching principle is used to establish the association. The distance threshold is set to 30 pixels; text exceeding the threshold is identified as loop label or device name.
[0056] Example 5: Multi-level Automatic Error Correction Step 5.1 Character-level error correction Character error correction based on the confusion matrix involves statistically analyzing common character confusion pairs in the training set, such as "0" and "O", "1" and "I", "8" and "B", etc. For characters with a recognition confidence score below 0.9, error correction is performed based on the confusion probability and contextual information. The error correction decision comprehensively considers both the confusion probability (weight 0.6) and the recognition confidence score (weight 0.4).
[0057] Step 5.2 Semantic-level error correction Semantic error correction based on a trigram language model is performed by training an N-gram model on an electrical engineering corpus. For a character sequence, its probability in the language model is calculated; sequences with probabilities below a threshold are marked as suspicious and candidate replacements are selected based on a professional dictionary. The Kneser-Ney smoothing method is employed, with a discount parameter δ=0.75.
[0058] Character error correction based on a confusion matrix involves statistically analyzing common character confusion pairs in the training set, such as "0" and "O", "1" and "I", "8" and "B", etc. For the recognition result ci and the candidate character cj, the replacement probability is: P(cj|ci) = N(ci→cj) / ∑N(ci→ck) Where N(ci→cj) represents the number of times the character ci is misidentified as cj. The error correction decision function based on confidence level is: The weighting coefficients are λ1=0.6 and λ2=0.4.
[0059] Step 5.3 Topology-level error correction Topology correction based on electrical connections verifies the rationality of terminal pair connections. The scoring consists of three parts: terminal type matching degree (weight 0.4), loop consistency (weight 0.35), and device correlation degree (weight 0.25). Valid connection type pairs include input-output, power supply-load, signal transmission-signal reception, etc.
[0060] Step 5.4 Comprehensive Confidence Assessment The final confidence level is calculated by combining the results of the three levels of error correction using a weighted average method, with the weights adaptively adjusted according to the confidence levels at each level. When the final confidence level is below 0.85, the result is marked as requiring manual review.
[0061] Example 6: Incremental Learning and Model Optimization Step 6.1 Sample Difficulty Assessment The difficulty coefficient is calculated for samples that have undergone manual review, taking into account both the initial identification confidence level and the edit distance between the prediction result and the true label. A higher difficulty coefficient indicates that the sample has greater learning value.
[0062] Difficulty level of calculation for manually reviewed samples: D(x) = 1 - Confinitial + β·EditDist(ypred, ytrue) Where Confinitial is the initial recognition confidence level, EditDist is the edit distance, and the normalization coefficient β=0.1.
[0063] Step 6.2 Incremental Learning Strategy An experience replay mechanism is employed, with training samples consisting of newly labeled samples and historical difficult samples. Samples are taken from the historical sample database according to the difficulty coefficient, with the sampling probability proportional to the square of the difficulty coefficient, ensuring that difficult samples have a higher probability of being selected.
[0064] The incremental learning loss function includes cross-entropy loss and knowledge distillation loss, with knowledge distillation weight λKD=0.5 and a temperature coefficient. This prevents the model from forgetting old knowledge.
[0065] This invention achieves high-precision automatic recognition of terminal block text on substation secondary drawings through multi-module collaboration, multi-level error correction, and continuous learning mechanisms, significantly improving the efficiency of digital construction in power engineering. Specifically, it includes: This innovative intelligent terminal block localization method, based on YOLOv8 and DBSCAN, combines YOLOv8 target detection with DBSCAN spatial clustering. It first detects individual terminal symbols and then clusters them into terminal block regions based on spatial relationships. The CIoU loss function is used to optimize small target detection accuracy. This method does not require pre-setting the number and location of terminal blocks, achieving a localization accuracy of 98.7%, thus solving the problem of poor generalization ability in traditional template matching methods.
[0066] This paper describes a SRN (Semantic Reasoning Network) text recognition network that integrates electrical engineering expertise. Based on the SRN architecture, it combines ResNet50 visual feature extraction, Transformer semantic reasoning, and LSTM sequence decoding. A special embedding layer containing over 10,000 electrical engineering terms is introduced, enabling the model to possess electrical domain knowledge. This significantly improves the recognition accuracy of technical terms, equipment numbers, and circuit identifiers, solving the problem of low accuracy in specialized domains for general OCR models.
[0067] A three-tiered, progressive automatic error correction mechanism—character-semantic-topology—constructs a three-layer error correction system: at the character level, it corrects easily confused characters (such as 0 / O, 1 / I, 8 / B) based on a confusion matrix; at the semantic level, it verifies the rationality of technical terms based on an N-gram language model; and at the topology level, it verifies the correctness of terminal pair relationships based on electrical connection rules. This three-tiered error correction improves the overall accuracy from 96.3% to 99.1%, and achieves intelligent quality control by calculating the overall confidence level through adaptive weighting.
[0068] Addressing the core problems of existing technologies, this invention proposes a complete solution to issues such as low recognition accuracy (78-85%), poor generalization ability of terminal block positioning, and lack of error correction mechanisms in traditional OCR. By integrating an SRN network with electrical expertise and introducing an embedding layer of over 10,000 specialized terms, the terminology recognition accuracy is improved to 98.5%. Employing YOLOv8 and DBSCAN intelligent positioning, adaptive layout is achieved without the need for templates. A three-level error correction mechanism is constructed, increasing the overall accuracy from 96.3% to 99.1%.
[0069] Significant improvements in recognition accuracy and processing efficiency were achieved. On a test set of 5000 drawings, the overall recognition accuracy reached 99.1%, an improvement of 9-14 percentage points compared to traditional OCR. The accuracy rate for professional terminology recognition was 98.5%, an improvement of 20.5 percentage points compared to general OCR. The accuracy rate for terminal block positioning was 98.7%, an improvement of 13-23 percentage points compared to template matching. Processing a single A3 drawing took only 3.2 seconds, a 470-fold increase in efficiency compared to 25 minutes of manual input.
[0070] With significantly enhanced adaptability and quality control capabilities, this invention automatically adapts to different design institute drawing specifications, maintaining a positioning accuracy rate of over 97%. It can handle drawings with tilt angles of ±15°, resolutions of 150 dpi or higher, and low contrast, increasing the recognition success rate from 60-70% to over 98%. A three-level error correction mechanism automatically triggers manual review, keeping the review rate below 5% and reducing the rework rate from 8-12% to below 0.5%.
[0071] This application also provides an embodiment of an electronic device. The electronic device is manifested in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: one or more processors or processing units, memory, and buses connecting different components (including memory and processing units).
[0072] A bus refers to one or more of several bus architectures, including memory buses or memory controllers, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. Examples of these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, Micro Channel Architecture (MCA) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.
[0073] Electronic devices typically include a variety of computer-readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, and removable and non-removable media.
[0074] The memory may include computer-readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. Electronic devices may further include other removable / non-removable, volatile / non-volatile computer device storage media. By way of example only, the storage system may be used to read and write non-removable, non-volatile magnetic media.
[0075] The electronic device can also communicate with one or more external devices (e.g., keyboard, pointing device, camera, etc.), may include a display, and may communicate with one or more devices that enable a user to interact with the electronic device, and / or with any device that enables the electronic device to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via an input / output (I / O) interface. Furthermore, the electronic device can also communicate with one or more networks (e.g., Local Area Network (LAN), Wide Area Network (WAN) and / or public networks, such as the Internet) via a network adapter. The network adapter communicates with other modules of the electronic device via a bus. The processor executes various functional applications and data processing by running programs stored in memory, such as implementing the intelligent recognition and automatic error correction method for terminal block text on substation secondary drawings provided in the above embodiments of the present invention.
[0076] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A substation secondary drawing terminal block text intelligent recognition and automatic correction method, characterized in that, The method comprises the following steps: Performing tilt correction, contrast enhancement and noise removal operations on the substation secondary drawing, performing super-resolution reconstruction on the low-resolution image, and standardizing to improve image quality; Using a target detection algorithm to identify terminal symbols in the drawing, using a spatial clustering algorithm to aggregate terminal symbols to form a terminal row area, and automatically defining the text recognition range; Based on the recognition model of the fused electrical professional vocabulary, detecting the text in the terminal row area, and according to the font size, using the corresponding recognition strategy to output the text sequence and confidence; Classifying the recognized text into different types through a pre-trained model, analyzing the legality of the numbering format, and establishing the spatial correlation between the text and the terminal symbol; Sequentially performing character-level confusion correction, semantic-level specification verification, and topological-level connection rationality verification, comprehensively calculating the confidence, and marking the low-confidence recognition results; Implementing artificial review on the low-confidence results, using the corrected data as training samples, optimizing the model through incremental learning, and continuously improving the recognition accuracy and adaptability.
2. The method according to claim 1, characterized in that, The tilt correction, contrast enhancement and noise removal operations on the substation secondary drawing are specifically as follows: for the substation secondary drawing, a transformation matrix is determined by using a Hough transform to detect the characteristic lines of the frame, the tilted drawing is automatically corrected, the contrast is enhanced by performing histogram equalization in blocks through a CLAHE algorithm, and the image noise is removed by applying a bilateral filter while preserving the edge details of the text.
3. The method of claim 1, wherein the method further comprises: The super-resolution reconstruction on the low-resolution image and the standardization to improve the image quality are specifically as follows: first, determine the image resolution, process the low-resolution image using a super-resolution reconstruction network, optimize the reconstructed image through multiple types of loss, improve the text details and clarity of the reconstructed image, and standardize the output to meet the subsequent recognition requirements of high-quality images.
4. The method of claim 1, wherein the method further comprises: The target detection algorithm is used to identify terminal symbols in the drawing, and the spatial clustering algorithm is used to aggregate terminal symbols to form a terminal row area, and automatically define the text recognition range, which is specifically as follows: an improved target detection model is used to identify multiple types of terminal symbols in the drawing, outputting the bounding box, confidence and category information, extracting the center points of the terminal symbols, and then using a spatial clustering algorithm to aggregate terminal symbols with similar spatial positions, automatically filtering isolated noise points, calculating the minimum bounding rectangle after clustering and expanding the boundary to define the text recognition range, and calculating the priority score according to the terminal row related information and processing the key areas in priority.
5. The method of claim 1, wherein the method further comprises: The recognition model based on the fused electrical professional vocabulary detects the text in the terminal row area, which is specifically as follows: a DBNet algorithm is used to detect the text area in the terminal row area and output related information, which can accurately segment densely arranged and multi-line superimposed text, and an improved SRN algorithm is used to perform text recognition, which uses related networks to extract visual features and inputs them into a semantic reasoning module after encoding, fuses the visual features and semantic embedding vectors through an embedding layer containing electrical professional related vocabulary, and inputs them into a decoder for processing, and uses a character confusion matrix to perform secondary discrimination and adjust the recognition results according to the context semantics.
6. The method of claim 1, wherein the method further comprises: The corresponding recognition strategy is adopted according to the font size of the text, and the text sequence and confidence are output, specifically, the actual font size is obtained through the text boundary box height output by the DBNet, the corresponding processing strategy is adopted according to the font size classification, the small font size is enlarged and the edge is kept clear, the large font size is not scaled, the processed image is input into the improved SRN model, the initial confidence of the character is output, the confidence is adjusted according to the character confusion matrix, the comprehensive confidence of the text sequence is calculated, and finally the text sequence, the confidence of each character and the comprehensive confidence of the sequence are output.
7. The method of claim 1, wherein the method further comprises: The recognized text is classified into different types by the pre-training model, the number format legality is analyzed, and the spatial association between the text and the terminal symbol is established, specifically, the type of the recognized text is classified by the pre-training model, the terminal number analysis, equipment model and circuit number related rule library are established, the number format legality is analyzed and the equipment and circuit type are recognized, the spatial distance between the recognized text and the terminal symbol is calculated, the nearest neighbor matching principle is adopted to establish the association, and the text beyond the distance threshold is determined as the circuit label or the equipment name.
8. The method of claim 1, wherein the method further comprises: The character level confusion correction, semantic level specification verification and topology level connection rationality verification are performed in sequence, specifically, the similar characters are corrected according to the confidence based on the confusion matrix at the character level, the character sequence not meeting the format is adjusted, the number format, equipment matching degree and circuit type are verified based on the electrical professional corpus and specification rule library at the semantic level, the optimal replacement result meeting the specification is generated, the terminal pair type, circuit and equipment information are extracted at the topology level, the connection rationality is verified, and the correction suggestion is given for the abnormal result.
9. The method of claim 1, wherein the method further comprises: The comprehensive confidence is calculated, and the low confidence recognition result is marked, specifically, the scores after correction at the character level, semantic level and topology level are calculated, the three-level weights are dynamically adjusted according to the historical correction data, the comprehensive confidence is obtained by weighted summation, the confidence threshold is set, and the recognition result below the threshold is marked as low confidence, and the related information is superimposed on the corresponding area of the original drawing.
10. The method of claim 1, wherein the method further comprises: The low confidence result is manually reviewed, the corrected data is used as a training sample, the model is optimized through incremental learning, and the recognition accuracy and adaptability are continuously improved, specifically, the low confidence recognition related information is superimposed on the original drawing, the corrected data is automatically labeled as a training sample, the samples are selected by using the active learning and experience replay strategy, the model is optimized through incremental learning, and the new model meeting the standard is deployed after performance evaluation.