Terminal block drawing detection method based on two-stage optimization and multi-level feature enhancement

Through the methods of dual-stage optimization and multi-level feature enhancement, the category imbalance, small object detection difficulties and background interference in terminal strip drawing detection are solved, and more efficient object detection effect is achieved.

CN120260069BActive Publication Date: 2025-08-22NANJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510750636.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-08-22
Estimated Expiration
2045-06-06

AI Technical Summary

Technical Problem

The existing terminal strip drawing detection model is difficult to achieve efficient and accurate target detection when facing problems such as unbalanced element category, difficulty in identifying few sample categories, difficulty in detecting small objects, background interference and loss of feature extraction.

Method used

The method based on dual-stage optimization and multi-level feature enhancement is adopted to optimize the model through sliding window slicing, regular interactive data synthesis, dual-focus loss function, and the backbone and neck network of the YOLOv1 model are improved, including C3K2_KStar, C3K2_FKConv and DB-HSFPN modules, to enhance feature extraction and fusion capabilities.

Benefits of technology

It improves the accuracy and efficiency of target detection of terminal strip drawings, can better identify and locate small targets, alleviate the problems of category imbalance and scale differences, and improves the overall detection performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120260069B_ABST
    Figure CN120260069B_ABST
Patent Text Reader

Abstract

The present invention discloses a terminal strip drawing detection method based on dual-stage optimization and multi-level feature enhancement, comprising the following steps: slicing the drawing using a slicing technique and performing secondary processing on the sliced ​​image through a rule-based interactive synthetic data enhancement method to obtain an enhanced sliced ​​image data set; inputting the processed image data set into a target detection model with multi-level feature enhancement for detection to obtain category and coordinate results predicted by the model; inputting the predicted result and the true result into a dual-focus loss function for calculation to obtain a loss value, and optimizing the model through back propagation to train a final detection model after multiple rounds of iterations; inputting the sliced ​​image of the detection drawing into the trained model, and fusing the slicing results to obtain a final detection result; the present invention effectively addresses the problem of category imbalance in the drawing, and significantly improves the recognition accuracy of small targets, especially in the drawing, through the primitive detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of target detection, and in particular relates to a terminal block drawing detection method based on dual-stage optimization and multi-level feature enhancement. Background Art

[0002] Substations have become crucial hubs in intelligent, information-based power grids. Terminal block drawings are key technical documents that describe equipment connection methods, line distribution, and system interactions. The accuracy of their interpretation directly impacts equipment operation and maintenance efficiency, the accuracy of troubleshooting, and the feasibility of future expansion and renovation. However, current methods rely primarily on manual interpretation, which is tedious and time-consuming, and requires high labor costs. Due to the dense information, complex symbols, and intricate cable interactions in drawings, manual interpretation is susceptible to subjective factors and can lead to misinterpretations. This not only results in high error correction costs during the construction phase, but can also impact project schedules and equipment safety. With the rapid development of artificial intelligence, computer-based drawing interpretation has become an effective alternative to manual interpretation.

[0003] The core of computer image reading lies in accurately locating key elements in drawings and accurately classifying them to support subsequent element matching operations. With the development of deep learning, existing engineering object detection models have achieved good accuracy in detecting elements. However, directly using these models still cannot fully meet the needs of drawing object detection. There are several technical challenges, specifically:

[0004] 1. The distribution of sample and target instances across drawing categories is uneven, exhibiting a significant long-tail pattern. Due to the directional sensitivity and contextual continuity of drawings, common data augmentation methods (such as copying and flipping) are difficult to effectively apply. Furthermore, terminal strip drawings have strict geometric constraints, making it difficult to accurately ensure rule consistency when creating graphic elements using generative models. Furthermore, the scarcity of data for rare-sample categories further complicates generative model training.

[0005] 2. Rare-sample objects not only have a significant difference in number compared to other categories, but are also generally small and difficult to identify. Existing loss functions for difficult samples, while improving the recognition of difficult objects, often significantly reduce the recognition accuracy of other primitives, making it difficult to effectively address this extremely unbalanced challenge.

[0006] 3. Some elements in the drawing are similar to background features (such as cable corners and table corners), which are easily interfered with during detection, resulting in reduced recognition accuracy.

[0007] 4. Small objects and other objects each account for 50% of the drawing, but there are significant size differences between the two types of objects. The model needs to detect these vastly different objects simultaneously, which not only increases recognition complexity but also reduces overall detection efficiency and accuracy.

[0008] 5. After multi-layer downsampling, small target primitives in the drawing are prone to losing their effective information during the feature extraction process, resulting in the model being unable to accurately identify and locate small targets. Summary of the Invention

[0009] To avoid and overcome the technical problems existing in the prior art, the present invention provides a terminal block drawing detection method based on dual-stage optimization and multi-level feature enhancement. The present invention can improve the accuracy of target detection in terminal block drawings and more accurately determine the presence and location of targets.

[0010] To achieve the above object, the present invention provides the following technical solutions:

[0011] In the first aspect, a substation terminal block drawing detection method based on two-stage collaborative optimization is provided, comprising:

[0012] Use the sliding window to overlap and slice the input substation terminal block drawing to obtain a slice image;

[0013] The slice images are enhanced using a rule-based interactive data synthesis method, and the enhanced slice images and the original slice images are used as training datasets.

[0014] The category and coordinate results of the training data set obtained by model prediction are input into the dual-focus loss function for calculation to obtain the loss value, and the model is optimized through backpropagation, and the final optimized model is obtained through multiple rounds of iteration;

[0015] The test drawings are directly sliced ​​into overlapping slices and then input into the final optimization model to obtain the slice prediction results corresponding to each slice, and the final result is obtained through the slice fusion algorithm.

[0016] Optionally, the input substation terminal block drawing is overlapped and sliced ​​using a sliding window to obtain a slice image, and the horizontal and vertical movement steps are calculated according to the preset slice size parameters and overlap ratio. The sliding window method is used to ensure that adjacent slices retain the specified overlapping area; when the sliding window reaches the edge of the image, the zero-filling technology is used to fill in the part that exceeds the boundary of the original image to generate a complete slice image with uniform size.

[0017] Optionally, the interactive data synthesis method based on rules is used to perform data enhancement on the slice image, and the enhanced slice image and the original slice image are used as a training data set. The steps of using the interactive data synthesis method based on rules include:

[0018] Identify the position and size of the table area in the input slice image, as well as parameters such as the starting position, row height, and number of rows of the table;

[0019] Create a visualization window and use the sliding controls to fine-tune the table and direction parameters to ensure that the generated effect meets actual needs;

[0020] Based on the set parameters, a graphic element with a corner structure is generated at a random position in a specified row of the table according to the preset proportions and geometric rules.

[0021] Optionally, the category and coordinate results of the training data set obtained by model prediction are input into the dual-focus loss function for calculation to obtain the loss value, and the model is optimized by back propagation, and the final optimized model is obtained through multiple rounds of iteration. The dual-focus loss function for:

[0022]

[0023] in, is the bounding box regression loss function of the primitive detection model, is the classification loss function of the primitive detection model, is the regression loss weight, is the classification loss weight.

[0024] Bounding box regression loss function of the primitive detection model for:

[0025]

[0026] in, is the specifically adjusted intersection-over-union ratio, which indicates the degree of overlap between the predicted box and the true box;

[0027] The specific adjusted intersection-over-intersection ratio for:

[0028]

[0029] in is the adjusted IoU metric, and is a distance metric used to measure the degree of matching between two rectangular boxes. is the width of the input image, is the height of the input image;

[0030] The adjusted IoU metric for:

[0031]

[0032] in, is the central region interaction ratio, is the first hyperparameter, is the second hyperparameter;

[0033] The distance metric and for:

[0034]

[0035]

[0036] in, and is the coordinate of the upper left corner of the real box, and is the coordinate of the lower right corner of the real box, and is the coordinate of the upper left corner of the prediction box, and is the coordinate of the lower right corner of the prediction box;

[0037] Classification loss function of the primitive detection model for:

[0038]

[0039] in, For the model to sample Belong to category The predicted probability of is the regulating factor, is the category to which sample n belongs The weight coefficient of .

[0040] The category to which the sample n belongs The weight coefficient for:

[0041]

[0042] in, is the total number of categories, For category The number of valid samples;

[0043] The categories The effective number of samples is:

[0044]

[0045] in, For category The number of samples, is the attenuation coefficient.

[0046] The test drawing is directly sliced ​​and then input into the final optimization model to obtain the slice prediction result corresponding to each slice, and the final result is obtained by the slice fusion algorithm. The steps of the slice fusion algorithm are as follows:

[0047] First, the bounding box coordinates of the detected object in each slice are mapped back to the original image coordinate system while retaining the category and confidence information. The transformed detection results are then merged into a unified set, which now contains detection results from all slices. In particular, there may be a large number of repeated detections in the overlapping areas of the slices.

[0048] Next, the non-maximum suppression (NMS) algorithm is applied to sort the detection boxes from high to low by confidence. The box with the highest confidence is selected to add to the result set, and its intersection over union (IoU) with the remaining detection boxes is calculated. Other boxes with an IoU greater than a threshold are removed, and this process is repeated until all detection boxes have been processed. The confidence threshold is then applied to the results after NMS processing to remove low-confidence detections.

[0049] Finally, the bounding box position of the same target detected multiple times is fine-tuned to obtain the final detection result.

[0050] Secondly, a method for improving the YOLOv11 target detection model based on multi-level feature enhancement is provided, including:

[0051] Designing the C3K2_KStar module in the shallow layers of the model backbone network (P2-P3 layers) to obtain key details for enhancement and differentiation in the early stages of feature extraction;

[0052] Design the C3K2_FKConv module in the deep layers of the model backbone network (P4-P5 layers) to capture more subtle nonlinear features;

[0053] A DB-HSFPN module is designed in the model neck network, DySample is used to replace static upsampling, and a bidirectional information interaction mechanism is constructed to enhance feature expression capabilities.

[0054] Optionally, a C3K2_KStar module is designed in the shallow layer (P2~P3 layer) of the model backbone network to obtain key details for enhancement and differentiation in the early stage of feature extraction. The C3K2_KStar module includes a C3K_KStar module and a KStarBlock module. When the c3k parameter is set to True, the C3K_KStar module is used, and when the c3k parameter is set to False, the KStarBlock module is used; the C3K_KStar module is composed of multiple KStarBlock modules;

[0055] In the KStarBlock, the output features It can be expressed as:

[0056]

[0057] in, represents the input features, represents the depthwise convolution operation, represents batch normalization, Represents two feature transformations.

[0058] In the KStarBlock module, the input feature X is first divided into two feature branches, which are processed by linear transformation FC and nonlinear transformation GR-KAN respectively to obtain different feature representations and generate two feature branches F1 and F2.

[0059] Next, the two feature branches are fused through element-wise multiplication to implicitly map the input features to a high-dimensional nonlinear feature space and output features Expressed as:

[0060]

[0061] in," ” means element-wise multiplication.

[0062] Finally, the output features Spatial information is extracted through deep convolution, and the extracted features are processed through batch normalization to stabilize the feature distribution and accelerate model convergence. The final output features are passed to the next layer of network or module.

[0063] The GR-KAN is a special type of multilayer perceptron (MLP) that combines rational functions with group parameter sharing. By using group rational functions, it improves the model's expressiveness while maintaining computational efficiency.

[0064] GR-KAN's operation on the input vector x can be expressed as:

[0065]

[0066] in, Represents the entire GR-KAN transformation operation, Represents a function composite operation, Indicates the number of input channels, Indicates the number of output channels, represents the i-th element of the input vector x, represents the number of channels per group, calculated as , Indicates the number of groups Indicates the rounding down operation to determine the group index to which the input channel i belongs. The weight connecting the i-th input channel to the j-th output channel, F represents the rational function of the group;

[0067] The rational function F of each group is defined as:

[0068]

[0069] in, , ,…, and ,…, is a learnable parameter.

[0070] In GR-KAN, channels in the same group share the same rational function parameters and , but each input-output connection still has a unique weight Specifically, for the input channel index , the group index to which it belongs is , using the rational function of the group . This can be expressed in matrix form as:

[0071]

[0072] Where W represents the weight matrix, is a group rational function applied to the input;

[0073] In practical implementation, GR-KAN can be expressed as two consecutive operations:

[0074]

[0075] in, is the application of a group of rational functions to the input, This implementation allows GR-KAN to be viewed as a special MLP where the activation function precedes the linear layer and is a learnable, group-shared rational function.

[0076] Optionally, a C3K2_FKConv module is designed in the deep layer (P4~P5 layers) of the model backbone network to capture more subtle nonlinear features. The C3K2_FKConv module includes a C3K2_FKConv module and a Bottleneck_FKConv module. When the c3k parameter in C3K2_FKConv is set to True, the C3K2_FKConv module is used. When the c3k parameter is set to False, the Bottleneck_FKConv module is used. The C3K2_FKConv module is composed of multiple Bottleneck_FKConv modules.

[0077] In the Bottleneck_FKConv module, the output features It can be expressed as:

[0078]

[0079] in, represents the input features, Indicates the use of the residual convolution layer of FastKAN.

[0080] The residual convolution layer The operation on the input vector x can be expressed as:

[0081]

[0082] in, represents the basic convolution operation, Representation layer normalization, represents the nonlinear transformation of radial basis function transformation, Represents the activation function

[0083] In FKConv, each set of input features is first transformed nonlinearly using the SiLU activation function to enhance the expressiveness of the input features. Then, a basic convolution operation is performed to extract local features and generate preliminary outputs.

[0084] Next, the initial output results pass through a normalization layer to stabilize the feature distribution and reduce gradient instability during training. The normalized features are mapped to a high-dimensional spline space using radial basis functions (RBFs), generating the basis function representation required for spline convolution. At this point, the number of feature channels is expanded to grid_size times the original number.

[0085] Finally, the generated basis function representation is further input into the spline convolution layer to perform nonlinear transformation on the high-dimensional features. The output of the spline convolution is fused with the output of the base convolution through element-by-element addition to form a residual link, which preserves the original information of the input features while enhancing the nonlinear expression capability.

[0086] The role of the RBF (Radial Basis Function) is to map the normalized input features into a high-dimensional nonlinear space, providing a basis function representation for subsequent convolution operations. The introduction of RBF significantly enhances the nonlinear expression capability of the module, while expanding the feature dimension and providing a basis for capturing complex feature patterns. The mathematical definition of RBF is:

[0087]

[0088] in, represents the normalized input feature, c represents the center point of RBF, Indicates the width parameter of RBF.

[0089] In FKConv, the specific process of RBF is as follows:

[0090] First, the input is the normalized feature, denoted as , where B is the batch size, is the number of channels per group, H and W are the height and width of the feature map respectively, and for each position of the feature map, its feature vector is The module will generate a set of RBF center points. ,in Indicates the number of center points;

[0091] Next, for each input feature vector x and all center points, its RBF mapping value is calculated. Through this mapping, the input feature is expanded to a high-dimensional space, and the number of feature channels is increased from Expand to , the specific formula is:

[0092]

[0093] Finally, after the feature vectors of all positions are mapped by RBF, the expanded high-dimensional feature map is obtained, which is recorded as The feature vector at each position is expressed as:

[0094]

[0095] in, It is the RBF mapping value between the position (i, j) and the K-th center point.

[0096] Optionally, the DB-HSFPN module is designed in the model neck network, DySample is used to replace static upsampling and a two-way information interaction mechanism is constructed to enhance the feature expression capability. The DB-HSFPN module is a feature fusion pyramid network, including a channel attention module (CA), a dimension matching module (DM), a dynamic downsampling module (DySample) and a bidirectional feature fusion module.

[0097] In the DB-HSFPN module, we first extract the multi-scale feature map from the backbone network, denoted as , , , representing low-level, mid-level, and high-level features respectively. These feature maps serve as the input of the network and enter the channel attention module for screening;

[0098] Second, each input feature map Pass through the channel attention module in sequence Matching modules with dimensions , generate filtered features , expressed as:

[0099]

[0100] The channel attention module (CA) extracts global context information through maximum pooling and average pooling operations, and generates channel weights through a fully connected layer and a Sigmoid function. The calculation formula is:

[0101]

[0102] in, is the Sigmoid activation function, is the ReLU activation function, and Represents two convolution operations, represents the average pooling operation, Represents the maximum pooling operation

[0103] The dimension matching module (DM) reduces the number of channels of features filtered by the CA module to 256 through a 1×1 convolution operation, ensuring that features of different scales can be effectively fused. The calculation formula is:

[0104]

[0105] Then, the high-level features are passed through the dynamic upsampling module , passing semantic information downward step by step and fusing it with the middle and low-level information, specifically as follows:

[0106] High-level features After upsampling operation and middle layer features Fusion to obtain mid-level features , the specific formula is:

[0107]

[0108] Mid-level features After upsampling operation and low-level features Fusion to obtain low-level features , the specific formula is:

[0109]

[0110] Through the top-down path, high-level semantic information is gradually transferred to low-level features, enhancing the category recognition ability of low-level features;

[0111] Next, the low-level features are downsampled to pass spatial and detail information upward step by step, and then fused with the middle and high-level features. Specifically,

[0112] Low-level features After passing through the CA module and the middle-level features Fusion to obtain the final mid-level features , the specific formula is:

[0113]

[0114] Mid-level features After passing through the CA module and high-level features Fusion to obtain the final high-level features , the specific formula is:

[0115]

[0116] Through the bottom-up path, the low-level spatial and edge information is passed to the high-level features step by step, enhancing the position information of the high-level features;

[0117] Finally, after bidirectional fusion, the multi-scale final output features are obtained It can be expressed as:

[0118]

[0119] In the dynamic upsampling module (DySample), the goal is to convert the input feature map After upsampling operation, upsampled feature map is generated , where s is the upsampling factor, and are the height and width of the input feature map respectively. The specific process of DySample is as follows:

[0120] First, construct the initial sampling grid , used to represent the coordinates of the standard sampling points. The grid positions are defined by the bilinear interpolation rule to ensure that the sampling points are evenly distributed. The grid is repeated in the channel dimension. times, and finally adjusted to the shape , for use with an offset, where Indicates the number of groups of input features in the channel dimension;

[0121] Next, the input feature map X is linearly projected to generate the original offset , and adjust it to the target space size through pixel shuffle operation to get the new offset , expressed as:

[0122]

[0123] in, is the first weight matrix, is the first offset vector;

[0124] Then, the dynamic range factor is used to control the offset, and the dynamic range factor is generated through an additional linear layer , expressed as:

[0125]

[0126] in, is the second weight matrix, is the second offset vector;

[0127] By modulating the dynamic range factor , get the final offset ,

[0128]

[0129] Initial sampling grid With the final offset Add together to get the sampling point set :

[0130]

[0131] Finally, the sampling point set Normalize the coordinates in , for each set of input feature maps , independently generate offsets and sampling point set , using the grid sampling function , according to the sampling point set From the input feature map Extract the value and generate each group of independent up-sampled feature maps , and concatenate the results of each group to obtain the final up-sampled feature map .

[0132] Compared with the prior art, the present invention has the following beneficial effects:

[0133] (1) This paper introduces a rule-based interactive data synthesis method to generate scarce primitives in drawings and proposes a dual-focus loss function, which improves the small object detection capability while alleviating the dominance of the majority class in the loss. The introduction of category prior information in the classification makes it closer to the current data distribution. The combination of these two stages effectively solves the serious imbalance of sample categories in drawings.

[0134] (2) This paper makes different deep and shallow improvements to the backbone network of the YOLOv11 primitive detection model, enabling the model to capture key details in the early stages of feature extraction and more subtle nonlinear features in the later stages. This improvement enables the accurate positioning and identification of small target primitives in complex drawings, significantly improving feature extraction capabilities and enhancing overall detection efficiency and accuracy.

[0135] (3) This paper proposes a new feature pyramid, DB-HSFPN, which removes redundant information by filtering high-level features and retains semantic information that is critical for downstream tasks. By leveraging the learnable mechanism of DySample, the ability to retain small object features is enhanced. A bidirectional fusion mechanism is designed to enable high-level and low-level features to complement each other, improving detail capture. DB-HSFPN can help the model accurately identify and locate small objects, effectively alleviating the scale discrepancy problem. BRIEF DESCRIPTION OF THE DRAWINGS

[0136] Figure 1 It is the overall structure diagram of the method of the present invention;

[0137] Figure 2 It is a flow chart of the operating steps of the present invention;

[0138] Figure 3 This is a slice example diagram of a substation terminal block drawing provided by the present invention;

[0139] Figure 4 The present invention is to Figure 3 Schematic diagram of the synthetic data augmentation results of the drawing shown

[0140] Figure 5 Schematic diagram of the network structure of the primitive detection model of the present invention;

[0141] Figure 6This is a schematic diagram of the module framework structure of the C3K2_KStar of the present invention

[0142] Figure 7 This is a schematic diagram of the module framework structure of C3K2_FKConv of the present invention

[0143] Figure 8 This is a schematic diagram of the module framework structure of the DB-HSFPN of the present invention

[0144] Figure 9 The present invention is Figure 4 Schematic diagram of the recognition results of the drawing slice shown; DETAILED DESCRIPTION

[0145] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention.

[0146] Example 1

[0147] like Figure 1 and 2 As shown, a terminal block drawing detection method based on two-stage optimization and multi-level feature enhancement includes the following steps:

[0148] S1: Use a sliding window to overlap and slice the input substation terminal block drawing to obtain a slice image.

[0149] Specifically, in step S1, the horizontal and vertical moving steps are calculated based on the preset slice size parameters and overlap ratio, and a sliding window is used to ensure that adjacent slices retain the specified overlapping area; when the sliding window reaches the edge of the image, the zero-filling technology is used to fill in the part that exceeds the original image boundary to generate a complete slice image of uniform size.

[0150] More specifically, the present invention sets the slice size parameter to 1760 The system first calculates a step size of 1232 pixels using the formula "step size = slice size × (1 - overlap ratio)" and moves horizontally and vertically in a grid pattern, starting from the top left corner of the image, 1232 pixels at a time. For areas at the edge of the original image where the remaining space is less than a full slice, zero padding is used to fill in the space beyond the original image boundary. During detection, each slice's precise position within the original image is recorded based on the coordinates of its top left corner, which is then used to map the detection results back to the original coordinate system.

[0151] S2: Use a rule-based interactive data synthesis method to perform data augmentation on the slice images, and use the enhanced slice images and the original slice images together as training datasets.

[0152] like Figure 3 and Figure 4 As shown, specifically, the S2 step is as follows:

[0153] S21: identifying the position and size of the table area in the input slice image, as well as parameters such as the starting position, row height, and number of rows of the table;

[0154] More specifically, step S21 is as follows:

[0155] First, the input image is converted to grayscale and inverse binarization is applied to white the table lines and black the background. Next, dilation is used to enhance the connectivity of the table lines using a 3×3 rectangular structuring element. All contours in the image are systematically detected, and the contour with the largest area is selected as the table area. The bounding rectangle of this contour is calculated to obtain the table's starting coordinates (x, y), width, and height.

[0156] Then, the region of interest (ROI) is extracted based on the detected table area, converted into a grayscale image and binarized.

[0157] Finally, the horizontal projection is calculated, accumulating pixel values ​​horizontally to obtain the pixel density distribution for each row. This distribution is analyzed to identify the boundaries between rows in the table. When a pixel value falls below a threshold (indicating content) and no row has been detected previously, it is recorded as the starting position of a row. The system calculates the difference between the starting positions of adjacent rows, takes the median as the standard row height, and calculates the total number of rows.

[0158] S22: Creates a calibration window with multiple sliders for adjusting key parameters: table starting coordinates, row height, number of rows, and the direction of corner lines (left or right), ensuring the generated results meet your needs. A vertical image cropping function has been added to the window, allowing you to focus on a specific area of ​​a large image for calibration. During calibration, table row guides are drawn in real time, and valid and invalid rows (those outside the image boundaries) are indicated with different colors.

[0159] S23: Based on the set parameters, a graphic element with a corner structure is generated at a random position in a specified row of the table according to the preset proportions and geometric rules. For each row, the system calculates the length of the horizontal line segment based on the row index, so that the corner lines of different rows are in increasing order.

[0160] S24: Annotate the enhanced slice image and the original slice image, and use the two images together as a training dataset.

[0161] S3: Input the processed image dataset into the multi-level feature enhanced target detection model for detection to obtain the category and coordinate results predicted by the model.

[0162] Furthermore, based on the terminal strip drawing, there are ten types of graphic elements that need to be identified in the target detection process, namely unit label, end mark, upper left mark, upper right mark, left upper and lower marks, right upper and lower marks, lower right mark, lower left mark, left cable, and right cable.

[0163] like Figure 5 As shown in the figure, specifically, the target detection model is improved and constructed based on the YOLOv11 model, with the following specific improvements:

[0164] S31: In the backbone network of the primitive detection model, the C3K2_Kstar module is designed in the shallow network (P2-P3 layers) to replace the C3K2 module of the original YOLOv11 model's shallow network. This enables the model to enhance and distinguish key details in the early stages of feature extraction, laying a good foundation for deeper feature extraction.

[0165] like Figure 6 As shown, specifically, the C3K2_KStar module includes the C3K_KStar module and the KStarBlock module. When the c3k parameter is set to True, the C3K_KStar module is used, and when the c3k parameter is set to False, the KStarBlock module is used; the C3K_KStar module is composed of multiple KStarBlock modules;

[0166] In KStarBlock, output features The description is as follows:

[0167]

[0168] in, represents the input features, represents the depthwise convolution operation, represents batch normalization, Represents two feature transformations.

[0169] More specifically, the steps of the KStarBlock module are as follows:

[0170] D1: In the KStarBlock module, the input feature X is first divided into two feature branches, which are processed by linear transformation FC and nonlinear transformation GR-KAN respectively to obtain different feature representations and generate two feature branches F1 and F2.

[0171] Specifically, GR-KAN is a special type of multilayer perceptron (MLP) that combines rational functions with group parameter sharing. By using group rational functions, it improves the model's expressiveness while maintaining computational efficiency.

[0172] The operation of GR-KAN on the input vector x is described as follows:

[0173]

[0174] in, Represents the entire GR-KAN transformation operation, Represents a function composite operation, Indicates the number of input channels, Indicates the number of output channels, represents the i-th element of the input vector x, represents the number of channels per group, calculated as , Indicates the number of groups Indicates the rounding down operation to determine the group index to which the input channel i belongs. The weight connecting the i-th input channel to the j-th output channel, F represents the rational function of the group;

[0175] The rational function F of each group is defined as:

[0176]

[0177] in, , ,…, and ,…, is a learnable parameter.

[0178] In GR-KAN, channels in the same group share the same rational function parameters and , but each input-output connection still has a unique weight Specifically, for the input channel index , the group index to which it belongs is , using the rational function of the group . This can be expressed in matrix form as:

[0179]

[0180] Where W represents the weight matrix, is a group rational function applied to the input.

[0181] In practical implementation, GR-KAN can be expressed as two consecutive operations:

[0182]

[0183] in, is the application of a group of rational functions to the input, This implementation allows GR-KAN to be viewed as a special MLP where the activation function precedes the linear layer and is a learnable, group-shared rational function.

[0184] D2: For two feature branches and Through element-level multiplication, the input features are implicitly mapped to a high-dimensional nonlinear feature space, and the output features are Expressed as:

[0185]

[0186] in," " represents element-by-element multiplication. By fusing the two branches, background noise and irrelevant information can be better suppressed, reducing the possibility of false detection and missed detection.

[0187] D3: Output features Spatial information is extracted through deep convolution, and the extracted features are processed through batch normalization to stabilize the feature distribution and accelerate model convergence. The final output features are passed to the next layer of network or module.

[0188] S32: In the backbone network of the primitive detection model, the C3K2_FKConv module is designed in the deep network (P4~P5 layers) to replace the C3K2 module of the original YOLOv11 model deep network. C3K2_FKConv can improve the quality and robustness of feature extraction while retaining the efficient network structure, enabling the model to capture more subtle nonlinear features and still accurately locate and identify small targets in complex drawings.

[0189] like Figure 7 As shown, specifically, the C3K2_FKConv module includes a C3K2_FKConv module and a Bottleneck_FKConv module. When the c3k parameter in C3K2_FKConv is set to True, the C3K2_FKConv module is used. When the c3k parameter is set to False, the Bottleneck_FKConv module is used. The C3K2_FKConv module is composed of multiple Bottleneck_FKConv modules.

[0190] In the Bottleneck_FKConv module, output features It can be expressed as:

[0191]

[0192] in, represents the input features, Indicates the use of the residual convolution layer of FastKAN.

[0193] The residual convolution layer The operation on the input vector x can be expressed as:

[0194]

[0195] in, represents the basic convolution operation, Representation layer normalization, represents the nonlinear transformation of radial basis function transformation, Represents the activation function

[0196] More specifically, the steps of the FKConv module are as follows:

[0197] D1: Each set of input features is first transformed nonlinearly using the SiLU activation function to enhance the expressiveness of the input features. Then, a basic convolution operation is performed to extract local features and generate preliminary output.

[0198] D2: The initial output results are normalized to stabilize the feature distribution and reduce gradient instability during training. The normalized features are mapped to a high-dimensional spline space using radial basis functions (RBFs), generating the basis function representation required for spline convolution. At this point, the number of feature channels is expanded to multiples of the original grid_size.

[0199] The role of RBF (Radial Basis Function) is to map the normalized input features into a high-dimensional nonlinear space, providing a basis function representation for subsequent convolution operations. The introduction of RBF significantly enhances the nonlinear expression capability of the module, while expanding the feature dimension and providing a basis for capturing complex feature patterns. The mathematical definition of RBF is:

[0200]

[0201] in, represents the normalized input feature, c represents the center point of RBF, Indicates the width parameter of RBF.

[0202] More specifically, in FKConv, the specific steps of RBF are as follows:

[0203] D21: The input is the normalized feature, denoted as , where B is the batch size, is the number of channels per group, H and W are the height and width of the feature map respectively, and for each position of the feature map, its feature vector is The module will generate a set of RBF center points. ,in Indicates the number of center points.

[0204] D22: For each input feature vector x and all center points, calculate its RBF mapping value. Through this mapping, the input feature is expanded to a high-dimensional space, and the number of feature channels is increased from Expand to , the specific formula is:

[0205]

[0206] D23: After the feature vectors of all positions are mapped by RBF, the expanded high-dimensional feature map is obtained, which is recorded as The feature vector at each position is expressed as:

[0207]

[0208] in, It is the RBF mapping value between the position (i, j) and the K-th center point.

[0209] D3: The generated basis function representation is further input to the spline convolution layer, which performs a nonlinear transformation on the high-dimensional features. The output of the spline convolution is fused with the output of the base convolution through element-by-element addition to form a residual link, which preserves the original information of the input features and makes the extracted features more expressive.

[0210] S33: In the neck network of the primitive detection model, a new feature fusion pyramid network DB-HSFPN module is designed to replace the original feature fusion pyramid network in the neck of the YOLOv11 model. DySample is used to replace the static upsampling in the original pyramid and a two-way information interaction mechanism is constructed to enhance feature expression capabilities.

[0211] like Figure 8 As shown in the figure, specifically, the DB-HSFPN module includes a channel attention module (CA), a dimension matching module (DM), a dynamic downsampling module (DySample) and a bidirectional feature fusion module, which can not only improve the small target detection performance, but also alleviate the problem of scale difference of the detected targets.

[0212] The specific steps of the DB-HSFPN module are as follows:

[0213] D1: Extract multi-scale feature maps from the backbone network, denoted as , , , representing low-level, mid-level, and high-level features respectively. These feature maps serve as the input of the network and enter the channel attention module for screening.

[0214] D2: Each input feature map Pass through the channel attention module in sequence Matching modules with dimensions , generate filtered features , expressed as:

[0215]

[0216] More specifically, the channel attention module (CA) extracts global context information through maximum pooling and average pooling operations, and generates channel weights through a fully connected layer and a Sigmoid function. The calculation formula is:

[0217]

[0218] in, is the Sigmoid activation function, is the ReLU activation function, and Represents two convolution operations, represents the average pooling operation, Represents the maximum pooling operation.

[0219] The Dimension Matching Module (DM) reduces the number of channels of features filtered by the CA module to 256 through a 1×1 convolution operation, ensuring that features of different scales can be effectively fused. The calculation formula is:

[0220]

[0221] D3: High-level features through dynamic upsampling module , passing semantic information downward step by step and fusing it with the middle and low-level information, specifically as follows:

[0222] High-level features After upsampling operation and middle layer features Fusion to obtain mid-level features , the specific formula is:

[0223]

[0224] Mid-level features After upsampling operation and low-level features Fusion to obtain low-level features , the specific formula is:

[0225]

[0226] Through the top-down path, high-level semantic information is passed step by step to low-level features, enhancing the category recognition ability of low-level features.

[0227] In the dynamic upsampling module (DySample), the goal is to convert the input feature map After upsampling operation, upsampled feature map is generated , where s is the upsampling factor, and are the height and width of the input feature map, respectively. DySample uses a learnable mechanism to enhance the retention of small object features and improve the detection recall rate.

[0228] The specific process of DySample is as follows:

[0229] D31: Constructing the initial sampling grid , used to represent the coordinates of the standard sampling points. The grid positions are defined by the bilinear interpolation rule to ensure that the sampling points are evenly distributed. The grid is repeated in the channel dimension. times, and finally adjusted to the shape , for use with an offset, where Indicates the number of groups of input features along the channel dimension.

[0230] D32: Input feature map X is linearly projected to generate the original offset , and adjust it to the target space size through pixel shuffle operation to get the new offset , expressed as:

[0231]

[0232] in, is the first weight matrix, is the first offset vector.

[0233] D33: Use dynamic range factor to control the offset, and generate dynamic range factor through additional linear layer , expressed as:

[0234]

[0235] in, is the second weight matrix, is the second offset vector.

[0236] By modulating the dynamic range factor , get the final offset ,

[0237]

[0238] Initial sampling grid With the final offset Add together to get the sampling point set :

[0239]

[0240] D34: Set of sampling points Normalize the coordinates in , for each set of input feature maps , independently generate offsets and sampling point set , using the grid sampling function , according to the sampling point set From the input feature map Extract the value and generate each group of independent up-sampled feature maps , and concatenate the results of each group to obtain the final up-sampled feature map .

[0241] D4: Low-level features pass spatial and detail information upward step by step through downsampling operations and are fused with mid-level and high-level features. Specifically,

[0242] Low-level features After passing through the CA module and the middle-level features Fusion to obtain the final mid-level features , the specific formula is:

[0243]

[0244] Mid-level features After passing through the CA module and high-level features Fusion to obtain the final high-level features , the specific formula is:

[0245]

[0246] Through the bottom-up pathway, the low-level spatial and edge information is passed to the high-level features step by step, enhancing the position information of the high-level features.

[0247] D5: After bidirectional fusion, the multi-scale final output features are obtained It can be expressed as:

[0248]

[0249] Bidirectional fusion enables high-level and low-level features to complement each other, maintaining both global semantic information and local details, which helps improve the model's ability to capture details.

[0250] The primitive detection network structure of the present invention consists of three parts: the backbone network (Backbone), the neck network (Neck), and the head network (Head). In the backbone network, the first two C3k2 layers are improved to C3k2_KStar layers, and the last two C3k2 layers are improved to C3k2_FKConv layers. The DB-HSFPN feature pyramid network is used in the neck network to form a new YOLOv8 network structure, such as Figure 5 As shown, the Head network structure of the present invention is exactly the same as that of YOLOv11.

[0251] More specifically, the primitive detection model of the present invention modifies the first two C3k2 layers in the backbone network into C3k2_KStar layers, and the last two C3k2 layers into C3k2_FKConv layers. The DB-HSFPN network is used in the neck network, and the other processing units and network structures remain unchanged. The structure mainly includes:

[0252] Backbone network: This stage is responsible for extracting multi-level feature representation of the image; it consists of 5 Conv layers, 2 C3k2_KStar layers, 2 C3k2_FKConv layers, one SPPF layer and one C2SPA layer;

[0253] Neck network: This stage adopts an innovative dynamic bidirectional HSFPN structure and uses the Dysample dynamic upsampling algorithm to effectively preserve detailed information. This module is located between the backbone network and the head network, serving as a bridge for feature fusion and enhancement. It can achieve bidirectional information fusion of multi-scale feature maps and enhance information of objects at different scales.

[0254] Head network: responsible for the final object detection and classification tasks, including the detection head for generating bounding boxes and the classification head for object recognition.

[0255] To verify the effectiveness of the proposed module improvements on drawing detection performance, experiments were conducted on a dataset of drawing slices that were not used in training. All models were trained with the same hyperparameter settings, using the AdamW optimizer for 300 iterations. The experimental platform was an NVIDIA RTX 4090 GPU (CUDA 11.8), and the baseline model was YOLOv11.

[0256] Table 1

[0257]

[0258] As shown in Table 1, the proposed improved modules and their combinations significantly improve drawing detection performance. The three-module combination outperforms the baseline model in terms of accuracy, recall, and mAP, validating the improvement of detection performance achieved by multi-module fusion.

[0259] S4: The categories and coordinates of the training dataset obtained through model prediction are input into the dual-focus loss function for calculation to obtain the loss value. The model is then optimized through backpropagation, and the final optimized model is obtained after multiple rounds of iteration.

[0260] Although the data synthesis method proposed in S2 can expand categories with very small sample sizes, the problem of data imbalance remains objectively present in order to maintain the integrity of the feature distribution of real datasets. Furthermore, drawings often contain a large number of small objects. Due to their small physical size, these objects are difficult to maintain consistent standards during the annotation process. Furthermore, small objects are more sensitive to size changes, resulting in significant instability in the bounding box regression process, significantly increasing the difficulty and complexity of model training.

[0261] To address these issues, we proposed the Bi-Focal Loss strategy, which improves model performance through two optimizations: First, the CIoU loss (Complete Intersection over Union loss) in the original model is replaced with the Focaler_MPDIoU loss (Focaler_MPDIoU loss), enhancing the model's ability to detect and accurately locate small objects. Second, the Binary Cross-Entropy loss in the original model is replaced with the Class-Prior Guided Focal Loss, making the loss function more tailored to the current data distribution and effectively alleviating the class imbalance problem. The synergy of these two loss functions not only optimizes the regression accuracy of the object bounding box, but also balances the detection performance of each class, forming a more comprehensive object detection optimization framework.

[0262] Specifically, the dual focus loss function for:

[0263]

[0264] in, is the bounding box regression loss function of the primitive detection model, is the classification loss function of the primitive detection model, is the regression loss weight, is the classification loss weight.

[0265] Bounding box regression loss function of the primitive detection model for:

[0266]

[0267] in, is the specifically adjusted intersection-over-union ratio, which indicates the degree of overlap between the predicted box and the true box;

[0268] The specific adjusted intersection-over-intersection ratio for:

[0269]

[0270] in is the adjusted IoU metric, and is a distance metric used to measure the degree of matching between two rectangular boxes. is the width of the input image, is the height of the input image;

[0271] The adjusted IoU metric for:

[0272]

[0273] in, is the central region interaction ratio, is the first hyperparameter, is the second hyperparameter

[0274] The distance metric and for:

[0275]

[0276]

[0277] in, and is the coordinate of the upper left corner of the real box, and is the coordinate of the lower right corner of the real box, and is the coordinate of the upper left corner of the prediction box, and is the coordinate of the lower right corner of the prediction box;

[0278] Classification loss function of the primitive detection model for:

[0279]

[0280] in, For the model to sample Belong to category The predicted probability of is the regulating factor, is the category to which sample n belongs The weight coefficient of .

[0281] The category to which the sample n belongs The weight coefficient for:

[0282]

[0283] in, is the total number of categories, For category The number of valid samples;

[0284] The categories The effective number of samples is:

[0285]

[0286] in, For category The number of samples, is the attenuation coefficient.

[0287] The category prediction results and target frame coordinate information obtained in step S3 are input into the Bi-Focal Loss function for loss calculation. Specifically, the category prediction is evaluated by Class-Prior Guided Focal Loss, which dynamically adjusts the weights of each category according to the category distribution characteristics of the data set; at the same time, the target frame coordinates are calculated by Focaler_MPDIoU Loss (Focal Minimum Point Distance Intersection-Union Loss) to calculate the positioning error and improve the accuracy of small target detection. After combining the two parts of the loss value, the system calculates the gradient and updates the model parameters through the back propagation algorithm. The entire training process requires multiple rounds of iterations, during which the learning rate decay strategy is adopted, and finally converges to obtain a target detection model with optimized performance. In addition, the improved YOLOv11 model needs to set parameters during training. The slice detection results are as follows Figure 9 shown.

[0288] To verify the effectiveness of the collaborative optimization method of drawing synthesis data enhancement and dual-focus loss function, experiments were conducted under four settings: no optimization, only drawing synthesis data enhancement, only dual-focus loss function optimization, and two collaborative optimizations. All experiments were based on the unoptimized YOLOv11 model and kept the parameters consistent.

[0289] Table 2

[0290]

[0291] As shown in Table 2, using either synthetic data augmentation or dual-focus loss function optimization alone can bring certain performance improvements. After combining the two, the model achieved optimal performance in all indicators, effectively alleviating the performance bottleneck caused by the imbalance of drawing categories.

[0292] S5: The test drawing is directly sliced ​​into overlapping slices and then input into the final optimization model to obtain the slice prediction result corresponding to each slice, and the final result is obtained through the slice fusion algorithm.

[0293] Specifically, step S5 is described as follows:

[0294] S51: The coordinates of the detected object bounding boxes in each slice are mapped back to the original image coordinate system, while preserving the corresponding class labels and confidence scores. A coordinate transformation algorithm is used to accurately calculate the absolute position of each detection box in the original image, taking into account the position and size ratio of the slice in the original image. All transformed detection results are merged into a unified set, which now contains detection results from all slices, especially in the overlapping areas of slices where there may be a large number of repeated detections.

[0295] S52: Apply the non-maximum suppression (NMS) algorithm to eliminate redundancy in the merged detection results. First, sort all detection boxes from high to low according to the confidence level, then select the box with the highest confidence level to add to the final result set, and calculate its intersection over union (IoU) with the remaining detection boxes, and remove other boxes whose IoU with it is greater than the preset threshold, indicating that they may be repeated detections of the same target. Repeat this process until all detection boxes are processed. Subsequently, apply the confidence threshold filtering mechanism to the results after NMS processing, remove the detection results with confidence levels lower than the set threshold, and further improve the detection accuracy;

[0296] S53: Fine-tune the bounding box position of the same object detected multiple times. For the same object that has been detected multiple times in different slices and retained by NMS, based on its detection confidence and position information, algorithms such as weighted averaging are used to fine-tune the bounding box coordinates to improve positioning accuracy and ultimately obtain more accurate primitive detection results.

[0297] On the other hand, the present invention further discloses a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.

[0298] In another embodiment provided in the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the mobile source emission prediction methods based on time series feature migration in the above embodiments.

[0299] It is understandable that the system, device and storage medium provided in the embodiments of the present invention correspond to the method provided in the embodiments of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts of the above methods.

[0300] In the above embodiments, all or part of the embodiments can be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, hard disk, tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0301] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0302] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.

[0303] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A terminal block drawing detection method based on two-stage optimization and multi-level feature enhancement, characterized in that: include: Use the sliding window to overlap and slice the input substation terminal block drawing to obtain a slice image; The slice images are enhanced using a rule-based interactive data synthesis method, and the enhanced slice images and the original slice images are used as training datasets. The processed image dataset is input into the multi-level feature enhanced target detection model for detection to obtain the category and coordinate results predicted by the model; The category and coordinate results of the training data set obtained by model prediction are input into the dual-focus loss function for calculation to obtain the loss value, and the model is optimized through backpropagation, and the final optimized model is obtained through multiple rounds of iteration; The test drawings are directly sliced ​​and then input into the final optimization model to obtain the slice prediction results corresponding to each slice, and the final result is obtained through the slice fusion algorithm; The steps of utilizing the rule-based interactive data synthesis method include: Identify the position and size of the table area in the input slice image, as well as the parameters of the table row start position, row height and number of rows; Create a visualization window and use the sliding controls to fine-tune the table and direction parameters to ensure that the generated effect meets actual needs; Based on the set parameters, a primitive with a corner structure is generated at a random position in a specified row of the table according to the preset proportions and geometric rules; The dual focus loss function for: in, is the bounding box regression loss function of the primitive detection model, is the classification loss function of the primitive detection model, is the regression loss weight, is the classification loss weight; Bounding box regression loss function of the primitive detection model for: in, is the specifically adjusted intersection-over-union ratio, which indicates the degree of overlap between the predicted box and the true box; The specific adjusted intersection-over-intersection ratio for: in is the adjusted IoU metric, and is a distance metric used to measure the degree of matching between two rectangular boxes. is the width of the input image, is the height of the input image; The adjusted IoU metric for: in, is the central region interaction ratio, is the first hyperparameter, is the second hyperparameter; The distance metric and for: in, and is the coordinate of the upper left corner of the real box, and is the coordinate of the lower right corner of the real box, and is the coordinate of the upper left corner of the prediction box, and is the coordinate of the lower right corner of the prediction box; Classification loss function of the primitive detection model for: in, For the model to sample Belong to category The predicted probability of is the regulating factor, is the category to which sample n belongs The weight coefficient of The category to which the sample n belongs The weight coefficient for: in, is the total number of categories, For category The number of valid samples; The categories The effective number of samples is: in, For category The number of samples, is the attenuation coefficient.

2. The terminal block drawing detection method based on dual-stage optimization and multi-level feature enhancement according to claim 1, characterized in that: The method comprises the steps of overlapping and slicing the input substation terminal block drawing using a sliding window to obtain a slice image, including calculating the horizontal and vertical movement steps according to preset slice size parameters and overlap ratios, and ensuring that adjacent slices retain a specified overlap area by means of a sliding window; When the sliding window reaches the edge of the image, the zero-filling technique is used to fill in the part that exceeds the boundary of the original image to generate a complete slice image of uniform size.

3. The terminal block drawing detection method based on dual-stage optimization and multi-level feature enhancement according to claim 1 is characterized in that: The processed image dataset is input into the multi-level feature enhanced target detection model for detection to obtain the category and coordinate results predicted by the model. The multi-level feature enhanced target detection model is constructed based on the YOLOv11 algorithm, including: Design the C3K2_KStar module in the shallow layers of the model backbone network, i.e., P2~P3 layers; Design the C3K2_FKConv module in the deep layers of the model backbone network, i.e., layers P4 and P5; Design the DB-HSFPN module in the model neck network, use DySample to replace static upsampling, and build a bidirectional information interaction mechanism; The C3K2_KStar module includes a C3K_KStar module and a KStarBlock module. When the c3k parameter is set to True, the C3K_KStar module is used. When the c3k parameter is set to False, the KStarBlock module is used. The C3K_KStar module is composed of multiple KStarBlock modules. In KStarBlock, output features Expressed as: in, represents the input features, represents the depthwise convolution operation, represents batch normalization, Represents two feature transformations; In the KStarBlock module, the input feature X is first divided into two feature branches, which are processed by linear transformation FC and nonlinear transformation GR-KAN respectively to obtain different feature representations and generate two feature branches F1 and F2; Next, the two feature branches are fused through element-wise multiplication to implicitly map the input features to a high-dimensional nonlinear feature space and output features Expressed as: in," ” means element-by-element multiplication; Finally, the output features Spatial information is extracted through deep convolution, and the extracted features are processed through batch normalization to stabilize the feature distribution and accelerate model convergence. The final output features are passed to the next layer of network or module; The operation of GR-KAN on the input vector x is expressed as: in, Represents the entire GR-KAN transformation operation, Represents a function composite operation, Indicates the number of input channels, Indicates the number of output channels, represents the i-th element of the input vector x, represents the number of channels per group, calculated as , Indicates the number of groups Indicates the rounding down operation to determine the group index to which the input channel i belongs. The weight connecting the i-th input channel to the j-th output channel, F represents the rational function of the group; Specifically, GR-KAN is represented as two consecutive operations: in, is the application of a group of rational functions to the input, represents a standard linear layer; The C3K2_FKConv module includes a C3K2_FKConv module and a Bottleneck_FKConv module. When the c3k parameter in C3K2_FKConv is set to True, the C3K2_FKConv module is used. When the c3k parameter is set to False, the Bottleneck_FKConv module is used. The C3K2_FKConv module is composed of multiple Bottleneck_FKConv modules. In the Bottleneck_FKConv module, the output features Expressed as: in, represents the input features, Indicates the use of the residual convolution layer of FastKAN; The residual convolution layer The operation on the input vector x is expressed as: in, represents the basic convolution operation, Representation layer normalization, represents the nonlinear transformation of radial basis function transformation, represents the activation function; The mathematical definition of the RBF is: in, represents the normalized input feature, c represents the center point of RBF, Indicates the width parameter of RBF; The DB-HSFPN module is a feature fusion pyramid network, including a channel attention module CA, a dimension matching module DM, a dynamic downsampling module DySample and a bidirectional feature fusion module; The specific process of DB-HSFPN is as follows: First, extract the multi-scale feature map from the backbone network, denoted as , , , representing low-level, mid-level, and high-level features respectively; these feature maps serve as the input of the network and enter the channel attention module for screening; Second, each input feature map Pass through the channel attention module in sequence Matching modules with dimensions , generate filtered features , expressed as: The channel attention module CA extracts global context information through maximum pooling and average pooling operations, and generates channel weights through the fully connected layer and Sigmoid function. The calculation formula is: in, is the Sigmoid activation function, is the ReLU activation function, and Represents two convolution operations, represents the average pooling operation, Represents the maximum pooling operation; The dimension matching module DM reduces the channels of the features filtered by the CA module to 256 through a 1×1 convolution operation. The calculation formula is: Then, the high-level features are passed through the dynamic upsampling module , passing semantic information downward step by step and fusing it with the middle and low-level information, specifically as follows: High-level features After upsampling operation and middle layer features Fusion to obtain mid-level features , the specific formula is: Mid-level features After upsampling operation and low-level features Fusion to obtain low-level features , the specific formula is: Through the top-down path, high-level semantic information is gradually transferred to low-level features, enhancing the category recognition ability of low-level features; Next, the low-level features are downsampled to pass spatial and detail information upward step by step, and then fused with the middle and high-level features. Specifically, Low-level features After passing through the CA module and the middle-level features Fusion to obtain the final mid-level features , the specific formula is: Mid-level features After passing through the CA module and high-level features Fusion to obtain the final high-level features , the specific formula is: Through the bottom-up path, the low-level spatial and edge information is passed to the high-level features step by step, enhancing the position information of the high-level features; Finally, after bidirectional fusion, the multi-scale final output features are obtained Expressed as: 。 4. The terminal block drawing detection method based on dual-stage optimization and multi-level feature enhancement according to claim 3 is characterized in that: The specific process of DySample is as follows: First, construct the initial sampling grid , used to represent the coordinates of the standard sampling points. The grid positions are defined by the bilinear interpolation rule to ensure that the sampling points are evenly distributed. The grid is repeated in the channel dimension. times, and finally adjusted to the shape , for use with an offset, where Indicates the number of groups of input features in the channel dimension; Next, the input feature map X is linearly projected to generate the original offset , and adjust it to the target space size through the pixel rearrangement operation PixelShuffle to get the new offset , expressed as: is the first weight matrix, is the first offset vector, is the upsampling factor, and are the height and width of the input feature map respectively; Then, the dynamic range factor is used to control the offset, and the dynamic range factor is generated through an additional linear layer , expressed as: is the second weight matrix, is the second offset vector; By modulating the dynamic range factor , get the final offset , Initial sampling grid With the final offset Add together to get the sampling point set : Finally, the sampling point set Normalize the coordinates in , for each set of input feature maps , independently generate offsets and sampling point set , using the grid sampling function , according to the sampling point set From the input feature map Extract the value and generate each group of independent up-sampled feature maps , and concatenate the results of each group to obtain the final up-sampled feature map .

5. The terminal block drawing detection method based on dual-stage optimization and multi-level feature enhancement according to claim 1 is characterized in that: The test drawing is directly sliced ​​and then input into the final optimization model to obtain the slice prediction result corresponding to each slice, and the final result is obtained by the slice fusion algorithm. The steps of the slice fusion algorithm are as follows: First, the bounding box coordinates of the detected object in each slice are mapped back to the original image coordinate system while retaining the category and confidence information. The transformed detection results are then merged into a unified set, which now contains detection results from all slices. There may be a large number of duplicate detections in the overlapping areas of the slices. Next, the non-maximum suppression (NMS) algorithm is applied to sort the detection boxes from high to low confidence. The box with the highest confidence is selected and added to the result set. The intersection over union (IoU) with the remaining detection boxes is calculated. Other boxes with an IoU greater than a threshold are removed. This process is repeated until all detection boxes have been processed. The confidence threshold is then applied to the NMS results to remove low-confidence detections. Finally, the bounding box position of the same target detected multiple times is fine-tuned to obtain the final detection result.

Citation Information

Patent Citations

  • Identification method and device for terminal block drawing short connecting piece primitives and storage medium

    CN115995086A

  • Transformer substation terminal block drawing identification method and system based on computer vision technology

    CN118038481A